Chapter 5 exercise 31