I am taking a class in group theory (we began with basic number theory). I am trying to show that there is a homomorphism from $\mathbb{Z}$ to $\mathbb{Z}_n$. By this, I mean from the integers to the integers mod n. I know this is a standard proof that has already been asked, but I do not understand them so I am trying to figure it out myself.
To show that a mapping $f$ is homomorphic, you need to show that $f(xy)=f(x)f(y)$, but for this problem it's $f(x+y)=f(x)+f(y)$. With the division algorithm I can write $(x+y)=qn+r$ where $0\le r< n$ to get $f(x+y)=r$. For $x$ and $y$,we get $x=q_1n+r_1$, $y=q_2n+r_2$, so $f(x)=r_1$ and $f(y)=r_2$. This is where I am stuck, I do not understand how to show that $r=r_1+r_2$. Intuitively, I think that I am missing a basic modular arithmetic lemma, but I don't know what it is. (The proofs that I saw do not explicitly say what said lemma is.)