Solution of problem 4