spider-and-fly problem
The spider-and-fly problem is a puzzle that was originally posed in the Weekly Dispatch, an English newspaper, on 14 June 1903, by Henry Dudeney, and that appears as one of the problems in The Canterbury Puzzles (1907).1 A simple but elegant exercise in geodesics, it is Dudeney's best-known brain-teaser. In a cuboidal (shoebox-shaped) room measuring 30 feet × 12 feet × 12 feet, a spider is in the middle of one 12 feet × 12 feet 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 (the geodesic) the spider must crawl along the walls, ceiling, and floor in order to get to the fly? The answer, 40 feet, can be obtained by flattening out the walls. Note that this distance is shorter than the 42 ft the spider would have to travel if it first crawled along the wall to the floor, then across the floor, then up one foot to get to the fly.
A twist to the problem can be obtained by a spider that suspends himself from 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 (30 feet) and ascend a single foot, thus reaching his prey after a total crawl of 31 feet (although the total distance traveled is of course 42 feet). If the spider is not proficient with fastening strands to vertical walls, he must first ascend 1 feet to the ceiling, from where it can lower himself to the floor, traverse the length of the room, and climb one foot to get to the fly, for a total distance crawled of 32 feet.
Dudeney and Stanley Loyd offered several versions of the problem in a rectangular room. In 1926 Dudeney gave a version on a cylindrical glass with the source and the target on opposite sides.
Reference
1. Dudeney, H. E. The Canterbury Puzzles. London: Nelson, 1907. Reprinted Mineola, NY: Dover, 1958.