Suppose that $n$ divides $m$ and that $a$ is an idempotent of $Z_n$. Show that the mapping $x \rightarrow ax$ is a ring homomorphism
Attempt: Let $\Phi: Z_m \rightarrow Z_n$ be a ring homomorphism such that $\Phi(x) = x \mod n$. And Let $m = n \lambda$.
Then, $\Phi[ (x+y)\mod m ] = a[(x+y) \mod m] \mod n $.
$\implies \Phi[ (x+y)\mod m ] = a[(x+y) \mod n \lambda] \mod n $
$= a(x+y) \mod n [ (ax) \mod n + (ay) \mod n] \mod n$
$\Phi(xy \mod m) = a [(xy) \mod n \lambda] \mod n = a^2 [(xy) \mod n \lambda] \mod n$
$= a^2 [(xy) ] \mod n = [(ax) \mod n (ay) \mod n] \mod n$
Hence, a ring homomorphism
Is my attempt correct?
Thank you for your help.
In your attempt, you are bringing in too many "mod" and thereby creating issues about well-definedness and order in which the mods are applied, you need to be careful about these.
Here is what I would recommend: Instead of using $x \in \mathbb{Z}_n$ consider $[x]_n \in \mathbb{Z}_n$. This way you can have $x \in \mathbb{Z}$ as a representative of the class $[x]_n$.
Now consider $\phi:\mathbb{Z}_m \longrightarrow \mathbb{Z}_n$ be given by $\phi([x]_m)=[ax]_n$, where $[a]_n$ is an idempotent of $\mathbb{Z}_n$. The first issue you should now take care of is that of well-definedness.
$\phi$ is Well-defined: Let $[x]_m=[y]_m$, then $x \equiv y \pmod{m}$. Since $n$ divides $m$ therefore by transitivity of divisibility $x \equiv y \pmod{n}$, thereby we get $\color{blue}{[x]_n}=\color{blue}{[y]_n}$.
Now observe that $$\phi([x]_m)=[ax]_n=[a]_n\color{red}{[x]_n}=[a]_n\color{red}{[y]_n}=[ay]_n=\phi([y]_m).$$ Thus $\phi$ is well-defined.
$\phi$ is a homomorphism: \begin{align*} \phi([x+y]_m) & = [a(x+y)]_n\\ & = [a]_n[x+y]_n\\ & = [a]_n\left([x]_n+[y]_n\right)\\ & = [a]_n[x]_n+[a]_n[y]_n\\ & = [ax]_n+[ay]_n\\ & = \phi([x]_m)+\phi([y]_m) \end{align*}
Now we go for the multiplication operation:
\begin{align*} \phi([xy]_m) & = [a(xy)]_n\\ & = [a]_n[xy]_n\\ & = [a]^2_n[xy]_n & \text{since $[a]^2_n=[a]_n$}\\ & = [a]_n[x]_n \cdot [a]_n[y]_n\\ & = [ax]_n \cdot [ay]_n\\ & = \phi([x]_m) \cdot \phi([y]_m) \end{align*}