Solution for Problem 8
Starting to solve Problem 9