eigenvalues of a projection matrix proof with the determinant of block matrix Let X be a matrix n x d (n > d). 
Show that the eigenvalues of the projection matrix : X(XTX)-1 XT are 0 and 1 and the multiplicity of 1 is d. 
To do so calculate the determinant of the following block matrix (d+n)x(d+n) (4 blocks).
$$
\
  \begin{bmatrix}
    λI_n&X\\
    X^T&X^TX 
  \end{bmatrix}\,$$  where In is the identity matrix nxn.
What I have done so far 
I have used the following formula to calculate the determinant :
$$ det
\
  \begin{bmatrix}
    A&B\\
    C&D 
  \end{bmatrix}\,
 = (detA)det(D - C(A^-1)B$$
 det(λIn) = λn (product of the elements on the diagonal), since det λIn≠0, λIn is invertible, λIn-1 =(λ-1)In. 
D - C(A^-1)B
=XTX - (XT(λ-1)(In) X
=XTX - (XT(λ-1) X
=XTX - (XT(λ-1)(In) X
=XTX[1-1\λ]
det (XTX - (XT(λ-1)(In) X) 
= [1 - 1/λ]ddet(X^tX) 
= [(λ-1)/λ]ddet (X^tX) 
I don't understand why do we need to calculate the determinant of that matrix to show that the eigenvalues are 0 and 1. (Where does that matrix comes from ?) Is it the characteristic equation ? If so then : 
the determinant of the bloc matrix is : λn[(λ-1)/λ]ddet (X^tX) 
=  λn-d(λ-1)ddet (X^tX)
If I suppose det (X^tX) is a scalar then :
λn-d(λ-1)ddet (X^tX)
= λn-d(λ-1)dk= 0
λn-d(λ-1)d = 0
the eigenvalues are 0 with multiplicity of n-d and 1 with multiplicity of d. 
Any help will be appreciated
 A: To show that the eigenvalues of $X(X^TX)^{-1}X^T$ are all $0$ or $1$ and that the multiplicity of $1$ is $d$, you need to show that the roots of the characteristic polynomial of $X(X^TX)^{-1}X^T$ are all $0$ or $1$ and that $1$ is a root of multiplicity $d$.
The characteristic polynomial of $X(X^TX)^{-1}X^T$ is $\det[\lambda I_n - X(X^TX)^{-1}X^T] = 0$. 
It's hard to directly calculate $\det[\lambda I_n - X(X^TX)^{-1}X^T]$ without knowing what the entries of $X$ are. So, we need to calculate it indirectly. 
The trick they used to do this is to consider the block matrix $\begin{bmatrix}A&B\\C&D\end{bmatrix} = \begin{bmatrix}\lambda I_n&X\\X^T&X^TX\end{bmatrix}$. 
There are two equivalant formulas for its determinant:
$\det\begin{bmatrix}A&B\\C&D\end{bmatrix} = \det(D)\det(A-BD^{-1}C) = \det(A)\det(D-CA^{-1}B)$.
If we use the first formula, we get 
$\begin{bmatrix}\lambda I_n&X\\X^T&X^TX\end{bmatrix} = \det(X^TX)\det(\lambda I_n - X(X^TX)^{-1}X^T)$.
Note that this is the characteristic polynomial of $X(X^TX)^{-1}X^T$ multiplied by $\det(X^TX)$. 
If we use the second formula, we get 
$\begin{bmatrix}\lambda I_n&X\\X^T&X^TX\end{bmatrix} = \det(\lambda I_n)\det(X^TX-X^T(\lambda I_n)^{-1}X) = \det(\lambda I_n)\det((1-\lambda^{-1})X^TX)$ 
$= \lambda^{n}(1-\lambda^{-1})^d\det(X^TX) = \lambda^{n-d}(\lambda-1)^{d}\det(X^TX)$.
Since these two formulas are equivalent, the two results are equal. Hence, $\det(X^TX)\det(\lambda I_n - X(X^TX)^{-1}X^T) = \lambda^{n-d}(\lambda-1)^{d}\det(X^TX)$. 
Since $(X^TX)^{-1}$ exists, $\det(X^TX) \neq 0$, and so, we can divide both sides by $\det(X^TX)$ to get $\det(\lambda I_n - X(X^TX)^{-1}X^T) = \lambda^{n-d}(\lambda-1)^{d}$. Thus, the characteristic polynomial of $X(X^TX)^{-1}X^T$ is $\lambda^{n-d}(\lambda-1)^{d}$, which has only $0$ and $1$ as roots, and $1$ has multiplicity $d$.
