solution to Problem 12