Solution for problem 7
Solution for problem 9