Solution to problem 3