# Ask Uncle Colin: Perpendicular vectors

Dear Uncle Colin,

I’m struggling a bit with my C4 vectors. Most of it is fine, except when I have to find a point $P$ on a given line such that $\vec{AP}$ is perpendicular to the line, for some known $A$. How do I figure that out?

-- Any Vector Insight Lavishly Appreciated

Hi, AVILA, and thanks for your message!

There are a couple of approaches I like for this, both of which involve the dot product in slightly different ways.

### The perpendicular way

This is the way I was taught. Suppose you’ve got the equation of a line as $\mathbf{r} = \colvecthree{x_0}{y_0}{z_0} + \lambda \colvecthree{\Delta_x}{\Delta_y}{\Delta_z}$, and a known point $A$ at $\colvecthree{X}{Y}{Z}$. For any point $P$ on the line, $\vec{AP} = \colvecthree{X-x_0}{Y-y_0}{Z-z_0} - \lambda_P \colvecthree{\Delta_x}{\Delta_y}{\Delta_z}$, for some value of $\lambda_P$.

For that to be perpendicular to the line, the scalar (dot) product between $\vec{AP}$ and the direction vector of the line, $\colvecthree{\Delta_x}{\Delta_y}{\Delta_z}$, must be zero. So, all you need to do is solve: $\left(\colvecthree{X-x_0}{Y-y_0}{Z-z_0} - \lambda_P \colvecthree{\Delta_x}{\Delta_y}{\Delta_z}\right)\cdot \colvecthree{\Delta_x}{\Delta_y}{\Delta_z} = 0$ for $\lambda_P$, the only thing you don’t know.

You can try to be clever about rearranging and simplifying, but I wouldn’t bother: stick in the numbers and get an answer; then put $\lambda_P$ back into the equation of the line to find point $P$.

### The trigonometry way

A way I like slightly better, as I can see the geometry behind it, is to make a right-angled triangle between a known point $Q$ on the line ((if you’re not given one, you can find one by sticking in any value you like for $\lambda$; my favourite is 0.)), known point $A$ and point $P$. It helps if you normalise the direction vector of the line: divide it by its modulus and call the result $\mathbf{\hat v}$.

You know the length of the hypotenuse: it’s simply $|\vec{QA}|$.

You can easily figure out the cosine of the angle $A\hat QP$: call the direction vector of the line $\mathbf{v}$ and it’s $\cos(\theta) = \frac{\vec{QA} \cdot \mathbf{\hat v}}{|\vec{QA}|}$ .

Then the distance $|\vec{QP}|$ is then $|\vec{QA}| \cos(\theta)$, using standard right-angled trigonometry.

This *is* a place where simplification helps: if you notice the $|\vec{QA}|$ on the bottom of the $\cos(\theta)$ fraction, you can see that the distance you want is $d = \vec{QA} \cdot \mathbf{\hat {v}}$.

Now you just need to go this far along the line from $Q$ - which means you need to add on $d$ lots of $\mathbf {\hat v}$.

Your final answer for point $P$ is $\mathbf{q} + \left(\vec{QA} \cdot \mathbf{\hat{v}}\right) \mathbf{\hat{v}}$, where $\mathbf{q}$ is the vector $\vec{OQ}$.

Hope that helps!

-- Uncle Colin