# Finding the distance between a line and a vector, given a projection

So my question has two parts:

a) Let L be a line given by y=2x, find the projection of $\vec{x}$=$\begin{bmatrix}5\\3\end{bmatrix}$ onto the line L.

So, for this one:

proj$_L$($\vec{x}$) = $\frac{\vec{x}\bullet \vec{y}}{\vec{y}\bullet \vec{y}}$$\times \vec{y}$ = $\frac{(\begin{bmatrix}5\\3\end{bmatrix} \bullet \begin{bmatrix}2\\1\end{bmatrix}}{(\begin{bmatrix}2\\1\end{bmatrix} \bullet \begin{bmatrix}2\\1\end{bmatrix}} ) \times \begin{bmatrix}2\\1\end{bmatrix}$ = $\frac{13}{5} \times \begin{bmatrix}2\\1\end{bmatrix}$ = \begin{bmatrix}5.2\\2.6\end{bmatrix}

b) using the above, find the sitance between L and the terminal point of x.

Here is where I am stuck... my instinct is to just do:

$\begin{bmatrix}5\\3\end{bmatrix} - \begin{bmatrix}5.2\\2.6\end{bmatrix}$ = $\begin{bmatrix}-.2\\.4\end{bmatrix}$

but I'm sure this is incorrect... how would I solve this?

-

One moment, your line is $y=2x$, then it rather contains $\pmatrix{1\\2}$ than $\pmatrix{2\\1}$ (and its normalvector is $\pmatrix{2\\-1}$)..
Your $\vec y$ is rather $\pmatrix{1\\2}$. It will give a bit different solution. Then calculate the difference vector and its length by $||v||=\sqrt{v\cdot v}$. Unless I miscalculated, the distance is $\displaystyle\frac7{\sqrt5}$. –  Berci Nov 29 '12 at 0:52
how did you arrive at $\frac{7}{\sqrt{5}}$ ? I know where the $\sqrt{5}$ came from, but how did you arrive at 7 in the numerator? –  gfppaste Nov 29 '12 at 1:06