exercise 13, problem 29 (exam Jan 2013, Problem 5)