Find the number of homomorphisms between $\mathbb{Z}_m$ and $\mathbb{Z}_n$ Although there are many attempts to the problem but I wasn't really able to understand those so I took some idea from examples and attempted it. Can someone just go through it please.
My attempt: Let $\sigma:\mathbb{Z}_{m}\to \mathbb{Z}_{n}$. The kernel $\ker(\sigma)$ is a normal subgroup of $\mathbb{Z}_{m}$. So $\ker(\sigma)=\langle\frac{m}{d}\rangle$, where $d|m$. Now $\operatorname{im}(\sigma$) is a subgroup of $\mathbb{Z}_n$. So, now the order of the image should be $d$ so $d|n$. Now the number of homomorphisms when the kernel is of order $d$ will be $\sum_{d|m,d|n}\varphi(d)$. From here we can conclude that the no of homomorphisms should be $\gcd(m,n)$. Is this OK? Where am I making mistakes?
Yes, there are $\gcd(m,n)$ such homomorphisms.
Another way to see it is that we need $f([1])=[a]$ where $0\le a&lt;n$ and that
$m[a]=[ma]=0$ in $\Bbb Z_n$, that is, $n\mid ma$ or $ma\equiv 0\pmod n$.
The solution to this congruence is $a\equiv 0\pmod{n/g}$ where
$g=\gcd(m,n)$, so that $a=jn/g$
for $0\le j&lt;g$, so there are $g$ solutions.
A homomorphism $\sigma:\mathbb Z_m\to\mathbb Z_n$ is uniquely determined by $\sigma(1)=a\in\mathbb Z_n$. This has to be such that $ma=\sigma(m)=0$, so that $a\gcd(m,n)=0$. Thus, there are $\gcd(m,n)$ such homomorphisms.