Is $A(AA^T)^{-1}A^T$ a diagonal matrix? $A$ is a $n\times k$ matrix with rank $k<n$. I was wondering if $A(A^TA)^{-1}A^T$ a diagonal matrix where $k$ entries are one and other entries are zero.
I'm not sure if this is correct. If this is correct, how to prove it?
 A: For $k<n$ that's always incorrect. The matrix $A(A^\top A)^{-1} A^\top$ is a linear projector from $\mathbb{R}^n$ onto column space of $A$. What you described ($1$s on diagonals and $0$s elsewhere) is simply the identity matrix, and it means projection of every element onto the column space is itself. That requires to have at least $n$ vectors to span $\mathbb{R}^n$ and therefore for $k<n$  can never be the case. Here is a link to read about linear orthogonal projection link. Here is also a counter-example:
$ A= \begin{bmatrix}
   0 & 1 \\ 1  & 0 \\ 1 & 0 
   \end{bmatrix}$ , 
$ A(A^\top A)^{-1} A^\top = \begin{bmatrix}
   1 & 0 & 0\\0  & 0.5 & 0.5 \\ 0 & 0.5 & 0.5
   \end{bmatrix}
$
A: My first instinct would be to try out an example or two, using (for instance) WolframAlpha. Then, once I had gotten the correct order of transopses and non-transopses so that all the dimensions line up and make sense, I would see that it is not the case:

A: This is true up to a change of orthonormal basis. Let $A=USV^\top$ be a singular value decomposition. Then $P:=A(A^\top A)^{-1}A^\top=U\pmatrix{I_k\\ &0}U^\top$. Therefore, while $P$ is usually not a diagonal matrix due to the conjugation by $U$, the linear operator it represents in the standard basis does have a diagonal matrix representation $\pmatrix{I_k\\ &0}$ in the orthonormal basis defined by $U$.
A: Assuming $A$ is square, invertible and symmetric, we have
$$A(AA^T)^{-1}A^T = AA^{-T}A^{-1}A^T =  AA^{-1}A^{-1}A = I$$
which is diagonal. Otherwise, it is not necessarily true, as a counter example is given by @kvphxga
