Ring homomorphisms from $\mathbb{Z}_n$ to $\mathbb{Z}_m$

I’m trying to find the ring homomorphisms from $\mathbb{Z}_n$ to $\mathbb{Z}_m$.

What I think is the answer is two cases:

1) If $m \gt n $ there is no ring homomorphism.

2) Otherwise, the homomorphism sends each element $x$ in $\mathbb{Z}_n$ to $(x \bmod m)$ in $\mathbb{Z}_m$.

Is this correct?

Part of the ring homomorphism definition is that 1 is sent to 1

Solutions Collecting From Web of "Ring homomorphisms from $\mathbb{Z}_n$ to $\mathbb{Z}_m$"

There exists a ring homomorphism from $\mathbb{Z}_n$ to $\mathbb{Z}_m$ if and only if $m$ divides $n$.

If $m$ divides $n$, let define: $$\Phi:\left\{\begin{array}{ccc}
\mathbb{Z}_n & \to & \mathbb{Z}_m\\
x\bmod n & \mapsto & x\bmod m
$\Phi$ is a well defined ring homomorphism.

Assume there exists $\Phi$ a ring homomorphism from $\mathbb{Z}_n$ to $\mathbb{Z}_m$, then one has : $$\Phi(0\bmod n)=\Phi(n\bmod n)=n\Phi(1\bmod n)=n\bmod m.$$
Since $\Phi(0\bmod n)=0\bmod m$, one has $n\bmod m=0$ and $m$ divides $n$.