← Triangle Calculators /

3D Pythagorean Theorem Calculator

Calculate the 3D space diagonal of a rectangular prism using the 3D Pythagorean theorem.

Reviewed by [email protected], Geometry Calculator Developer & Online Math Educator Last updated April 24, 2026

3D Pythagorean Theorem Calculator

Formulas Used in 3D Pythagorean Theorem Calculator

d = √(a² + b² + c²)

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.