Step 32: Vectors and Lines in 3D
- A vector has a size and a direction, written as a column or with \( \mathbf{i}, \mathbf{j}, \mathbf{k} \). Its length is \( |\mathbf{a}| = \sqrt{a_1^2 + a_2^2 + a_3^2} \), and \( \overrightarrow{AB} = \mathbf{b}-\mathbf{a} \): end minus start.
- The scalar product \( \mathbf{a} \cdot \mathbf{b} = a_1b_1 + a_2b_2 + a_3b_3 = |\mathbf{a}||\mathbf{b}|\cos\theta \) gives angles, and \( \mathbf{a} \cdot \mathbf{b} = 0 \) means perpendicular.
- A line is \( \mathbf{r} = \mathbf{a} + t\mathbf{b} \): start at a point, then move any multiple of a direction. In 3D two lines can be parallel, intersecting or skew (not parallel, never meeting).
- Exam point: for the foot of the perpendicular from \( P \) to a line, write the general point \( N \), then solve \( \overrightarrow{PN} \cdot \mathbf{b} = 0 \). The vector product and planes are IB HL only.
Vectors, notation and magnitude
Vectors are topic 3.7 of Cambridge 9709 Paper 3, usually one multi-part question on lines. In IB Analysis and Approaches all vectors are HL only (3.12 to 3.18), and HL adds the vector product and planes, covered in the last section. AP Calculus BC uses 2D vectors for motion (step 28).
A scalar answers “how much?”; a vector answers “how much, and which way?”. In three dimensions, \( \mathbf{i} \), \( \mathbf{j} \) and \( \mathbf{k} \) are vectors of length 1 along the \( x \)-, \( y \)- and \( z \)-axes, and every vector is a combination of them. The same vector can be written two ways:
In print vectors are bold; by hand, underline them. The numbers are the components, and two vectors are equal when every component matches.
The magnitude \( |\mathbf{a}| \) is the length of the arrow, by Pythagoras used twice (across the floor, then up):
Let \( \mathbf{v} = 4\mathbf{i}-4\mathbf{j} + 7\mathbf{k} \). Find \( |\mathbf{v}| \), the unit vector in the direction of \( \mathbf{v} \), and the vectors of magnitude 27 that are parallel to \( \mathbf{v} \).
The vectors are \( \pm(12\mathbf{i}-12\mathbf{j} + 21\mathbf{k}) \). The minus sign gives the one pointing the opposite way.
Vector arithmetic and position vectors
Adding, subtracting and scaling all work one component at a time. Adding means “do one journey, then the other”. A scalar multiple \( k\mathbf{a} \) stretches \( \mathbf{a} \) by the factor \( |k| \), and reverses it if \( k < 0 \). So non-zero vectors are parallel exactly when one is a multiple of the other: \( \mathbf{b} = k\mathbf{a} \). To test, divide matching components; every ratio must give the same \( k \).
Fix an origin \( O \). Each point \( A \) then has a position vector \( \mathbf{a} = \overrightarrow{OA} \), whose components are just its coordinates. To go from \( A \) to \( B \), go back to \( O \) and out again: \( \overrightarrow{AB} = -\mathbf{a} + \mathbf{b} \).
\( A \) is \( (1, 0, 2) \) and \( B \) is \( (3, 6, 5) \). Find \( \overrightarrow{AB} \), the distance \( AB \), the point \( P \) on \( AB \) with \( AP : PB = 1 : 2 \), and show that \( C(7, 18, 11) \) lies on the line through \( A \) and \( B \).
Hence \( A \), \( B \) and \( C \) are collinear.
The scalar product and angles
Here \( 0^\circ \le \theta \le 180^\circ \). The answer is a number, hence scalar product (or dot product); the two forms agree by the cosine rule. Three facts follow:
- For non-zero vectors, \( \mathbf{a} \cdot \mathbf{b} = 0 \) exactly when they are perpendicular.
- A positive dot product means an acute angle; a negative one means obtuse.
- \( \mathbf{a} \cdot \mathbf{a} = |\mathbf{a}|^2 \).
The points \( P(2, 0, 1) \), \( Q(3, 2, 3) \) and \( R(4, 0, 4) \) form a triangle. Find angle \( PQR \).
Angle \( PQR = 82.2^\circ \). Using \( \overrightarrow{PQ} \) instead of \( \overrightarrow{QP} \) flips the sign of the dot product and gives the supplement, \( 97.8^\circ \): both vectors must point away from the vertex.
The economics of the dot product. A shopping basket of three goods is a vector \( \mathbf{x} \). With a price vector \( \mathbf{p} \), total spending is \( p_1x_1 + p_2x_2 + p_3x_3 = \mathbf{p} \cdot \mathbf{x} \). With prices \( \mathbf{p} = (3, 2, 5) \) dollars, the basket \( (4, 10, 2) \) costs \( 12 + 20 + 10 = \$42 \). A consumer with income \( M \) faces the budget constraint \( \mathbf{p} \cdot \mathbf{x} = M \). A move \( \mathbf{d} \) along the budget line costs nothing extra, so \( \mathbf{p} \cdot \mathbf{d} = 0 \): the price vector is perpendicular to the budget line.
Lines in 3D: parallel, intersecting or skew
In 3D there is no single gradient, so a line is given like directions: start here, then keep going that way.
Here \( \mathbf{a} \) is the position vector of a known point, \( \mathbf{b} \) is a direction vector, and each real value of the parameter \( t \) gives one point \( \mathbf{r} \) of the line. For the line through \( A \) and \( B \), use \( \mathbf{r} = \overrightarrow{OA} + t\,\overrightarrow{AB} \). The equation is not unique: any point can be the start and any non-zero multiple of \( \mathbf{b} \) the direction.
To test a point, find \( t \) from one component and check the other two. On \( \mathbf{r} = (1, 0, 2) + t(2, 6, 3) \), the point \( D(5, 12, 8) \) gives \( t = 2 \) in every component, so it lies on the line; \( E(-1, -6, 0) \) gives \( t = -1 \) from \( x \) and \( y \) but needs \( 2 + 3t = 0 \), so it does not. The angle between two lines is the angle between their direction vectors. Exams want the acute one, so take the modulus: \( \cos\theta = \dfrac{|\mathbf{b}_1 \cdot \mathbf{b}_2|}{|\mathbf{b}_1||\mathbf{b}_2|} \).
In the plane, two different lines are parallel or they cross. In space there is a third case, like a road under a flyover.
| Step | For \( \mathbf{r} = \mathbf{a}_1 + \lambda\mathbf{b}_1 \) and \( \mathbf{r} = \mathbf{a}_2 + \mu\mathbf{b}_2 \) |
|---|---|
| 1 | Is \( \mathbf{b}_2 \) a multiple of \( \mathbf{b}_1 \)? If so the lines are parallel (or the same line, if a point of one lies on the other). |
| 2 | If not, set the general points equal: three equations in two unknowns. |
| 3 | Solve two of the equations, then test the third. If it holds, the lines intersect; if not, they are skew. |
Show that \( l_1: \mathbf{r} = \begin{pmatrix} 1 \\ 2 \\ 0 \end{pmatrix} + \lambda\begin{pmatrix} 1 \\ 1 \\ 2 \end{pmatrix} \) and \( l_2: \mathbf{r} = \begin{pmatrix} 4 \\ 0 \\ 3 \end{pmatrix} + \mu\begin{pmatrix} 2 \\ -3 \\ 1 \end{pmatrix} \) intersect. Find the point of intersection and the acute angle between the lines.
The lines meet at \( (2, 3, 2) \) at an acute angle of \( 83.7^\circ \).
Compare \( l_3: \mathbf{r} = (0, 1, 5) + \mu(1, 0, -1) \) with \( l_1 \). The directions are not multiples. Equating, the \( y \)-components give \( \lambda = -1 \), then \( x \) gives \( \mu = 0 \), but the \( z \)-components become \( -2 = 5 \). Not parallel and not meeting, so skew.
The foot of the perpendicular
The shortest distance from a point \( P \) to a line is at the point \( N \) where \( PN \) meets the line at right angles. \( N \) is the foot of the perpendicular, and \( |\overrightarrow{PN}| \) is the perpendicular distance. Method: write the general point \( N \) in terms of \( t \), solve \( \overrightarrow{PN} \cdot \mathbf{b} = 0 \), then substitute.
Find the foot of the perpendicular from \( P(7, 6, 1) \) to the line \( \mathbf{r} = \begin{pmatrix} 1 \\ 0 \\ 1 \end{pmatrix} + t\begin{pmatrix} 2 \\ 1 \\ 2 \end{pmatrix} \), and the perpendicular distance from \( P \) to the line.
The foot is \( N(5, 2, 5) \) and the perpendicular distance is 6. Check: \( (-2)(2) + (-4)(1) + (4)(2) = 0 \).
IB HL only: the vector product and planes
IB Analysis and Approaches HL only (3.16 to 3.18). The vector product and planes are not in Cambridge 9709.
The vector product (cross product) of two vectors is a vector perpendicular to both:
It follows the right-hand rule, \( \mathbf{b} \times \mathbf{a} = -\mathbf{a} \times \mathbf{b} \), and its length is the area of the parallelogram on \( \mathbf{a} \) and \( \mathbf{b} \), so a triangle has area \( \tfrac{1}{2}|\mathbf{a} \times \mathbf{b}| \). A plane is fixed by one point \( A \) and a normal \( \mathbf{n} \) perpendicular to it: \( \mathbf{r} \cdot \mathbf{n} = \mathbf{a} \cdot \mathbf{n} \), or in Cartesian form \( n_1x + n_2y + n_3z = d \). The coefficients of \( x, y, z \) are a normal vector.
(IB HL) For \( A(1, 1, 0) \), \( B(3, 2, 2) \), \( C(2, 3, 1) \), find the area of triangle \( ABC \) and a Cartesian equation of the plane \( ABC \). Then find where the line \( \mathbf{r} = (0, 1, 2) + t(2, 1, 1) \) meets the plane, and the acute angle between them.
Area \( \tfrac{3\sqrt{2}}{2} \), plane \( x-z = 1 \), meeting point \( (6, 4, 5) \), angle \( 16.8^\circ \).
Practise: 6 questions
Try each one on paper first, then check the worked answer.
EasyQ1. Let \( \mathbf{a} = 3\mathbf{i}-\mathbf{j} + 2\mathbf{k} \) and \( \mathbf{b} = \mathbf{i} + 4\mathbf{j}-2\mathbf{k} \). Find \( 2\mathbf{a}-\mathbf{b} \) and its magnitude. Show worked answer
\( 2\mathbf{a}-\mathbf{b} = 5\mathbf{i}-6\mathbf{j} + 6\mathbf{k} \).
\( |2\mathbf{a}-\mathbf{b}| = \sqrt{25 + 36 + 36} = \sqrt{97} \approx 9.85 \).
EasyQ2. Find the unit vector in the direction of \( 2\mathbf{i}-6\mathbf{j} + 3\mathbf{k} \). Show worked answer
Unit vector: \( \tfrac{1}{7}(2\mathbf{i}-6\mathbf{j} + 3\mathbf{k}) \).
Check: \( \tfrac{4 + 36 + 9}{49} = 1 \).
MediumQ3. The points \( A(1, 2, 3) \), \( B(2, 0, 1) \) and \( C(3, 2, 1) \) form a triangle. Find angle \( ABC \). Show worked answer
\( \overrightarrow{BA} \cdot \overrightarrow{BC} = -1 + 4 + 0 = 3 \); \( |\overrightarrow{BA}| = 3 \), \( |\overrightarrow{BC}| = \sqrt{5} \).
\( \cos B = \dfrac{3}{3\sqrt{5}} = \dfrac{1}{\sqrt{5}} \).
Angle \( ABC = 63.4^\circ \).
MediumQ4. Decide whether the lines \( \mathbf{r} = (2, -1, 0) + s(1, 2, -2) \) and \( \mathbf{r} = (5, 3, -1) + t(-2, -4, 4) \) are the same line, parallel, intersecting or skew. Show worked answer
Is \( (5, 3, -1) \) on the first line? \( (5, 3, -1)-(2, -1, 0) = (3, 4, -1) \).
Ratios with \( (1, 2, -2) \): \( 3, 2, \tfrac{1}{2} \). Not equal, so the point is not on the first line.
The lines are parallel and distinct.
MediumQ5. Find the foot of the perpendicular from \( P(3, 4, -1) \) to the line \( \mathbf{r} = (0, 0, 1) + t(1, 1, 0) \), and the perpendicular distance. Show worked answer
\( \overrightarrow{PN} \cdot (1, 1, 0) = 2t-7 = 0 \), so \( t = 3.5 \).
\( N = (3.5, 3.5, 1) \), \( \overrightarrow{PN} = (0.5, -0.5, 2) \).
Distance \( = \sqrt{0.25 + 0.25 + 4} = \sqrt{4.5} = \tfrac{3}{\sqrt{2}} \approx 2.12 \).
ExamQ6. The lines \( l \) and \( m \) have equations \( l: \mathbf{r} = \mathbf{i}-2\mathbf{j} + 3\mathbf{k} + \lambda(2\mathbf{i} + \mathbf{j}-\mathbf{k}) \) and \( m: \mathbf{r} = \mathbf{i}-5\mathbf{j} + 4\mathbf{k} + \mu(\mathbf{i} + 2\mathbf{j}-\mathbf{k}) \). (a) Show that \( l \) and \( m \) intersect, and find the position vector of the point of intersection. [4] (b) Find the acute angle between \( l \) and \( m \). [3] (c) Find the position vector of the foot of the perpendicular from the origin to \( l \), and hence the perpendicular distance from \( O \) to \( l \). [3] Show worked answer
First: \( \mu = 2\lambda \). Second: \( -2 + \lambda = -5 + 4\lambda \), so \( \lambda = 1 \), \( \mu = 2 \). [A1]
Third: \( 3-1 = 2 \) and \( 4-2 = 2 \), so it holds and the lines intersect. [A1]
Point: \( 3\mathbf{i}-\mathbf{j} + 2\mathbf{k} \). [A1]
(b) \( (2, 1, -1) \cdot (1, 2, -1) = 2 + 2 + 1 = 5 \); both lengths are \( \sqrt{6} \). [M1]
\( \cos\theta = \tfrac{5}{6} \) [M1], so \( \theta = 33.6^\circ \). [A1]
(c) \( \overrightarrow{ON} = (1 + 2\lambda, -2 + \lambda, 3-\lambda) \); \( \overrightarrow{ON} \cdot (2, 1, -1) = 6\lambda-3 = 0 \), so \( \lambda = \tfrac{1}{2} \). [M1]
\( \overrightarrow{ON} = 2\mathbf{i}-1.5\mathbf{j} + 2.5\mathbf{k} \). [A1]
\( ON = \sqrt{4 + 2.25 + 6.25} = \sqrt{12.5} \approx 3.54 \). [A1]
Total: 10 marks.
Check yourself
1. What is the magnitude of \( 2\mathbf{i}-3\mathbf{j} + 6\mathbf{k} \)?
2. For which value of \( k \) are \( (k, 2, -1) \) and \( (3, k, 4) \) perpendicular?
3. Two lines have non-parallel directions, and the three equations from equating their general points have no common solution. The lines are
Your score: 0 out of 3
The short version
- \( |\mathbf{a}| = \sqrt{a_1^2 + a_2^2 + a_3^2} \); a unit vector is \( \mathbf{a}/|\mathbf{a}| \); \( \overrightarrow{AB} = \mathbf{b}-\mathbf{a} \). Parallel means one vector is a multiple of the other.
- \( \mathbf{a} \cdot \mathbf{b} = a_1b_1 + a_2b_2 + a_3b_3 = |\mathbf{a}||\mathbf{b}|\cos\theta \); zero means perpendicular. For an angle in a triangle, both vectors point away from the vertex.
- A line is \( \mathbf{r} = \mathbf{a} + t\mathbf{b} \). Check the directions first, then equate with different parameters and test the third equation: intersecting or skew.
- Foot of the perpendicular: general point \( N \), solve \( \overrightarrow{PN} \cdot \mathbf{b} = 0 \), and the distance is \( |\overrightarrow{PN}| \).
- IB HL only: \( \mathbf{a} \times \mathbf{b} \) is perpendicular to both, with length equal to the parallelogram area; a plane is \( \mathbf{r} \cdot \mathbf{n} = d \).
- The full chapter in Mathematics Made Simple has many more worked examples and a full set of practice questions with a complete answer key.
Further reading on EconTutorials
Related in-depth articles from our blog:
