Fog Creek Software
Discussion Board

Treasure Island Revisited, or why to use algebra

Okay, in the terminology of the question, the answer is to start from the palm tree, walk halfway to the coconut tree, turn righ 90 deg., and walk the same distance again.  I'll do my best with the explanation.

Setting up a coordinate system is the way to go, but I think in this case introducing numbers is misleading.  The key is that when one axis is the line connecting the trees, the cannon was at a point that was the same distance along the perpendicular axis from either tree.  [In coordinate algebra, if both trees have y=0, and we say the cannon is at (x0, y0), then the distance along the y axis from the cannon to either tree is y0.]

I'll work one axis at a time, starting with the baseline connecting the two trees.  You walk from any point (the cannon) to the palm, hang left and walk the same distance.  The perpendicular distance to the palm of your original point is now the baseline (or parallel) distance from the palm of your ending point (stake 1).  Similarly for stake 2, your distance along the baseline from the coconut tree is the perpendicular distance from the baseline of the cannon.  BUT, the perpendicular distance from the cannon to either tree is the same!  AND you first walk to the baseline and turn left, and then you walk to the baseline and turn right.  Since left is opposite to right, and the distances are equal, then your travel along the baseline cancels out.  So, the baseline component of the location of the treasure is the halfway point between the trees.

Now for the perpendicular, which is trickier, since the baseline distances from the cannon to each of the trees are not necessarily equal.  Look from the cannon along the perpendicular to the baseline.  Either both trees are on your left, both on your right, or there's one on either side.  In the first two cases, after walking to each tree and turning, your second leg, from the trees, will be in opposite directions along the perpendicular.  With rotation those distances will be equal to your first leg distances along the baseline.  If both trees were on one side of you, then those two distances were x, to the first tree, making the distance along the baseline to the second tree x plus the distance between the trees.  But since the second legs are in opposite directions along the perpendicular they have opposite signs and the x's cancel out.  When you average (by finding the midpoint of the two stakes) you get half the distance between the trees.  Looking at two factors: whether both trees are on your right or your left; and whether you're nearer the palm or coconut, you can see that regardless, the treasure will always be located so that looking from treasure to trees, the palm is on your left and the coconut on your right.  In the third case (one tree on either side) your second leg trips from the trees will be in the same direction along the perpendicular, but the two first leg baseline distances to the trees will necessarily sum to the total distance between the trees, leaving you with the same result.

If you have read this far, you should realize that problems really are best solved using abstract math such as algebra.  It was only by redoing the other solution's algebra and reinterpreting it that I got the nice simple wording of the solution at the top.

Alec Campbell
Friday, October 8, 2004

*  Recent Topics

*  Fog Creek Home