[Math] How to find the projection of a vector onto a line, given the equation of the line in the form $y = mx + b$

linear algebra

I have the equation of a line in the form $y = mx + b$. I also have a vector $a$.

How would I find the projection of $a$ onto the the line?

Best Answer

From the line equation, we find the slope to be:

$$\tan\alpha=\frac{dy}{dx}=m$$

So $$\sin\alpha=\frac{m}{\sqrt{m^2+1}},\cos\alpha=\frac{1}{\sqrt{m^2+1}}$$

The unit tangent vector $\vec{t}$ is given by:

$$\vec{t}=(\cos\alpha,sin\alpha)$$

The project of vector a onto this line is equal to $\vec{a}\cdot\vec{t}=a_x \cos\alpha +a_y \sin\alpha$.

Related Question