solution to problem 8
solution to problem 9