Solution to Problem 18. Filled in the gap!