To Catch A Pirate

August 13th 2013

I just finished doing a fun brainteaser concerning the pursuit of pirates, which I thought I could share. Here’s the puzzle itself, in the words of Abhishek Sinha:

You're on a government ship, looking for a pirate ship. You know that the pirate ship travels at a constant speed, and you know what that speed is. Your ship can travel twice as fast as the pirate ship. Moreover, you know that the pirate ship travels along a straight line, but you don't know what that line is. It's very foggy, so foggy that you see nothing. But then! All of a sudden, and for just an instant, the fog clears enough to let you determine the exact position of the pirate ship. Then, the fog closes in again and you remain (forever) in the thick fog. Although you were able to determine the position of the pirate ship during that fog-free moment, you were not able to determine its direction. How will you navigate your government ship so that you will capture the pirate ship?

A note of my own: later, in the comments, Sinha made it clear that the puzzle assumed that the world was a flat plane consisting of only water. Keeping that in mind, go ahead and try to solve it for yourself.

I’ll wait.

All right, if you haven’t solved it yet, and plan on trying, stop reading here. There be spoilers ahead. If you’ve come up with a solution and/or want to know one possible solution, keep reading. My solution might not be optimal, but it made intuitive sense and didn’t require extremely advanced math knowledge. Here’s what I came up with:

My Solution

Let C be the location at which you spotted the pirate ship. Let N be the distance, in feet, from your position to C.

  1. As soon as you see the pirate ship, navigate towards C.
  2. By the time you reach C, you will have traveled N feet. In that same amount of time, since the pirate ship moves at half your speed, it will have traveled N/2 feet from C.
  3. Now, continue forward (or in any arbitrary direction, really) for another N feet. In the time that you spent going N more feet, the pirate ship will have continued another N/2 feet on its line. That puts it N feet away from C, same as you. Now, you and the pirate ship are both at points on a circle with center C and radius N.
  4. Now you start on a spiral path, with C at its center. The spiral that we will be traveling on will fit the following conditions: Let R be the radius of the spiral at an arbitrary point. R will always be greater than or equal to N. As the ship continues on its path, the change in the radius of the spiral (that is, R - N) at any given point will always be equal to half of the distance travelled on the spiral path (the arc length). Such a spiral would be described by the polar equation $r=N*e^{\frac{\theta}{\sqrt{3}}}$, rotated so that it starts at the point at which your ship touches the same circle as the pirate ship. The point C would be the pole.

Through this method, regardless of which direction the pirate ship went from C, by the time your spiral path hits the pirate’s line, the pirate will be at the exact same spot as you. For example, if the pirate ship is going on a line at a 90 degree angle to the line between C and the spiral’s starting point, by the time your ship’s path intersects the pirate’s line, the distance you have travelled (the arc length of the spiral from 0 to 90 degrees) will be exactly twice the difference between the distance from C to the pirate and N. Since you travel at twice the pirate’s speed, you will have reached that point in the same amount of time that the pirate would take to go half the distance, from his starting point on the initial circle. So you’ll run right in to your runaway pirate, in at most one turn of the spiral path.

(After coming up with this idea, I was unsure about how exactly to represent such a spiral (my polar graphing is a little rusty), so I went to and asked. If you’re curious about how to reach the polar equation, see this answer and look at the graph on Wolfram Alpha for N=100.)

Partially to convince myself, I also made a little visual demonstration of this method. in the following demonstration, your ship always starts at the same position, and spots the pirate ship at the same position ©. I decided not to bother with randomly generating these two locations, since any two locations would obviously work and look the same if you changed the scale and rotation of the plane. However, the pirate ship then goes off from that point in a randomly generated direction. The path of the pirate ship is in RED, your ship’s path is in GREEN, and the circle that both your ship and the pirate ship will be on before you start spiraling is in GREY . Both ships' paths keep going after they collide, and the spot of collision is marked with a small BLACK dot. The dot is only shown when both ships are at the same point at the same time. I realize that the value of N used in this simulation is really small (N=10), but that was the only way I could fit one full turn of the spiral. Looking at the size of that path, if I was really a government ship, I’d probably just let that particularly pirate go.

(If the simulation picks an angle that causes the pirate ship to run in to the government ship before the government ships starts spiralling, just try restarting the simulation. Or just wait; they might collide again on the same paths.)

blog comments powered by Disqus