3D Pythagorean Theorem Calculator
Results
Formulas Used in 3D Pythagorean Theorem Calculator
In-Depth Tutorial: 3D Pythagorean Theorem Calculator
The 3D Pythagorean theorem extends the classic 2D Pythagorean theorem (a² + b² = c²) into three dimensions. It computes the space diagonal of a rectangular box — the straight-line distance from one corner of the box to the diagonally opposite corner through the interior. The formula:
d = √(a² + b² + c²)
where a, b, c are the three edge lengths (length, width, height). This tutorial walks through the derivation (two-stage application of the standard Pythagorean), worked examples, and the deeper pattern that extends to any number of dimensions.
The setup
Consider a rectangular box (rectangular prism) with edges:
- Length a (along the x-axis)
- Width b (along the y-axis)
- Height c (along the z-axis)
Place one corner at the origin and the opposite corner at (a, b, c). The space diagonal connects these two corners — the longest straight-line distance inside the box.
Why d = √(a² + b² + c²) — the derivation
The 3D formula is the standard Pythagorean theorem applied twice.
Step 1: Find the diagonal of the bottom rectangle (the floor of the box). This is a 2D problem: legs a and b, hypotenuse √(a² + b²). Call this the "face diagonal" f.
Step 2: Now form a right triangle whose legs are (i) the face diagonal f along the floor, and (ii) the height c going straight up. The hypotenuse of this triangle is the space diagonal d.
By Pythagorean: d² = f² + c² = (a² + b²) + c² = a² + b² + c².
Taking the positive square root: d = √(a² + b² + c²). ✓
Worked example 1 — basic box
A box has edges 3, 4, and 12. Find the space diagonal.
d = √(3² + 4² + 12²) = √(9 + 16 + 144) = √169 = 13.
Notice 3, 4, 12, 13 is a special integer set: it's a "Pythagorean quadruple". Just as 3-4-5 is a famous 2D Pythagorean triple, 3-4-12-13 is its 3D analog.
Worked example 2 — cube
A cube has edges all equal to 6. Find the space diagonal.
d = √(36 + 36 + 36) = √108 = 6√3 ≈ 10.39.
For any cube with edge s: space diagonal = s√3. Notice √3 ≈ 1.732 — the space diagonal of a cube is about 73% longer than its edge.
Worked example 3 — practical application
A 30 × 18 × 12 inch carton ships a 32-inch fishing pole. Can it fit diagonally?
Space diagonal: d = √(900 + 324 + 144) = √1368 ≈ 36.98 inches.
Yes — 32 inches fits inside the 36.98-inch space diagonal. (For a tight fit you'd also need to check that the pole isn't too thick to lie along the diagonal, but for thin rod-like items the diagonal is the relevant constraint.)
Pythagorean quadruples
Just as 2D Pythagorean triples (a, b, c) satisfy a² + b² = c², 3D Pythagorean quadruples (a, b, c, d) satisfy a² + b² + c² = d². Famous quadruples with integer values:
- 1, 2, 2, 3 (smallest): 1 + 4 + 4 = 9 = 3²
- 2, 3, 6, 7: 4 + 9 + 36 = 49 = 7²
- 1, 4, 8, 9: 1 + 16 + 64 = 81 = 9²
- 3, 4, 12, 13: 9 + 16 + 144 = 169 = 13²
- 4, 5, 20, 21: 16 + 25 + 400 = 441 = 21²
These quadruples are useful in problems where the diagonal comes out as an integer.
The 3D distance formula
The 3D Pythagorean theorem is the geometric heart of the 3D distance formula. For two arbitrary points P₁ = (x₁, y₁, z₁) and P₂ = (x₂, y₂, z₂) in space:
d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)
Think of (x₂−x₁), (y₂−y₁), and (z₂−z₁) as the edge lengths of an "implied" box whose space diagonal connects the two points. Same formula.
Extension to N dimensions
The pattern continues. In 4D, the "hyperdiagonal" of a 4D rectangular hyper-prism has length:
d = √(a² + b² + c² + e²)
And so on, for any N. The general N-dimensional formula:
d = √(x₁² + x₂² + ... + xₙ²)
This is the Euclidean norm in N dimensions. It is the foundational measure of "magnitude" or "length" in linear algebra, physics, and machine learning.
Real-world applications
- Packaging. "Can this object fit inside this box?" — compute the space diagonal and compare to the object's length.
- Aviation and shipping. Cargo dimensional analysis for irregularly-shaped items.
- Computer graphics. Distance between any two 3D points (for collision detection, lighting calculations, AI vision).
- Vector magnitudes. The "length" of a vector v = (vx, vy, vz) in physics is |v| = √(vx² + vy² + vz²) — exactly the 3D Pythagorean form.
- GPS / surveying. Computing 3D distances when elevation differences matter (e.g., mountain climbing routes vs straight-line distance).
- Quantum mechanics. Position-momentum uncertainty calculations in 3D phase space use the 3D Pythagorean structure.
Comparing 2D and 3D
For a rectangle a × b, the face diagonal is √(a² + b²). For a box a × b × c with the same a, b plus height c, the space diagonal is √(a² + b² + c²).
So the space diagonal is always longer than (or equal to, if c = 0) the face diagonal. Adding more dimensions can only make the diagonal longer, never shorter.
Common mistakes
- Adding edges instead of squaring. The formula squares each edge, sums, then takes the square root. Just adding a + b + c gives the perimeter-like sum, not the diagonal.
- Confusing space diagonal with face diagonal. Face diagonal = √(a² + b²) (a 2D problem). Space diagonal = √(a² + b² + c²) (3D). The space diagonal is longer.
- Mixing units. All three edges must be in the same unit. Output is in linear (not squared) units.
- Forgetting to square-root. The squared form gives d², not d. Take √ at the end.
Frequently Asked Questions – 3D Pythagorean Theorem Calculator
It extends the classic theorem to three dimensions. The space diagonal of a rectangular box is d = √(a² + b² + c²), where a, b, c are length, width, and height.
The space diagonal is the longest straight-line distance inside a box — the line from one corner to the diagonally opposite corner, passing through the interior.
The standard theorem works in 2D: d = √(a² + b²). The 3D version adds a third dimension under the square root.
Yes — free and unlimited.
Diagonals get strange when you add more dimensions
The 3D version of Pythagoras tells you that a 1×1×1 cube has a space diagonal of √3 ≈ 1.732. The pattern continues: in 4D, a unit hypercube's diagonal is √4 = 2. In 10D, it's √10 ≈ 3.162. In 100D, about 10. The diagonal of an N-cube of side 1 is exactly √N, growing without bound as N grows.
This is the geometric source of what statisticians and machine-learning engineers call the curse of dimensionality. In a 1000-dimensional space, random points scattered uniformly inside a unit hypercube all tend to lie far from each other — typical pairwise distances cluster around √(1000/6) ≈ 12.9, with relatively small variance. The intuition built from 2D and 3D — that some points are "near" and others "far" — collapses. Algorithms like k-nearest-neighbor classification, which depend on a meaningful notion of "close points," lose discriminating power as dimension increases.
The same formula d = √(x₁² + x₂² + ... + xₙ²) that this calculator runs on three inputs is what underlies every embedding-distance computation in modern NLP and image-search systems. The vector representations behind ChatGPT-style embeddings are 768 to 4096 dimensions; "semantic distance" between two passages is just the N-dimensional Pythagorean distance between their embedding vectors. The 3D version on this page is the visible base case of the same operation that runs trillions of times a day across the AI industry.
The "will it fit" problem solved with one calculation
The practical situation that motivates most 3D-diagonal calculations: you have a long object and a smaller-looking box, and you need to know if the object will fit along the box's space diagonal. The space diagonal is always the longest straight-line path inside a rectangular container, so it's the binding constraint.
Moving a 7-foot sofa. A doorway 36 inches wide by 80 inches tall sits in a 12-inch-thick wall. The longest object that can pass through the door at an angle is the diagonal of a 36 × 80 × 12 rectangular opening. Compute: √(36² + 80² + 12²) = √(1296 + 6400 + 144) = √7840 ≈ 88.5 inches, or about 7 ft 4.5 in. A 7-foot sofa (84 inches) fits with about 4.5 inches of clearance — assuming the sofa is thin enough to lie along the diagonal axis.
Carry-on luggage diagonal. Airlines specify carry-on bags by their longest exterior dimension, but the limiting factor when stuffing them into an overhead bin is actually the bin's interior space diagonal. A typical bin opening is 24 × 16 × 10 inches, giving an interior diagonal of √(576 + 256 + 100) = √932 ≈ 30.5 inches. A bag labeled "30-inch carry-on" only fits because the bin is rated by diagonal, not by long edge.
Running ductwork through a basement. An HVAC contractor needs to slide a 9-foot length of straight rigid duct through a basement opening of 7 ft × 6 ft × 8 ft. Space diagonal: √(49 + 36 + 64) = √149 ≈ 12.2 ft. The 9-foot duct fits with room to spare. Without the 3D Pythagorean check, the contractor might have assumed an 8-ft wall + 7-ft floor opening was too tight for a 9-ft pipe and ordered shorter segments — the diagonal gives the real answer.
Subtler questions about 3D distance
Does the space diagonal always pass through the geometric center of the box?
Yes. The space diagonal connects two opposite vertices, say (0, 0, 0) and (a, b, c). The midpoint of that line segment is (a/2, b/2, c/2), which is exactly the centroid of the box (the point equidistant from all six faces). Both space diagonals of any rectangular box pass through this same center point, which is why an X-shaped pair of diagonals always crosses at the centroid. This is also why structural beams running along space diagonals are common in load-balancing applications — they pass through the box's center of mass, distributing forces evenly.
What if my box isn't actually a perfect rectangular prism?
The formula d = √(a² + b² + c²) requires all three edge pairs to be perpendicular (orthogonal). For a box with slightly skewed angles — a "parallelepiped" rather than a rectangular prism — you need the full vector form: if the three edges as vectors are u, v, w, then the space diagonal is |u + v + w| = √((u+v+w)·(u+v+w)), which expands to a Law-of-Cosines-style expression involving the angles between the edges. For most practical cases — shipping cartons, rooms, server racks — the rectangular assumption is exact enough. For machined parts or geological samples with non-perpendicular faces, use the vector formula or model the figure as a parallelepiped instead.
Why does the formula work the same in higher dimensions?
Because each new dimension is geometrically perpendicular to all the lower ones, the squared length contributions add independently. Mathematically, the formula d² = x₁² + x₂² + ... + xₙ² is the squared norm in any inner-product space — the dot product of the vector with itself. The same identity holds in 2D, 3D, 4D, infinite-dimensional Hilbert space, even function spaces. It's the defining property of "Euclidean" geometry across all dimensions, which is why the Euclidean norm gets the unqualified name "the distance" while every other distance metric needs a modifier.
Is there a 3D Pythagorean inequality the way there's a triangle inequality?
Yes — the 3D analog says that for any rectangular prism, the space diagonal is greater than or equal to any face diagonal (with equality only when the third edge is zero), which in turn is greater than or equal to any single edge. More generally, in N-dimensional Euclidean space, the norm of a sum of vectors is bounded by the sum of their norms: |u + v + w + ...| ≤ |u| + |v| + |w| + .... This is the triangle inequality extended to any number of vectors, and the 3D Pythagorean theorem is the equality case when all the vectors are mutually perpendicular. Engineering applications use this constantly — the diagonal length of a stacked array of components is always less than the sum of their individual lengths but more than the longest single component.