The simple way to solve that crocodile problem
This past week, certain portions of the internet worked themselves into a tizzy over a math problem about a crocodile.
Specifically, this problem:
As with most word problems, I’m sure that what confounded people was making the translation between a verbal description of the problem and a set of equations. The actual math problem that needs to be solved is pretty standard for a calculus class. It just comes down to finding the minimum of the function (which is one of the things that calculus is absolutely most useful for). In practical terms, that means taking the derivative and setting it equal to zero.
But it turns out that there is a more clever way to solve the problem that doesn’t require you to know any calculus or take any derivatives. It has fewer technical steps (and therefore comes with a smaller chance of screwing up your calculation somewhere along the way), but more steps of logical thinking. And it goes like this.
The problem is essentially asking you to find the path of shortest time for a crocodile moving from one point to another. If the crocodile were just walking on land, this would be easy: the quickest route is always a straight line. The tricky part is that the crocodile has to move partly on land and partly on water, and the water section is slower than the land section.
If you want to know the speed of the crocodile on land and on water, you can pretty much read them off directly from the problem statement. The problem gives you the equation . The quantity in that equation represents the path length for the on-land section, and the quantity is the path length for the water section. (That square root is the length of the hypotenuse of a triangle with side lengths and — apparently the river is 6 meters wide.) Since , this means that the on-land speed is m/s, and the water velocity is m/s (remember that the units of time were given in tenths of a second, and not seconds — not that it matters for the final answer).
That was just interpreting the problem statement. Now comes the clever part.
The trick is to realize that the problem of “find the shortest time path across two areas with different speed” is not new. It’s something that nature does continually whenever light passes from one medium to another:
I’m talking, of course, about Fermat’s principle: any time you see light go from one point to another, you can be confident that it took the shortest time path to get there. And when light goes from one medium to another one where it has a different speed, it bends. (Like in the picture above: light moves slower through the glass, so the light beam bends inward in order to cross through the glass more quickly.)
The bending of light is described by Snell’s law:
where and are the speeds in regions and , and and are the angles that the light makes with the surface normal.
Since our crocodile is solving the exact same problem as a light ray, it follows that its motion is described by the exact same equation. Which means this:
Here, m/s is the crocodile speed on land, and m/s is its speed in the river. The sine of is , and the sine of is .
So in the end the fastest path for the crocodile is the one that satisfies
If you solve that equation (square both sides and rearrange), you’ll get the correct answer: m.
So knowing some basic optics will give you a quick solution to the crocodile problems.
This happy coincidence brings to mind a great Richard Feynman quote: “Nature uses only the longest threads to weave her patterns, so each small piece of her fabric reveals the organization of the entire tapestry.” It turns out that this particular tapestry had both light rays and crocodiles in it.
By the way, this post has a very cool footnote. It turns out that ants frequently have to solve a version of this same problem: they need to make an efficient trail from the anthill to some food source, but the trail passes over different pieces of terrain that have different walking speeds.