solved hw1 problem 3