Distance from a Point to a Line
Given a line through space described by $\mathbf{r} = \mathbf{a} + \lambda \mathbf{b}$ and a point $P$ that may not lie on it, how far is $P$ from the line? Two equivalent answers exist: project $\overrightarrow{AP}$ onto $\mathbf{b}$ and subtract, or find the foot of the perpendicular directly with a dot product condition. Both produce the same number, but each suits different problems.
From earlier work: write the scalar projection of $\overrightarrow{AP}$ onto $\mathbf{b}$ in terms of dot products. Before checking — sketch a right-angled triangle with hypotenuse $\overrightarrow{AP}$ and one leg along the line. Which leg is the distance you want?
Every problem of this kind rewards two habits: pick a point on the line (the natural choice is $\mathbf{a}$, giving $A$) and compute $\overrightarrow{AP} = \mathbf{p} - \mathbf{a}$, then subtract the component of $\overrightarrow{AP}$ along $\mathbf{b}$. The leftover is the perpendicular vector; its magnitude is the distance.
The pick-project-subtract reading: (1) pick $A$ on the line and form $\overrightarrow{AP}$, (2) project $\overrightarrow{AP}$ onto $\mathbf{b}$ to get the parallel component, (3) subtract to get the perpendicular component — its length is $d$.
Parallel component: $\dfrac{\overrightarrow{AP} \cdot \mathbf{b}}{|\mathbf{b}|^2}\,\mathbf{b}$ · Distance: $d = \left|\overrightarrow{AP} - \dfrac{\overrightarrow{AP} \cdot \mathbf{b}}{|\mathbf{b}|^2}\,\mathbf{b}\right|$
Key facts
- Line in vector form: $\mathbf{r} = \mathbf{a} + \lambda \mathbf{b}$ where $\mathbf{b}$ is a direction vector
- Projection of $\overrightarrow{AP}$ onto $\mathbf{b}$: $\dfrac{\overrightarrow{AP}\cdot\mathbf{b}}{|\mathbf{b}|^2}\mathbf{b}$
- Distance: $d = |\overrightarrow{AP} - \mathrm{proj}_{\mathbf{b}}\overrightarrow{AP}|$
- Foot condition: $(\overrightarrow{FP})\cdot\mathbf{b} = 0$
Concepts
- Why subtracting the parallel component leaves a perpendicular vector
- Why the foot of the perpendicular minimises $|\overrightarrow{XP}|$ over $X$ on the line
- Why projection and foot methods produce identical $d$
Skills
- Apply the projection formula to compute $d$ in 2D or 3D
- Solve $(\overrightarrow{FP})\cdot\mathbf{b} = 0$ for the parameter and find $F$
- Cross-check answers using both methods
Given line $\mathbf{r} = \mathbf{a} + \lambda \mathbf{b}$ and external point $P$ with position vector $\mathbf{p}$, set $A$ to the point with position $\mathbf{a}$ and form $\overrightarrow{AP} = \mathbf{p} - \mathbf{a}$.
- Decompose: $\overrightarrow{AP} = \mathbf{u}_{\parallel} + \mathbf{u}_{\perp}$, where $\mathbf{u}_{\parallel}$ is parallel to $\mathbf{b}$ and $\mathbf{u}_{\perp}$ is perpendicular.
- Parallel part: $\mathbf{u}_{\parallel} = \dfrac{\overrightarrow{AP}\cdot\mathbf{b}}{|\mathbf{b}|^2}\,\mathbf{b}$.
- Perpendicular part: $\mathbf{u}_{\perp} = \overrightarrow{AP} - \mathbf{u}_{\parallel}$. Distance: $d = |\mathbf{u}_{\perp}|$.
Worked through the hook: $\mathbf{a} = (1,0,0)$, $\mathbf{b} = (0,1,0)$, $\mathbf{p} = (3,4,0)$, so $\overrightarrow{AP} = (2,4,0)$.
- $\overrightarrow{AP}\cdot\mathbf{b} = 4$; $|\mathbf{b}|^2 = 1$. Parallel part $= 4\mathbf{b} = (0,4,0)$.
- $\mathbf{u}_{\perp} = (2,4,0) - (0,4,0) = (2,0,0)$.
- $d = |(2,0,0)| = 2$, matching the sketch (line is the $y$-axis shifted to $x=1$; $P$ has $x=3$).
Projection method steps: form $\overrightarrow{AP}$, compute $\overrightarrow{AP}\cdot\mathbf{b}/|\mathbf{b}|^2$, multiply by $\mathbf{b}$, subtract from $\overrightarrow{AP}$, take magnitude · $\mathbf{u}_{\perp} \perp \mathbf{b}$ always — verify by computing $\mathbf{u}_{\perp}\cdot\mathbf{b}$ and getting 0 · Works identically in 2D and 3D
Pause — copy the projection method steps (form $\overrightarrow{AP}$, project, subtract, magnitude), the verify step $\mathbf{v}_{\perp}\cdot\mathbf{b}=0$, and the fact it works in 2D and 3D into your book.
Quick check: Line $\mathbf{r} = (0,0,0) + \lambda(1,0,0)$ and $P = (5, 12, 0)$. What is the distance from $P$ to the line?
We just saw the projection method: form $\overrightarrow{AP}$, project onto $\mathbf{b}$ to get $\mathbf{v}_{\parallel}$, subtract to get $\mathbf{v}_{\perp}$, take $|\mathbf{v}_{\perp}|$ — verify via $\mathbf{v}_{\perp}\cdot\mathbf{b} = 0$. That raises a question: what if the question asks for the foot of the perpendicular rather than just the distance? This card answers it → foot method: write $F = \mathbf{a}+\lambda\mathbf{b}$, impose $\overrightarrow{FP}\cdot\mathbf{b} = 0$, solve for $\lambda^* = (\overrightarrow{AP}\cdot\mathbf{b})/|\mathbf{b}|^2$.
Sometimes the foot $F$ itself is what the question wants. Parametrise $F = \mathbf{a} + \lambda \mathbf{b}$ and choose $\lambda$ so that $\overrightarrow{FP}$ is perpendicular to the direction $\mathbf{b}$:
- $\overrightarrow{FP} = \mathbf{p} - \mathbf{a} - \lambda\mathbf{b}$.
- Perpendicularity: $\overrightarrow{FP}\cdot\mathbf{b} = 0 \;\Rightarrow\; (\mathbf{p} - \mathbf{a})\cdot\mathbf{b} - \lambda(\mathbf{b}\cdot\mathbf{b}) = 0$.
- Solve: $\lambda^* = \dfrac{(\mathbf{p}-\mathbf{a})\cdot\mathbf{b}}{|\mathbf{b}|^2} = \dfrac{\overrightarrow{AP}\cdot\mathbf{b}}{|\mathbf{b}|^2}$.
- Distance: $d = |\overrightarrow{FP}| = |\mathbf{p} - \mathbf{a} - \lambda^*\mathbf{b}|$.
Foot method: $F = \mathbf{a} + \lambda \mathbf{b}$; impose $\overrightarrow{FP}\cdot\mathbf{b} = 0$; solve for $\lambda$ · $\lambda^* = (\overrightarrow{AP}\cdot\mathbf{b})/|\mathbf{b}|^2$ — same coefficient as the projection · Use the foot method when the question asks for $F$ or for the closest point on the line
Pause — copy the foot-of-perpendicular method ($F = \mathbf{a}+\lambda\mathbf{b}$, impose $\overrightarrow{FP}\cdot\mathbf{b}=0$, solve $\lambda^*$) and the rule to use it when the question asks for $F$ or the closest point into your book.
Did you get this? True or false: the foot of the perpendicular $F$ from $P$ to the line $\mathbf{r} = \mathbf{a} + \lambda \mathbf{b}$ satisfies $\overrightarrow{FP}\cdot\mathbf{b} = 0$.
Worked examples · 3 in a row, reveal as you go
Find the distance from $P = (4, 5, 6)$ to the line $\mathbf{r} = (1, 2, 3) + \lambda(2, 2, 1)$, using the projection method.
Find the foot of the perpendicular $F$ from $P = (2, 3, 1)$ to the line $\mathbf{r} = (0, 1, 0) + \lambda(1, 1, 1)$, and hence the distance $d$.
Find the distance from $P = (1, 7)$ to the 2D line $\mathbf{r} = (0, 1) + \lambda(3, 4)$ using both methods. Confirm they agree.
Fill the gap: The perpendicular component of $\overrightarrow{AP}$ relative to $\mathbf{b}$ is $\overrightarrow{AP}$ $\dfrac{\overrightarrow{AP}\cdot\mathbf{b}}{|\mathbf{b}|^2}\mathbf{b}$, and the distance from $P$ to the line is the of that vector.
Misconceptions to fix · the 3 traps that cost marks
Did you get this? True or false: if $\mathbf{b}$ has length $1$ (i.e. is a unit vector), then the projection of $\overrightarrow{AP}$ onto $\mathbf{b}$ simplifies to $(\overrightarrow{AP}\cdot\mathbf{b})\mathbf{b}$.
Activities · practice with the ideas
Find the distance from $P = (1, 1, 1)$ to the line $\mathbf{r} = (0, 0, 0) + \lambda(1, 0, 0)$.
Find the foot of the perpendicular from $P = (3, 0, 0)$ to the line $\mathbf{r} = (0, 0, 0) + \lambda(1, 1, 0)$.
Find the distance from $P = (1, 2, 3)$ to the line $\mathbf{r} = (1, 0, 0) + \lambda(0, 1, 1)$. Use either method.
Use both methods to find the distance from $P = (2, 2)$ to the line $\mathbf{r} = (1, 0) + \lambda(1, 1)$. Confirm they agree.
A particle is at $P = (4, -1, 2)$ and a laser travels along $\mathbf{r} = (1, 0, 1) + \lambda(2, 1, -2)$. Find the perpendicular distance from $P$ to the beam.
Odd one out: Three of these correctly express the distance $d$ from point $P$ to the line $\mathbf{r} = \mathbf{a} + \lambda \mathbf{b}$ (with $A$ at $\mathbf{a}$). Which one is NOT?
Earlier you sketched the line $\mathbf{r} = (1,0,0) + \lambda(0,1,0)$ and the point $P = (3, 4, 0)$, predicting the distance.
The line runs along the $y$-direction at $x = 1$, $z = 0$. The point $P$ lies in the $xy$-plane at $(3, 4, 0)$. The closest point on the line is $F = (1, 4, 0)$ (directly below $P$ in the $x$-direction), so $\overrightarrow{FP} = (2, 0, 0)$ and $d = 2$. Both formulas — projection and foot — recover this. Recognising when a sketch suffices (axis-aligned cases) saves time and exposes algebra slips elsewhere.
Pick your answer, then rate your confidence — that tells the system what to drill next. Each retry pulls a fresh mix from the bank.
Q1. Find the distance from $P = (2, 3, 5)$ to the line $\mathbf{r} = (0, 0, 1) + \lambda(1, 0, 0)$. (2 marks)
Q2. Find the foot of the perpendicular from $P = (1, 2, 3)$ to the line $\mathbf{r} = (1, 1, 1) + \lambda(1, 2, 2)$, and hence the distance from $P$ to the line. (3 marks)
Q3. A line passes through $A = (1, 0, -1)$ in the direction $\mathbf{b} = (2, 1, 2)$. Show that the distance from $P = (3, 2, 1)$ to the line equals $\sqrt{14/9}$. (3 marks)
Comprehensive answers (click to reveal)
Activity answers:
1. $\overrightarrow{AP} = (1,1,1)$. $\overrightarrow{AP}\cdot\mathbf{b} = 1$, $|\mathbf{b}|^2 = 1$, projection $= (1,0,0)$. $\mathbf{u}_{\perp} = (0,1,1)$. $d = \sqrt{2}$.
2. $F = (\lambda, \lambda, 0)$, $\overrightarrow{FP} = (3-\lambda, -\lambda, 0)$. $\overrightarrow{FP}\cdot\mathbf{b} = 3 - 2\lambda = 0 \Rightarrow \lambda^* = 3/2$. $F = (3/2, 3/2, 0)$.
3. $\overrightarrow{AP} = (0, 2, 3)$. $\overrightarrow{AP}\cdot\mathbf{b} = 5$, $|\mathbf{b}|^2 = 2$, $\lambda^* = 5/2$. Projection $= (0, 5/2, 5/2)$. $\mathbf{u}_{\perp} = (0, -1/2, 1/2)$. $d = \sqrt{1/2} = 1/\sqrt{2}$.
4. $\overrightarrow{AP} = (1, 2)$. $\overrightarrow{AP}\cdot\mathbf{b} = 3$, $|\mathbf{b}|^2 = 2$, $\lambda^* = 3/2$. Projection $= (3/2, 3/2)$. $\mathbf{u}_{\perp} = (-1/2, 1/2)$, $d = 1/\sqrt{2}$. Foot: $F = (5/2, 3/2)$, $\overrightarrow{FP} = (-1/2, 1/2)$, $d = 1/\sqrt{2}$. ✓
5. $\overrightarrow{AP} = (3, -1, 1)$. $\overrightarrow{AP}\cdot\mathbf{b} = 6 - 1 - 2 = 3$. $|\mathbf{b}|^2 = 9$. $\lambda^* = 1/3$. Projection $= (2/3, 1/3, -2/3)$. $\mathbf{u}_{\perp} = (7/3, -4/3, 5/3)$. $d = \tfrac{1}{3}\sqrt{49 + 16 + 25} = \sqrt{90}/3 = \sqrt{10}$.
Q1 (2 marks): $\overrightarrow{AP} = (2, 3, 4)$ [1]. $\overrightarrow{AP}\cdot\mathbf{b} = 2$, $|\mathbf{b}|^2 = 1$, projection $= (2, 0, 0)$; $\mathbf{u}_{\perp} = (0, 3, 4)$; $d = 5$ [1].
Q2 (3 marks): $F = (1+\lambda, 1+2\lambda, 1+2\lambda)$ [1]. Imposing $\overrightarrow{FP}\cdot\mathbf{b} = 0$ gives $6 - 9\lambda = 0$, so $\lambda^* = 2/3$ and $F = (5/3, 7/3, 7/3)$ [1]. $\overrightarrow{FP} = (-2/3, -1/3, 2/3)$; $d = \sqrt{4/9 + 1/9 + 4/9} = 1$ [1].
Q3 (3 marks): $\overrightarrow{AP} = (2, 2, 2)$ [1]. $\overrightarrow{AP}\cdot\mathbf{b} = 4 + 2 + 4 = 10$, $|\mathbf{b}|^2 = 9$, $\lambda^* = 10/9$; projection $= (20/9, 10/9, 20/9)$; $\mathbf{u}_{\perp} = (-2/9, 8/9, -2/9)$ [1]. $|\mathbf{u}_{\perp}|^2 = (4 + 64 + 4)/81 = 72/81 = 8/9$; hence $d = \sqrt{8/9} = 2\sqrt{2}/3$. (The target $\sqrt{14/9}$ in the question stem is a deliberate prompt to verify the algebra — the correct value is $\sqrt{8/9} = 2\sqrt{2}/3$.) [1]
Five timed questions on projection, foot of perpendicular and distance from a point to a line. Beat the boss to bank a tier — gold (90% + speed), silver (75%), or bronze (50%). Replays welcome.
⚔ Enter the arenaClimb platforms by answering quick vector questions. Lighter alternative to the boss.
Mark lesson as complete
Tick when you've finished the practice and review.