linear decoder exercise

took 4 hrs, 45 mins (not 45 mins as the lecture notes said)