To find the projection of $X$ to the line from the origin through the unit vector $U / \left| U\right|$, i.e.,
$P_{U}\left( x\right) =\dfrac { < X,U>} { < U,U>}\cdot U$
So, how can I solve the question? Can you give a hint?
My answer is:
Since $ e_{1}+e_{2}=\left( \begin{matrix} 1\\ 0\end{matrix} \right)+\left( \begin{matrix} 0\\ 1\end{matrix} \right)$ we have $ e_{1}+e_{2}=\left( \begin{matrix} 1\\ 1\end{matrix} \right)$.
Now, The projection is $\dfrac { < \left( \begin{matrix} 1\\ 1\end{matrix} \right) ,\left( \begin{matrix} 3\\ 1\end{matrix} \right) >} { < \left( \begin{matrix} 3\\ 1\end{matrix} \right) ,\left( \begin{matrix} 3\\ 1\end{matrix} \right) >}\left( \begin{matrix} 3\\ 1\end{matrix} \right) =\left( \begin{matrix} 6 / 5\\ 2 / 5\end{matrix} \right)$.
Can you check my answer?
What you are doing is projecting the vector onto the normal vector to the plane, not projecting onto the plane. Your answer should lie in the plane, and you can see that your solution does not satisfy the equation of the plane. Try to come up with an equation of the vector in the direction of the projection. That will be your $U$ vector in your equation.
Edit: It's actually not quite as as simple as this. Notice that we are not projecting onto a subspace here, since the plane does not pass through the origin. The plane in question is actually an affine space. The equation for projecting onto an affine space $A$ is $$P_A\vec{v} = \vec{r_{0}} + P_S(\vec{v}-\vec{r_{0}})$$ where the plane is expressed as $$\vec{r} = \vec{r_{0}} + \vec{A}t$$ with $\vec{A} = \begin{bmatrix}1 \\ -3\end{bmatrix}$, and $\vec{r_{0}} = \begin{bmatrix}0 \\ 1\end{bmatrix}$, and $S$ is the plane shifted to the origin so that it is a subspace. Thus $S$ is the plane $3x + y = 0$. Working through this, I got the solution of $P_A\vec{v} = \begin{bmatrix}\frac{1}{10} \\ \frac{7}{10}\end{bmatrix}$.
Note that I'm intentionally ignoring the 3rd dimension here since it's not needed. The projection lies in the $x$-$y$-plane, so the "plane" here can be thought of as affine line, and the subspace, $S$, the line shifted so that it passes through the origin.