Unfold the room into a net; the straight line on the net is the shortest wall-crawling path.
Key formulas

Idea
On the 3D surface the geodesic looks bent. On an unfolded net it becomes an ordinary hypotenuse.
Example outline
Room length L, width W, height H. Unfold front+top so the fly’s path crosses a rectangle of sides L and W+H, then d=√(L²+(W+H)²). Compare other unfoldings and take the minimum.
Check candidates
Different nets give different straight lines; the physical shortest is the minimum among valid unfoldings.
Worked example
Worked example
Problem. A room is 4 m long, 3 m wide and 2.5 m high. A fly crawls from one lower corner to the opposite upper corner on the surfaces. Compare √(4²+(3+2.5)²) and √(3²+(4+2.5)²).
Solution. Path via length and (width+height): √(16 + 5.5²) = √(16+30.25) = √46.25 ≈ 6.80. Path via width and (length+height): √(9 + 6.5²) = √(9+42.25) = √51.25 ≈ 7.16. The shorter of these two is about 6.80 m (still compare the third unfolding √(2.5²+(4+3)²) before deciding the global minimum).
Classic
Compare √(L²+(W+H)²) with √(W²+(L+H)²) and √(H²+(L+W)²).
Review quiz
On room surfaces, the shortest crawl path is a:
Practice questions
- Explain why a straight line through the air is not allowed in this problem.
- Name three nets you should compare for a rectangular room.
Study notes
Is this HKDSE common?
Variants appear; the net idea is the key insight.