(a) Find the number of matrices of size $n$ by $n$ over the field of two elements which are conjugate to a diagonal matrix. What is the answer for $n = 4$?
(b) What is the number of $n$ by $n$ matrices conjugate to a diagonal matrix over any finite field $F_q$?
Any help or approaches to this problem would be very much appreciated!
Let $X(q,n,r)$ denote the set of all uples of independent vectors $(v_1,v_2, \ldots,v_r)\in V^r$, where $V$ is an $n$-dimensional vector space over ${\mathbb F}_q$.
By an easy induction,
$$ |X(n,q,r)|=(q^n-1)(q^n-q)(q^n-q^2) \ldots (q^n-q^{r-1}) \tag{1} $$
In particular, if we denote by ${\cal B}(V)$ the set of all bases of $V$, then ${\cal B}(V)=X(q,n,n)$ so
$$ |{\cal B}(V)|=(q^n-1)(q^n-q)(q^n-q^2) \ldots (q^n-q^{n-1}), \ \text{with} \ n={\sf dim}(V) \tag{2} $$
Then, if we denote by ${\cal S_1}(q,n,a)$ the set of all subspaces $W$ of dimensionality $a$ in $V$, then
$$ |{\cal S_1}(q,n,a)|=\frac{|X(n,q,a)|}{|{\cal B}(W)|}= \frac{(q^n-1)(q^n-q)(q^n-q^2) \ldots (q^n-q^{a-1})}{(q^a-1)(q^a-q)(q^a-q^2) \ldots (q^a-q^{a-1})} \tag{3} $$
More generally, if we denote by ${\cal S_s}(q,n,a_1,a_2, \ldots,a_s)$ the set of all uples $(W_1,W_2,\ldots,W_s)$ such that the sum $\sum_{W_j}$ is a direct sum and ${\sf dim}(W_i)=a_i$, we have
$$ |{\cal S_s}(q,n,a_1,a_2, \ldots,a_s|=\frac{|X(n,q,a_1+a_2+\ldots +a_s)|}{\prod_{j}|{\cal B}(W_j)|}= \frac{(q^n-1)(q^n-q)(q^n-q^2) \ldots (q^n-q^{a_1+a_2+a_3+\ldots a_s-1})}{\prod_{j}(q^a_j-1)(q^a_j-q)(q^a_j-q^2) \ldots (q^a_j-q^{a_j-1})} \tag{3} $$
Given a partition $\pi=[p_1+\ldots+p_s]$ of $[n]$, the number of diagonalizable $n\times n$ matrices of type $\pi$ is $L(\pi) \times M(\pi)$, where $L(\pi)$ is the number of choices for the eigenvalues and $M(\pi)$ is the number of space decompositions. We compute $L(\pi)$ by direct counting and we compute $M(\pi)$ by (3).
Here are some examples :
$$ \begin{array}{|l|l|l|l|} \hline n & \pi & L(\pi) & M(\pi) & N(\pi)=L(\pi)M(\pi) \\ \hline 2 & [2] & q & 1 & q \\ \hline 2 & [1+1] & q(q-1) & q(q+1) & q^2(q^2-1) \\ \hline 3 & [3] & q & 1 & q \\ \hline 3 & [2+1] & q(q-1) & q^2+q+1 & q(q-1)(q^2+q+1) \\ \hline 3 & [1+1+1] & q(q-1)(q-2) & q^3(q+1)(q^2+q+1) & (q-2)(q-1)q^4(q+1)(q^2+q+1) \\ \hline 4 & [4] & q & 1 & q \\ \hline 4 & [3+1] & q(q-1) & q^3(q+1)(q^2+1) & (q-1)q^4(q+1)(q^2+1) \\ \hline 4 & [2+2] & q(q-1) & q^4(q^2+1)(q^2+q+1) & (q-1)q^5(q^2+1)(q^2+q+1) \\ \hline 4 & [2+1+1] & q(q-1)(q-2) & q^5(q+1)(q^2+q+1)(q^2+q+1) & (q-2)(q-1)q^6(q+1)(q^2+q+1)(q^2+q+1) \\ \hline 4 & [1+1+1+1] & q(q-1)(q-2) & q^6(q+1)^2(q^2+q+1)(q^2+q+1) & (q-2)(q-1)q^7(q+1)^2(q^2+q+1)(q^2+q+1) \\ \hline \end{array} $$
Adding those results together, one can deduce the number $d_n$ of diagonlizable matrices of size $n\times n$ :
$$ \begin{array}{|l|l|l|l|} \hline n & d_n & d_n \ \text{when} \ q=2 \\ \hline 2 & q(q^3-q+1) & 14 \\ \hline 3 & q(q^8 - q^7 - 2q^6 + q^4 + 2q^3 - q^2 + 1) & 58 \\ \hline 4 & q(q^{15} - 3q^{14} - 2q^{13} + 4q^{12} + 5q^{11} + 8q^{10} + q^9 - 4q^8 - 4q^7 - 6q^6 + 2q^5 - q^4 - q^3 + 1)& 1362\\ \hline \end{array} $$