# A crawling spider and a cautious fly

Inside a rectangular room, measuring 16 feet in length and 8 feet in width and height, a spider resides at a corner. A fly buzzing in the room intends to land at a spot that will take the spider the longest to reach, knowing that the spider never drops or uses its web, but crawls at constant speed.

Where should the fly land?

• Is the corner where the spider resides known to the fly? – McMagister Dec 31 '14 at 11:13
• @McMagister - sure, the fly can see the spider. – Johannes Dec 31 '14 at 11:17
• Lateral Answer: On the spiders head, he will never reach a constantly changing location. – warspyking Dec 31 '14 at 12:01
• @war that doesn't really work as a lateral thinking answer though, given that the spider is already there. – frodoskywalker Dec 31 '14 at 13:18
• No, the spider is right under there, and will never be there! – warspyking Dec 31 '14 at 13:38

The optimal distance seems to be

$\sqrt{14^2+18^2} = \sqrt{22^2+6^2} \approx 22.804$
which is greater than
$\sqrt{16^2+16^2} \approx 22.627$
If the fly stayed at the opposite corner.

Assuming the spider is on the roof corner, be in the opposite corner (on the floor), then move upwards 2 feet and sideways 2 feet.

The key to this puzzle is that there are 4 distances to be optimized.    Intuitively, it seems the fly should land in the opposite corner.

If we unfold the room along the edge between short wall and roof, the spider travels 8 feet across and 24 feet along, for a distance $\sqrt{24^2+8^2}$ feet

However, we can improve things for the spider by

Unfolding the room along the join between the long wall and the roof gives us a distance of $\sqrt{16^2+16^2}$

Prompted by Johannes' comment that this can be beaten:

As shown below, if the fly moves some distance along the short wall it simultaneously improves the worse solution given and lengthens the improved solution. When they are equal the distance should be maximised. The distances are $d_1=\sqrt{16^2+(16+x)^2}$, $d_2=\sqrt{24^2+(8-x)^2}$

Which are equal to $\sqrt{24^2+(16/3)^2} \approx 24.585$ at x=8/3

• Nice try, but there is a point further than a $16\sqrt2$ spider crawl away... – Johannes Dec 31 '14 at 11:51
• I get the feeling it has something to do with it crawling – warspyking Dec 31 '14 at 12:06
• @Johannes I thought there might be. I'm having a lot of trouble finding it though. – frodoskywalker Dec 31 '14 at 12:43
• Oh, you have to force the spider to use something close to my first solution - deny it the convenient unfolding of the room along the long edge. – frodoskywalker Dec 31 '14 at 12:50
• @frodoskywalker - you can do better than the point at the opposite corner 8/3' away from the ceiling... – Johannes Dec 31 '14 at 13:35