# Shortest Path with Constraint

What is the length of the shortest path that goes from $(0,2)$ to $(12,1)$ that touches the $x$-axis?

I tried using calculus to solve this problem (i.e.: distance is:

$$\sqrt{(x-0)^2 + (0-2)^2} + \sqrt{(12-x)^2 + (1-0)^2}$$

and differentiating, but this is very tedious. I'm wondering whether there is a shorter, more elegant way.)

Very, very elegant way: Reflect across the $x$-axis, and notice that reflected paths (under the $x$-axis) have the same length as the real path.
So the shortest path from $(0,2)$ to $(12,1)$ (that touches the $x$-axis) is the line from $(0,-2)$ to $(12,1)$ (albeit with the part under the $x$-axis reflected back over). The length of this is:
$$\sqrt{(1-(-2))^2+(12-0)^2}=\sqrt{3^3+12^2}=\sqrt{9+144}=\sqrt{153}=\boxed{3\sqrt{17}}$$