# 7.16 Centralizer

`Centralizer( G, x )`

`Centralizer` returns the centralizer of an element x in G where x must be an element of the parent group of G.

The centralizer of an element x in G is defined as the set C of elements c of G such that c and x commute.

```    gap> s4 := Group( (1,2,3,4), (1,2) );
Group( (1,2,3,4), (1,2) )
gap> v4 := Centralizer( s4, (1,2) );
Subgroup( Group( (1,2,3,4), (1,2) ), [ (3,4), (1,2) ] )```

The default function `GroupOps.Centralizer` uses `Stabilizer` (see Stabilizer) in order to compute the centralizer of x in G acting by conjugation.

`Centralizer( G, U )`

`Centralizer` returns the centralizer of a group U in G as group record. Note that G and U must have a common parent group.

The centralizer of a group U in G is defined as the set C of elements c of C such c commutes with every element of U.

If G is the parent group of U then `Centralizer` will set and test the record component `U.centralizer`.

```    gap> s4 := Group( (1,2,3,4), (1,2) );
Group( (1,2,3,4), (1,2) )
gap> v4 := Centralizer( s4, (1,2) );
Subgroup( Group( (1,2,3,4), (1,2) ), [ (3,4), (1,2) ] )
gap> c2 := Subgroup( s4, [ (1,3) ] );
Subgroup( Group( (1,2,3,4), (1,2) ), [ (1,3) ] )
gap> Centralizer( v4, c2 );
Subgroup( Group( (1,2,3,4), (1,2) ), [  ] ) ```

The default function `GroupOps.Centralizer` uses `Stabilizer` in order to compute successively the stabilizer of the generators of U.

GAP 3.4.4
April 1997