Distance Formula in 3D Space

April 12, 2026

Problem

Find the distance between points (1, 2, 3) and (4, 6, 3) in 3D space using d = √[(x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²]. Show the 3D coordinate system with the distance as the space diagonal of a rectangular box.

Explanation

The 3D distance formula extends the 2D Pythagorean theorem by adding a third dimension:

d=(x2x1)2+(y2y1)2+(z2z1)2d = \sqrt{(x_{2}-x_{1})^{2} + (y_{2}-y_{1})^{2} + (z_{2}-z_{1})^{2}}

For (1,2,3)(1,2,3) to (4,6,3)(4,6,3): d=9+16+0=25=5d = \sqrt{9 + 16 + 0} = \sqrt{25} = 5.

The distance is the space diagonal of a rectangular box with sides Δx=3\Delta x = 3, Δy=4\Delta y = 4, Δz=0\Delta z = 0. In this case, since Δz=0\Delta z = 0, the two points lie in the same horizontal plane and the 3D distance equals the 2D distance. But try changing the z-coordinates to see the full 3D effect.

Try it in the visualization

Adjust the coordinates of both points and watch the distance update. The rectangular box shows how the space diagonal is built from three perpendicular components. Rotate the 3D view to see the geometry from different angles.

Interactive Visualization

Parameters

1.00
2.00
3.00
4.00
6.00
3.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Distance Formula in 3D Space | MathSpin