solution for problem 6.1