# 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:

The problem was written into this year’s Higher Maths exam in Scotland, and has since been the source of much angst for Scottish high schoolers and many Twitter jokes for everyone else.

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.

And, as it turns out, ants understand how to follow Fermat’s principle too! (original paper here)

Neat. I am sure your solution is correct in the case where the finishing point is fixed. Within the fictional world of the maths problem, it is, but in the real world that this reflects, it would not be.

The zebra may remain blissfully unaware of the crocodile’s intentions while the latter is in the water but not once he emerges onto the land. At this point, the zebra will spot the crocodile and start to run away. We now have a problem more akin to Achilles and the Tortoise except that in this case I think the tortoise can run faster than Achilles.

The ants refraction is amazing –good find and thanks for sharing that!

I’m so glad you updated. When I’ve read horrible things in the news or am having a bad day I love to come here and read about math, magnets, and quantum mechanics. It helps me to remember that some problems have answers, and that there is really “magic” in the universe.