I am looking for some hints to prove the following equality:
$y^{\top}y - y^{\top}X(X^{\top}X)^{-1}X^{\top}y = \dfrac{\det(L^{\top}L)}{\det(X^{\top}X)},$
where $y$ is a $n\times 1$ vector, $X$ is a $n\times m$ matrix and $L=(X,y)$ (concatenation of $y$ in the last column of $X$). I would appreciate any hints.
Recall that $$ \text{det}\left( \begin{matrix} A & B \\ C & D \end{matrix} \right) = \text{det}\left(A\right)\text{det}\left(D-CA^{-1}B\right) $$
We have that $$ L^TL = \left( \begin{matrix} X^TX & X^Ty \\ y^TX & y^Ty \end{matrix} \right). $$ Thus, $$ \text{det}\left(L^TL\right) = \text{det}\left(X^TX\right)\text{det}\left(y^Ty-y^TX(X^TX)^{-1}X^Ty\right). $$ Therefore \begin{align} \frac{\text{det}\left(L^TL\right) }{\text{det}\left(X^TX\right) }& = \text{det}\left(y^Ty-y^TX(X^TX)^{-1}X^Ty\right)\\& = y^Ty-y^TX(X^TX)^{-1}X^Ty \end{align} where the last equality follows from that fact that $\text{det}\left(c\right)=c$ for $c\in\mathbb{R}$.