# What does $W^TW$ or $(W^TW)^{-1}$ represent in the formula for orthongonal projection?

If $$W$$ is a real matrix and we want the orthogonal projection of some vector $$v$$ onto $$span(W)$$, the formula I can find is:

$$proj_{span(W)}(v)=W(W^TW)^{-1}W^Tv$$

Now, if the columns of $$W$$ are orthonormal, I can understand the simpler version of the formula:

$$proj_{span(W)}(v)=WW^Tv$$

Since $$W^Tv$$ is the dot product of $$v$$ with each column of $$W$$ and then left multiplying by $$W$$ gives the appropriate linear combination of the columns of $$W$$.

So, my feeling is that in the general formula, $$(W^TW)^{-1}$$ must represent some kind of way of correcting for the lack of orthonormality in the columns of $$W$$.

If the columns of $$W$$ are orthongonal, but not normal, I can see that $$W^TW$$ would be a diagonal matrix with each column being $$||W_{.,i}||^2$$ and the inverse of this would be the reciprocal of these which cancels out multiplying by $$|W_{.,i}||$$ twice with the other matrices in the formula.

But, I can't see how take this one step further. Each entry in $$W^TW$$ is the dot product of two columns and so I can imagine that inverting this sort of compensates for the columns not being orthonomal, but I can't see how to really capture that mathematically.