solution for problem 4,5