# Find a 2d unit vector perpendicular to a given vector

So I'm given the vector 5i-12j and I need to find a unit vector perpendicular to this line. I know I need to use the dot product in some way, shape, or form, but I just can't figure it out.

Thank you for your help.

• If you find $a$ and $b$ such that $5a-12b=0$, then $5i-12j$ will be perpendicular to $ai+bj$. – angryavian Oct 13 '16 at 5:56
• so I just have to pick random numbers till I find ones that satisfy that equation and that satisfy the definition of a unit vector? There's no precise math? – JeffreyWorley Oct 13 '16 at 6:01
• How about rotating it by $90^\circ$? Try ${1 \over 13 } (12i+5j)$. Or you could try $-90^\circ$. Not much choice here... – copper.hat Oct 13 '16 at 6:01
• @JeffreyWorley Ok so easy now – hamam_Abdallah Oct 13 '16 at 6:29

## 2 Answers

To figure it out do it that way: $$\vec{v} = \left[\begin{matrix} 5 \\ -12 \end{matrix}\right] \\ \vec{w} = \left[\begin{matrix} a \\ b \end{matrix}\right]\\ \vec{u} = \frac{1}{\sqrt{a^2 + b^2}}\left[\begin{matrix} a \\ b \end{matrix}\right]$$ what you need to do is find $a$ and $b$ to get $\vec{w}$ and then compute that unit vector $\vec{u}$.

By dot product definition, you know that $cos(\theta) = 0$ when $\theta = \frac{\pi}{2}$. Hence, by it's algebric deffition, you'll get that it needs to be 0 when $\theta = \frac{\pi}{2}$.

By dot product computation, you'll get: $$5a -12b = 0\\ a = 12, b = 5 \rightarrow 60 - 60 - 0$$

So your $\vec{w}$ is: $$\vec{w} = \left[\begin{matrix} 12\\ 5 \end{matrix}\right]$$

Now all you need to do is normalize $\vec{w}$ to get $\vec{u}$, the unit vector perpendicular to $\vec{v}$:

$$\sqrt{12^2 + 5^2} = \\ \sqrt{144+25} = 13\\ \vec{u} = \frac{1}{13}\vec{w}\\ \vec{u} = \left[\begin{matrix} \frac{12}{13}\\ \frac{5}{13} \end{matrix}\right]$$

given a non zero vector

$\vec{u}=(a,b)=a\vec{i}+b\vec{j}$

the vector $\vec{v}=(b,\color{red}{-}a)$ is perpendicular to $\vec{u}$.

the unit vector is then obtained by dividing by its norm

$||\vec{v}||=\sqrt{a^2+b^2}$.

so, the vector you seek is

$$\left(\frac{b}{||\vec{v}||},\frac{\color{red}{-}a}{||\vec{v}||}\right)$$.