The original assumption that G is not abelian must be false. This means that G must be abelian.
The proof that G is abelian if g1, g2, ..., gr are representatives of conjugacy classes in G, and gi commutes with gj for all i and j:
We will prove this by contradiction. Assume that G is not abelian.
This means that there exist elements a and b in G such that ab ≠ ba.
Let H be the subgroup of G generated by a and b. Since H is a subgroup of G, it is also closed under conjugation.
This means that for all h in H and g in G, ghg⁻¹ is also in H.
Let ha and hb be the conjugates of a and b in H, respectively. Since H is closed under conjugation, ha and hb are also in H. We know that ab ≠ ba, so hahb ≠ hbhb.
Let C(hb) be the centralizer of hb in H. This is the subgroup of H consisting of all elements that commute with hb.
Since hahb ≠ hbhb, ha ∉ C(hb). This means that there exists an element h in H such that hah⁻¹ ≠ hb.
Let k = hah⁻¹. Since H is closed under conjugation, k is also in H. We know that k ≠ e, since hah⁻¹ ≠ hb.
We claim that k commutes with all elements of H. To see this, let h be any element of H. Then we have:
khk⁻¹ = (hah⁻¹)h(hah⁻¹)
= hah⁻¹hhah⁻¹
= ha²h⁻¹
= ha(hb)h⁻¹
= (hah⁻¹)(hb)
= hb
This shows that khk⁻¹ = hb for all h in H, so k commutes with all elements of H.
ince k commutes with all elements of H, it must also commute with all elements of the centralizer of hb in H.
This means that k ∈ C(hb). However, we already saw that ha ∉ C(hb), so we have a contradiction.
Therefore, our original assumption that G is not abelian must be false. This means that G must be abelian.