homework3 problem 3 first version