## The Spider and the Fly Problem

A spider and a fly are on the inside of a cuboid room as below and the spider is looking to crawl the minimum distance to get from its current position to the stationary fly. The problem is to find the best possible route. The answer was surprising to me. This was one of several problems of this genre set by Ernest Dudeney. This is the 12th Dudeney problem for the website and I never fail to be impressed by the genius.

I encourage you to have a go, but I'm going to go straight into the solution. The natural solution of just crawling 1m up to the ceiling, straight across the ceiling and then 11m straight down gives us an upper bound on our solution of 42m. Everything we try will be attempting to lower this number. I'm not sure what your intuition says here, but trying something which goes across one of the side faces was my first attempt. I'm at the pub rather than my classroom so I don't have any string with me, so you'll have to make do with a headphone cord demonstrating the path:

This isnt easy to work out, even if you assume that the angles on both end faces are the same; you still get an optimisation problem. Instead, there is a clever trick we can employ to avoid all of the calculus faff. By drawing the proposed line on the net of the cuboid we can simply draw a straight line as the shortest distance between the two points. The problem becomes one of trying to find the best way to split it up as a net. Done in the way above we get this:

Well that was awful. Worse than just going straight there. How about going across two of the long faces instead:

This finally beats the simple solution of 42m, but we can do even better by climbing on a total of 5 of the 6 faces:

We get exactly 40m! This alone should probably be enough to convince you that we have probably reached the optimal solution to a well crafted puzzle,but thinking of those side squares as rotating down an ever growing central rectangle until they rotate into the optimal position should clench it: both the spider and the fly are as near to the centre as they can be.