Case where an orthogonal projection matrix becomes a diagonal matrix? Let $A$ be a tall $m \times n$ matrix with full column rank. Let $m \times m$ matrix
$$H=[h_{ij}] = A(A'A)^{-1}A'$$
denote the orthogonal projection onto the column space of $A$. I know that $0 \leq h_{ii} \leq 1$ for all $i = 1,2,\dots,m$, i.e., all the diagonal elements of projection matrix $H$ should be between $0$ and $1$. 
I'm wondering in which case $H$ matrix is a given diagonal matrix $D$. In other words, what restriction on matrix $A$ will lead to a conclusion that $H=D$, where $D$ is given?
 A: In order for your formula to make sense, $A$ must have linearly independent columns.  We therefore assume that this is the case.
$H$ will be diagonal if and only if $A$ has an invertible $n \times n$ submatrix and $A$ has zeros in all entries outside this submatrix.
A: Where the columns of $X_{n \times p}$ are orthogonal. You have used $H$ to denote the projection matrix, so I guess the domain is regression analysis. So, when the columns of $X$ are orthogonal, that is algebraic implication of pairwise independent random variables, then $X'X = I_p$, thus 
$$
X(X'X)^{-1}X'=XI_p^{-1}X'=XX'= I_n.
$$
A: Let $\mathrm A \in \mathbb R^{m \times n}$ be tall and have full column rank. Let $\rm A = U \Sigma V^\top$ be its singular value decomposition (SVD). Let
$$\rm A \,\big( A^\top A \big)^{-1} A^\top = \cdots = U \begin{bmatrix} \mathrm I_n & \mathrm O\\ \mathrm O & \mathrm O\end{bmatrix} U^\top$$
be the $m \times m$ projection matrix that projects onto the column space of $\rm A$. Therefore, if $\rm U$ is an $m \times m$ permutation matrix, i.e., if the $n$-dimensional column space of $\rm A$ is spanned by $n$ of the $m$ vectors in the standard basis of $\mathbb R^m$, then the projection matrix will be diagonal with diagonal entries $0$ and $1$. 
