finished problem 1 and 2 from hw8
finished problem 3