We need to find all ring homomorphisms from $\mathbb Z_{20} \to \mathbb Z_{30} $ ; I read its solution somewhere which states that : $R : \mathbb Z_{20} \to \mathbb Z_{30}$ defined by $R(x) = ax$ , $a$ belongs to $\mathbb Z_{30}$ is a ring homomorphism if :
$1) \ a^2 = a$ and ,
$2) |a| \ \Big| \ 20 , \ \ \ |a| \ \Big| \ 30$
$1)$ is acceptable , but i couldn't understand $2)$.. why order of $a$ should divide both $20$ and $30$ ?