## Spider Fly Distance

#### Problem

A spider, S, is in one corner of a cuboid room, with dimensions `a` by `b` by `c`, and a fly, F, is in the opposite corner.

Find the shortest distance from S to F.

#### Solution

There are three straight line routes from S to F.

Let the distances from S to F_{1}, F_{2}, and F_{3}, be `d`_{1}, `d`_{2}, and `d`_{3} respectively.

Using the Pythagorean Theorem we get:

`d`_{1}^{2} = (`a`+`b`)^{2} + `c`^{2} = `a`^{2} + `b`^{2} + `c`^{2} + 2`ab``d`_{2}^{2} = (`a`+`c`)^{2} + `b`^{2} = `a`^{2} + `b`^{2} + `c`^{2} + 2`ac``d`_{3}^{2} = (`b`+`c`)^{2} + `a`^{2} = `a`^{2} + `b`^{2} + `c`^{2} + 2`bc`

Without loss of generality, let us assume that `a` `b` `c`.

As `b` `c`, `ab` `ac`, and it follows that `d`_{1} `d`_{2}.

Similarly, as `a` `c`, `ab` `bc`, and `d`_{1} `d`_{3}.

And finally, as `a` `b`, `ac` `bc`, giving `d`_{2} `d`_{3}.

Hence, `d`_{1} `d`_{2} `d`_{3} and, of the three routes, the shortest distance would be from S to F_{3}; that is, the journey from S to the longest edge.

What is the smallest cuboid for which the shortest route is integer?

What about the smallest cuboid for which all three routes are integer?