Most people are familiar with the traditional 2D Pythagorean theorem, which states that for any right triangle where a and b represent the legs and c represents the hypotenuse, the equivalence a² + b² = c² holds true. This allows us to determine any of the triangle’s side lengths if the other two are known.
The 2D Pythagorean theorem can be applied twice to calculate the longest diagonal inside a rectangular prism. If the base of the prism has dimensions x and y, and the diagonal along the base is represented by c, then x² + y² = c². The longest diagonal in the solid, s, is the hypotenuse of the triangle formed by the sides c and the height of the solid, z. So we know that, c² + z² = s². From this you can see that it is possible to find the longest diagonal inside a rectangular prism using the 2D version of the theorem alone, but we can skip a step by using a slightly different equation.
There is a 3D analog to the Pythagorean Theorem that is both intuitive and useful. If we are attempting to calculate the longest diagonal that can fit inside a rectangular prism or cube we use the 3D Pythagorean Theorem. If the side lengths of the rectangular prism are x, y, and z, and the diagonal line connecting opposite corners of the rectangular prism is s, then the equivalence holds where x² + y² + z² = s²