In short

Three-dimensional coordinate geometry locates every point in space with an ordered triple (x, y, z). Three mutually perpendicular axes divide space into eight octants. The distance formula and section formula from 2D carry over almost unchanged — just with an extra term for the third coordinate.

Stand in the middle of an empty room. Point your right arm at the far wall — that is one direction. Point your left arm at the side wall — that is a second direction, perpendicular to the first. Now point straight up at the ceiling — that is a third direction, perpendicular to both.

You have just set up three coordinate axes. Every object in the room — the corner of a table, the tip of a hanging bulb, a fly buzzing near the ceiling — can be described by saying how far it is along each of those three directions. Two numbers located points on a flat sheet of paper. Three numbers locate points in the entire room. In the entire universe, in fact. That is what three-dimensional coordinate geometry does.

The jump from 2D to 3D looks like a small step — you are just adding one more number to the pair (x, y). But that one extra number opens up an entirely new world: planes, octants, skew lines, and surfaces that could never exist in a flat world. The good news is that the algebra you already know — the distance formula, the section formula — transfers almost intact. The pictures are harder to draw on paper, but the formulas are clean.

The three axes

In two dimensions, you had two perpendicular lines: the x-axis (horizontal) and the y-axis (vertical), meeting at the origin O. In three dimensions, you add a third axis — the z-axis — perpendicular to both.

The standard convention, used across Indian textbooks and the rest of the world, is the right-hand rule: if you curl the fingers of your right hand from the positive x-axis toward the positive y-axis, your thumb points along the positive z-axis.

The three coordinate axes in 3D A perspective drawing of the three coordinate axes. The x-axis points to the lower right, the y-axis points to the right, and the z-axis points straight up. The origin O is at the centre. Positive directions are labelled with x, y, and z. z y x O
The three coordinate axes meet at the origin $O$. Solid lines show the positive directions; dashed lines show the negative directions. By the right-hand rule, curling your fingers from $+x$ toward $+y$ makes your thumb point along $+z$.

A point P in space is located by three numbers: its x-coordinate, y-coordinate, and z-coordinate. You write P = (x, y, z) — an ordered triple. The origin is (0, 0, 0).

To reach P = (3, 4, 5) from the origin, walk 3 units along the positive x-axis, then 4 units parallel to the positive y-axis, then 5 units parallel to the positive z-axis (straight up). That is exactly the same idea as 2D coordinates, with one more step.

The three coordinate planes

Every pair of axes defines a flat plane:

Plane Equation What it contains
xy-plane z = 0 All points with zero height — the "floor"
yz-plane x = 0 All points with zero x-coordinate — the "side wall"
xz-plane y = 0 All points with zero y-coordinate — the "back wall"

These three planes slice through the origin and divide all of space into eight regions, just as the two axes in 2D divided the plane into four quadrants.

A point lies on the xy-plane if and only if its z-coordinate is zero. Similarly, a point lies on the x-axis if and only if both its y- and z-coordinates are zero. The origin is the only point that lies on all three axes and all three planes simultaneously.

The eight octants

In two dimensions, two axes carve the plane into four quadrants. In three dimensions, three planes carve space into eight octants.

The eight octants of three-dimensional space A perspective view of the three coordinate planes meeting at the origin, with the eight octants labelled by the signs of x, y, and z. The first octant, where all three coordinates are positive, is highlighted. +z +y +x (+, +, +) I (+, −, +) IV (−, +, +) II (+, −, −) VIII (−, +, −) VI (−, −, −) VII (+, +, −) V (−, −, +) III O
The eight octants of 3D space, labelled by the signs of $(x, y, z)$. The first octant — where all three coordinates are positive — is highlighted in red. The numbering convention varies across textbooks; the signs do not.

The first octant is where x > 0, y > 0, and z > 0. Think of it as the "front-upper-right" region of space. The other seven octants correspond to all possible combinations of positive and negative signs for the three coordinates.

Octant Sign of x Sign of y Sign of z
I + + +
II - + +
III - - +
IV + - +
V + + -
VI - + -
VII - - -
VIII + - -

You do not need to memorise the numbering — different textbooks number the octants differently. What matters is that the signs determine the octant uniquely. Given a point like (-2, 5, -3), you can immediately say it lies in the octant where x < 0, y > 0, z < 0.

The distance formula

In 2D, the distance between two points (x_1, y_1) and (x_2, y_2) is

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

That is Pythagoras's theorem applied once. In 3D, you apply Pythagoras twice — and the result picks up one more term under the square root.

Derivation

Take two points P = (x_1, y_1, z_1) and Q = (x_2, y_2, z_2). You want to find PQ.

Step 1. Project both points onto the xy-plane (set their z-coordinates to zero). Call the projections P' = (x_1, y_1, 0) and Q' = (x_2, y_2, 0). By the 2D distance formula,

P'Q' = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

Step 2. Drop a perpendicular from Q to the horizontal plane at height z_1 (the plane through P). The foot of this perpendicular is the point R = (x_2, y_2, z_1) — it has Q's x- and y-coordinates but P's height. The segment QR is purely vertical, with length |z_2 - z_1|. The segment PR lies entirely in the horizontal plane at height z_1, and by the 2D formula its length is

PR = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

Step 3. The triangle PRQ is right-angled at R (because QR is vertical and PR is horizontal). Apply Pythagoras:

PQ^2 = PR^2 + QR^2 = \bigl[(x_2 - x_1)^2 + (y_2 - y_1)^2\bigr] + (z_2 - z_1)^2

Step 4. Take the square root:

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

That is the 3D distance formula. The pattern is clear: each new dimension contributes one more squared difference under the root. In one dimension, distance is |x_2 - x_1|. In two, you add (y_2 - y_1)^2. In three, you add (z_2 - z_1)^2.

Distance formula in 3D

The distance between two points P(x_1, y_1, z_1) and Q(x_2, y_2, z_2) is

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

Special case: distance from the origin. Setting (x_1, y_1, z_1) = (0, 0, 0), the distance of the point (x, y, z) from the origin is \sqrt{x^2 + y^2 + z^2}.

Deriving the 3D distance formula using two right triangles A 3D perspective diagram showing points P and Q in space. A horizontal segment PR and a vertical segment QR form a right triangle with PQ as the hypotenuse. The segment PR itself is computed from the 2D distance formula in the horizontal plane. z y x P Q R PR (horizontal) QR PQ
The 3D distance formula comes from applying Pythagoras twice. The segment $PR$ lies in a horizontal plane (computed by the 2D formula). The segment $QR$ is vertical. The triangle $PRQ$ is right-angled at $R$, so $PQ^2 = PR^2 + QR^2$.

The section formula

In 2D, if a point R divides the segment from P(x_1, y_1) to Q(x_2, y_2) in the ratio m : n, then

R = \left(\frac{mx_2 + nx_1}{m + n},\;\frac{my_2 + ny_1}{m + n}\right)

In 3D, the formula extends in the most natural way possible — the z-coordinate follows exactly the same weighted-average pattern.

Derivation

Take P = (x_1, y_1, z_1) and Q = (x_2, y_2, z_2). The point R divides PQ internally in the ratio m : n, meaning PR : RQ = m : n.

Consider what this means coordinate by coordinate. The x-coordinate of R must divide the interval from x_1 to x_2 in the ratio m : n, because projecting the segment PQ onto the x-axis preserves the division ratio. (A ratio on a line segment is preserved under projection onto any axis — this follows from similar triangles.) So the x-coordinate of R is \dfrac{mx_2 + nx_1}{m + n}, which is the 2D section formula applied to just the x-values.

The same reasoning applies independently to the y- and z-coordinates.

Section formula in 3D (internal division)

If the point R divides the segment from P(x_1, y_1, z_1) to Q(x_2, y_2, z_2) internally in the ratio m : n, then

R = \left(\frac{mx_2 + nx_1}{m + n},\;\frac{my_2 + ny_1}{m + n},\;\frac{mz_2 + nz_1}{m + n}\right)
Section formula: a point dividing a segment in a given ratio A horizontal segment from P to Q with a point R between them. The segment PR is labelled m and the segment RQ is labelled n, showing that R divides PQ in the ratio m to n. P (x₁, y₁, z₁) Q (x₂, y₂, z₂) R m n
The point $R$ divides the segment $PQ$ internally in the ratio $m : n$. The position of $R$ is a weighted average of $P$ and $Q$: $Q$'s coordinates get weight $m$ and $P$'s coordinates get weight $n$, divided by $m + n$.

Midpoint. Setting m = n = 1, the midpoint of PQ is

M = \left(\frac{x_1 + x_2}{2},\;\frac{y_1 + y_2}{2},\;\frac{z_1 + z_2}{2}\right)

External division. If R divides PQ externally in the ratio m : n (meaning R lies on the line PQ but outside the segment), replace n with -n in the formula:

R = \left(\frac{mx_2 - nx_1}{m - n},\;\frac{my_2 - ny_1}{m - n},\;\frac{mz_2 - nz_1}{m - n}\right)

This is exactly the same convention as in 2D. The only new thing is the third coordinate — the algebra is identical.

Computing one from start to finish

Example 1: Distance between two points

Find the distance between A = (1, 2, 3) and B = (4, 6, 3).

Step 1. Write down the differences in each coordinate.

x_2 - x_1 = 4 - 1 = 3, \quad y_2 - y_1 = 6 - 2 = 4, \quad z_2 - z_1 = 3 - 3 = 0

Why: the distance formula needs the squared differences, so compute the differences first. Notice that both points have the same z-coordinate — they lie at the same height.

Step 2. Square each difference.

3^2 = 9, \quad 4^2 = 16, \quad 0^2 = 0

Why: squaring removes negative signs and sets up the Pythagorean sum.

Step 3. Add the squares.

9 + 16 + 0 = 25

Why: this is PQ^2 — the squared distance.

Step 4. Take the square root.

AB = \sqrt{25} = 5

Why: the distance itself is the square root of the sum of squared differences.

Result: AB = 5.

A 2D projection of the segment $AB$ (since both points have $z = 3$, they lie in a horizontal plane and the picture is flat). The dashed right triangle shows the familiar 3-4-5 pattern. The $z$-difference is zero, so it contributes nothing to the distance.

Because z_1 = z_2 = 3, both points lie in the plane z = 3, and the distance reduces to the 2D formula. You get the classic 3-4-5 right triangle. The picture confirms the algebra.

Example 2: Section formula — finding a dividing point

The point R divides the segment from P(2, -1, 4) to Q(5, 3, -2) internally in the ratio 2 : 1. Find the coordinates of R.

Step 1. Identify m = 2, n = 1, and write the formula for each coordinate.

x_R = \frac{mx_2 + nx_1}{m + n} = \frac{2(5) + 1(2)}{2 + 1}

Why: R is closer to Q than to P (ratio 2 : 1), so Q's coordinate gets the larger weight.

Step 2. Compute the x-coordinate.

x_R = \frac{10 + 2}{3} = \frac{12}{3} = 4

Step 3. Compute the y-coordinate.

y_R = \frac{2(3) + 1(-1)}{3} = \frac{6 - 1}{3} = \frac{5}{3}

Why: the same weighted-average formula, applied to the y-values.

Step 4. Compute the z-coordinate.

z_R = \frac{2(-2) + 1(4)}{3} = \frac{-4 + 4}{3} = \frac{0}{3} = 0

Why: the z-coordinate comes out to zero, meaning R lies exactly on the xy-plane. This makes geometric sense — P has z = 4 (above the plane) and Q has z = -2 (below it), and a point two-thirds of the way from P to Q crosses through z = 0.

Result: R = \left(4,\;\dfrac{5}{3},\;0\right).

A projection showing the $x$- and $z$-coordinates of the three points (the horizontal axis is $x$, the vertical axis is $z$). The point $R$ divides $PQ$ in the ratio $2:1$ and lands exactly on the $xy$-plane (the dashed line $z = 0$). The red segment is twice as long as the pink one.

The picture makes the ratio visible: R sits two-thirds of the way from P to Q. Its z-coordinate is zero, confirming that R lies on the xy-plane — exactly where you would expect a point two-thirds of the way from z = 4 to z = -2 to land.

Common confusions

Going deeper

If you are comfortable with the coordinate axes, the distance formula, and the section formula, you have the core of 3D coordinates — you can stop here. The rest is for readers who want the fuller picture.

Coordinates along a single axis

Some useful special cases to internalise:

These follow directly from the definitions. A point lies on the x-axis if and only if its distance from the x-axis is zero, which happens precisely when y = 0 and z = 0.

The distance of a point from an axis

The distance of a point P(x, y, z) from the x-axis is not |x| — it is the distance from P to the nearest point on the x-axis, which is (x, 0, 0). By the distance formula:

d(P, x\text{-axis}) = \sqrt{(x - x)^2 + (y - 0)^2 + (z - 0)^2} = \sqrt{y^2 + z^2}

Similarly, the distance from a coordinate axis involves the other two coordinates:

Distance from Formula
x-axis \sqrt{y^2 + z^2}
y-axis \sqrt{x^2 + z^2}
z-axis \sqrt{x^2 + y^2}

These are worth remembering. The distance from the z-axis, \sqrt{x^2 + y^2}, is the same as the 2D distance from the origin — because projecting onto the xy-plane and measuring distance from the origin is exactly what "distance from the z-axis" means.

Reflections

Reflecting a point across a coordinate plane simply negates the appropriate coordinate:

Reflecting across the origin negates all three: (-a, -b, -c).

These follow from the same logic as reflections in 2D. To reflect in the xy-plane, you keep the x- and y-coordinates and flip the z-coordinate — because the xy-plane is the set of points where z = 0, and the reflected point is equally far from this plane but on the opposite side.

A note on dimensions beyond three

The distance formula \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 + (z_2-z_1)^2} has an obvious pattern: one squared difference per dimension. Mathematicians define distance in four or more dimensions by continuing this pattern — \sqrt{\sum (x_{i,2} - x_{i,1})^2} — even though you cannot draw a picture anymore. The section formula likewise generalises by applying the weighted average to each coordinate independently. The algebra does not care how many dimensions you have; it is the pictures that stop working past three.

Where this leads next

You now have the language to describe any point in space and to measure distances and divide segments. The next step is to talk about directions — not just where a point is, but which way a line points.