It is well-known that number of pairs of commuting elements in finite group G is equal to number of conjugacy classes multiplied by cardinality of G. More generally [here (MO275769)][1] Qiaochu Yuan explains that it can be generalized: > **Claim:** Let $\pi$ be a finitely generated group and $G$ be a finite group. Then > > $$\frac{|\text{Hom}(\pi \times \mathbb{Z}, G)|}{|G|}$$ > > is equal to the number of conjugacy classes of homomorphisms $\pi \to G$. (Taking $\pi = \mathbb{Z} $ one obtains initial claim.) **Question:** Is there any generalization of these relations to semigroups $G$ ? In particular to a semigroup of ALL (non-necessarily non-degenerate) matrices over finite field $F_q$ ? Or for $G$ - ALL (non-necessarily bijective) maps of finite set to itself ? (The later is a kind of "field with one element" version of the previous). **Remark:** Commuting pairs for ALL (non-necessarily non-degenerate) matrices has been widely studied - the so-called "commuting variety", in particular there is nice generating function for such pairs due to Feit and Fine see e.g. [MO271752][2]. **Remark:** I vaguely remember Benjamin Steinberg some years ago explained here on MO that there can be several definitions of "conjugacy classes" for semigroups, cannot find that post now. So it might work for some and may not work for others. **Example no-go?:** Let us look on 2x2 matrices over $F_q$: the number of commuting pairs seems to be $p^2(p^4+p^3-p)$, semigroup cardinality is $p^4$, group cardinality $(p^2-1)(p^2-p)$, number of "conjugacy classes" defined as conjugated with respect to GROUP (i.e. part of invertible elements) is $p^2+p$. So $$p^2(p^4+p^3-p) \ne (p^2-1)(p^2-p) * (p^2+p ) ~~ group ~ cardinality ~ used $$ $$p^2(p^4+p^3-p) \ne (p^4) * (p^2+p ) ~~ semigroup~ cardinality~ used$$ So if I am not making mistake somewhere (for example incorrectly quoting number of commuting pairs or "conjugacy classes"), then - naively it might not work, it is a pity if would be so. PS On count of conjugacy classes - quote from [Steven Sam blog][3]: > As an aside, if we look at the conjugacy classes of all matrices > instead of invertible matrices, i.e., we allow the domain of the > partition valued functions above to include the polynomial x, then the > number of such classes is \sum_j p_j(n) q^j where p_j(n) is the number > of partitions of n into j parts. I think it’s a really nice formula > (though it takes some work to show). See Chapter 1, Section 10 of the > second edition of Enumerative Combinatorics I for a derivation of this > formula. So $p^2+p$ for $n=2$, $p$ - classes of scalar matrices, $p^2$ with "full" "Frobenius cell". [1]: https://mathoverflow.net/a/275769/10446 [2]: https://mathoverflow.net/q/271752/10446 [3]: https://concretenonsense.wordpress.com/2009/09/14/glfq-i-conjugacy-classes-of-a-finite-general-linear-group/