Solution and writeup for exercise 2.9