The following problem appeared on a math (or “maths”) exam for Scottish students, and it has generated a fair amount of discussion on the Internet.

In this note, I will explain how to solve part (b) without using calculus. The trick is to use the substitution \(x = u – 9/u\). This substitution is cleverly chosen to complete the square under the radical.

$$\sqrt{36+x^2} = u + 9/u$$

Expressing $T$ in terms of the new variable $u$, we have

$$T(u) = 5\left(u + \frac9u\right) + 4\left(20 – \left(u – \frac9u\right)\right) \text{, or}$$

$$T(u) = u + \frac{81}u + 80.$$

This quantity is minimized when $u = 81/u$, by the AM-GM inequality. So the time is minimized when $u = 9$, hence when $x = 8$.

**Addendum:** Presh Talwalkar presents an elegant solution using Snell’s law.