computing centralizers in the von dyck group $\langle a,b | a^3=b^3=(ab)^3 =1\rangle$ Let $G = \langle a,b | a^3=b^3=(ab)^3 =1\rangle$. I'm trying to compute centralizers in $G$; in particular, I'm interested in the centralizers of $ab$, $ba$, $a^2$, and $b^2$.  Does anyone know a good way to compute these centralizers?  Will GAP do it for me or anything?  Thanks.
 A: EDIT: It's actually not hard to see that $a$ generates its own centralizer, and similarly for $b$ or $ab$; the GAP code below is more useful for computing centralizers of longer words.  To see that $C_G(a)$ has order $3$, one could first begin to understand the structure of $G'$: it is generated by $[a,b]$ and $[a^2,b]$ and we have $G'\cong \mathbb{Z}^2$. [This is not surprising: your group is a Euclidean triangle group, and so should be virtually $\mathbb{Z}^2$.] In this way, $a$ acts as the matrix $\begin{pmatrix} -1 & -1\\ 1 & 0\end{pmatrix}$, and thus fixes no nonzero vector of $\mathbb{Z}^2$. That is, $C_G(a)\cap G'=\{1\}$. So $C_G(a)$ injects into $G/G'$, an elementary abelian group of order $9$, and since $G$ is not abelian, certainly $b\notin C_G(a)$; thus $C_G(a)$ has order $3$.
Here's a way to do it in GAP (you will need the polycyclic package):
>ftl:=FromTheLeftCollector(4);
<<from the left collector with 4 generators>>
>SetRelativeOrder(ftl,1,3);
>SetRelativeOrder(ftl,2,3);
>SetConjugate(ftl,2,1,[2,1,4,-1]);
>SetConjugate(ftl,3,1,[4,-1]);
>SetConjugate(ftl,4,1,[3,1,4,-1]);
>SetConjugate(ftl,4,3,[4,1]);
>SetConjugate(ftl,3,2,[4,-1]);
>SetConjugate(ftl,4,2,[3,1,4,-1]);
>UpdatePolycyclicCollector(ftl);
>IsConfluent(ftl);
true
>g:=PcpGroupByCollector(ftl);
Pcp-group with orders [ 3, 3, 0, 0 ]
>c:=GeneratorsOfGroup(g);
[ g1, g2, g3, g4 ]
>a:=c[1];b:=c[2];u:=c[3];v:=c[4];
g1
g2
g3
g4

$a$ and $b$ are your generators; we also have $u=[a^2,b]$ and $v=[a,b]$:
>Comm(a^2,b);
g3
>Comm(a,b);
g4

Now we can compute centralizers; for example:
>w:=a*b*a;
g1^2*g2*g4^-1
>h:=Centralizer(g,w);
Pcp-group with orders [ 3, 0, 0 ]
>IsAbelian(h);
true
>AbelianInvariants(h);
[ 0, 0 ]

