Adding problem 2 from homework 2.