Consider a $p \times n$ random matrix
$$X^T = \begin{bmatrix} | & | & & |\\ x_1 & x_2 & \dots & x_n\\ | & | & & |\end{bmatrix}$$
with i.i.d. columns $x_{i} \sim \mathcal{N}(0,I_{p\times p}), p\geq n$. Let
$$\Pi := X^T(XX^T)^{-1}X$$
be the projection matrix that projects onto the column space of $X^T$. Let $a = (a_{1},a_{2}...,a_{n})$ be given. How to compute the following expected value?
$$\mathbb{E} \left( \| \Pi a \|_{2}^2 \right)$$
The result is $\|a\|^2_2 \cdot \frac{n}{p}$. It seems like having something to do with the rank, but I don't know how to derive it.
The $n\times p $ matrix $X$ has singular value decomposition $X=UDV$ where $U$ is $n\times n$ orthogonal, where $D$ is $n\times n$ diagonal, and $V$ is the top $n$ rows of a $p\times p$ orthogonal matrix. So the matrix product $XX^T=UD^2U'$, whose inverse is $(XX^T)^{-1} = U D^{-2}U'$, if $D$ is non-singular, that is, if $X$ has full rank.
The matrix $\Pi$ is then $$X^T U D^{-2}U' X = (V' D U') (U D^{-2}U' )(UDV) = V'V,$$ and since the distribution of $V$ is right invariant, the distribution of $\Pi a$ depends only on the length of the vector $a$. (Right invariance means, for each fixed $p\times p$ orthogonal matrix $B$, the matrix $VB$ is distributed the same way $V$ is. It is a consequence of the rotational symmetry buit into the $\mathcal N(0,I_{p\times p})$ distribution.) Thus, $E\|\Pi a\|^2 = \|a\|^2 E\Pi_{11}$, taking $a=(\|a\|,0,0,\ldots,0)^T$. So what is $E\Pi_{11}$? By symmetry it is $E\,\text{tr}(\Pi)/p.$ But $\text{tr}(\Pi)=\text{tr}(V'V) = \text{tr}(VV') = n$, so finally $E\Pi_{11}=n/p$ and $E\|\Pi a\|^2=\|a\|^2 n/p$.