Order of the group of commuting elements in a finite group Let $G$ be a finite group of order $n$ and class number $k.$ Show that $$
\left|\left\{(a,b)\in G^2: ab=ba\right\}\right|=nk.
$$ I considered $G$ acting on itself by conjugation, and then applied Burnside's lemma to give me $$ nk = \sum_{a\in G}o(Z(a)).$$ This is where I'm stuck. I just need to show that there are $k$ centralizers of $a \in G$ of order $n$. Any help would be appreciated.
 A: I will use $C_G(a)$ to denote the centralizer of an element $a\in G$.
As Mike F points out in the comments, to count the pairs $(a,b)$ of commuting elements $a,b$ we can count how many $b$ commute with $a$ for each $a$ and tally up the results:
$$ \#\{(a,b)\in G^2\mid ab=ba\} = \sum_{a\in G}\#\{b\in G\mid ab=ba\}=\sum_{a\in G}|C_G(a)|. $$
On the other hand, Burnside's lemma says that when $G\curvearrowright G$ acts on itself by conjugation, the number of orbits (i.e. the number $k$ of conjugacy classes of $G$) is the average number of fixed points, and the fixed points of $a\in G$ are precisely the elements of the centralizer $C_G(a)$, so (multiplying by $n$) we may conclude
$$ nk=\sum_{a\in G} |C_G(a)| $$
Therefore, combining these two equations gives the desired result:
$$ \#\{(a,b)\in G^2\mid ab=ba\}=\sum_{a\in G}|C_G(a)|=nk. $$
Note another way to deal with the summation $\sum_{a\in G}|C_G(a)|$ is to partition $G$ into conjugacy classes $X_1,\cdots,X_k$ with representatives $x_1,\cdots,x_k$; this is a good exercise, and is basically the proof of the Burnside lemma recapitulated for the specific case of $G\curvearrowright G$ acting on itself by conjugation.
