solution for chapter 1 exercise 5