[DM-HW3] updated for prob 3(e)