# How could compute the centralizers by GAP?

Let $G$ be a finite group. How could we obtain all conjugacy classes of element centralizers of $G$ by GAP?

(By the centralizer of an element $g$ in $G$, I mean the subgroup $C_G(g):=\{x\in G | xg=gx \}$ of $G$ and by the conjugacy class of $C_G(g)$ I mean the set $\{x^{-1}C_G(g)x | x\in G\}$).

Thank you so much!

• I assume you are aware of the naive way to do this and is looking for a more efficient one than just applying the obvious functions to all elements? – Tobias Kildetoft Apr 2 '16 at 18:19
• Dear Tobias Yes! I want to apply a more efficient and shorter way to obtain them. Any suggestion please? – sebastian Apr 2 '16 at 18:26

If you compute ConjugacyClasses you get a list of classes, each having a Representative and a Centralizer, these centralizers are (with duplicates if two classes have the same centralizer, e.g. Galois-conjugate elements) the different possible centralizers in $G$: