Solution for Problem 9