<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] Clearly your first equation must be incorrect -- the dot product returns a scalar, so there is no way to obtain a vector on the right hand side, unless you are overloading your nomenclature.
The dot product returns the sum of the element-wise products of vectors. When you take the dot product of a vector with itself, then that dot product returns the sum of the squares of the component of that vector.
Thus, when you perform a transform such as $\frac{y^Tx}{x^Tx} = \frac{y\cdot x}{x\cdot x}$ you are dividing by the sum of the squares of $x$. The sum of the squares of a vector is, of course, the square of the distance of that vector from the origin.
</s>