# The spider and the fly problem

**The spider and the fly problem** is a recreational geodesics problem with an unintuitive solution.

## Problem

In the typical version of the puzzle, an otherwise empty cuboid room 30 feet long, 12 feet wide and 12 feet high contains a spider and a fly. The spider is 1 foot below the ceiling and horizontally centred on one 12′×12′ wall. The fly is 1 foot above the floor and horizontally centred on the opposite wall. The problem is to find the minimum distance the spider must crawl along the walls, ceiling and/or floor to reach the fly, which remains stationary.

## Solutions

A naive solution is for the spider to remain horizontally centred, and crawl up to the ceiling, across it and down to the fly, giving a distance of 42 feet. The shortest distance strictly abiding by the rules, 40 feet, is obtained by constructing an appropriate net of the room and connecting the spider and fly with a straight line.

A lateral thinking solution involves the spider attaching dragline silk to the wall to lower itself to the floor, and crawling 30 feet across it and 1 foot up the opposite wall, giving a crawl distance of 31 feet. Similarly, it can climb to the ceiling, cross it, then attach the silk to lower itself 11 feet, also a 31-foot crawl.[1]

An even more drastic solution has the spider crawling up 1 foot, and forward an infinitesimal distance *δx* along the centre line of the ceiling. It then attaches silk to the ceiling, lowers itself *δx* and, as in pumping a swing, swings itself up to the ceiling at 2*δx*, repeating the process until it reaches the far wall. Lastly, it attaches silk to the far wall to lower itself to the fly. The total crawling distance is 1 foot + *δx*, which tends to 1 foot as *δx* tends to zero.

## Generalisation

l | w | h | b | a | n | o | n−o |
---|---|---|---|---|---|---|---|

22 | 5 | 5 | 1 | 1 | 27 | 26 | 1 |

22 | 9 | 9 | 1 | 1 | 31 | 30 | 1 |

28 | 8 | 8 | 1 | 1 | 36 | 34 | 2 |

28 | 9 | 7 | 1 | 1 | 35 | 34 | 1 |

26 | 11 | 10 | 1 | 1 | 36 | 35 | 1 |

33 | 6 | 6 | 1 | 1 | 39 | 37 | 2 |

33 | 7 | 5 | 1 | 1 | 38 | 37 | 1 |

34 | 8 | 7 | 1 | 1 | 41 | 39 | 2 |

34 | 9 | 6 | 1 | 1 | 40 | 39 | 1 |

30 | 12 | 12 | 1 | 1 | 42 | 40 | 2 |

30 | 13 | 11 | 1 | 1 | 41 | 40 | 1 |

38 | 5 | 4 | 1 | 1 | 42 | 41 | 1 |

34 | 14 | 13 | 1 | 1 | 47 | 45 | 2 |

34 | 15 | 12 | 1 | 1 | 46 | 45 | 1 |

38 | 15 | 15 | 1 | 1 | 53 | 50 | 3 |

38 | 16 | 14 | 1 | 1 | 52 | 50 | 2 |

36 | 15 | 15 | 2 | 2 | 51 | 50 | 1 |

37 | 15 | 15 | 1 | 2 | 51 | 50 | 1 |

37 | 15 | 15 | 2 | 1 | 51 | 50 | 1 |

38 | 17 | 13 | 1 | 1 | 51 | 50 | 1 |

40 | 17 | 16 | 2 | 2 | 56 | 55 | 1 |

40 | 20 | 20 | 1 | 1 | 60 | 58 | 2 |

38 | 21 | 21 | 1 | 1 | 59 | 58 | 1 |

40 | 21 | 19 | 1 | 1 | 59 | 58 | 1 |

For a room of length *l*, width *w* and height *h*, the spider a distance *b* below the ceiling, and the fly a distance *a* above the floor, the optimal distance *o* is while the naive distance *n* is .

This table gives integer solutions for *l*, *w* ≤ 40, *h* ≤ *w* and *o* < *n*, sorted by ascending *o* then *n*−*o*, with the original values in bold.

## History

The problem was originally posed by Henry Dudeney in the English newspaper *Weekly Dispatch* on 14 June 1903, presented in *The Canterbury Puzzles* (1907) and described by Martin Gardner.[2]

## References

- Weisstein, Eric W. "Spider and Fly Problem".
*Mathworld.wolfram.com*. Retrieved 1 March 2019. - Darling, David. "spider-and-fly problem".
*Daviddarling.info*. Retrieved 1 March 2019.