Pythagoras in Three Dimensions
Find the diagonal of a box by applying the theorem twice, then use the 3D formula d = √(l^2 + w^2 + h^2) to answer will-it-fit questions.
Welcome back!
Step 1 of 12Learn
Will the pole fit in the box?
Alex wants to ship a 1.3-meter fishing rod in one piece. The longest box at the post office measures 1.0 m long, 0.6 m wide and 0.5 m tall. The rod is longer than every edge of the box. Is there any way it fits?
Yes, if it goes corner to corner, from the bottom-front-left corner to the top-back-right corner. That line is the space diagonal of the box, and you can find it by applying the Pythagorean theorem twice.
Step 1: the floor diagonal. The bottom of the box is a rectangle 1.0 m by 0.6 m. Its diagonal is √(1.02 + 0.62) = √(1.00 + 0.36) = √1.36 ≈ 1.166 m.
Step 2: the space diagonal. Stand that floor diagonal up against the box's height. The floor diagonal and the vertical edge (0.5 m) meet at a right angle, so the space diagonal is √(1.36 + 0.52) = √(1.36 + 0.25) = √1.61 ≈ 1.27 m.
So the longest straight object that fits is about 1.27 m. The 1.3-meter rod won't fit, but it misses by only 3 centimeters. Alex needs a slightly bigger box.
Notice that in step 2 you can use 1.36 directly. You never needed to take the square root in step 1, because you square it again right away.
Step 2 of 12Learn
The 3D distance formula
Skipping the middle square root gives a neat formula. For a box with length l, width w and height h, the space diagonal is:
d = √(l2 + w2 + h2)
It's the Pythagorean theorem with one more term. Each extra dimension just adds another square under the root.
Example: a box 3 by 4 by 12.
- d = √(9 + 16 + 144) = √169 = 13
Example: a cube with side s. The space diagonal is √(s2 + s2 + s2) = √(3s2) = s√3. A cube with 10 cm edges has a space diagonal of 10√3 ≈ 17.3 cm. Compare that with the face diagonal of the same cube, s√2 ≈ 14.1 cm.
The same idea gives the distance between two points in 3D space, (x1, y1, z1) and (x2, y2, z2):
d = √((x2 − x1)2 + (y2 − y1)2 + (z2 − z1)2)
3D game engines, flight software and robot arms all rely on this formula. Drones use it to calculate how far they are from a landing point in the air, not just on the map.
Step 3 of 12Try the calculator
Box diagonal calculator
Enter the inside dimensions of a box to find the longest straight object that fits.
- Floor diagonal √(l2 + w2)
- 1.166 m
- Space diagonal √(l2 + w2 + h2)
- 1.269 m
- Gain over the longest edge
- 0.269 m
Step 4 of 12Practice · Work it out
A box is 2 ft by 3 ft by 6 ft. What is the length of its space diagonal, in feet?
Step 5 of 12Practice · Put in order
Put the steps for finding a box's space diagonal (two-step method) in order.
Drag the items, or use the arrow buttons, to put them in order.
- Find the square of the face diagonal: l2 + w2
- Pick a face, usually the bottom, with length l and width w
- Take the square root to get the space diagonal
- Add the square of the height: l2 + w2 + h2
Step 6 of 12Diagram
Two triangles inside a box
Tap a shape with to see more.
- Floor diagonal
First triangle: √(l2 + w2) across the bottom.
- Stand it against the height
The floor diagonal and a vertical edge meet at a right angle.
- Space diagonal
Second triangle: √(floor2 + h2).
- Shortcut
Skip the first root: d = √(l2 + w2 + h2).
Step 7 of 12Note
Step 8 of 12Learn
Rooms and real objects
The space diagonal answers many practical questions.
Moving furniture. A room is 5 m long, 4 m wide and 2.5 m tall. Could a 6.5-meter pipe fit inside, corner to corner? d = √(25 + 16 + 6.25) = √47.25 ≈ 6.87 m. Yes, with about 37 cm to spare, though actually maneuvering it there is another matter.
Spider paths. A spider on the floor in one corner of the same room wants to reach the opposite top corner. Crawling isn't the same as flying: the spider has to stay on the walls and floor. Flattening ("unfolding") the walls into a plane and drawing a straight line gives the shortest crawling path, which is longer than the space diagonal. The flying distance, 6.87 m, is the absolute minimum.
Common mistake. People often find the floor diagonal and stop, or they add l + w + h. In the room example, the floor diagonal is only √41 ≈ 6.40 m, which would wrongly say the 6.5-meter pipe doesn't fit. Adding the dimensions, 11.5 m, would wrongly say almost anything fits.
Always include all three dimensions under one square root.
Step 9 of 12Practice · Chart
Lengths inside a 5 × 4 × 2.5 m room
Which is the longest straight line that fits in the room?
Tap the bar that answers the question, then press Check.
Step 10 of 12Practice · Choose one
A cube has edges of 6 cm. Which is the length of its space diagonal?
Step 11 of 12Practice · True or false
A 1.2-meter umbrella fits flat in a suitcase that measures 0.8 m by 0.5 m by 0.3 m if it is placed along the space diagonal.
Step 12 of 12Practice · Work it out
Find the distance between the points (1, 2, 3) and (3, 5, 9) in 3D space.
Lesson complete!