TITLE: Number Of Solutions $X^{2}=X$
QUESTION [5 upvotes]: The equation $x^{2}=x$ $,x\in \mathbb{R}$ has only the solutions $x=0$ and $x=1$.
For a $2 \times 2$ matrix X, how many solutions does $X^{2}=X$ have?
What if $X$ is symmetric?

REPLY [10 votes]: Infinitely many solutions. And a lot of structure. Since you said "symmetric", I'll detail the real case. But note that the argument of the first paragraph below shows that the solutions in $M_n(K)$, for any field $K$, split by diagonalization into $n+1$ similarity orbits under $GL(n,K)$ of the obvious diagonal solutions.
1) Elements $p=p^2$ are called idempotents. Equivalently, these are the diagonalizable (just think about the minimal polynomial) matrices with spectrum in $\{0,1\}$. An idempotent is characterized by the decomposition of the vector space into the direct sum of its range and its nullspace. In $M_n$ ($\mathbb{R}$ or $\mathbb{C}$) in general, they split in $n+1$ connected components according to their rank, which is also equal to their trace. Each component corresponds to a similarity orbit. The natural representatives are the diagonal idempotents $0_n$ and $I_n$ (which are alone in their orbits), and $(1,\ldots,1,0,\ldots,0)$ with $k$ $1$'s, $1\leq k\leq n-1$ (whose orbit is a manifold of dimension $2k(n-k)$). 
In $M_2(\mathbb{R})$, there are therefore three components: $\{0_2\}$, $\{I_2\}$, and the rank one idempotents. That is, the $2\times 2$ matrices whose characteristic polynomial is $X^2-X$:
$$
\pmatrix{a&b\\c&d}\qquad a+d=1\qquad ad-bc=0
$$
I let you work on these two equations to realize that this manifold is in affine bijection with the one-sheet hyperboloid. If you want a parametrization, here is a rational one for all but a subset of them of topological dimension one:
$$
\pmatrix{\frac{1}{1+st} &\frac{s}{1+st}\\\frac{t}{1+st}&\frac{st}{1+st}}\qquad (s,t)\in\mathbb{R}^2\setminus\{1+st=0\}.
$$
2) Elements $p=p^*=p^2$ are called projections (=self-adjoint idempotents) in operator algebras. They are characterized by their range solely, as their nullspace is the orthogonal of their range. Again, they split into $n+1$ components according to their rank. The rank $k$ component is called the Grassmannian $G(k,n)$ and has dimension $k(n-k)$, half (we dropped the nullspace) of the dimension of the corresponding idempotent component in which it lies as a submanifold.
In $M_2(\mathbb{R})$, we still have three components. I let you check that the nontrivial one, rank one projections, can be parametrized by
$$
\pmatrix{\cos^2\theta&\cos\theta\sin\theta\\ \cos\theta\sin\theta&\sin^2\theta}\qquad \theta\in [0,\pi].
$$
It should not surprize you that we recover the complex unit circle. These are the one-dimensional subspaces of $\mathbb{R}^2$. That is the projective line. Note that unlike rank one idempotents, it is now compact.