completing part2 of problem 3