Midterm 1, Problem 8 solution