Solution to exercise 1 in chapter 1