# Simple modular arithmetic expression proof [duplicate]

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 StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 4 at 18:50

• 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. – fleablood Mar 4 at 18:56
• 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. – fleablood Mar 4 at 19:00
• "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. – fleablood Mar 4 at 19:02