adding answer for problem 3