Finished problem 5 of HW1