Building up solution to A2 Q1 part f.