Distance between two points (3D)

You already know how to find the distance between two points on a flat plane: subtract the coordinates, square, add, and take a square root. Space just adds one more coordinate to keep track of. Once you have the coordinates of two points in three dimensions, the same Pythagorean instinct — squares of differences, summed, square-rooted — gives you the distance between them, except now there are three differences instead of two. This section builds that 3-D distance formula from two stacked right triangles, applies it to the special case of a point's distance from the origin, and shows how it drives the standard exam tasks: testing whether three points are collinear, and deciding whether a triangle in space is scalene, isosceles, equilateral, or right-angled. Everything here stays within the CBSE Class 11 syllabus for coordinate geometry in three dimensions — no direction cosines, no vectors, just coordinates and square roots.

The core insight

The distance between P(x1,y1,z1)P(x_1,y_1,z_1) and Q(x2,y2,z2)Q(x_2,y_2,z_2) in space is PQ=(x2−x1)2+(y2−y1)2+(z2−z1)2PQ=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}, the natural three-coordinate extension of the familiar 2-D distance formula.

The core idea

Three-dimensional space is described using three mutually perpendicular axes, xx, yy, and zz, meeting at the origin OO. Any point PP in space is fixed by an ordered triple of coordinates (x,y,z)(x,y,z), exactly the way a point on paper is fixed by (x,y)(x,y). The distance formula answers one question: given two such triples, how far apart are the points they describe? For points P(x1,y1,z1)P(x_1,y_1,z_1) and Q(x2,y2,z2)Q(x_2,y_2,z_2),

PQ=(x2−x1)2+(y2−y1)2+(z2−z1)2.PQ = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 + (z_2-z_1)^2}.

where: (x2−x1)(x_2-x_1), (y2−y1)(y_2-y_1), and (z2−z1)(z_2-z_1) are the differences of the corresponding coordinates of QQ and PP, and PQPQ is the straight-line distance between the two points, always taken as the positive square root. A useful special case is the distance of a point from the origin. Setting P=O(0,0,0)P = O(0,0,0) and Q=(x,y,z)Q = (x,y,z) in the formula above:

OP=x2+y2+z2.OP = \sqrt{x^2+y^2+z^2}.

where: xx, yy, zz are the coordinates of the point PP itself, since each coordinate of the origin is zero. The formula is symmetric — it does not matter which point you call "first" and which "second," since every difference gets squared anyway. It also reduces correctly to the familiar 2-D formula (x2−x1)2+(y2−y1)2\sqrt{(x_2-x_1)^2+(y_2-y_1)^2} whenever the two points share a zz-coordinate, because that term then vanishes.

Figure
A rectangular box showing the diagonal PQ built from three perpendicular edges dx dy and dz
The 3-D distance as two Pythagorean steps P Q PQ dx dy dz First combine dx and dy on the base, then combine that diagonal with dz

Three standard uses of this formula recur across problems: checking whether three points are collinear (compute all three pairwise distances; the largest equals the sum of the other two exactly when the points lie on one line), classifying a triangle as isosceles, equilateral, or right-angled using squared distances and the converse of the Pythagorean theorem, and checking whether a point is equidistant from two given points, which is useful for locus-type questions. A fourth use, less common but still examinable, is deciding whether four points form a parallelogram, rectangle, or square by comparing the lengths of the four sides and the two diagonals, all computed with the same formula — equal opposite sides indicate a parallelogram, and equal diagonals on top of that indicate a rectangle. Working with squared distances instead of distances themselves is a habit worth building early: it avoids carrying square roots through an entire multi-step problem and only takes the root at the very end, which keeps the arithmetic cleaner and the sign-handling more transparent.

Derivation AThe 3-D distance formula from two Pythagorean steps

The goal is to show, using only the ordinary (2-D) Pythagorean theorem applied twice in succession, that the straight-line distance between P(x1,y1,z1)P(x_1,y_1,z_1) and Q(x2,y2,z2)Q(x_2,y_2,z_2) in three-dimensional space is exactly PQ=(x2−x1)2+(y2−y1)2+(z2−z1)2PQ=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}, with no new geometric idea beyond what already produces the 2-D distance formula.

Step 1. Drop a point RR that shares PP's zz-coordinate and QQ's xx- and yy-coordinates, so R=(x2,y2,z1)R = (x_2, y_2, z_1). Then RR lies in the same horizontal plane as PP (both have zz-coordinate z1z_1), and PRPR is a purely 2-D distance within that plane, between (x1,y1)(x_1,y_1) and (x2,y2)(x_2,y_2). By the ordinary distance formula, PR=(x2−x1)2+(y2−y1)2PR=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}.

Step 2. Look at RR and QQ. They share both the xx- and yy-coordinates (x2,y2x_2,y_2) and differ only in the zz-coordinate, so RQRQ is a vertical segment of length RQ=∣z2−z1∣RQ = |z_2 - z_1|, perpendicular to the plane containing PP and RR.

Step 3. Because RQRQ is perpendicular to the horizontal plane, it is perpendicular to PRPR as well, so triangle PRQPRQ has a right angle at RR. Apply the Pythagorean theorem to this right triangle: PQ2=PR2+RQ2=[(x2−x1)2+(y2−y1)2]+(z2−z1)2PQ^2 = PR^2 + RQ^2 = \left[(x_2-x_1)^2+(y_2-y_1)^2\right] + (z_2-z_1)^2.

Step 4. Take the positive square root of both sides to get PQ=(x2−x1)2+(y2−y1)2+(z2−z1)2PQ = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}, exactly the stated formula. The whole argument used the 2-D distance formula once (Step 1) and one more application of Pythagoras (Step 3), which is why the 3-D formula is often described as "two Pythagorean steps stacked."

Worked example

Question: Find the distance between the points A(1,−2,3)A(1,-2,3) and B(4,2,−1)B(4,2,-1), and hence check whether AA, BB, and the origin O(0,0,0)O(0,0,0) could be the vertices of a right-angled triangle.

Step 1. Apply the distance formula to A(1,−2,3)A(1,-2,3) and B(4,2,−1)B(4,2,-1):

AB=(4−1)2+(2−(−2))2+(−1−3)2=32+42+(−4)2=9+16+16=41.AB = \sqrt{(4-1)^2+(2-(-2))^2+(-1-3)^2} = \sqrt{3^2+4^2+(-4)^2} = \sqrt{9+16+16} = \sqrt{41}.

Since 4141 is prime, this does not simplify further; 41≈6.4\sqrt{41} \approx 6.4 units.

Step 2. Find the distance of each point from the origin using OP=x2+y2+z2OP=\sqrt{x^2+y^2+z^2}:

OA=12+(−2)2+32=1+4+9=14,OB=42+22+(−1)2=16+4+1=21.OA = \sqrt{1^2+(-2)^2+3^2} = \sqrt{1+4+9} = \sqrt{14}, \qquad OB = \sqrt{4^2+2^2+(-1)^2} = \sqrt{16+4+1} = \sqrt{21}.

Step 3. Test the right-angle condition using squares of the three sides: OA2=14OA^2 = 14, OB2=21OB^2 = 21, AB2=41AB^2 = 41. Check whether the largest squared side equals the sum of the other two: OA2+OB2=14+21=35≠41=AB2OA^2 + OB^2 = 14 + 21 = 35 \ne 41 = AB^2.

Step 4. Since OA2+OB2≠AB2OA^2+OB^2 \ne AB^2 (and no other pairing works either, as AB2=41AB^2=41 is already the largest), the converse of the Pythagorean theorem fails, so triangle OABOAB is not right-angled. The distance AB=41≈6.4AB=\sqrt{41}\approx6.4 units, and OO, AA, BB do not form a right-angled triangle.

Common traps

  • Mishandling signs when a coordinate is already negative, e.g. computing (2−(−2))(2-(-2)) as 00 instead of 44.
  • Being inconsistent about subtraction order across the three coordinates within a single distance calculation, which does not change the squared result but causes arithmetic slips if done carelessly.
  • Declaring a triangle right-angled or isosceles by eyeballing coordinates instead of actually computing and comparing all three squared distances.
  • Leaving a surd unsimplified when it could be reduced (writing 50\sqrt{50} instead of 525\sqrt2), or trying to force-simplify a surd like 41\sqrt{41} that is already in simplest form since 4141 is prime.

Ask the tutor: if you get stuck classifying a triangle from squared distances or want more collinearity practice, ask the AI tutor for similar 3-D coordinate problems with step-by-step checking.

Why does the 3-D distance formula have three squared terms instead of two?

Because a point in space needs three coordinates to locate it, so there are three coordinate differences to account for: one along each axis. The derivation shows this is not an arbitrary extra term — it comes from applying the ordinary Pythagorean theorem a second time, once to combine the x and y differences within a plane, and again to bring in the z difference as a perpendicular leg. Each dimension you add contributes exactly one more squared term under the root.

Do I need to know direction cosines or vectors to use this formula?

No. The distance formula only needs the coordinates of the two points; it is pure arithmetic once you know (x1,y1,z1)(x_1,y_1,z_1) and (x2,y2,z2)(x_2,y_2,z_2). Direction cosines, direction ratios, and vector methods for distances and angles belong to Class 12 and are not required for this topic. If a problem only gives you coordinates and asks for a distance, length of a side, or whether points are collinear, the formula on this page is all you need.

How do I decide if a surd answer like root 41 can be simplified further?

Factor the number under the root and look for a perfect-square factor greater than 11. For example, 50=25×2=52\sqrt{50}=\sqrt{25\times2}=5\sqrt2 because 2525 is a perfect square. For 41\sqrt{41}, since 4141 is a prime number, it has no factors other than 11 and itself, so no perfect-square factor exists and 41\sqrt{41} is already in simplest form. A quick way to check is to test small perfect squares (4,9,16,25,36,…4, 9, 16, 25, 36, \dots) as possible factors before concluding a surd cannot be reduced.

Before this

Where this leads