Use the picture below to calculate the projection of $\mathbf{v}$ onto $\mathbf{u}$:
\(\vec{u}=(3,1)\\ \vec{v} = (2,4)\\ p_{\vec{u}}(\vec{v}) = \dfrac{\vec{v}\cdot \vec{u}}{|\vec{u}|^2}\vec{u} = \\ \dfrac{(3,1)\cdot(2,4)}{|(3,1)|^2} \vec{u}= \dfrac{10}{10}(3,1) =(3,1)\)