Solution to problem 21