The Distance Formula in Space

Key Point (Distance formula): for P(x1,y1,z1)P(x_1, y_1, z_1) and Q(x2,y2,z2)Q(x_2, y_2, z_2),

PQ=(x2x1)2+(y2y1)2+(z2z1)2PQ = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2}

Rectangular box with diagonal PQ and the 3D distance formula

Why (the box argument): build the rectangular box with PP and QQ at opposite corners and edges parallel to the axes. Pythagoras in the base gives the base-diagonal2=(x2x1)2+(y2y1)2^2 = (x_2-x_1)^2 + (y_2-y_1)^2; Pythagoras again in the vertical right triangle adds (z2z1)2(z_2-z_1)^2. The 2D formula just grows one more square.

Special case: the distance from the origin to Q(x,y,z)Q(x, y, z) is OQ=x2+y2+z2OQ = \sqrt{x^2 + y^2 + z^2}.

Worked check: P(1,3,4)P(1, -3, 4), Q(4,1,2)Q(-4, 1, 2): PQ=25+16+4=45=35PQ = \sqrt{25 + 16 + 4} = \sqrt{45} = 3\sqrt{5}.

Collinearity test: three points are collinear when the two shorter distances add up to the longest: for P(2,3,5)P(-2,3,5), Q(1,2,3)Q(1,2,3), R(7,0,1)R(7,0,-1), the distances are PQ=14PQ = \sqrt{14}, QR=214QR = 2\sqrt{14}, PR=314PR = 3\sqrt{14}, and PQ+QR=PRPQ + QR = PR — collinear.

Classifying Figures and Describing Loci

Classification by distances. Compute all side lengths (squared!), then compare:

Cards for collinearity isosceles right triangle and parallelogram tests

An isosceles triangle has two equal sides; a right triangle satisfies a2+b2=c2a^2 + b^2 = c^2 (check the largest square against the sum of the other two — the check can fail, so always verify rather than assume); a parallelogram has equal opposite sides, and it is a rectangle only if the diagonals are also equal (a quadrilateral with AC=3BD=155AC = \sqrt{3} \ne BD = \sqrt{155} is a parallelogram but not a rectangle).

Loci: geometry conditions become equations. Write P(x,y,z)P(x, y, z), translate the condition through the distance formula, and simplify:

Locus cards equidistant plane constant sum surface and spheres

Equidistance from two fixed points gives a plane (the 3D perpendicular bisector — e.g. 10x+6y18z29=010x + 6y - 18z - 29 = 0 in Example 8 below); a constant sum of distances from (±4,0,0)(\pm 4, 0, 0) equal to 10 gives 9x2+25y2+25z2=2259x^2 + 25y^2 + 25z^2 = 225; constant distance from a fixed point gives a sphere; and PA2+PB2=k2PA^2 + PB^2 = k^2 expands to a sphere-type equation.

[Board Tip] Compare distances through their squares18=32\sqrt{18} = 3\sqrt{2} hides equalities that 18=1818 = 18 shows instantly, and no marks are lost to surd arithmetic.

Solved Examples

Example 1: A first distance

Find the distance between P(1,3,4)P(1, -3, 4) and Q(4,1,2)Q(-4, 1, 2).

Solution:

Step 1 — Difference each coordinate. Δx=41=5\Delta x = -4 - 1 = -5, Δy=1(3)=4\Delta y = 1 - (-3) = 4, Δz=24=2\Delta z = 2 - 4 = -2.

Step 2 — Square, add, root. PQ=25+16+4=45PQ = \sqrt{25 + 16 + 4} = \sqrt{45}.

Step 3 — Simplify the surd. 45=9×5=35\sqrt{45} = \sqrt{9 \times 5} = 3\sqrt{5} units.

Rectangular box with diagonal PQ and the 3D distance formula

Takeaway: Signs of the differences never matter — squaring erases them, so difference in either order.

Example 2: Four quick distances

Find the distances between: (i) (2,3,5)(2,3,5), (4,3,1)(4,3,1); (ii) (3,7,2)(-3,7,2), (2,4,1)(2,4,-1); (iii) (1,3,4)(-1,3,-4), (1,3,4)(1,-3,4); (iv) (2,1,3)(2,-1,3), (2,1,3)(-2,1,3).

Solution:

Step 1 — (i). 22+02+(4)2=20=25\sqrt{2^2 + 0^2 + (-4)^2} = \sqrt{20} = 2\sqrt{5}.

Step 2 — (ii). 52+(3)2+(3)2=25+9+9=43\sqrt{5^2 + (-3)^2 + (-3)^2} = \sqrt{25 + 9 + 9} = \sqrt{43}.

Step 3 — (iii). 22+(6)2+82=4+36+64=104=226\sqrt{2^2 + (-6)^2 + 8^2} = \sqrt{4 + 36 + 64} = \sqrt{104} = 2\sqrt{26}.

Step 4 — (iv). (4)2+22+02=20=25\sqrt{(-4)^2 + 2^2 + 0^2} = \sqrt{20} = 2\sqrt{5}.

Takeaway: A zero difference (equal coordinates) just drops a term — spot those first and the arithmetic halves.

Example 3: Collinearity

Show that P(2,3,5)P(-2, 3, 5), Q(1,2,3)Q(1, 2, 3) and R(7,0,1)R(7, 0, -1) are collinear.

Solution:

Step 1 — Compute all three distances. PQ=9+1+4=14PQ = \sqrt{9 + 1 + 4} = \sqrt{14}; QR=36+4+16=56=214QR = \sqrt{36 + 4 + 16} = \sqrt{56} = 2\sqrt{14}; PR=81+9+36=126=314PR = \sqrt{81 + 9 + 36} = \sqrt{126} = 3\sqrt{14}.

Step 2 — Test the degenerate triangle condition. PQ+QR=14+214=314=PRPQ + QR = \sqrt{14} + 2\sqrt{14} = 3\sqrt{14} = PR.

Step 3 — Conclude. The "triangle" is flat: QQ lies on segment PRPR, so the points are collinear. ∎

Takeaway: Same-surd answers (14\sqrt{14}, 2142\sqrt{14}, 3143\sqrt{14}) are the signature of collinear points — the common factor is the direction's length scale.

Example 4: Testing for a right angle

Are A(3,6,9)A(3, 6, 9), B(10,20,30)B(10, 20, 30), C(25,41,5)C(25, -41, 5) the vertices of a right-angled triangle?

Solution:

Step 1 — Squared sides only. AB2=72+142+212=49+196+441=686AB^2 = 7^2 + 14^2 + 21^2 = 49 + 196 + 441 = 686; BC2=152+612+252=225+3721+625=4571BC^2 = 15^2 + 61^2 + 25^2 = 225 + 3721 + 625 = 4571; CA2=222+472+42=484+2209+16=2709CA^2 = 22^2 + 47^2 + 4^2 = 484 + 2209 + 16 = 2709.

Step 2 — Check Pythagoras against the largest. Largest is BC2=4571BC^2 = 4571; the other two give 686+2709=33954571686 + 2709 = 3395 \ne 4571.

Step 3 — Conclude. No pairing works (the largest square is the only candidate for the hypotenuse): not right-angled.

Cards for collinearity isosceles right triangle and parallelogram tests

Takeaway: Always test — never assume a triangle is right-angled because the numbers look engineered; here the check fails.

Example 5: Isosceles and right triangles

Verify: (i) (0,7,10)(0,7,-10), (1,6,6)(1,6,-6), (4,9,6)(4,9,-6) form an isosceles triangle; (ii) (0,7,10)(0,7,10), (1,6,6)(-1,6,6), (4,9,6)(-4,9,6) form a right triangle.

Solution:

Step 1 — (i) Squared sides. AB2=1+1+16=18AB^2 = 1 + 1 + 16 = 18, BC2=9+9+0=18BC^2 = 9 + 9 + 0 = 18, CA2=16+4+16=36CA^2 = 16 + 4 + 16 = 36.

Step 2 — (i) Compare. AB=BC=18=32AB = BC = \sqrt{18} = 3\sqrt{2}: two equal sides — isosceles. ∎

Step 3 — (ii) Same squares, stronger conclusion. AB2=18AB^2 = 18, BC2=18BC^2 = 18, CA2=36CA^2 = 36: now check AB2+BC2=18+18=36=CA2AB^2 + BC^2 = 18 + 18 = 36 = CA^2 — right-angled at BB. ∎

Takeaway: The same distance data can hold more than one property — compute once, test every classification.

Example 6: A parallelogram

Verify that A(1,2,1)A(-1,2,1), B(1,2,5)B(1,-2,5), C(4,7,8)C(4,-7,8), D(2,3,4)D(2,-3,4) are the vertices of a parallelogram.

Solution:

Step 1 — Squared sides in order. AB2=4+16+16=36AB^2 = 4 + 16 + 16 = 36; BC2=9+25+9=43BC^2 = 9 + 25 + 9 = 43; CD2=4+16+16=36CD^2 = 4 + 16 + 16 = 36; DA2=9+25+9=43DA^2 = 9 + 25 + 9 = 43.

Step 2 — Compare opposite pairs. AB=CD=6AB = CD = 6 and BC=DA=43BC = DA = \sqrt{43}: both pairs of opposite sides equal.

Step 3 — Conclude. ABCDABCD is a parallelogram. ∎

Takeaway: Keep the vertices in cyclic order — comparing ABAB with CDCD (not BCBC) is what "opposite sides" means.

Example 7: The equidistant plane

Find the set of points equidistant from A(1,2,3)A(1, 2, 3) and B(3,2,1)B(3, 2, -1).

Solution:

Step 1 — Translate the condition. PA=PBPA = PB; square to avoid roots: (x1)2+(y2)2+(z3)2=(x3)2+(y2)2+(z+1)2(x-1)^2 + (y-2)^2 + (z-3)^2 = (x-3)^2 + (y-2)^2 + (z+1)^2.

Step 2 — Expand and cancel. The x2,y2,z2x^2, y^2, z^2 terms cancel (and so do the yy-terms, since both points share y=2y = 2): 2x6z+14=6x+2z+14-2x - 6z + 14 = -6x + 2z + 14, which collects to 4x8z=04x - 8z = 0.

Step 3 — Conclude. x2z=0x - 2z = 0 — a plane (the 3D perpendicular bisector of ABAB).

Takeaway: Squaring an equidistance condition always kills the squares — the locus of PA=PBPA = PB is forever linear: a plane.

Example 8: Another equidistant plane

Find the set of points equidistant from A(3,4,5)A(3, 4, -5) and B(2,1,4)B(-2, 1, 4).

Solution:

Step 1 — Square both distances. (x3)2+(y4)2+(z+5)2=(x+2)2+(y1)2+(z4)2(x-3)^2 + (y-4)^2 + (z+5)^2 = (x+2)^2 + (y-1)^2 + (z-4)^2.

Step 2 — Expand. Left: 6x8y+10z+50-6x - 8y + 10z + 50; right: 4x2y8z+214x - 2y - 8z + 21 (after the squares cancel).

Step 3 — Collect. 6x8y+10z+50=4x2y8z+21-6x - 8y + 10z + 50 = 4x - 2y - 8z + 21 gives 10x+6y18z29=010x + 6y - 18z - 29 = 0.

Locus cards equidistant plane constant sum surface and spheres

Takeaway: Move everything to one side at the END — collecting term-by-term mid-expansion is where sign errors breed.

Example 9: A constant sum of distances

Find the equation of the set of points PP whose distances from A(4,0,0)A(4, 0, 0) and B(4,0,0)B(-4, 0, 0) sum to 10.

Solution:

Step 1 — Set up. (x4)2+y2+z2+(x+4)2+y2+z2=10\sqrt{(x-4)^2 + y^2 + z^2} + \sqrt{(x+4)^2 + y^2 + z^2} = 10.

Step 2 — Isolate one root and square. After the first squaring and simplification: 5(x+4)2+y2+z2=25+4x5\sqrt{(x+4)^2 + y^2 + z^2} = 25 + 4x.

Step 3 — Square again and collect. 25(x2+8x+16+y2+z2)=625+200x+16x225(x^2 + 8x + 16 + y^2 + z^2) = 625 + 200x + 16x^2 collapses to 9x2+25y2+25z2=2259x^2 + 25y^2 + 25z^2 = 225.

Takeaway: This is the ellipse's string definition lifted to 3D — with a=5a = 5, c=4c = 4, b2=9b^2 = 9, the equation is its solid-of-revolution analogue.

Example 10: A sum of squared distances

Find the set of points PP with PA2+PB2=2k2PA^2 + PB^2 = 2k^2, where A=(3,4,5)A = (3, 4, 5) and B=(1,3,7)B = (-1, 3, -7).

Solution:

Step 1 — Write both squared distances. (x3)2+(y4)2+(z5)2+(x+1)2+(y3)2+(z+7)2=2k2(x-3)^2 + (y-4)^2 + (z-5)^2 + (x+1)^2 + (y-3)^2 + (z+7)^2 = 2k^2.

Step 2 — Expand and merge. 2x2+2y2+2z24x14y+4z+(9+16+25+1+9+49)=2k22x^2 + 2y^2 + 2z^2 - 4x - 14y + 4z + (9+16+25+1+9+49) = 2k^2.

Step 3 — Collect the constant. The constants sum to 109: 2x2+2y2+2z24x14y+4z=2k21092x^2 + 2y^2 + 2z^2 - 4x - 14y + 4z = 2k^2 - 109 — a sphere-type equation.

Takeaway: Squared-distance conditions keep their squares, so they produce spheres; plain equidistance cancels them and produces planes.

Example 11: Distance from the origin — a drill

Which is farther from the origin: A(2,3,6)A(2, 3, 6) or B(4,4,4)B(4, 4, 4)?

Solution:

Step 1 — Compare squares. OA2=4+9+36=49OA^2 = 4 + 9 + 36 = 49; OB2=16+16+16=48OB^2 = 16 + 16 + 16 = 48.

Step 2 — Read off. 49>4849 > 48: AA is farther (OA=7OA = 7, OB=436.93OB = 4\sqrt{3} \approx 6.93).

Takeaway: Never take roots to compare distances — 4949 vs 4848 settles instantly what 77 vs 6.9286.928\ldots obscures.

Example 12: An equilateral check

Show that A(1,1,0)A(1, 1, 0), B(0,1,1)B(0, 1, 1), C(1,0,1)C(1, 0, 1) form an equilateral triangle.

Solution:

Step 1 — Squared sides. AB2=1+0+1=2AB^2 = 1 + 0 + 1 = 2; BC2=1+1+0=2BC^2 = 1 + 1 + 0 = 2; CA2=0+1+1=2CA^2 = 0 + 1 + 1 = 2.

Step 2 — Conclude. All sides 2\sqrt{2}: equilateral. ∎

Step 3 — See the symmetry. The three points permute the coordinates of (1,1,0)(1, 1, 0) — permutation symmetry forces equal distances before any arithmetic.

Takeaway: Points that are coordinate-permutations of each other are automatically "equally spread" — a symmetry worth spotting in exams.