Number of ring homomorphisms from $\mathbb Z_{12}$ to $\mathbb Z_{28}$. Question: 

Find the number of non trivial ring homomorphisms from $\mathbb Z_{12}$ to $\mathbb Z_{28}$. ($f$ is not necessarily unitary, i.e., $f(1)$ need not be $1$.) 

Suppose $f$ is a ring homomorphism from $\mathbb Z_{12}$ to $\mathbb Z_{28}$.
Consider $f$ as a additive group homomorphism.  Let $k= |\ker f|$ and 
$ t = |\operatorname{im}(f)|$. Then $k\mid 12$ and $t\mid 24$ and $kt=12$, by first isomorphism 
theorem of groups.
There are two possibilities $k=3$, $t=4$   and $k=6$, $t=2$.
For the first case $f$ should map $1$ to an element of the subgroup generated by $7$ as there is a unique subgroup of $\mathbb Z_{28}$ of order $4$ generated by $7$. For the second case $1$ has to map to $14$, for the same reasoning.
So there are at most two ring homomorphisms from $\mathbb Z_{12}$ to $\mathbb Z_{28}$.
Question is how to check the possible maps which are ring homomorphisms.
Thanks.
 A: Number of ring homomorphism from $\mathbb Z_m$ into $\mathbb Z_n$ is $2^{[w(n)-w(n/\gcd(m,n))]}$ , where $w(n)$ denotes the numbers of prime divisors of positive integer n.
From this formula we get number of ring homomorphism from $\mathbb Z_{12}$ to $\mathbb Z_{28}$ is $2$.
A: Even if not necessarily $f(1)=1$, we still need $f(1)\cdot f(1)=f(1\cdot 1)=f(1)$, hence $f(1)$ must be a solution of $x^2-x=0$ in $\mathbb Z_{28}$. The solutions for this are the residue classes of: $0, 1, 8, 21$.
Therefore, $f\colon \mathbb Z_{12}\to\mathbb Z_{28}$ is necessarily induced by $\mathbb Z\to\mathbb Z$, $x\mapsto cx$ with $c\in \{0,1,8,21\}$.
Also, we need $28|12c$, i.e. $c$ must be a multiple of $7$. This leaves only the cases $c=0$ and $c=21$.
A: A ring homomorphism $f:Z_{12}\to Z_{28}$ must map $1$ to $1$, because ring homomorphisms do that (if you are not assuming your ring homomorphisms to be unitary, you should always be explicit about it!) 
Now $\underbrace{1+1+\dots+1}_{\text{$12$ summands}}=0$ in $Z_{12}$, so applying $f$ we must have $$\underbrace{1+1+\dots+1}_{\text{$12$ summands}}=\underbrace{f(1)+f(1)+\dots+f(1)}_{\text{$12$ summands}}=0$$ in $Z_{28}$. As this is not true, there is no morphism!
A: Hint $\ $ Applying the hom $\rm\,f\,$ to $\rm\:12\cdot 1 = 0\:$ and $\:1^2\!= 1,\:$ denoting $\rm\:e = f(1),\:$ we infer that $\rm\: 12\,e = 0\:\Rightarrow\:28\:|\:12\,e\:\Rightarrow\: 7\:|\:e,\:$ hence $\rm\:mod\ 28\!:\ e \equiv 0,7,14,21;\:$ also $\rm\:e^2 \equiv e\:$ hence $\rm\:e\equiv\,\ldots$
To understand better the role played by idempotents $\rm\:e^2 = e\:$ look up the Peirce decomposition. 
