solution to Problem 3