Rank and trace are equal for a real symmetric idempotent matrix

Proposition. Let \mathbf{X} \in \mathbb{R}^{n \times n} be a matrix that is symmetric (\mathbf{X}^\top = \mathbf{X}) and idempotent (\mathbf{X}^2 = \mathbf{X}). Then the rank of \mathbf{X} is equal to the trace of \mathbf{X}. In fact, they are both equal to the sum of the eigenvalues of \mathbf{X}.

The proof is relatively straightforward. Since \mathbf{X} is real and symmetric, it is orthogonally diagonalizable, i.e. there is an orthogonal matrix \mathbf{U} (\mathbf{U}^\top \mathbf{U} = \mathbf{I}) and a diagonal matrix \mathbf{D} such that \mathbf{D} = \mathbf{UXU}^\top (see here for proof).

Since \mathbf{X} is idempotent,

\begin{aligned} \mathbf{X}^2 &= \mathbf{X}, \\  \mathbf{U}^\top \mathbf{D}^2 \mathbf{U} &= \mathbf{U}^T \mathbf{DU}, \\  \mathbf{D}^2 &= \mathbf{D}. \end{aligned}

Since \mathbf{D} is a diagonal matrix, it implies that the entries on the diagonal must be zeros or ones. Thus, the number of ones on the diagonal (which is \text{rank}(\mathbf{D}) = \text{rank}(\mathbf{X})) is equal to the sum of the diagonal (which is \text{tr}(\mathbf{D}) = \text{tr}(\mathbf{X})).

1 thought on “Rank and trace are equal for a real symmetric idempotent matrix

  1. Pingback: Asymptotic distribution of the Pearson chi-square statistic | Statistical Odds & Ends

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s