The 3D Pythagorean Theorem: Calculating Space Diagonals and Distance in Three Dimensions
How to find distance in 3D space using d = √(x² + y² + z²). Learn the derivation from two consecutive 2D triangles and real-world box diagonals.
The Pythagorean Theorem is not limited to flat, two-dimensional surfaces. It extends naturally into three-dimensional space to calculate the interior space diagonal of a box, room, or any point in 3D Cartesian coordinates (x, y, z).
The three-dimensional formula is:
D = √(x² + y² + z²)
or, in terms of Length (L), Width (W), and Height (H):
D = √(L² + W² + H²)
The Two-Step Derivation
To understand why this formula works, you do not need new physics or advanced calculus—only the standard 2D Pythagorean Theorem applied twice in succession.
Consider a rectangular box with dimensions:
- Length along the x-axis =
L - Width along the y-axis =
W - Height along the z-axis =
H
We want to find the distance from bottom-front-left corner (0, 0, 0) to the opposite top-back-right corner (L, W, H).
Step 1: The 2D Floor Diagonal
Look at the rectangular base on the floor. It is a 2D rectangle with sides L and W. The diagonal across the floor (d_base) forms the hypotenuse of a right triangle on the horizontal plane:
d_base² = L² + W² ⇒ d_base = √(L² + W²)
Step 2: The Vertical Right Triangle
Now, imagine a vertical right triangle standing inside the box:
- Base leg: the floor diagonal
d_base - Vertical leg: the box height
H - Hypotenuse: the 3D space diagonal
Dconnecting the opposite corners
Applying the Pythagorean Theorem to this vertical triangle:
D² = d_base² + H²
Substitute the expression for d_base² from Step 1:
D² = (L² + W²) + H² = L² + W² + H²
Taking the positive square root gives:
D = √(L² + W² + H²) ■
Example 1: The Longest Pole in a Moving Truck
Problem: A shipping container is 12 feet long, 9 feet wide, and 8 feet high. What is the longest rigid metal pole that can fit inside without bending?
Solution:
- Identify dimensions:
L = 12,W = 9,H = 8. - Calculate base diagonal:
d_base = √(12² + 9²) = √(144 + 81) = √225 = 15 feet - Calculate 3D space diagonal:
D = √(15² + 8²) = √(225 + 64) = √289 = 17 feet
A 17-foot pole fits corner-to-corner. Notice that (15, 8, 17) and (9, 12, 15) are both Pythagorean triples!
Example 2: Distance Between Two 3D Points
In 3D analytical geometry and game development, the Euclidean distance between two points P₁(x₁, y₁, z₁) and P₂(x₂, y₂, z₂) is:
d = √[(x₂ - x₁)² + (y₂ - y₁)² + (z₂ - z₁)²]
If player coordinates are (2, 3, 5) and a target is at (6, 6, 17):
Δx = 6 - 2 = 4Δy = 6 - 3 = 3Δz = 17 - 5 = 12d = √(4² + 3² + 12²) = √(16 + 9 + 144) = √169 = 13 units.
Calculate 3D space diagonals instantly with our 3D Pythagorean Calculator.