**Introduction to Three–dimensional Geometry: the distance between two points and the section formula**

The familiar formula for the distance between two points in a plane is easily extended from 2D geometry to the following 3D formula.

To prove this equation, construct a rectangular box as shown, where: *P*_{1} and *P*_{2} are opposite vertices.The faces of the box are assumed to be parallel to the coordinate planes.If *A*(*x*_{2}, *y*_{1}, *z*_{1}) and *B*(*x*_{2}, *y*_{2}, *z*_{1}) are the vertices of the box, then:

|*P*_{1}*A*| = |*x*_{2} – *x*_{1}|

|*AB*| = |*y*_{2} – *y*_{1}|

|*BP*_{2}| = |*z*_{2} – *z*_{1}|

Triangles *P*_{1}*BP*_{2} and *P*_{1}*AB* are right-angled.So, two applications of the Pythagorean Theorem give:

|*P*_{1}*P*_{2}|^{2} =|*P*_{1}*B*|^{2} + |*BP*_{2}|^{2}

|*P*_{1}*B*|^{2} = |*P*_{1}*A*|^{2} + |*AB*|^{2}

|*P*_{1}*P*_{2}|^{2} = |*P*_{1}*A*|^{2} + |*AB*|^{2} + |*BP*_{2}|^{2}

= |*x*_{2} – *x*_{1}|^{2} + |*y*_{2} – *y*_{1}|^{2} + |*z*_{2} – *z*_{1}|^{2}

= (*x*_{2} – *x*_{1})^{2} + (*y*_{2} – *y*_{1})^{2} + (*z*_{2} – *z*_{1})^{2}

Therefore,

For example, the distance from the point *P*(2, –1, 7) to the point *Q*(1, –3, 5) is:

A section is a point that divides a line segment in a given ratio. To evaluate the section formula in the internal or external division for a line in 3D space we consider the following figure:

For this purpose, consider two points A (x_{1}, y_{1}, z_{1}) and B(x_{2}, y_{2}, z_{2}) and a point P(x, y, z) dividing AB in the ratio m:n. To find point P, we first draw lines AL, PN, and BM that are perpendicular to XY plane such that AL || PN || BM. This means that the points L, M and N lie on the straight line that is made by the intersection of a plane with AL, PN and BM and XY- plane.From point P, a line segment ST is drawn parallel to LM which intersects AL externally at S and it intersects BM internally at T.Since ST ||LM and AL || PN || BM, the quadrilaterals LNPS and NMTP qualify as parallelograms.Also, ∆ASP is a similar triangle of ∆BTP therefore,

Making z as the subject of the equation, we rearrange them to obtain:

mz_{2} – mz = nz – nz_{1}

mz_{2} + nz_{1} = z(n + m)

Similarly,

In conclusion, the coordinates of the point P(x, y, z) that divide the line segment by the points A(x_{1}, y_{1}, z_{1}) and B(x_{2}, y_{2}, z_{2}) in the ratio m:n internally are given by:

For the case where point P divides the line segment joining the points A(x_{1}, y_{1}, z_{1}) and B(x_{2}, y_{2}, z_{2}) externally in the ratio m:n, then we deduce coordinates of P are by switching n with –n:

The midpoint M of the line segment PQ with endpointsP(x_{1}, y_{1}, z_{1} ) and Q(x_{2}, y_{2}, z_{2} ) is