# If the trace of a matrix equals its rank, is it idempotent?

It is well-known and can easily be proven that if a matrix $$A$$ is idempotent, then its trace equals its rank:

$$A^2 = A \Rightarrow \mathrm{tr}(A) = \mathrm{rk}(A)$$

Does the inverse also hold? If yes, how can this be proven?

• Clearly not. Consider $A=\begin{pmatrix}3 & 0\\ 0 & -1\end{pmatrix}$, $\tr(A)=\rk(A)$ but $A$ is not idempotent Mar 28 at 21:44
• @AngaeMT you should post this as an answer Mar 29 at 11:01
• Another thing: I think you meant (as other responders also seem to agree) the converse of the statement, not the inverse. The inverse of this statement would be "if $A$ is not idempotent, then its trace and rank are unequal." Mar 29 at 13:55

The trace is linear, so we can achieve any desired value by simply multiplying $$A$$ by some scalar as long as $$\operatorname{tr}(A)≠0$$. For instance, $$\widetilde{A}≔\tfrac{\operatorname{rk(A)}}{\operatorname{tr}(A)}A$$ trivially satisfies $$\operatorname{tr}(\widetilde{A}) = \operatorname{rk}(\widetilde{A})$$.
The idea is $$A$$ is idempotent if and only if it has eigenvalues $$0,1$$, but the converse condition cannot ensure. So we can construct a counterexample with non-zero and non-one eigenvalues. For example, consider $$A=\begin{pmatrix}3 & 0 \\ 0 & -1\end{pmatrix}$$which you can see $$A$$ has rank $$2$$ and $$\operatorname{tr}(A)=2$$, but $$A^2\ne A$$.