Pythagoras in 3D
Stand in the corner of your room and look straight across to the opposite corner — not
along a wall, not across the floor, but the single longest straight line that fits inside the
whole room, slicing diagonally through the air from a bottom corner to the top corner furthest
away. That line is the space diagonal. How long is it?
Pythagoras' theorem was built for flat triangles — but with one beautiful trick we can
send it into three dimensions and measure that longest diagonal exactly. The secret is to spot a
right-angled triangle standing up inside the solid, and apply Pythagoras
twice.
The longest diagonal of a box
A cuboid (a box) has a longest diagonal that runs from one corner
straight through the inside to the opposite corner. To find its length we
apply Pythagoras twice.
First, look at the rectangular base, with sides
a and b. Its diagonal
d is the hypotenuse of a right triangle:
d^2 = a^2 + b^2
Now stand the height c up from the end of that base diagonal.
The base diagonal d and the height
c form a second right triangle, whose
hypotenuse is the space diagonal D:
D^2 = d^2 + c^2 = a^2 + b^2 + c^2
So the longest diagonal of an a \times b \times c cuboid is
D = \sqrt{a^2 + b^2 + c^2}
One idea, two right triangles
-
The space diagonal of an
a \times b \times c cuboid is
D = \sqrt{a^2 + b^2 + c^2}.
-
It comes from using Pythagoras on the base
(d^2 = a^2 + b^2), then again on the right triangle
standing up from that diagonal
(D^2 = d^2 + c^2).
-
The same idea finds distances in 3D coordinates: the distance between
two points is the square root of the sum of the squared gaps along
x, y and
z.
Worked example 1 — a clean space diagonal
Find the space diagonal of a cuboid measuring 2 \times 3 \times 6.
Step 1 — the base diagonal d of the
2 \times 3 base:
d^2 = 2^2 + 3^2 = 4 + 9 = 13
Step 2 — stand the height 6 up and use the second triangle:
D^2 = d^2 + 6^2 = 13 + 36 = 49 \quad\Rightarrow\quad D = \sqrt{49} = 7
Notice we never had to work out d as a messy decimal — we carried
d^2 = 13 straight into step 2. Keeping the square is
neater and avoids rounding.
Worked example 2 — will it fit in the box?
You want to post a 30\text{ cm} ruler flat inside a box measuring
20 \times 20 \times 10 cm. No face is
30 cm across — but could it fit corner-to-corner, along the space
diagonal?
D = \sqrt{20^2 + 20^2 + 10^2} = \sqrt{400 + 400 + 100} = \sqrt{900} = 30
The longest line inside the box is exactly 30 cm — the ruler
just slides in along the diagonal. This is precisely how you check whether a long object
fits in a box, a suitcase, or a lift.
Worked example 3 — the angle with the base
Combine Pythagoras with right-angled
trigonometry. A cuboid has base 3 \times 4 and height
12. What angle \theta does its space
diagonal make with the base?
Step 1 — the base diagonal:
d = \sqrt{3^2 + 4^2} = \sqrt{25} = 5
Step 2 — \theta lives in the standing-up right triangle: the
height 12 is opposite
\theta, and the base diagonal 5 is
adjacent. So use \tan:
\tan\theta = \frac{\text{opposite}}{\text{adjacent}} = \frac{12}{5} \quad\Rightarrow\quad \theta = \tan^{-1}\!\left(\tfrac{12}{5}\right) \approx 67.4^\circ
(As a bonus, this cuboid's space diagonal is \sqrt{5^2 + 12^2} = 13 —
a tidy 5–12–13
triangle hiding inside the box.)
Picture the two diagonals
Step through the sketch: the box, then the base diagonal
d, then the space diagonal
D running from a bottom corner to the opposite top corner. Watch how
d and the height together carry D.
See it in 3D — spin the box
Here is the same idea as a real solid you can turn over in your hands. The
space diagonal of a box (the longest straight line that fits inside it) is found
by using Pythagoras twice: first the base diagonal across the
floor (blue), then combine that with the vertical height (the second right
triangle) to reach the far top corner. Drag to rotate and watch the two right
triangles nested inside the transparent box.
The traps that turn a two-mark question into zero:
-
Find the right right-triangle. The space diagonal is the hypotenuse of a
triangle whose other two sides are the base diagonal and the
vertical height — not two edges of the box. Actually drawing that
triangle inside the solid is the step most students skip, and then get lost.
-
Square all three, add, root once.
\sqrt{a^2+b^2+c^2} means square every side, add the three squares,
then take a single square root. It is not
a+b+c, and not
\sqrt{a}+\sqrt{b}+\sqrt{c}.
-
Only the final answer is a decimal. Carry the squares
(d^2) through the working; round just once, at the very end, so
rounding errors don't pile up.
The formula \sqrt{x^2 + y^2 + z^2} isn't only for boxes — it is the
distance between two points in 3D space. Every 3D video game, flight simulator
and molecular-modelling program uses exactly this to measure how far apart two things are: how
close the enemy is, whether the bullet reached, how two atoms sit in a protein. When your
character sprints across a 3D world, the engine is quietly running Pythagoras in 3D thousands of
times a second.
Yes — and the pattern just keeps going. In 4D the distance is
\sqrt{w^2 + x^2 + y^2 + z^2}; in
n dimensions you square every coordinate gap, add them all, and take
one root. Nobody can picture a 4D box, but the algebra doesn't care. This is how
data science measures how "far apart" two things are when each is described by
hundreds of numbers — the same humble theorem, stretched into spaces we can never draw.