Algebra of vectors in three dimensions
Extend vectors into space with algebra of vectors in three dimensions for Year 12 Specialist Mathematics in Queensland (QCAA). Using the unit vectors i, j and k, you add, subtract and scale 3D vectors, find the vector between two points, and work with the scalar (dot) product.
You will learn to test whether vectors are parallel or perpendicular, find the angle between them, and calculate scalar and vector projections — the core toolkit for lines, planes and motion problems later in Unit 3.
Theory
Algebra of vectors in three dimensions extends the vector rules of Year 12 Specialist Mathematics (QCAA, Queensland) into space. Working with the unit vectors i, j and k, this page covers adding, subtracting and scaling 3D vectors, the vector between two points, the scalar (dot) product, and using it to test for parallel or perpendicular vectors and to find angles and projections.
A vector in three dimensions is written in component form using the standard unit vectors: \(\mathbf{a}=a_1\mathbf{i}+a_2\mathbf{j}+a_3\mathbf{k}\), or as a column \(\begin{pmatrix}a_1\\a_2\\a_3\end{pmatrix}\). Every rule from two dimensions carries over — you simply work one extra component.
Addition, subtraction and scalar multiples act component by component: add matching components to get \(\mathbf{a}+\mathbf{b}\), subtract them for \(\mathbf{a}-\mathbf{b}\), and multiply every component by \(k\) for \(k\mathbf{a}\). The vector between two points is \(\overrightarrow{AB}=\mathbf{b}-\mathbf{a}\) (position vector of the end minus the start), and the midpoint of \(AB\) averages the coordinates.
The scalar (dot) product multiplies matching components and adds: \(\mathbf{a}\cdot\mathbf{b}=a_1b_1+a_2b_2+a_3b_3\). It also equals \(|\mathbf{a}||\mathbf{b}|\cos\theta\), which links it to the angle \(\theta\) between the vectors.
Two non-zero vectors are perpendicular exactly when \(\mathbf{a}\cdot\mathbf{b}=0\), and parallel when one is a scalar multiple of the other, \(\mathbf{a}=\lambda\mathbf{b}\). The dot product also gives the scalar projection (the length of \(\mathbf{a}\) along \(\mathbf{b}\)) and the vector projection (that length as a vector pointing along \(\mathbf{b}\)).
For \(\mathbf{a}=a_1\mathbf{i}+a_2\mathbf{j}+a_3\mathbf{k}\) and \(\mathbf{b}=b_1\mathbf{i}+b_2\mathbf{j}+b_3\mathbf{k}\), the component operations are:
The magnitude and the dot product are:
Rearranging gives the angle, and the projections of \(\mathbf{a}\) onto \(\mathbf{b}\):
Finding the angle between two 3D vectors
- Write both vectors in component form \(a_1\mathbf{i}+a_2\mathbf{j}+a_3\mathbf{k}\), lining up the \(\mathbf{i}\), \(\mathbf{j}\) and \(\mathbf{k}\) parts.
- Compute the dot product \(\mathbf{a}\cdot\mathbf{b}=a_1b_1+a_2b_2+a_3b_3\).
- Find the magnitudes \(|\mathbf{a}|\) and \(|\mathbf{b}|\) with the 3D distance formula.
- Solve \(\cos\theta=\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|}\), then \(\theta=\cos^{-1}(\cdots)\) — a dot product of \(0\) means \(\theta=90^\circ\).
Scale \(\mathbf{a}\) first, then subtract \(\mathbf{b}\) one component at a time:
| \(2\mathbf{a}\) | \(=\) | \(2(4\mathbf{i}-\mathbf{j}+2\mathbf{k})\) |
| \(=\) | \(8\mathbf{i}-2\mathbf{j}+4\mathbf{k}\) | |
| \(2\mathbf{a}-\mathbf{b}\) | \(=\) | \((8-1)\mathbf{i}+(-2-3)\mathbf{j}+(4-(-5))\mathbf{k}\) |
| \(=\) | \(7\mathbf{i}-5\mathbf{j}+9\mathbf{k}\) |
\(2\mathbf{a}-\mathbf{b}=7\mathbf{i}-5\mathbf{j}+9\mathbf{k}\).
Vector between points is end minus start, \(\overrightarrow{AB}=\mathbf{b}-\mathbf{a}\):
| \(\overrightarrow{AB}\) | \(=\) | \((6-2)\mathbf{i}+(5-(-1))\mathbf{j}+(-8-4)\mathbf{k}\) |
| \(=\) | \(4\mathbf{i}+6\mathbf{j}-12\mathbf{k}\) |
The distance is its magnitude:
| \(|\overrightarrow{AB}|\) | \(=\) | \(\sqrt{4^2+6^2+(-12)^2}\) |
| \(=\) | \(\sqrt{16+36+144}\) | |
| \(=\) | \(\sqrt{196}=14\) |
The midpoint averages the coordinates:
| \(M\) | \(=\) | \(\left(\dfrac{2+6}{2},\ \dfrac{-1+5}{2},\ \dfrac{4+(-8)}{2}\right)\) |
| \(=\) | \((4,\,2,\,-2)\) |
\(\overrightarrow{AB}=4\mathbf{i}+6\mathbf{j}-12\mathbf{k}\), \(|\overrightarrow{AB}|=14\), midpoint \((4,2,-2)\).
Multiply matching components and add for the dot product:
| \(\mathbf{a}\cdot\mathbf{b}\) | \(=\) | \((2)(1)+(3)(2)+(6)(2)\) |
| \(=\) | \(2+6+12=20\) |
Find each magnitude:
| \(|\mathbf{a}|\) | \(=\) | \(\sqrt{2^2+3^2+6^2}=\sqrt{49}=7\) |
| \(|\mathbf{b}|\) | \(=\) | \(\sqrt{1^2+2^2+2^2}=\sqrt{9}=3\) |
Substitute into \(\cos\theta=\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|}\):
| \(\cos\theta\) | \(=\) | \(\dfrac{20}{7\times3}=\dfrac{20}{21}\) |
| \(\theta\) | \(=\) | \(\cos^{-1}\!\left(\dfrac{20}{21}\right)\) |
| \(\approx\) | \(18^\circ\) |
\(\mathbf{a}\cdot\mathbf{b}=20\) and the angle is \(\theta\approx18^\circ\).
Start with the dot product and the magnitude of \(\mathbf{b}\):
| \(\mathbf{a}\cdot\mathbf{b}\) | \(=\) | \((5)(2)+(2)(2)+(4)(1)\) |
| \(=\) | \(10+4+4=18\) | |
| \(|\mathbf{b}|\) | \(=\) | \(\sqrt{2^2+2^2+1^2}=\sqrt{9}=3\) |
Scalar projection is \(\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{b}|}\):
| \(\text{scalar proj}\) | \(=\) | \(\dfrac{18}{3}=6\) |
Vector projection is \(\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{b}|^2}\,\mathbf{b}\):
| \(\text{vector proj}\) | \(=\) | \(\dfrac{18}{9}(2\mathbf{i}+2\mathbf{j}+\mathbf{k})\) |
| \(=\) | \(4\mathbf{i}+4\mathbf{j}+2\mathbf{k}\) |
Scalar projection \(6\); vector projection \(4\mathbf{i}+4\mathbf{j}+2\mathbf{k}\).
Common pitfalls
Frequently asked questions
How do you add or subtract vectors in three dimensions?
Work one component at a time: add (or subtract) the \(\mathbf{i}\), \(\mathbf{j}\) and \(\mathbf{k}\) parts separately, so \(\mathbf{a}\pm\mathbf{b}=(a_1\pm b_1)\mathbf{i}+(a_2\pm b_2)\mathbf{j}+(a_3\pm b_3)\mathbf{k}\).
What is the dot product of two 3D vectors?
Multiply matching components and add them: \(\mathbf{a}\cdot\mathbf{b}=a_1b_1+a_2b_2+a_3b_3\). It also equals \(|\mathbf{a}||\mathbf{b}|\cos\theta\), where \(\theta\) is the angle between the vectors.
How do you tell if two 3D vectors are perpendicular?
Find the dot product. If \(\mathbf{a}\cdot\mathbf{b}=0\) (and neither vector is zero) they are perpendicular, because \(\cos 90^\circ=0\).
How do you tell if two 3D vectors are parallel?
They are parallel when one is a scalar multiple of the other, \(\mathbf{a}=\lambda\mathbf{b}\); that is, all three components are in the same ratio.
How do you find the angle between two vectors in 3D?
Compute the dot product and both magnitudes, then use \(\cos\theta=\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|}\) and take the inverse cosine.
What is the difference between the scalar and vector projection?
The scalar projection \(\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{b}|}\) is the length of \(\mathbf{a}\) along \(\mathbf{b}\); the vector projection \(\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{b}|^2}\,\mathbf{b}\) turns that length into a vector pointing along \(\mathbf{b}\).