Determine the number of idempotent matrices in $M_2(\mathbb{F}_p)$ I believe I have the first part of this problem figured out, however I am unable to come up with how to approach the final step.  Here is what I have thus far: If $A$ is an idempotent matrix, then $A^2 = A$ and therefore the $A$ is a root of $f(t) = t(t-1)$.  The minimal polynomial for $A$, $M_a(t)$ must divide $f(t)$, and when $m_A(t)$ is $t$ or $t-1$ the matrix $A$ is the zero matrix or the identity matrix respectively.  Both the zero matrix and the identity matrix are clearly idempotent, so thus far we have counted 2.
In the remaining case that $m_A(t) = t(t-1)$ we see that $A$ splits into distinct linear factors over the field $\mathbb{F}_p$, hence $A$ is diagonalizable over $\mathbb{F}_p$.  The diagonalization of $A$ gives a diagonal matrix which has either 0 or 1 in the diagonal entries and 0s in all other places (0 and 1 are the roots of the minimal polynomial, and therefore the eigenvalues of $A$).
If we let $Q$ denote the number of idempotent elements in $M_2(\mathbb{F}_p)$, then $\text{GL}_2(\mathbb{F}_p)$ acts on $Q$ by conjugation.  Indeed, if $A \in Q$ and $X \in \text{GL}_2(\mathbb{F}_p)$ then
$$
(XAX^{-1})^2 = XAX^{-1}XAX^{-1} = XA^2X^{-1} = XAX^{-1}
$$
so $XAX^{-1}$ is an idempotent matrix and hence in $Q$.  Now, determining the number of elements in $Q$ amounts to determining the sum of the orbits of $A$ where $A \in Q$.  Based on the fact that we have eigenvalues $0$ and $1$, we can choose four representatives to represent $Q$, namely the set $R$ consisting of
$$
\begin{pmatrix} 0 & 0 \\ 0 & 0  \end{pmatrix}, \quad \begin{pmatrix} 0 & 0 \\ 0 & 1 \\ \end{pmatrix}, \quad \begin{pmatrix} 1 & 0 \\ 0 & 0 \\ \end{pmatrix}, \quad \begin{pmatrix} 1 & 0 \\ 0 & 1 \\ \end{pmatrix}.
$$
The stabilizer of $A \in Q$ is the set of all matrices $P$ which have $PAP^{-1} = A$, in other words $\text{Stab}_{\text{GL}_2(\mathbb{F}_p)}(A) = C_{\text{GL}_2(\mathbb{F}_p)}(A)$. The Orbit-Stabilizer theorem then gives that
$$
|Q| = \sum_{X \in R}[\text{GL}_2(\mathbb{F}_p): C_{\text{GL}_2(\mathbb{F}_p)}(X)] 
$$
Where I am getting stuck is at this point, how do I determine $[\text{GL}_2(\mathbb{F}_p): C_{\text{GL}_2(\mathbb{F}_p)}(X)]$?  For instance, the first term in the sum I need to determine is
$$
[\text{GL}_2(\mathbb{F}_p) : C_{\text{GL}_2(\mathbb{F}_p)}\bigg(\begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix} \bigg)],
$$
but I'm not sure how to proceed with this type of calculation.
Edit after reading over the comments here is what I now have:
There are three conjugacy classes, that of the zero matrix, the identity matrix and that of $Y = \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}$.  Determining the centralizer of $Y$ in $\text{GL}_2(\mathbb{F}_p)$ amounts to determining the number of matrices $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$ which satisfy
$$
\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
\begin{pmatrix}
1 & 0 \\
0 & 0
\end{pmatrix} = 
\begin{pmatrix}
1 & 0 \\
0 & 0
\end{pmatrix}\begin{pmatrix}
a & b \\
c & d
\end{pmatrix}
$$,
which is the same as the number of matrices $\begin{pmatrix} a & b \\ c & d \end{pmatrix}$ which satisfy
$$
\begin{pmatrix}
a & 0 \\
c & 0
\end{pmatrix} = \begin{pmatrix}
a & b \\
0 & 0
\end{pmatrix},
$$
there is one degree of freedom (namely the choice of $a$), and there are precisely $p-1$ nonzero elements to choose for $a$.  So, there are $(p^2 - 1)/p-1$ elements in the orbit of $Y$.  There is one element in the orbit of the zero matrix and one element in the orbit of the identity matrix, so the total number of idempotent elements is
$$
\frac{(p^2 - 1)}{p-1} + 2.
$$
is this correct?
 A: Here's an alternative approach to the problem. If $A$ is idempotent, then it is either the identity matrix, the zero matrix, or has rank $1$, so it suffices to add 2 to the number of possible rank $1$ matrices.
A rank-1 idempotent matrix is uniquely determined by its eigenspace associated with $1$ and its eigenspace associated with $0$, and these subspaces must be distinct and of dimension $1$. There are $\frac{p^2 - 1}{p-1} = p+1$ distinct one-dimensional subspaces of $\Bbb F_p^2$ (each non-zero vector spans a 1D subspace, and each 1D subspace is spanned by $p-1$ distinct vectors). Thus, we have
$$
(p+1) \cdot [(p + 1) - 1] = p(p+1)
$$
possible pairs of eigenspaces, which means $p(p+1)$ rank 1 idempotent transformations, yielding a total of $2 + p(p+1)$.

My original strategy was as follows:
Every rank $1$ matrix can be written in the form $A = uv^T$ for non-zero column vectors $u,v \in \Bbb F_p^2$. We have
$$
A^2 = uv^Tuv^T = (v^Tu) \cdot uv^T,
$$
so $A$ is idempotent iff the dot-product $v^Tu$ of $u$ and $v$ is $1$. For a given non-zero vector $u \in \Bbb F_p^2$, the vectors $v$ satisfying the equation $v^Tu = 1$ is a $1$-dimensional affine subspace of $\Bbb F_p^2$. Thus, for any $u \in \Bbb F_p^2 \setminus \{0\}$, there $p$ vectors $v$ for which $uv^T$ is idempotent.
Now, the question remains: how many distinct matrices of the form $uv^T$ are obtained from these pairs? Note that for any satisfactory pair $u,v$ and $k \in \Bbb F_p \setminus \{0\}$, $ku,k^{-1}v$ is a pair that results in the same matrix. Moreover, I claim that for $u_1,u_2,v_1,v_2$, we have $u_1v_1^T = u_2v_2^T$ only if $u_2 = ku_1$ and $v_2 = kv_1$ for some $k \neq 0$.
Thus, we can come to the conclusion that each satisfactory matrix is attained $p-1$ times among the products $uv^T$. Putting all that together, we end up with the total count of
$$
2 + \frac{(p^2-1)p}{p-1} = 2 + p(p+1).
$$
A: Here is a completely elementary approach. This classifies idempotent $2\times 2$ matrices over an arbitrary field $k$. We can count the total when $k=\mathbb{F}_q$ for some prime power $q$. The benefit of this approach is it gives an explicit description of them.
Let the matrix
$$ A=\begin{pmatrix} a&b \\ c&d\end{pmatrix} $$
be idempotent. Then just evaluating $A^2=A$ yields four expressions
$$a^2-a+bc,\quad ab+bd-b,\quad ac-c+dc,\quad bc+d^2-d,$$
each of which must be $0$. The middle two expressions can be factorized, yielding
$$ b(a+d-1)=c(a+d-1)=0.$$
First, suppose that $b=c=0$. Then $A$ is a diagonal matrix, and we obtain $a^2=a$ and $d^2=d$. In any field the only two idempotents are $0,1$, so one obtains exactly four idempotents with $b=c=0$ over any $k$.
Thus we may assume that $a+d-1=0$. This makes the second and third expression $0$, and the fourth becomes the first upon substituting $d=1-a$. Thus we are left with $a(1-a)=bc$.
If $a=0,1$ then either $b=0$ or $c=0$ (but not both!). For either value of $a$, this yields that either $b=0$ and $c$ is arbitrary non-zero, or $c=0$ and $b$ is arbitrary non-zero. If $k=\mathbb{F}_q$ this yields $4(q-1)$ idempotent matrices.
Otherwise $a\neq 0,1$, and $bc\neq 0$. Given an arbitrary non-zero $b$ one must have $c=a(1-a)/b$, which is determined. If $k=\mathbb{F}_q$ this yields $(q-2)(q-1)$ idempotent matrices.
For $k$ finite we therefore sum, and obtain $4+4(q-1)+(q-2)(q-1)=q^2+q+2$.
