I am porting this question across from StackExchange, since it has received no answers and perhaps is sufficiently deep to fit here. 


I am considering the set of upper triangular matrices
$$D\_N=\left\{\begin{pmatrix}a&b\\0&d\end{pmatrix}:a,b,d\in\mathbb{Z}, ad=N, \gcd(a,b,d)=1, 0\leq b<d\right\}.$$
Standard facts tell us that this is a set of representatives for $M\_N$ under the action of $\operatorname{SL}\_2(\mathbb{Z})$ from the left. ($M\_N$ being the set of primitive integer matrices of determinant $N$.)


There is also an action of $\operatorname{SL}\_2(\mathbb{Z})$ on $D\_N$ from the right. 


Namely, given $g\in D\_N$ and $\gamma\in\operatorname{SL}\_2(\mathbb{Z})$, the matrix $g\gamma$ is still a primitive integer matrix of determinant $N$, and hence takes the form $\gamma' h$ for some $\gamma'\in\operatorname{SL}\_2(\mathbb{Z})$ and unique $h\in D\_N$. So let $\gamma$ act on $D\_N$ by sending each $g$ to the corresponding $h$.


The question is: is this action transitive? I thought this was a standard fact, and one seems to need it to prove that the $N$th modular polynomial $\Phi\_N$ is irreducible (among other things).


However, I can't seem to find a reference for it, and after struggling for a time to prove it, I am increasingly pessimistic - it seems to rely on some properties of the "3-variable Euclidean algorithm" that I'm not certain I believe in.


(It would be enough to know, for instance, that one can write
$$a\lambda m + bmn + dn\mu=1,$$
for some integers $\lambda, \mu,m,n$, but this doesn't seem particularly likely to hold in general - the Euclidean algorithm gets us close to this but not quite there.)



Action of SL(2,Z) on upper triangular primitive integer matrices of determinant N, from the right. Is it transitive?
Yes, the action is transitive. It is easier not to choose a set of coset representatives for the left action, so the question is whether $SL\_2(\mathbb{Z}) \times SL\_2(\mathbb{Z})$ acts transitively on $M\_N$ (under left and right action). We will want the following notations: Let $\tilde{M}\_N$ be **all** integer matrices of determinant $N$; let $GL\_2(\mathbb{Z})$ be the integer matrices with determinant $\pm 1$. 


The double coset representatives for $GL\_2(\mathbb{Z}) \times GL\_2(\mathbb{Z})$ acting on $\tilde{M}\_N$ are given by the matrices in [Smith normal form](https://en.wikipedia.org/wiki/Smith_normal_form): $\left( \begin{smallmatrix} a&0 \\ 0&b \end{smallmatrix} \right)$ with $a|b$, $ab=N$ and $a$, $b>0$. Such a matrix is only primitive if $a=1$, so the $GL\_2(\mathbb{Z}) \times GL\_2(\mathbb{Z})$ orbits on $M\_N$ are represented by $\left( \begin{smallmatrix} N&0 \\ 0&1 \end{smallmatrix} \right)$. 


We now must pass from $GL\_2(\mathbb{Z})$ to $SL\_2(\mathbb{Z})$. We have shown that any matrix in $M\_N$ is of the form $\gamma\_1 \left( \begin{smallmatrix} N&0 \\ 0&1 \end{smallmatrix} \right) \gamma\_2$ with $\gamma\_1$, $\gamma\_2 \in GL\_2(\mathbb{Z})$. Moreover, taking determinants, we must have $\det(\gamma\_1) = \det(\gamma\_2) = \pm 1$. If the sign is $+$, we are done. If it is $-$, replace $\gamma\_1$ by $\gamma\_1 \left( \begin{smallmatrix} 1&0 \\ 0&-1 \end{smallmatrix}\right)$ and $\gamma\_2$ by 
$\left( \begin{smallmatrix} 1&0 \\ 0&-1 \end{smallmatrix}\right) \gamma\_2$.


