TITLE: Minimum distance to reach opposite corner
QUESTION [7 upvotes]: An ant is caught on one corner of a cuboid with sides $l, b,$ and $h$. It wants to reach the diagonally opposite corner, However, the ant can perform a walk only along the faces of the cuboid.
What is the least amount of distance that the ant needs to walk to reach the other corner?
Example : Let $l=b=h=4$ then answer is $8.944271$. How to find it for given $l , b $ and $h$ ?

REPLY [9 votes]: If we look at the net of the box:

The ant starts at the blue/pink/green corner. He would like to get to the red/orange/grey corner.
My box is a cube; assume each side has length $l$. $2l$ is the combined width of the orange and pink faces. Using Pythag, where $d$ is the distance the ant must travel:
$$
d^2 = l^2 + (2 l)^2\\ 
d^2 = 5l^2\\
d = l\sqrt5
$$
Of course, for a cuboid where $l \neq b \neq h$, the values would be different. However the math would be largely the same. Assume the pink square now has dimensions $l \times h$; the orange $b \times h$.
$$
d^2 = (l + b)^2 + (h)^2\\
d^2 = l^2 + 2bh + b^2 + h^2\\
d = \sqrt{l^2 + b^2 + h^2 + 2bh}
$$
Note that for the cubic case, where $l=b=h$, the above simplifies into my original result.