$\Bbb Z_m \times \Bbb Z_n$ isomorphic to $\Bbb Z_{\operatorname{lcm}(m,n)}\times \Bbb Z_{\gcd(m,n)}$
I want to show the title.
Let $\Bbb Z_{\operatorname{lcm}(m,n)}=\langle x\rangle$, $\Bbb Z_{\gcd(m,n)}=\langle y\rangle$, $\Bbb Z_m=\langle z\rangle$, $\Bbb Z_n=\langle w\rangle$ and $d=\gcd(m,n)$.
I use the function $f\colon \Bbb Z_{\operatorname{lcm}(m,n)}\times \Bbb Z_{\gcd(m,n)}\to \Bbb Z_m\times \Bbb Z_n$ such that
$f(x,1)=(z,w)$ and $f(1,y)=(z^{m/d}, w^{n/d})$
This is homomorphism, but I can't show it is injective or surjective to show that it is bijective.
Help me!
Fix $u,v\in\Bbb Z$ with $un+vm=d$ (Bezout). The map $$\Bbb Z_{\operatorname{lcm}(n,m)}\times\Bbb Z_{\gcd(n,m)} \to\Bbb Z_m\times\Bbb Z_n$$ $$ (a+\operatorname{lcm}(n,m)\Bbb Z,b+\gcd(n,m)\Bbb Z)\mapsto(ua+\tfrac mdb+m\Bbb Z,va-\tfrac ndb+n\Bbb Z)$$ is well-defined(!) and clearly a group homomorphism. For the element on the left to be in the kernel, $ua+\tfrac mdb$ must be a multiple of $m$ and $va-\tfrac ndb$ a multiple of $n$. But then $$\frac nd\left(ua+\frac mdb\right)+\frac md\left(va-\frac ndb\right) =\frac{nu+vm}{d}a=a$$ is a multiple of $\frac{nm}d=\operatorname{lcm}(n,m)$, i.e., we may as well assume that $a=0$. Then $\frac mdb$ must be a multiple of $m$, i.e., $b$ a multiple of $d$, i.e. $b\equiv 0$. We conclude that the kernel is trivial and our homomorphism injective. As both groups are finite of same order, the homomoprhism must be an isomorphism.