Chapter 8 Problem #39 explained