The Scalar Product & Angles
The scalar product turns two vectors into a single number — and that number tells you the angle between them.
The scalar (dot) product
For $\mathbf{a}=(a_1,a_2,a_3)$ and $\mathbf{b}=(b_1,b_2,b_3)$: $$\mathbf{a}\cdot\mathbf{b}=a_1b_1+a_2b_2+a_3b_3=|\mathbf{a}||\mathbf{b}|\cos\theta$$ where $\theta$ is the angle between the vectors when placed tail to tail.
$$\cos\theta=\frac{\mathbf{a}\cdot\mathbf{b}}{|\mathbf{a}||\mathbf{b}|}$$ Two non-zero vectors are perpendicular exactly when $\mathbf{a}\cdot\mathbf{b}=0$.
$\mathbf{a}\cdot\mathbf{b}=2(1)+1(3)+(-2)(4)=2+3-8=-3$.
$|\mathbf{a}|=\sqrt{4+1+4}=3$, $|\mathbf{b}|=\sqrt{1+9+16}=\sqrt{26}$.
$\mathbf{a}\cdot\mathbf{b}=3(2)+k(-1)+(-1)(5)=6-k-5=1-k$.
Perpendicular $\Rightarrow 1-k=0 \Rightarrow k=1$.
Dot product: $1(2)+2(-2)+2(1)=2-4+2=0$.
The direction vectors are perpendicular, so the lines meet (or would meet if extended) at $90°$.
If a calculated angle from $\cos\theta$ comes out obtuse but the question asks for the angle between two lines (rather than two directed vectors), take the acute angle instead by using $|\cos\theta|$ — lines don't have a "direction", so the angle between them is always taken to be $\leq90°$.
Exam-style questions
Question 1 5 marks
Find the angle between $\mathbf{a}=(1,-2,2)$ and $\mathbf{b}=(2,2,1)$, giving your answer to 1 decimal place.
$\mathbf{a}\cdot\mathbf{b}=1(2)+(-2)(2)+2(1)=2-4+2=0$ (M1, A1)
Since the scalar product is $0$, the vectors are perpendicular: $\theta=90°$. (A1, B1, B1)
Question 2 6 marks
Given $\mathbf{a}=(4,-1,3)$ and $\mathbf{b}=(1,2,-2)$, find $\mathbf{a}\cdot\mathbf{b}$, $|\mathbf{a}|$, $|\mathbf{b}|$, and the angle between $\mathbf{a}$ and $\mathbf{b}$ to 1 decimal place.
$\mathbf{a}\cdot\mathbf{b}=4(1)+(-1)(2)+3(-2)=4-2-6=-4$ (M1, A1)
$|\mathbf{a}|=\sqrt{16+1+9}=\sqrt{26}$, $|\mathbf{b}|=\sqrt{1+4+4}=3$ (A1)
$\cos\theta=\dfrac{-4}{3\sqrt{26}}=-0.2614\ldots \Rightarrow \theta=105.2°$ (M1, A1, A1)