L5 Problem 9 solution