Solution to problem 7