TITLE: Families of Idempotent $3\times 3$ Matrices
QUESTION [14 upvotes]: I did the following analysis for $2\times2$ real idempotent (i.e. $A^2=A$) matrices:
$$
\begin{bmatrix}a&b\\c&d\end{bmatrix}^2=\begin{bmatrix}a^2+bc&(a+d)b\\(a+d)c&bc+d^2\end{bmatrix}=\begin{bmatrix}a&b\\c&d\end{bmatrix}
$$
So in particular we have $(a+d)c=c$ and $(a+d)b=b$ so if either $b$ or $c$ is nonzero we have $a+d=1$. We also see that $a$ and $d$ both satisfy the equation $x^2+bc=x\iff x^2-x+bc=0$ which is a quadratic equation having solutions
$$
x=\frac{1\pm\sqrt{1-4bc}}{2}=0.5\pm\sqrt{0.25-bc}
$$
But this is only possible if $bc\leq 0.25$ for otherwise the above expression is not real. This gives us the following cases:
CASE 1: If $b,c=0$ we have $x\in\{0,1\}$ and since $a+d=1$ is unnecessary we have four possibilities: $(a,d)\in\{(0,0),(1,0),(0,1),(1,1)\}$.
CASE 2: If $bc=0.25$ we have $x=0.5$ so $a=d=0.5$.
CASE 3: If $bc<0.25$ yet $(b,c)\neq(0,0)$ we have $x\in L=\{0.5-\sqrt{0.25-bc},0.5+\sqrt{0.25-bc}\}$ and to have $a+d=1$ we must have $\{a,d\}=L$ so that if $a$ is one solution, then $d$ is forced to be the other solution. Or the other way around.
The cases can be illustrated via the following diagram graphing the hyperbola $xy=0.25$ corresponding to CASE 2, the area $xy<0.25$ corresponding to CASE 3, and the point $(0.0)$ corresponding to CASE 1:



The blue bands show the graphs of $xy=k$ for $k=0.05$ to $0.20$ and the cyan bands show $xy=k$ for $k=-0.05,-0.10,...$ For instance one could choose $(b,c)=(3.75,-1)$ so that $\sqrt{0.25-bc}=2$ thus rendering $x=0.5\pm 2=-1.5$ and $2.5$ and form the matrix
$$
A=\begin{bmatrix}-1.5&3.75\\-1&2.5\end{bmatrix}
$$
which will then be idempotent, as an example of CASE 3.
QUESTIONs:

Can similar descriptions be derived for $3\times 3$ matrices?
Is this a well known description of idempotent $2\times 2$ matrices?

REPLY [5 votes]: By the kernel decomposition theorem, you have
${\mathbb R}^3={\sf Ker}(A(A-I))={\sf Ker}(A)\oplus{\sf Ker}(A-I)$, so that
${\sf rank}(A)+{\sf rank}(A-I)=3$. If one of ${\sf rank}(A)$ or 
${\sf rank}(A-I)$ is zero, we have the trivial cases $A=0$ or $A=I$. Otherwise,
one of ${\sf rank}(A)$ or ${\sf rank}(A-I)$ is $1$, and the other is $2$. Remember also
that when $A$ is idempotent, ${\sf rank}(A)$ coincides with ${\sf trace}(A)$.
Technical remark. A $3\times 3$ matrix has rank $1$ iff it has one
of the three forms $[C,xC,yC],[0,C,xC],[0,0,C]$ where $x$ and $y$
are constants and $C$ is a column with at least one nonzero entry.
When ${\sf rank}(A)=1$, using the technical remark and reinjecting into
$A\times A=A$, we see that $A$ is of one of the following three forms :
$$
\begin{array}{lcl}
A_1&=&\left(\begin{array}{ccc}
1-xa_2-ya_3 & x(1-xa_2-ya_3) & y(1-xa_2-ya_3) \\
a_2 & xa_2 & ya_2 \\
a_3 & xa_3 & ya_3 \\
\end{array}\right), \\
A_2&=&\left(\begin{array}{ccc}
0 & a_1 & xa_1 \\
0 & 1-xa_3 & x(1-xa_3) \\
0 & a_3 & xa_3 \\
\end{array}\right),
A_3=\left(\begin{array}{ccc}
0 & 0 & a \\
0 & 0 & b \\
0 & 0 & 1 \\
\end{array}\right) \\
\end{array}
$$
Similarly, when ${\sf rank}(A-I)=1$, using the technical remark and reinjecting into
$A\times A=A$, we see that $A$ is of one of the following forms :
$$
\begin{array}{lcl}
A_4&=&\left(\begin{array}{ccc}
-xa_2-ya_3 & x(-1-xa_2-ya_3) & y(-1-xa_2-ya_3) \\
a_2 & 1+xa_2 & ya_2 \\
a_3 & xa_3 & 1+ya_3 \\
\end{array}\right), \\
A_5&=&\left(\begin{array}{ccc}
1 & a_1 & xa_1 \\
0 & -xa_3 & x(-1-xa_3) \\
0 & a_3 & 1+xa_3 \\
\end{array}\right),
A_6=\left(\begin{array}{ccc}
1 & 0 & a \\
0 & 1 & b \\
0 & 0 & 0 \\
\end{array}\right) \\
\end{array}
$$
All the $A_i$ are idempotent. We have thus obtained a necessary and sufficient
condition, made up of six cases (eight if you include the degenerate cases
$A=0$ and $A=I$).