Posts Tagged ‘pirate’

The pirate-catching solution

Friday, May 7th, 2010

This is the solution for the pirate-catching puzzle I posted a few days ago.

Here’s the general idea:

It’s helpful to put things into a coordinate system where the starting position of the pirate ship is (0,0), and the government ship is at (3,0).  This works because we know they start 3 km apart, so any two points at distance 3 are fine as starting points.  In the picture above, the blue line is the path of the pursuing government ship, and the red line is one possible straight line the pirates could take.

The strategy is in two parts:

  1. Start by travelling straight toward the pirate ship for 2 km.  If, by luck, the pirates are headed directly toward the government ship, they’ll meet at this point, since the pirates will have travelled 1 km in the same time (1 minute).
  2. After that, go in an expanding spiral around the origin.  Think in polar coordinates.  You know the pirates are going directly away from (0,0) at constant speed 1 km/min, so their distance r from the origin is the same as the time t that has passed since the start.  Your ship (the government one) just needs to keep at the same radius as the pirate ship, while sweeping its angle around in a circle.  The government ship has to meet the pirate ship by the time it completes 360 degrees.

This strategy is possible because the government ship is going faster than the pirates.  That gives us a general idea of how to solve the puzzle – but it’s still a little vague.  We still don’t know the exact spiral to take, or how long it will take at most to catch them.

That’s where the real fun starts.  Let’s find the spiral’s equation, using (r,\theta) as the coordinates of the government ship at time t (where t=0 is the instant they spotted the pirates and went for them).

We have two constraints:

  • r=t, and
  • speed s=2.

We also know that the angle \theta and radius r are increasing over time.  To put this all together, we can use this equation for the speed of the government ship as a derivative of time:

s = \sqrt{(\frac{dr}{dt})^2+r^2(\frac{d\theta}{dt})^2}

Where did that equation come from?  Well, it’s basically the derivative (with respect to t) of arc length in polar coordinates.  We know s=2, so

\sqrt{(\frac{dr}{dt})^2+r^2(\frac{d\theta}{dt})^2} = 2

We also know that r=t and therefore \frac{dr}{dt}=1, so

\sqrt{1+t^2(\frac{d\theta}{dt})^2} = 2 1 + t^2(\frac{d\theta}{dt})^2 = 4 t^2(\frac{d\theta}{dt})^2 = 3 \frac{d\theta}{dt} = \frac{\sqrt{3}}{t} \theta = \sqrt{3}\log t

Almost got it!  Using that r=t again, we see that \theta = \sqrt{3}\log r, so solve for r to get

r = e^{\theta/\sqrt{3}}

That’s the path of the government ship, which looks like this:

How long does it take to traverse?  The highest the angle can get is arbitrarily close to 360 degrees.  Our equations use radians (for example, the speed equation assumes \theta is in radians), so we can just plug in 2\pi for \theta to find out the answer to our puzzle.  The longest time is exactly

e^{2\pi/\sqrt{3}} \approx 37.622 minutes.

As a mathematician, I think this is a great answer to such a simple-to-state problem!