Solution for problem 1.