Unit 13 · Analytic Geometry · 6 teaching hours · 20 min read
Coordinates in Space
What the syllabus asks for 3
- Points in space
- Distance between two points
- Direction cosines and direction ratios
Everything you have done in coordinate geometry so far has lived on a flat sheet. Real objects — a kite over Tundikhel, a drone above Pokhara, the corner of a room — need a third number to fix them.
This unit adds a z-axis perpendicular to the x and y axes, and rebuilds the three basic tools in three dimensions: the distance formula, the section formula, and the direction cosines that describe which way a line points.
Expect one short question on the distance or section formula and one longer question on direction cosines. The two results you must be able to derive are AB = \sqrt{(x_2-x_1)^{2}+(y_2-y_1)^{2}+(z_2-z_1)^{2}} and l^{2}+m^{2}+n^{2} = 1.
13.1 Points in space
Take three mutually perpendicular lines through a point O — the origin — and call them the x-, y- and z-axes. Taken in pairs they determine three coordinate planes:
| Plane | Contains the axes | Equation |
|---|---|---|
| xy-plane | x and y | z = 0 |
| yz-plane | y and z | x = 0 |
| zx-plane | z and x | y = 0 |
These three planes cut space into eight octants. The first octant is the one in which all three coordinates are positive; the others are labelled by the sign pattern of (x,y,z).
A point P in space is fixed by an ordered triple (x, y, z): drop a perpendicular from P to the xy-plane meeting it at M, then x and y are the usual plane coordinates of M and z = PM, taken positive above the plane.
For P(x,y,z):
- distance from the yz-, zx- and xy-planes: |x|, |y|, |z|
- distance from the x-, y- and z-axes: \sqrt{y^{2}+z^{2}}, \sqrt{z^{2}+x^{2}}, \sqrt{x^{2}+y^{2}}
- distance from the origin: OP = \sqrt{x^{2}+y^{2}+z^{2}}
Problem. For the point P(3,-4,5) find (i) its distance from the xy-plane, (ii) its distance from the x-axis, (iii) its distance from the origin, and (iv) the octant it lies in.
Solution.
(i) The distance from the xy-plane is |z| = 5 units.
(ii) The distance from the x-axis ignores the x-coordinate:
(iii) OP = \sqrt{3^{2}+(-4)^{2}+5^{2}} = \sqrt{9+16+25} = \sqrt{50} = 5\sqrt{2} \approx 7.07 units.
(iv) The signs are (+,-,+), so P lies in the fourth octant.
Distance from a plane uses the one coordinate perpendicular to it; distance from an axis uses the other two. Students routinely swap these. A quick memory check: a point can be far from the x-axis while having a huge x-coordinate, so x cannot appear in that distance.
13.2 Distance between two points
Let A(x_1,y_1,z_1) and B(x_2,y_2,z_2) be two points. Complete the rectangular box whose edges are parallel to the axes and which has AB as a space diagonal. Let M be the corner (x_2,y_2,z_1) — vertically below B and in the same horizontal plane as A.
Step 1 — the horizontal diagonal. A and M have the same z, so by the two-dimensional distance formula
Step 2 — the vertical edge. MB is parallel to the z-axis, so MB = |z_2-z_1| and MB is perpendicular to the plane containing AM, hence perpendicular to AM.
Step 3 — Pythagoras in \triangle AMB, right-angled at M.
Putting A at the origin gives OB = \sqrt{x_2^{2}+y_2^{2}+z_2^{2}}.
Problem. Show that the points A(0,7,10), B(-1,6,6) and C(-4,9,6) are the vertices of a right-angled isosceles triangle.
Solution. Work with the squares of the lengths — no surds are needed.
Since AB^{2} = BC^{2}, the triangle is isosceles. Since AB^{2}+BC^{2} = 18+18 = 36 = CA^{2}, the converse of Pythagoras' theorem gives a right angle at B. So \triangle ABC is right-angled and isosceles, with AB = BC = 3\sqrt{2} and CA = 6.
Problem. Prove that A(1,2,3), B(2,3,1) and C(3,1,2) form an equilateral triangle.
Solution.
All three sides equal \sqrt{6} units, so the triangle is equilateral.
Problem. Find the point on the y-axis that is equidistant from A(3,1,2) and B(5,5,2).
Solution. Any point on the y-axis has the form P(0,y,0). The condition PA^{2} = PB^{2} gives
The point is (0,5,0).
Check. PA = \sqrt{9+16+4} = \sqrt{29} and PB = \sqrt{25+0+4} = \sqrt{29} ✓.
The section formula
Let P(x,y,z) divide the join of A(x_1,y_1,z_1) and B(x_2,y_2,z_2) internally in the ratio m:n, so AP:PB = m:n.
Drop perpendiculars AL, PN, BM from A, P, B to the xy-plane. These three perpendiculars are parallel, so they lie in one plane, and the line AB cuts them proportionally.
Draw through A a line parallel to LM, meeting PN at R and BM at S. Then RP = z-z_1 and SB = z_2-z_1, and \triangle APR and \triangle ABS are similar (equal angles, since RP and SB are parallel), so
Cross-multiplying, (m+n)(z-z_1) = m(z_2-z_1), so (m+n)z = mz_2+nz_1, that is
The same argument applied to the other two pairs of coordinate planes gives x and y, so
For external division replace n by -n: P = \left(\dfrac{mx_2-nx_1}{m-n},\ \dfrac{my_2-ny_1}{m-n},\ \dfrac{mz_2-nz_1}{m-n}\right).
- Midpoint (m=n=1): \left(\dfrac{x_1+x_2}{2},\ \dfrac{y_1+y_2}{2},\ \dfrac{z_1+z_2}{2}\right)
- Centroid of the triangle with vertices A, B, C: \left(\dfrac{x_1+x_2+x_3}{3},\ \dfrac{y_1+y_2+y_3}{3},\ \dfrac{z_1+z_2+z_3}{3}\right)
Problem. Find the coordinates of the points dividing the join of A(2,-1,3) and B(4,3,1) in the ratio 3:2 (i) internally and (ii) externally.
Solution. Here m = 3, n = 2, so m+n = 5 and m-n = 1.
(i) Internally:
The point is \left(\dfrac{16}{5},\ \dfrac{7}{5},\ \dfrac{9}{5}\right).
(ii) Externally:
The point is (8,\ 11,\ -3).
Problem. In what ratio does the yz-plane divide the join of A(2,4,5) and B(3,5,-4)?
Solution. Let the plane cut AB in the ratio k:1 at the point
Every point of the yz-plane has x = 0, so
A negative ratio means external division: the yz-plane divides AB externally in the ratio 2:3.
13.3 Direction cosines and direction ratios
A line in space is aimed by the three angles it makes with the positive directions of the axes.
If a directed line through the origin makes angles \alpha, \beta, \gamma with the positive x-, y- and z-axes, then \alpha, \beta, \gamma are its direction angles and
are its direction cosines, written (l, m, n).
Let P(x,y,z) be a point on the directed line through the origin, with OP = r = \sqrt{x^{2}+y^{2}+z^{2}}.
Drop a perpendicular PA from P to the x-axis. Then OA = x and \triangle OAP is right-angled at A, so
Similarly \cos\beta = \dfrac{y}{r} and \cos\gamma = \dfrac{z}{r}, so
Squaring and adding,
l^{2}+m^{2}+n^{2} = 1 means the three direction cosines are not independent — you cannot pick all three. In particular no set like (\frac12,\frac12,\frac12) can be direction cosines, since \frac14+\frac14+\frac14 \ne 1.
Note also \sin^{2}\alpha+\sin^{2}\beta+\sin^{2}\gamma = 3-1 = 2.
Direction ratios
Any three numbers a, b, c proportional to l, m, n are called direction ratios of the line. Direction ratios are far more convenient, because you may scale them freely. To recover the direction cosines, divide by the length:
The \pm appears because a line has two opposite directions.
- The line through A(x_1,y_1,z_1) and B(x_2,y_2,z_2) has direction ratios
- If two lines have direction cosines (l_1,m_1,n_1) and (l_2,m_2,n_2), the angle \theta between them satisfies
- In terms of direction ratios,
- Perpendicular: a_1a_2+b_1b_2+c_1c_2 = 0. Parallel: \dfrac{a_1}{a_2} = \dfrac{b_1}{b_2} = \dfrac{c_1}{c_2}.
Problem. A line makes angles 60^{\circ} and 45^{\circ} with the positive x- and y-axes. Find the angle it makes with the positive z-axis, and its direction cosines.
Solution. l = \cos 60^{\circ} = \frac12 and m = \cos 45^{\circ} = \frac{1}{\sqrt{2}}. Using l^{2}+m^{2}+n^{2} = 1,
So \gamma = 60^{\circ} or \gamma = 120^{\circ}, and the direction cosines are
Problem. Find the direction ratios and direction cosines of the line joining A(1,2,3) and B(2,4,5).
Solution. Direction ratios are the differences:
Their length is \sqrt{1^{2}+2^{2}+2^{2}} = \sqrt{9} = 3, so the direction cosines are
Check. \frac19+\frac49+\frac49 = \frac99 = 1 ✓.
Problem. Find the acute angle between two lines whose direction ratios are (2,2,1) and (4,1,8).
Solution.
Problem. Show that the points A(1,2,3), B(4,0,4) and C(-2,4,2) are collinear.
Solution. Direction ratios of AB: (4-1,\ 0-2,\ 4-3) = (3,-2,1). Direction ratios of AC: (-2-1,\ 4-2,\ 2-3) = (-3,2,-1).
Since (-3,2,-1) = -1\times(3,-2,1), the two sets are proportional, so AB and AC are parallel lines. They share the point A, so they are the same line and A, B, C are collinear.
(The negative factor tells us A lies between B and C.)
In three dimensions almost every standard question can be settled without ever taking a square root: compare AB^{2} with BC^{2} for triangles, and compare ratios a_1:b_1:c_1 with a_2:b_2:c_2 for parallel lines. You lose marks to arithmetic slips, not to missing ideas.

Chapter summary
- Three mutually perpendicular axes give three coordinate planes (x=0, y=0, z=0) and eight octants; a point is an ordered triple (x,y,z).
- Distance of P(x,y,z) from the xy-plane is |z|; from the x-axis is \sqrt{y^{2}+z^{2}}; from the origin is \sqrt{x^{2}+y^{2}+z^{2}}.
- AB = \sqrt{(x_2-x_1)^{2}+(y_2-y_1)^{2}+(z_2-z_1)^{2}}.
- Section formula (internal, ratio m:n): \left(\dfrac{mx_2+nx_1}{m+n},\ \dfrac{my_2+ny_1}{m+n},\ \dfrac{mz_2+nz_1}{m+n}\right); for external division replace n by -n. Midpoint is the case m=n; centroid is the average of the three vertices.
- Direction cosines l = \cos\alpha, m = \cos\beta, n = \cos\gamma satisfy l^{2}+m^{2}+n^{2} = 1, and l = \dfrac{x}{r}, m = \dfrac{y}{r}, n = \dfrac{z}{r} with r = OP.
- Direction ratios (a,b,c) are any numbers proportional to (l,m,n); divide by \sqrt{a^{2}+b^{2}+c^{2}} to get the direction cosines.
- The join of A and B has direction ratios (x_2-x_1, y_2-y_1, z_2-z_1).
- \cos\theta = l_1l_2+m_1m_2+n_1n_2; lines are perpendicular when a_1a_2+b_1b_2+c_1c_2 = 0 and parallel when their direction ratios are proportional.
Practice questions
Group A — Multiple choice (1 mark each)
- The distance of the point (2,-3,6) from the origin is [1]a5b7c11d\sqrt{41}
- The number of octants into which the coordinate planes divide space is [1]a4b6c8d12
- If l, m, n are direction cosines then l^{2}+m^{2}+n^{2} equals [1]a0b1c2d3
- The direction ratios of the line joining (1,0,2) and (3,4,5) are [1]a(2,4,3)b(4,4,7)c(3,0,10)d(-2,-4,-7)
- The distance of the point (1,-2,3) from the y-axis is [1]a1b2c\sqrt{10}d\sqrt{13}
- Two lines with direction ratios (1,2,-1) and (3,-1,1) are [1]aparallelbperpendicularccoincidentdinclined at 60^{\circ}
Answers to Group A
1. (b) — \sqrt{4+9+36} = \sqrt{49} = 7.
2. (c) — three planes, each giving two sides: 2^{3} = 8.
3. (b) — proved in §13.3.
4. (a) — (3-1,\ 4-0,\ 5-2) = (2,4,3).
5. (c) — ignore y: \sqrt{1^{2}+3^{2}} = \sqrt{10}.
6. (b) — 1(3)+2(-1)+(-1)(1) = 3-2-1 = 0.
Group B — Short answer (5 marks each)
- Derive the formula for the distance between the points A(x_1,y_1,z_1) and B(x_2,y_2,z_2). [5]
- Show that the points (-2,3,5), (1,2,3) and (7,0,-1) are collinear. [5]
- Find the ratio in which the zx-plane divides the join of A(-2,4,7) and B(3,-5,8). [5]
- A line makes angles 90^{\circ} and 135^{\circ} with the positive x- and y-axes. Find the angle it makes with the positive z-axis and write down its direction cosines. [5]
- Find the angle between the lines whose direction ratios are (1,1,2) and (\sqrt{3}-1,\ -\sqrt{3}-1,\ 4). [5]
Answers to Group B
1. Complete the rectangular box on AB as a space diagonal, with M(x_2,y_2,z_1). A and M lie in the plane z = z_1, so AM^{2} = (x_2-x_1)^{2}+(y_2-y_1)^{2}. The edge MB is parallel to the z-axis, so MB = |z_2-z_1| and MB \perp AM.
Pythagoras in \triangle AMB gives AB^{2} = AM^{2}+MB^{2}, hence AB = \sqrt{(x_2-x_1)^{2}+(y_2-y_1)^{2}+(z_2-z_1)^{2}}.
2. Let A(-2,3,5), B(1,2,3), C(7,0,-1). Direction ratios of AB are (3,-1,-2) and of AC are (9,-3,-6) = 3\times(3,-1,-2). The ratios are proportional and the lines share A, so the three points are collinear.
(Alternatively AB = \sqrt{9+1+4} = \sqrt{14}, BC = \sqrt{36+4+16} = \sqrt{56} = 2\sqrt{14}, AC = \sqrt{81+9+36} = \sqrt{126} = 3\sqrt{14}, and AB+BC = AC.)
3. Let the zx-plane cut AB in the ratio k:1. The dividing point is \left(\frac{3k-2}{k+1},\ \frac{-5k+4}{k+1},\ \frac{8k+7}{k+1}\right). On the zx-plane y = 0, so -5k+4 = 0 and k = \frac45. The ratio is 4:5 internally.
4. l = \cos 90^{\circ} = 0 and m = \cos 135^{\circ} = -\frac{1}{\sqrt{2}}. Then n^{2} = 1-0-\frac12 = \frac12, so n = \pm\frac{1}{\sqrt{2}} and \gamma = 45^{\circ} or 135^{\circ}.
The direction cosines are \left(0,\ -\frac{1}{\sqrt{2}},\ \frac{1}{\sqrt{2}}\right) or \left(0,\ -\frac{1}{\sqrt{2}},\ -\frac{1}{\sqrt{2}}\right).
5. a_1a_2+b_1b_2+c_1c_2 = 1(\sqrt{3}-1)+1(-\sqrt{3}-1)+2(4) = -2+8 = 6. The lengths are \sqrt{1+1+4} = \sqrt{6} and \sqrt{(\sqrt{3}-1)^{2}+(\sqrt{3}+1)^{2}+16} = \sqrt{(4-2\sqrt{3})+(4+2\sqrt{3})+16} = \sqrt{24} = 2\sqrt{6}.
So \cos\theta = \dfrac{6}{\sqrt{6}\cdot 2\sqrt{6}} = \dfrac{6}{12} = \dfrac12, giving \theta = 60^{\circ}.
Group C — Long answer (8 marks each)
- (a) Define the direction cosines of a line and prove that l^{2}+m^{2}+n^{2} = 1. [5](b) A line makes angles 60^{\circ}, 45^{\circ} with the x- and y-axes. Find the angle it makes with the z-axis. [3]
- The vertices of a triangle are A(3,-1,2), B(1,-3,-4) and C(-1,1,2).(a) Find the lengths of the three sides and classify the triangle. [4](b) Find the centroid, and the length of the median from A. [4]
Answers to Group C
1. (a) If a directed line through the origin makes angles \alpha, \beta, \gamma with the positive axes, its direction cosines are l = \cos\alpha, m = \cos\beta, n = \cos\gamma. Take P(x,y,z) on the line with OP = r.
Dropping a perpendicular from P to the x-axis at A gives a right angle at A with OA = x, so \cos\alpha = \frac{x}{r}; similarly \cos\beta = \frac{y}{r}, \cos\gamma = \frac{z}{r}. Hence
(b) l = \cos 60^{\circ} = \frac12, m = \cos 45^{\circ} = \frac{1}{\sqrt{2}}, so n^{2} = 1-\frac14-\frac12 = \frac14 and n = \pm\frac12. Therefore \gamma = 60^{\circ} or 120^{\circ}.
2. (a) AB^{2} = (1-3)^{2}+(-3+1)^{2}+(-4-2)^{2} = 4+4+36 = 44, so AB = 2\sqrt{11}. BC^{2} = (-1-1)^{2}+(1+3)^{2}+(2+4)^{2} = 4+16+36 = 56, so BC = 2\sqrt{14}. CA^{2} = (3+1)^{2}+(-1-1)^{2}+(2-2)^{2} = 16+4+0 = 20, so CA = 2\sqrt{5}.
All three sides are different and AB^{2}+CA^{2} = 44+20 = 64 \ne 56, so the triangle is scalene and not right-angled.
(b) Centroid G = \left(\frac{3+1-1}{3},\ \frac{-1-3+1}{3},\ \frac{2-4+2}{3}\right) = \left(1,\ -1,\ 0\right). The midpoint of BC is D = \left(\frac{1-1}{2},\ \frac{-3+1}{2},\ \frac{-4+2}{2}\right) = (0,-1,-1), so the median from A has length
Group D — Model answers for long questions (10 marks each, for deeper revision)
- Describe the coordinate system in space, derive the distance formula between two points and use it for collinearity and shape problems. [10]
- Define direction cosines and direction ratios, prove l^{2}+m^{2}+n^{2}=1, find them for a line joining two points and derive the angle between two lines. [10]
Model answer D1: points in space and the distance formula (10 marks)
Introduction. A point in space is located by three mutually perpendicular axes OX, OY, OZ meeting at the origin O. The ordered triple (x,y,z) gives the distance of the point from the YZ-plane, the ZX-plane and the XY-plane respectively.
Drone navigation and the location of a mobile tower use such coordinates (latitude, longitude, height).
Octants. The three coordinate planes divide space into eight octants.
| Octant | Signs of (x,y,z) |
|---|---|
| I | (+,+,+) |
| II | (-,+,+) |
| III | (-,-,+) |
| IV | (+,-,+) |
| V | (+,+,-) |
| VI | (-,+,-) |
| VII | (-,-,-) |
| VIII | (+,-,-) |
Special points. A point on the X-axis has the form (x,0,0); on the XY-plane, (x,y,0). For P(3,-4,5) the distance from the XY-plane is 5, and from the X-axis is \sqrt{(-4)^{2}+5^{2}}=\sqrt{41}.
Theorem: distance formula. The distance between P(x_1,y_1,z_1) and Q(x_2,y_2,z_2) is
Proof. Through P and Q draw planes parallel to the coordinate planes to form a rectangular box with PQ as a diagonal. The edges of the box are |x_2-x_1|, |y_2-y_1| and |z_2-z_1|.
The diagonal of the base is d with d^{2}=(x_2-x_1)^{2}+(y_2-y_1)^{2}, and PQ is the hypotenuse of a right-angled triangle with sides d and |z_2-z_1|. Pythagoras' theorem gives the formula.
The distance from the origin is \sqrt{x^{2}+y^{2}+z^{2}}. The mid-point of PQ is \left(\dfrac{x_1+x_2}{2},\dfrac{y_1+y_2}{2},\dfrac{z_1+z_2}{2}\right).
Worked examples.
- A(1,2,3) and B(4,6,15): AB=\sqrt{9+16+144}=\sqrt{169}=13.
- Collinearity. A(3,2,-4), B(5,4,-6), C(9,8,-10): AB=\sqrt{4+4+4}=2\sqrt3, BC=\sqrt{16+16+16}=4\sqrt3 and AC=\sqrt{36+36+36}=6\sqrt3. Since AB+BC=AC, the points are collinear.
- Right-angled triangle. P(0,7,10), Q(-1,6,6), R(-4,9,6): PQ^{2}=1+1+16=18, QR^{2}=9+9+0=18 and PR^{2}=16+4+16=36. As PQ^{2}+QR^{2}=PR^{2}, the triangle is right-angled at Q, and isosceles because PQ=QR.
- Locus. The point (x,y,z) equidistant from (1,0,0) and (0,1,0) satisfies (x-1)^{2}+y^{2}+z^{2}=x^{2}+(y-1)^{2}+z^{2}, which gives x=y.
| Test | Condition |
|---|---|
| Collinear | the largest distance equals the sum of the other two |
| Right angle | a^{2}+b^{2}=c^{2} |
| Equilateral | all three sides equal |
Conclusion. The distance formula is Pythagoras' theorem applied twice, and it settles questions about collinearity, shapes and loci in space.
Model answer D2: direction cosines, direction ratios and the angle between lines (10 marks)
Introduction. A line through the origin makes angles \alpha,\beta,\gamma with the positive X, Y, Z axes. The cosines l=\cos\alpha, m=\cos\beta, n=\cos\gamma are the direction cosines (d.c.s) of the line.
Any three numbers a,b,c proportional to l,m,n are direction ratios (d.r.s).
Theorem: l^{2}+m^{2}+n^{2}=1.
Proof. Let P(x,y,z) be a point on the line with OP=r. The projections of OP on the axes give x=lr, y=mr, z=nr. Since OP^{2}=x^{2}+y^{2}+z^{2}, r^{2}=r^{2}(l^{2}+m^{2}+n^{2}), so l^{2}+m^{2}+n^{2}=1.
Relation between d.r.s and d.c.s. If a,b,c are d.r.s, then
The d.c.s are unique up to the sign for the two opposite senses of the line; d.r.s are not unique.
Line joining two points. For P(x_1,y_1,z_1) and Q(x_2,y_2,z_2) the d.r.s of PQ are x_2-x_1,\ y_2-y_1,\ z_2-z_1, and the d.c.s are these divided by PQ.
Example. For P(1,2,3) and Q(3,-1,9): d.r.s 2,-3,6, PQ=\sqrt{4+9+36}=7, so d.c.s are \dfrac27,-\dfrac37,\dfrac67. Check: \dfrac{4+9+36}{49}=1.
Axes and special lines. The d.c.s of the X-axis are 1,0,0; of the Y-axis 0,1,0. A line equally inclined to the axes has l=m=n=\dfrac1{\sqrt3}, so each angle is \cos^{-1}\dfrac1{\sqrt3}\approx54.74^{\circ} (the body diagonal of a cube).
Theorem: angle between two lines. If the lines have d.c.s l_1,m_1,n_1 and l_2,m_2,n_2 then
Proof. Draw lines through the origin parallel to the given lines and take P(l_1,m_1,n_1) and Q(l_2,m_2,n_2) on them at unit distance from O.
Then PQ^{2}=(l_1-l_2)^{2}+(m_1-m_2)^{2}+(n_1-n_2)^{2}=2-2(l_1l_2+m_1m_2+n_1n_2) using l^{2}+m^{2}+n^{2}=1 for each line. The cosine rule in \triangle OPQ gives PQ^{2}=1+1-2\cos\theta. Comparing, we get the result.
With d.r.s a_1,b_1,c_1 and a_2,b_2,c_2,
Conditions. The lines are perpendicular if a_1a_2+b_1b_2+c_1c_2=0 and parallel if \dfrac{a_1}{a_2}=\dfrac{b_1}{b_2}=\dfrac{c_1}{c_2}.
Worked examples.
- D.r.s 2,3,6 and 1,2,2: dot product =2+6+12=20; lengths 7 and 3, so \cos\theta=\dfrac{20}{21} and \theta\approx17.75^{\circ}.
- D.r.s 1,2,2 and 2,-2,1: dot product =2-4+2=0, so the lines are perpendicular.
Conclusion. The d.c.s of a line satisfy l^{2}+m^{2}+n^{2}=1, are found from the d.r.s by dividing by the length, and determine the angle between two lines.
Practise more: Mathematics question bank