Resources For Teachers For Tutors For Students & Parents Pricing
Year 12 Specialist (Unit 3 & 4) Vectors in two and three dimensions

Algebra of vectors in three dimensions

20 practice questions 0 video lessons Theory + worked examples

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.

Create a free accountTrack your progress and save your work as you go.
Create free account

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}\)).

Adding two vectors in three dimensions On isometric x, y, z axes, vector a runs from the origin, vector b is placed tip-to-tail at the end of a, and the resultant a plus b runs from the origin to the end of b, forming a triangle. x y z a b a + b
Adding in 3D: place \(\mathbf{b}\) tip-to-tail after \(\mathbf{a}\); the resultant \(\mathbf{a}+\mathbf{b}\) runs from start to finish.
Vector projection in three dimensions Vector a and vector b start at the origin. The projection of a onto b lies along b, and a dashed perpendicular drops from the tip of a to its foot on the line of b, meeting it at a right angle. x y z a b proj
Projection: \(\mathbf{a}\) is resolved along \(\mathbf{b}\); the dashed perpendicular meets the line of \(\mathbf{b}\) at a right angle.

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:

\[ \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},\qquad k\mathbf{a}=ka_1\mathbf{i}+ka_2\mathbf{j}+ka_3\mathbf{k} \]
ka=ka1i+ka2j+ka3k

The magnitude and the dot product are:

\[ |\mathbf{a}|=\sqrt{a_1^{\,2}+a_2^{\,2}+a_3^{\,2}},\qquad \mathbf{a}\cdot\mathbf{b}=a_1b_1+a_2b_2+a_3b_3=|\mathbf{a}||\mathbf{b}|\cos\theta \]
a·b=a1b1+a2b2+a3b3

Rearranging gives the angle, and the projections of \(\mathbf{a}\) onto \(\mathbf{b}\):

\[ \cos\theta=\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|},\qquad \text{scalar proj}=\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{b}|},\qquad \text{vector proj}=\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{b}|^{2}}\,\mathbf{b} \]
cosθ=a·b|a||b|
Two quick tests. Vectors are perpendicular when \(\mathbf{a}\cdot\mathbf{b}=0\), and parallel when \(\mathbf{a}=\lambda\mathbf{b}\) for some scalar \(\lambda\) (every component in the same ratio).

Finding the angle between two 3D vectors

  1. 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.
  2. Compute the dot product \(\mathbf{a}\cdot\mathbf{b}=a_1b_1+a_2b_2+a_3b_3\).
  3. Find the magnitudes \(|\mathbf{a}|\) and \(|\mathbf{b}|\) with the 3D distance formula.
  4. 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\).
Example 1 — Scalar multiple and difference
Given \(\mathbf{a}=4\mathbf{i}-\mathbf{j}+2\mathbf{k}\) and \(\mathbf{b}=\mathbf{i}+3\mathbf{j}-5\mathbf{k}\), find \(2\mathbf{a}-\mathbf{b}\).
Solution

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}\).

Example 2 — Between two points
For \(A(2,-1,4)\) and \(B(6,5,-8)\), find \(\overrightarrow{AB}\), the distance \(|\overrightarrow{AB}|\), and the midpoint of \(AB\).
Solution

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)\).

Example 3 — Dot product and angle
Find the angle between \(\mathbf{a}=2\mathbf{i}+3\mathbf{j}+6\mathbf{k}\) and \(\mathbf{b}=\mathbf{i}+2\mathbf{j}+2\mathbf{k}\), to the nearest degree.
Solution

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\).

Example 4 — Scalar and vector projection
Find the scalar projection and the vector projection of \(\mathbf{a}=5\mathbf{i}+2\mathbf{j}+4\mathbf{k}\) onto \(\mathbf{b}=2\mathbf{i}+2\mathbf{j}+\mathbf{k}\).
Solution

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}\).

Vector projection in three dimensions Vector a and vector b start at the origin. The projection of a onto b lies along b, and a dashed perpendicular drops from the tip of a to its foot on the line of b, meeting it at a right angle. x y z a b proj

Common pitfalls

Reversing the vector between points. The vector from \(A\) to \(B\) is \(\overrightarrow{AB}=\mathbf{b}-\mathbf{a}\) (end minus start), not \(\mathbf{a}-\mathbf{b}\). Swapping the order reverses the direction.
Confusing the two projections. The scalar projection \(\dfrac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{b}|}\) is a number (a length); the vector projection multiplies by \(\mathbf{b}\), so divide by \(|\mathbf{b}|^2\) and keep the direction.
Mixing up the parallel and perpendicular tests. Perpendicular uses the dot product, \(\mathbf{a}\cdot\mathbf{b}=0\). Parallel means one vector is a scalar multiple of the other, \(\mathbf{a}=\lambda\mathbf{b}\) — a zero dot product does not make vectors parallel.
Dropping a squared term in the magnitude. In 3D the magnitude is \(\sqrt{a_1^{2}+a_2^{2}+a_3^{2}}\); all three components are squared, and negatives become positive when squared.

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}\).