$A$ is $n\times n$ complex matrix with $A^2=A$. then need to show that Rank$A$=Trace$A$ So, I have that $A^n=A$ for every natural number $n$ which gives me that determinant of $A$ is either $0$ or the $(n-1)^{th}$ roots of unity, but I don't know how to take it from here.What do I do now? Thanks in advance!
 A: Let $\lambda$ an eigen value of $A$ then $AX=\lambda X$ and so $A^2X=\lambda^2 X$ what give us:
$$A^2X=AX \Rightarrow \lambda^2X=\lambda X \Rightarrow \lambda^2-\lambda=0 \Rightarrow \lambda =0 \ or \ \lambda =1$$
That means we have $m$ eigenvalues equal to $0$ and $n$ eigenvalues equal to $1$. 
But we know that 
$trace(A)=$ sum of eigenvalues $=n$
Also, by Jordan Form,
$rank(A)=$ number of non-null eigenvalue $=n$. 
A: $A$ is a projection matrix. So, if Rank $A$ equals $m$ you have a set 
$\{u_1,u_2,\dots,u_m\}$ of eigenvectors of $A$ with eigenvalue $1$. You can complete to a basis of $\mathbb C^n$, say 
$\{u_1,u_2,\dots,u_m,u_{m+1},\dots,u_n\}$ such that $Au_j=0$ if $j>m$. 
Therefore, $A$ is similar to a diagonal matrix with $m$ ones and $n-m$ zeroes. Since the trace is invariant under matrix similarity you obtain the result.
A: Unless your matrix is either $0$ or $I$, its minimal polynomial is $x^2 - x = (x-1) x$.  Therefore the characteristic polynomial is $(x-1)^j x^{n-j}$ for some $j$, $0 \le j \le n$.  Show that the rank and trace are both $j$.
A: For $x\in\Bbb R^n$ we have $x=(x-Ax)+Ax$ and since $x-Ax\in\ker A$ and $Ax\in Im (A)$ and by the rank-nullity theorem we have
$$\Bbb R^n=Im(A)\oplus \ker(A)$$
Let $p=rank(A)$ and let $\mathcal B=(e_1,\ldots,e_p)$ a basis of $Im(A)$ and $(e_{p+1},\ldots,e_n)$ a basis of $\ker A$ so $(e_1,\ldots,e_n)$ is a basis of $\Bbb R^n$. It's easy to prove that $x\in Im(A)\iff Ax=x$ so we see that $A$ is similar to this matrix (relative to the basis $\mathcal B$)
$$D=diag(\underbrace{1,\ldots,1}_{p\,\text{times}},0,\ldots,0)$$
hence
$$Tr(A)=Tr(D)=p=rank(A)$$
