Ring homomorphism $\pi : \mathbb{Z}_b \to \mathbb{Z}_a$ if $a | b$ 
Is the map
$$\pi : \mathbb{Z}/b\mathbb{Z} \to \mathbb{Z}/a\mathbb{Z},$$
  where $\pi([k]_b) = [k]_a$ and $a|b$, a ring homomorphism?

I ask because in a set of notes I read, it was given that the map
$$\pi : \mathbb{Z}/p^n\mathbb{Z} \to \mathbb{Z}/p\mathbb{Z}$$
is a ring homomorphism since $p|p^n$, given by $\pi([a]_{p^n}) = [a]_p$.
I'm somewhat confused as to why this is the case. Can we simply map the elements of $\mathbb{Z}/p^n\mathbb{Z}$ to their corresponding residue classes in $\mathbb{Z}/p\mathbb{Z}$? What goes wrong if $a \nmid b$? It seems as if $[1]_b$ doesn't map to $[1]_a$ if we lack this condition but I'm not sure..
 A: Use the third isomorphism theorem, since $a|b$ we have $(a)\supseteq (b)$ hence

$$\Bbb Z/(a)\cong\Bbb Z/(b)\bigg/(a)/(b)$$

So the reduction map is a well-defined ring map.
If there is no division then there is no inclusion of ideals, so there is no map down since the fourth isomorphism theorem tells you that the only ideals of $\Bbb Z/(n)$ are the $(m)/(n)$ with $m|n$ since this is the only case where $(m)\supseteq (n)$.
A: The function $\pi$ is well-defined if any only if $a\mid b$.
If $a\mid b$ and $[j]_b=[k]_b$ then $b\mid j-k$ and hence $a\mid j-k$, so $[j]_a=[k]_a$. So $\pi$ is a well-defined map.
On the other hand, if $a\not\mid b$ then $[0]_b=[b]_b$ but $[0]_a\neq [b]_a$, so $\pi$ is not a well-defined map.
A: Let R be a ring and let $I,J \subseteq R$ be ideals in $R$
For a map $R/I \to R/J$ which sends $r + I \to r + J$ to be well-defined we need that whenever $r_1 + \ I = r_2 + I$, then $r_1 + J = r_2 + J$, i.e that the value is independent of the choice of representative for the element you are evaluating. This is equivalent to saying that whenever $r_2 - r_1 \in I$, then $r_2 - r_1 \in J$, which in turn is equivalent to $I \subseteq J$. 
In your example $R = \mathbb{Z}$ and $I = p^n\mathbb{Z} \subseteq p\mathbb{Z} = J$.
Also, any possible map $\mathbb{Z}/p^n\mathbb{Z} \to \mathbb{Z}/p\mathbb{Z}$ which sends the identity to the identity must be given as above.
