I want to calculate the centralizer of a subgroup of $\mathrm{GL}(n, \mathbb{Z})$ when its generators $G\_i$ (whose number is finite) are known.


For any matrix $S$ that commutes with the group: $G\_iS$ = $SG\_i$, and I get a system of linear equations. Any commuting element then can be written as $S = \sum\_k x\_k S\_k, x\_k \in \mathbb{Z} $, where $S\_k$ are matrices with integer entries, and the commuting matrices form a ring with a finite basis.


But how do I calculate from these equations the group of invertible matrices? Particularly since the centralizer can have infinite elements.


Some special cases for $n=4$ are addressed here:


<https://www.ams.org/mcom/1973-27-121/S0025-5718-1973-0333025-7/S0025-5718-1973-0333025-7.pdf>


but is there a general method of solving the problem?



Calculating the centralizer of a subgroup of $\mathrm{GL}(n, \mathbb{Z})$
There is an algorithm to do this (and also to test two matrices in ${\rm GL}(n,{\mathbb Z})$ for conjugacy) described in [the paper](https://londmathsoc.onlinelibrary.wiley.com/doi/abs/10.1112/jlms.12246):


The conjugacy problem in ${\rm GL}(n,{\mathbb Z})$
Bettina Eick, Tommy Hofmann, E. A. O'Brien, Journal of the London Mathematical Society,
Volume 100, Issue 3,
December 2019
Pages 731-756.


It is implemented in Magma as the function $\mathtt {GLCentraliser}$.


*Later edit*: In view of the comments, I should have mentioned that the algorithm returns a finite generating set of the centralizer.


It is also worth pointing out that, given a finitely generated subgroup $G$ of ${\rm GL}(n,{\mathbb Z})$, there is a surprisingly fast algorithm to decide whether $G$ is finite and, if so, to find an isomorphic image of $G$ in ${\rm GL}(n,{\mathbb F}\_q)$ for some finite field $q$, which facilitates further investigation of the structure of $G$.


If $G$ is infinite, then you can decide which of the two Tits' alternatives it satisfies. There is not much more you can do if it has a free subgroup (although you can often find a free subgroup). If it is virtually solvable, then you can do further structural computations.


