Let $G_{k,m}$ be the set of the self-adjoint linear maps $P:\mathbb R^m \rightarrow \mathbb R^m$ of rank $k$ satisfying $P\circ P = P.$ Prove that $G_{k,m}$ is a $C^\infty$ submanifold of dimension $k(m-k)$ in $\mathbb R^{m^2}$.
Since $P$, being self-adjoint, has an orthonormal basis of eigenvectors and the condition $P^2=P$ ensures that all eigenvectors are equal to $0$ or $1$, then Rank$P$ = Trace $P$. Writing $Tr$ for the trace function, it seems that I should consider the pre-image $Tr^{-1}(k)$, but if I do so, I am going to obtain a much bigger set containing $G_{k,m}$...
How to work from here? Any clue, hint? Thank you.