Finding the projection of a vector onto another vector

linear algebraprojectionvectors

I have a vector $x$, and another vector $x_7$, and I want to find the projection of $x_7$ on $x$.

I know that $x = \begin{pmatrix} \frac{1}{36} (\sqrt{1465} – 13) & 1\end{pmatrix}$
and I'm given $x_7$ as a new data point but I'll treat it as a vector because only a vector can project on another vector, right?

So, I'm given $x_7 = \begin{pmatrix} 2 & 1\end{pmatrix}$. And here is what I did:

If we project onto $x$, it’s the same as projecting onto a vector that is longer or shorter than it. We can project on the unit vector, $u$, which has the length of 1 and has the same direction as $x$. A unit vector is defined by: $u = \frac{x}{||x||}$ .
We’ll define another vector, $d$, which is perpendicular on vector $x$ coming down from $x_7$, and the vector $t$, which is the vector that we would normally get from the projection of $x_7$ on $x$, and we would get $d=x_7-t$. Since $t$ is a vector that is shorter than $x$ and in the same direction, we can also write $t=ku$, where $k$ is a scalar, so $d=x_7-ku$.

Since $t$ and $d$ are perpendicular to each other, their dot product is zero.
$$t · d = 0$$
$$ku · (x_7 – ku)=0$$
$$k·u·x_7-k^2 u ·u=0$$
$$u·u=1→k=x_7·u$$

We find $t$:
$$t= ku = x_7·u*u = \frac{x_7 · x}{||x||} * \frac{x}{||x||}$$

So I got this equation for finding $t$ which is what I want, it's the projection of $x_7$ on $x$. But now what should I do? how do I find what is $t$ numerically using the values of vectors $x$ and $x_7$?

Again, I'm given $x_7$ as a "new data point" but I think it should be treated as a vector, it looks like a vector and it only makes sense to be a vector..

Thank you!

Best Answer

Without more context, I can't tell you if you're correct to assume that your new data point is well represented by a vector.

What you've derived is correct, though; it's the familiar vector projection of the vector $\mathbf{a}$ onto the vector $\mathbf{b}$, given by

\begin{equation*} \frac{\mathbf{a}\cdot\mathbf{b}}{\mathbf{b}\cdot\mathbf{b}}\mathbf{b}. \end{equation*}

So if you have the two real vectors

\begin{equation*} x = \left(\begin{array}{cc} a & b \end{array}\right) \end{equation*}

and

\begin{equation*} x_{7} = \left(\begin{array}{cc} c & d \end{array}\right), \end{equation*}

then the projection of $x_{7}$ onto $x$, as you've derived, is

\begin{equation*} t = \frac{x_{7}\cdot x}{\lVert{x\rVert}^{2}}x = \frac{ac+bd}{a^{2}+b^{2}}\left(\begin{array}{cc} a & b \end{array}\right). \end{equation*}

All that's left is to use your values for $a$, $b$, $c$, and $d$.

Related Question