I need help with the following problem:
Let $M$ be a connected smooth manifold. Let $f\colon M\to M$ be a smooth mapping satisfying $f(f(x))=f(x)$ for each $x \in M$. Show that $f(M)$ is an embedded submanifold of $M$.
I'd like to prove that $\operatorname{rank}(df_x)$ is locally constant. If so, $\operatorname{rank}(d_xf)$ would be a constant and then I could solve this problem. But I failed after several tries. Beside, I noticed that $df_x$ is a projection for each $x$ of $f(M)$, and I doubt this conclusion is useful though I'm still confused.
Thanks for your help and advice!