Wikipedia states
[Multiple correlation] is the correlation between the variable's values and the best predictions that can be computed linearly from the predictive variables.
But lecture notes state that the square of multiple correlation between $y$ and a vector of variables $X$ is equal to
$$\frac {Y^TX(X^TX)^{-1}X^TY}{Y^TY}$$
Which is equal to $$\frac {Y^T \hat Y}{Y^T Y}$$
(Where I assume that the first column of $X$ contains only $1$’s, so that there is a constant term in the model). But if the multiple correlation is really equal to the correlation between $Y$ and $\hat Y$, then the its square should rather be equal to $\frac {(Y^T \hat Y)^2}{(Y^T Y)\cdot (\hat Y^T \hat Y)}$.
I don't see that these are the same. Is wikipedia wrong, are my lecture notes wrong, or are these equal?