Projection Transformation on $x$ Axis Parallel to $y=2x$ 
Let $T \colon \mathbb{R}^2 \rightarrow \mathbb{R}^2$ be the projection transformation on x axis in parallel to $y=2x$. Find the representing matrix of $T^*$ for the standard basis $B=\left(\left \{1,0 \right \},\left\{0,1\right\}\right)$.

I have a solution which I don't understand.
A basis for $y=2x$ could be $\left \{(1,2) \right\}$. A basis for x axis could be $\left \{(1,0)\right\}$. Therefore A basis for the whole vector would be $$C=\left\{(1,0)\right\},\left\{(1,2)\right\}$$.
I understand why this basis is correct. However:
$e_1=(1,0)=1v_1+0v_2 \Rightarrow [e_1]_B=\left (\begin {matrix} 1\\ 0 \end {matrix}\right)$ - this is quite clear.
$e_2=(0,1)=-\frac{1}{2}v_1+\frac{1}{2}v_2\Rightarrow [e_2]_B=\left (\begin {matrix} -\frac{1}{2} \\ \frac{1}{2} \end {matrix}\right)$ - this is the part I don't understand. Why use $-\frac{1}{2}$ to multiply $v_1$? What am I missing here?
Next, since the proejction transformation is $T(x,y)=(x,0)$ it is easy enough to continue. But there's that part I don't understand.
Thanks,
Alan
 A: Given a linear map $T \colon V \rightarrow V$ and a choice of ordered basis $\mathcal{B} = (v_1, \ldots, v_n)$ for $V$, the matrix $[T]_{\mathcal{B}}$ representing $T$ using the basis $\mathcal{B}$ for the domain and range is by definition the matrix whose columns are the vectors $[Tv_1]_{\mathcal{B}}, \ldots, [Tv_n]_{\mathcal{B}}$. 
Since $T$ is a projection to the $x$ axis in parallel to $y = 2x$, it is natural to take a basis for both subspaces and see how $T$ acts on in. As you wrote, we can take $\mathcal{C} = (v_1, v_2)$ where
$$ v_1 = \left( \begin{matrix} 1 \\ 0 \end{matrix} \right), v_2 = \left( \begin{matrix} 1 \\ 2 \end{matrix} \right)  $$
to be our basis. With respect to this basis, since $T$ is a projection, it acts as $T(a_1v_1 + a_2v_2) = a_1v_1$. That is, if you decompose a vector $v$ as $v = a_1v_1 + a_2v_2$ the projection just forgets the component of $v$ in the direction of $v_2$. With respect to this basis, we have
$$ [T(v_1)]_{\mathcal{C}} = [v_1]_{\mathcal{C}} = \left( \begin{matrix} 1 \\ 0 \end{matrix} \right), [T(v_2)]_{\mathcal{C}} = [0]_{\mathcal{C}} = \left( \begin{matrix} 0 \\ 0 \end{matrix} \right) $$
so
$$ [T]_{\mathcal{C}} = \left( \begin{matrix} 1 & 0 \\ 0 & 0 \end{matrix} \right). $$
However, you are asked to find $[T]_{\mathcal{B}}$ where $\mathcal{B} = (e_1, e_2)$ where $e_i$ are the standard basis vectors. Thus, we need to find $[Te_1]_{\mathcal{B}}$ and $[Te_2]_{\mathcal{B}}$. To find $T(e_1)$ is easy since $e_1$ lies on the $x$ axis and $T$ projects to the $x$ axis and so leaves $e_1$ invariant. Thus, $T(e_1) = e_1$ and
$$ [T(e_1)]_{\mathcal{B}} = [e_1]_{\mathcal{B}} = \left( \begin{matrix} 1 \\ 0 \end{matrix} \right). $$
However, in order to understand what is $T(e_2)$, we have to decompose $e_2$ as $e_2 = a_1v_1 + a_2v_2$ and then $T(e_2) = a_1v_1$. Indeed, if
$$ e_2 =  \left( \begin{matrix} 0 \\ 1 \end{matrix} \right) = a_1v_1 + a_2v_2 = a_1 \left( \begin{matrix} 1 \\ 0 \end{matrix} \right) + a_2 \left( \begin{matrix} 1 \\ 2 \end{matrix} \right) = \left( \begin{matrix} a_1 + a_2 \\ 2a_2 \end{matrix} \right) $$
then by comparing coefficients we obtain the system of linear equations
$a_1 + a_2 = 0, 2a_2 = 1$ whose unique solution is $a_2 = \frac{1}{2}$, $a_1 = -\frac{1}{2}$.
Thus, 
$$ [T(e_2)]_{\mathcal{B}} = \left[ -\frac{1}{2} v_1 \right]_{\mathcal{B}} = \left[ \left( \begin{matrix} -\frac{1}{2} \\ 0 \end{matrix} \right) \right]_{\mathcal{B}} = \left( \begin{matrix} -\frac{1}{2} \\ 0 \end{matrix} \right)$$
and
$$[T]_{\mathcal{B}} = \left( \begin{matrix} 1 & -\frac{1}{2} \\ 0 & 0 \end{matrix} \right). $$
Finally, note that $T$ is not given by
$$ T\left( \begin{matrix} x \\ y \end{matrix} \right) = \left( \begin{matrix} x \\ 0 \end{matrix} \right) $$
(this is the projection to the $x$ axis in parallel to the $y$ axis) but
$$ T \left( \begin{matrix} x \\ y \end{matrix} \right) = [T]_{\mathcal{B}} \left( \begin{matrix} x \\ y \end{matrix} \right) =  \left( \begin{matrix} 1 & -\frac{1}{2} \\ 0 & 0 \end{matrix} \right) \left( \begin{matrix} x \\ y \end{matrix} \right) = \left( \begin{matrix} x - \frac{1}{2}y \\ 0 \end{matrix} \right). $$
