This question already has an answer here:

I'm trying to prove that if $N_1\mod(a) = n_1$ and $N_2\mod(a) = n_2$ then $(N_1+N_2)\mod(a) = (n_1+n_2)\mod(a)$

By our assumption $N_1 = am_1 + n_1$ and $N_2 = am_2 + n_2$

So $N_1+N_2 = a(m_1+m_2) + n_1 + n_2$

So $(N_1+N_2)\mod(a) = (a(m_1+m_2) + n_1 + n_2)\mod(a)$

Now my justification was long and considered the case where $n_1+n_2 < a$ and $= a$ and $>$ then a however the solutions I am using to check simply said both $n_1$ and $n_2$ are between $0$ and $a-1$ and so the expression is true. It feels like their reasoning is missing a few steps because I'm not sure how they can go from $n_1$ and $n_2$ between $0$ and $a-1$ to the identity is true. Am I missing something?


marked as duplicate by Bill Dubuque modular-arithmetic Mar 4 at 18:50

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Please format your questions using MathJax. This page should give you a start at learning how to typeset mathematics here so that your posts say what you want them to, and also look good. $\endgroup$ – Brian Mar 4 at 18:48
  • $\begingroup$ When you say $N\pmod a = n$ does that require that $0\le n < a$. i.e. that $n$ is the remainder? Most text don't require that. For most text $N \equiv n\pmod a$ just means $N$ and $n$ have the same remainder. It doesn't require one of them is the remainder. e.g. $6\equiv 10 \pmod 4$ because $6$ and $10$ both have the same remainder. $\endgroup$ – fleablood Mar 4 at 18:56
  • $\begingroup$ It is in the context of remainders so it requires 0 <= n < a $\endgroup$ – EBL Mar 4 at 18:59
  • $\begingroup$ If $N\pmod a = n$ DOES require than $0 \le n < a$ then yes you have to consider if $n_1 + n_2 \ge a$. But in that case $n_1 + n_2 = a + m_3$ for some $0\le m < a$ so $N_1 +N_2 = a(m_1+m_2 +1) + m_3$ and you are done. But I'd say none of that matters. $N_1 + N_2 = a(m_1 + m_2) + (n_1 + n_2)$ is enough. For most texts $0 \le n_1 + n_2 < a$ is not a requirement. $\endgroup$ – fleablood Mar 4 at 19:00
  • $\begingroup$ "It is in the context of remainders so it requires 0<=n < a" In that case you are correct. You have to consider that maybe $a\le n_1 + n_2 < 2a$ but that's really very easy. $\endgroup$ – fleablood Mar 4 at 19:02