HW 4 solution