explanation for hw2.3 solution