The spider and fly problem asks for the shortest surface path across a rectangular room (a cuboid) with dimensions . A spider is located in the middle
of one
wall one foot away from the ceiling. A fly is in the middle of the opposite wall
one foot away from the floor. If the fly remains stationary, what is the shortest
total distance (i.e., the geodesic) the spider must
crawl along the walls, ceiling, and floor in order to capture the fly?
The answer, ,
can be obtained by "flattening" the walls as illustrated above. Note that
this distance is shorter than the
the spider would have to travel if first crawling along
the wall to the floor, then across the floor, then up one foot to get to the fly.
The puzzle was originally posed in an English newspaper by Dudeney in 1903 (Gardner
1958).
To choose among the possible unfoldings, reflect each successive face across the shared polyhedron edge so that the surface path becomes a straight line segment in the plane. Only unfoldings for which that segment crosses the faces in the proposed order represent valid paths. Enumerating the finitely many combinatorially distinct face sequences, discarding invalid crossings, and taking the shortest remaining segment therefore gives the shortest surface path. Different unfoldings give candidate paths rather than different answers; the minimum over the valid candidates is the geodesic distance.
A twist to the problem can be obtained by a spider that suspends himself from a strand of cobweb and thus takes a shortcut by not being forced to remain glued to a surface
of the room. If the spider attaches a strand of cobweb to the wall at his starting
position and lowers himself down to the floor (thus not crawling a single inch),
he can then cross the length of the room by foot () and ascend a single foot, thus reaching his prey after
a total crawl of
(although the total distance traveled is of course
).
If the spider is not proficient with fastening strands to vertical walls, he can still get the fly crawling only . In particular, he can climb to the ceiling (
), then traverse the length of the ceiling (
) and lowering himself
(requiring no crawling), thus catching the fly.