part a and b from problem1 hw2