TITLE: Isomorphism of $\mathbb{Z}\ltimes_A \mathbb{Z}^m$ and $\mathbb{Z}\ltimes_B \mathbb{Z}^m$
QUESTION [20 upvotes]: here it's a question that I've posted in MSE but unfortunately got no answers:
Let $A$ and $B$ be matrices of finite order with integer coefficients.
Let $n\in\mathbb{N}$ and let $G_A=\mathbb{Z}\ltimes_A \mathbb{Z}^n$ be the semidirect product, where the action is $\varphi(n)\cdot (m_1,\ldots,m_n)=A^n (m_1,\ldots,m_n)$, and similarly with $B$.
It is easy to construct an isomorphism between $G_A$ and $G_B$ if $A$ is conjugate in $\mathrm{GL}(n,\mathbb{Z})$ to $B$ or $B^{-1}$. 
But, this is also a necessary condition? I mean, does $G_A\cong G_B$ implies $A\cong B$ or $A\cong B^{-1}$ in $\mathrm{GL}(n,\mathbb{Z})$ or is there a counterexample?
I've seen at this MSE question that it is true if $A$ and $B$ are hyperbolic, i.e none of their eigenvalues have module 1, but it isn't the case.
Thank you very much!

REPLY [3 votes]: This is a complement to Johannes Hahn's answer.
Corrigendum. In the previous version of this answer, I have made an erroneous claim, allowing $\omega$, the order of $A$ and $B$, to be any positive number.
The claim below is valid only if $$\omega \in \{1, 2, 3, 4, 6 \},$$ which is sufficient to address OP's subsequent examples.
Following Johannes Hahn's approach, we can prove the following:

Claim. Assume that $G_A$ and $G_B$ are isomorphic. Then
$\begin{pmatrix} 1 & 0 \\  0 & A \end{pmatrix}$ is a conjugate of $\begin{pmatrix} 1 & 0 \\  0 & B \end{pmatrix}$ or $\begin{pmatrix} 1 & 0 \\  0 & B^{-1} \end{pmatrix}$  in $\text{GL}_{n + 1}(\mathbb{Z})$. In particular $A$ is a conjugate of $B$ or $B^{-1}$ in
$\text{GL}_{n}(\mathbb{Q})$.


Proof. Let $K_A$ be the centraliser of the derived subgroup
$G_A' = [G_A, G_A]$ of $G_A$. It is clearly a characteristic subgroup of $G_A$. Let $C_A$ be the infinite cyclic subgroup of $G_A$ generated by $a \Doteq (1, (0, \dots, 0))$. The conjugation by $a$, or equivalently, the multiplication by $\begin{pmatrix} 1 & 0 \\  0 & A \end{pmatrix}$ induces a structure of $\mathbb{Z}[C_A]$-module on $K_A$. This structure is almost invariant under isomorphism in the following sense: if $\phi:G_A \rightarrow G_B$ is a group isomorphism, and if we identify $C_A$ with $C_B$ via $a \mapsto b = (1, (0, \dots, 0)) \in G_B$ then $K_A$ is isomorphic to $K_B$ or to $K_{B^{-1}}$ as a $\mathbb{Z}[C]$-module with $C = C_A \simeq C_B$, depending on whether $\phi(a) = bk$ or $b^{-1}k$ for some $k \in K_B$. This is so because conjugation by $bz$ induces a group action on $K_B$ which is independent of $k$. Now the claimed result immediately follows.

Thus the pair of modules $\{K_A, K_{A^{-1}}\}$ is a group isomorphism invariant of $G_A$  It turns out to be useful for this example and this one.

Addendum. Here are some details on the module $K_A$.
An element of $\mathbb{Z}[C_A]$ is a Laurent polynomial with coefficients in $\mathbb{Z}$ of the form $P(a) = \sum_{i = 0}^d c_i a^{e_i}$ where $e_i \in \mathbb{Z}$ for every $i$. The structure of $\mathbb{Z}[C_A]$-module of $K_A$ is defined in the following way:
$$P(a) \cdot k = (a^{e_0}k^{c_0}a^{-e_0}) \cdots (a^{e_d}k^{c_d}a^{-e_d})$$ for $k \in K_A$. Assume now that there is an isomorphism $\phi: G_A \rightarrow G_B$. As $\phi$ is surjective and $\phi(K_A) = K_B$, there is $f \in \mathbb{Z}$ coprime with $\omega$ and $z \in \mathbb{Z}^n \triangleleft G_B$, such that $\phi(a) = b^f z$. Since $\omega \in \{1, 2, 3, 4, 6\}$, we infer that $\phi(a) = b^{\epsilon}k'$ for some $\epsilon \in \{\pm 1\}$ and some $k' \in K_B$. Thus $\phi(a^e) = b^{\epsilon e}k''$ where $k'' \in K_B $ depends on $e$, $k$ and $\epsilon$. The image of $P(a) \cdot k$ by $\phi$, after substituting $\phi(a^{e_i})$ with $b^{\epsilon e_i}k_i''$, and after simplification ($K_B$ is Abelian), results in $$(b^{\epsilon e_0}\phi(k)^{c_0}b^{- \epsilon e_0}) \cdots (b^{\epsilon e_d}\phi(k)^{c_d}b^{- \epsilon e_d}) = P(b^{\epsilon}) \cdot \phi(k).$$
Therefore $\phi$ induces an isomorphism of $\mathbb{Z}[C]$-module if $\epsilon = 1$, where $C = C_A \simeq C_B$. Let $e_0 \Doteq (\omega, (0, \dots, 0))$. Let $(e_1, \dots, e_n)$ denote the canonical basis of $\mathbb{Z}^n$ and let $C \in \text{GL}_{n + 1}(\mathbb{Z})$ be the matrix of $\phi$ with respect to $(e_0, e_1, \dots, e_n)$. If $\epsilon = 1$, then the following identity $\phi(a \cdot k) = b \cdot \phi(k)$ holds true and translates into
$$C \begin{pmatrix} 1 & 0 \\  0 & A \end{pmatrix} 
 k = \begin{pmatrix} 1 & 0 \\  0 & B \end{pmatrix}C k$$ simply because of the way we defined the action of $a$ and $b$ on $K_A$ and $K_B$ respectively. The claimed result on the matrix conjugation follows.