Minimum distance to reach opposite corner
Solution 1:
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.
Solution 2:
Hint: Suppose you enclose perfectly the cake inside a box. Open it as a net.
- Where are starting and ending points of the original cuboid on the net?
- What is the distance?