The Spider and the Fly

  • Hard
  • Geometry and grid puzzles
  • Tests: Unfolding a room to straighten a path

The puzzle

A room is 30 ft long, 12 ft wide and 12 ft high. A spider sits on one end wall, 1 ft below the ceiling and centred side to side. A fly sits on the opposite end wall, 1 ft above the floor, also centred, and does not move.

The spider must crawl - no dropping, no web. What is the shortest distance it can travel?

Stuck?

One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.

Hint 1

A straight line is the shortest path on a flat surface. The room is not flat, so make it flat.

Hint 2

Cut the room along some edges and unfold it. The best route here crosses five faces, not the obvious three.

Show the answer Hide the answer

Exactly 40 ft, by a route that crosses the end wall, the ceiling, a side wall, the floor and the far end wall.

How to get there

Unfold the surfaces the spider crawls over into one plane. The path then becomes a straight line, and its length is the hypotenuse of the rectangle the unfolding creates.

The famous route unfolds end wall, ceiling, side wall, floor and far end wall into a strip. Laid out, the spider must cover 1 + 12 + 30 + 12 + 1 = 32 ft of length... but that is not the straight-line distance. In the unfolded plane the separation works out as 32 ft one way and 24 ft the other, so the distance is sqrt(32^2 + 24^2) = sqrt(1024 + 576) = sqrt(1600) = 40 ft.

The naive route - straight down the wall, along the floor, up the far wall - is 11 + 30 + 1 = 42 ft. The five-face route beats it by two feet, which is why this puzzle is famous: the longer-looking path is shorter once it is straight.

The technique worth keeping

Shortest paths over the surface of a solid are straight lines in some unfolding of that surface. Enumerate the unfoldings, measure each hypotenuse, and take the smallest - never trust the route that looks direct.