###### Asked in AlgebraGeometry

Algebra

Geometry

# What is the distance formula in 3D?

## Answer

###### Wiki User

###### September 09, 2009 1:31AM

The formula:

distance=sqrt(((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2))+((z1-z2)*(z1-z2)))

In DarkBASIC it's:

function distance3D(x1,y1,z1,x2,y2,z2)

x=x1-x2

y=y1-y2

z=z1-z2 result=sqrt((x*x)+(y*y)+(z*z)) endfunction result

In classic BASIC I think it's:

FUNCTION distance3D(x1,y1,z1,x2,y2,z2)

x=x1-x2

y=y1-y2

z=z1-z2 result=SQRT((x*x)+(y*y)+(z*z))

RETURN result

END FUNCTION

## Related Questions

###### Asked in Geometry

### Why is the distance formula important to geometry?

When we study the motion of body then its displacement is
described on cartesian plane or in 3d geometry and not in real
physical conditions,in this way to calculate the distance travelled
by the body is a major aspect in calculating its speed and other
things,and here distance formula help us to do so.There are many
other importance of distance formula...