<s>[INST] Mechanism Behind Dot Product and Least Square Sorry for my ignorance, but I want to know how the mechanism of finding the least square solutions or the closest points in Euclidean space works. 
For example: 

Find the closest point or points to $b =(−1,2)^T$ that lie on the line $x + y = 0$.

I know the answer is 
$$\frac{\left( \begin{matrix} -1 \\ 2 \end{matrix} \right) \cdot \left( \begin{matrix} 1 \\ -1 \end{matrix} \right)}{\left( \begin{matrix} 1 \\ -1 \end{matrix} \right) \cdot \left( \begin{matrix} 1 \\ -1 \end{matrix} \right)} \cdot \left( \begin{matrix} 1 \\ -1 \end{matrix} \right) = \left( \begin{matrix} -\frac{3}{2} \\ \frac{3}{2} \end{matrix} \right)$$
But what does the dot product between $\left( \begin{matrix} -1 \\ 2\end{matrix} \right) \cdot \left( \begin{matrix} 1 \\ -1 \end{matrix} \right)$ tell you? If I commute it the answer is $-3$, but what exactly is $-3$? Also, the denominator is $2$, again, what exactly is $2$ telling us here?
 [/INST] The projection onto a vector $x$ is give by $$Pv=\frac{xx^T}{||x||^2}v,$$ where $P \equiv \frac{xx^T}{||x||^2}$ is the projection operator, and $||x||^2=(x,x)$ (or $x*x$ in your notation) is the normalization factor.
</s>