# find the projection of a vector on a line using the projection formula

In the following problem:

"Find the projection of vector $\vec{v} = (2, 3)$` onto the line $y = 2x -1$"

What are the beginning steps in solving this problem ? Do I pick a point on the line and then use the projection formula to solve? Thanks in advance

-

In general, how do we find the projection of a vector $v \in V$ onto a subspace $W$ of $V$? Say $\dim W=m$, $\dim V=m+r$. Let $\{w_1,\ldots,w_m\}$ be a basis for $W$, and let $\{w_1,\ldots,w_m,v_1,\ldots,v_r\}$ be the extension of this basis to a basis for $V$. Then for arbitrary $v \in V$, we can write $v$ as a linear combination of basis vectors: $$v = \sum_{i=1}^{m} a_iw_i+\sum_{j=1}^r b_jv_j,$$
and if $V$ is an inner product space then the coefficients are given by $a_i=(v|w_i)$, $b_i=(v|v_j)$ (where $(\cdot|\cdot)$ denotes the inner product). To obtain the projection of $v$ into $W$ we throw away the part of this sum that has no part in $W$, i.e. we throw away $\sum_{j=1}^r b_jv_j$. So the projection of $v$ onto $W$ is $$\sum_{i=1}^m(v|w_i)w_i.$$
Now, how do we apply this to the problem at hand? Well, it is easy to verify that the line $y=2x-1$ is a subspace (let's call it $W$, like above) of $\mathbb{R}^2$ (which acts like $V$), which is an inner product space. To get the projection of $v$ we need to be able to expand $v$ like we did above, as a linear combination of basis vectors of $W$ and $V$. So first we need a basis of $W$, i.e. the line $y=2x-1$. Then we need a basis of $\mathbb{R}^2$ that contains our basis for $W$. Once we have that, we can expand $v$ as above and then the rest of the problem is easy.
In fact, you'll notice that all we really need is the basis for $W$, since we're looking for the second expansion that I gave above.