Homework assignment 1, question 2, first attempt.