If $M$ and $N$ are $2 \times 2$ invertible, non-unimodular matrices with integer entries, when is the product $MNM^{-1}$ an integer matrix?
I tried multiplying out components (as shown below), but it becomes very messy, so I am wondering if there is a better way to do this kind of thing.
If $M = \left[\begin{matrix}m_{a} & m_{b}\\m_{c} & m_{d}\end{matrix}\right]$ and $N = \left[\begin{matrix}n_{a} & n_{b}\\n_{c} & n_{d}\end{matrix}\right]$, then
$MNM^{-1} = \\ \left[\begin{matrix}\dfrac{-m_{c} \left(m_{a} n_{b} + m_{b} n_{d}\right) + m_{d} \left(m_{a} n_{a} + m_{b} n_{c}\right)}{m_{a} m_{d} - m_{b} m_{c}} & \dfrac{m_{a} \left(m_{a} n_{b} + m_{b} n_{d}\right) - m_{b} \left(m_{a} n_{a} + m_{b} n_{c}\right)}{m_{a} m_{d} - m_{b} m_{c}}\\\dfrac{- m_{c} \left(m_{c} n_{b} + m_{d} n_{d}\right) + m_{d} \left(m_{c} n_{a} + m_{d} n_{c}\right)}{m_{a} m_{d} - m_{b} m_{c}} & \dfrac{m_{a} \left(m_{c} n_{b} + m_{d} n_{d}\right) - m_{b} \left(m_{c} n_{a} + m_{d} n_{c}\right)}{m_{a} m_{d} - m_{b} m_{c}}\end{matrix}\right]$
From this we can see one sufficient condition is that $|M|$ divides $n_a, n_b, n_c, n_d$, from which we can find an example like the following:
$M = \left[\begin{matrix} 2 & 2 \\ 3 & 4\end{matrix}\right]$ and $N = \left[\begin{matrix}2 & 6\\6&2\end{matrix}\right]$, for which $MNM^{-1} = \left[\begin{matrix}8 & 0\\21&-4\end{matrix}\right]$.
(And we can also see that $M(N/2)M^{-1}$ is not an integer matrix, so it's not always the case that $MNM^{-1}$ is an integer matrix whenever $M$ and $N$ are.)