= Solution
For $g\in GL_n(q)$, make $V=\mathbb F_q^n$ a <module> over the <polynomial ring> $R=\mathbb F_q[t]$ by $t\cdot v=gv$. The <structure theorem for finitely generated modules over a principal ideal domain> and <primary decomposition> give
$$
V\cong\bigoplus_{f\ne t}\bigoplus_{j\ge1}\bigl(R/(f^j)\bigr)^{m_j(f)}.
$$
Here $f$ ranges over <monic polynomials> that are <irreducible polynomials>, and $t$ is excluded because $g$ is invertible. Associate the <integer partition> $\lambda_f$ having $m_j(f)$ parts equal to $j$. It has finite support and satisfies $\sum_f\deg(f)|\lambda_f|=n$. Two matrices are conjugate exactly when their R-modules are isomorphic, so this gives a bijective parameterization of <conjugacy classes>.
The <centralizer> is the R-module <automorphism> <group>. Homomorphisms between distinct primary components vanish: coprimeness of their annihilating <polynomials> makes each such map zero. Fix one $f$ of degree $d$, put $Q=q^d$, and write $m_j=m_j(f)$. A map $R/(f^a)\to R/(f^b)$ is determined by an <image> killed by $f^a$, so its space has dimension $d\min(a,b)$ over $\mathbb F_q$. Consequently the <endomorphism> algebra $E$ has
$$
|E|=Q^{\sum_{a,b}\min(a,b)m_am_b}=Q^{\sum_i(\lambda'_i)^2},
$$
where $\lambda'$ is the <conjugate partition>.
Its semisimple quotient is $\prod_jM_{m_j}(\mathbb F_Q)$: reduce the maps between the equal-length summands modulo $f$ and discard the maps between unequal lengths. Composition through a different length acquires a factor of $f$ when it returns to the original length, so these reductions define an algebra homomorphism. It is onto, and its <kernel> is nilpotent. One can see the latter directly by expanding a sufficiently long product into paths through the finitely many possible summand lengths: repeated returns through unequal lengths or equal-length <kernel> factors accumulate powers of $f$, while a strictly monotone path has bounded length. Eventually every path vanishes in every summand.
An element is invertible exactly when its <image> in that quotient is invertible, since a nilpotent error is inverted by a finite <geometric series>. The fraction of units is therefore $\prod_j|GL_{m_j}(Q)|/Q^{m_j^2}=\prod_j\prod_{r=1}^{m_j}(1-Q^{-r})$. Multiplying the independent primary contributions gives the <primary matrix centralizer formula>:
$$
\boxed{|C_{GL_n(q)}(g)|=\prod_{f\ne t}q^{\deg(f)\sum_i(\lambda'_{f,i})^2}\prod_{j\ge1}\prod_{r=1}^{m_j(f)}(1-q^{-r\deg(f)}).}
$$
Back to article page