solution of problem 6