Solution 4.
(c) John H. Mathews 2004