2

For all $n \in \mathbb{N}$, $n > 1$ and $x,y \in \mathbb{Z}$ prove that

\begin{equation} (x+y) \text{ mod } n = ((x \text{ mod } n)+(y \text{ mod } n))\text{ mod } n. \end{equation}

Would this be a proof if I say:

Let $x = x' \text{ mod } n$ and let $y=y' \text{ mod } n$. Then

\begin{equation} x+y = x'+y' \text{ mod } n. \end{equation}

Now, if we look at the current thing we want prove, this will follow:

\begin{equation} x+y \text { mod } n = (x \text{ mod } n + y \text{ mod } n) \text{ mod } n. \end{equation}


I'm not sure if this is allowed or will count as a "proof" at all. Maybe you can show me some other ways of doing this, more precise ones?

Bill Dubuque
  • 282,220
berndgr
  • 455

2 Answers2

4

Recall: same remainder $\!\iff\!$ congruent, i.e. with $\,\bar x = x\bmod n =$ remainder
we have $\ {\bar{\color{#0a0}a}\ =\ \bar{\color{#c00} b}^{\vphantom{i}}}\color{c00}\,\ \ \iff \ \ \,\color{#0a0}a\:\ \ \equiv\ \ \ \color{#c00}b \ \ \pmod{\!n},\:$
so $\ \overline{\color{#0a0}{x\!+\!y}}^{\vphantom{|^|}}\, =\, \overline{\color{#c00}{\bar x \!+\! \bar y}} \color{#c00}\iff \color{#0a0}{x\!+\!y}\:\!\equiv\:\!\color{#c00}{\bar x \!+\! \bar y}_{\vphantom{|_|}},\,$ which is true by Congruence Sum Rule.
The same proof also works for products by using the $ $ Congruence Product Rule, $ $ so

$$\bbox[1px,border:1px solid #c00]{\bbox[6px,border:1px solid #c00]{\begin{align} (x+y)\bmod n &\,=\, (x\bmod n + y\bmod n)\bmod n\\[.2em] (x\,*\,y)\bmod n &\,=\:\! (x\bmod n \,*\, y\bmod n)\bmod n\\[.4em] {\rm i.e.}\ \ \ \ \ \ \ \ \overline{x+y}\ &=\ \overline{\bar x+\bar y} \\ \overline{x\ *\ y}\ &=\ \overline{\bar x\ *\ \bar y}\\[.4em] {\rm i.e.}\ \ \ \ h(x+y) &\,=\, h(x)+_{\small n}h(y)\\[.2em] \ \ h(x\,*\,y) &\,=\, h(x)\,*_{\small n}h(y)\\ \end{align}}}\qquad\qquad$$

i.e. $\,h(x) := x\bmod n\,$ is a ring homomorphism from $\,\Bbb Z\,$ to $\,\Bbb Z_n\,$ which, being surjective (onto), enables transporting from $\,\Bbb Z\,$ to $\,\Bbb Z_n\,$ all the ring laws, e.g. associative, commutative, distributive.

Key Idea $ $ Generally, by proceeding as above, using said equivalence and congruence laws, erasing all $\!\bmod\!$ operations yields an equivalent congruence in any polynomial expression (i.e. where $\!\bmod\!$ appears in arguments of sums and products, but not in exponents). For example let's do that for a power analog of the above: $$\begin{align}(\color{#c00}{g^b\color{#bbb}{\bmod n})^a\color{#bbb}{\bmod n}} \,&=\, \color{#0a0}{(g^a \color{#bbb}{\bmod n})^b\color{#bbb}{\bmod n}}\\[.2em] \iff \color{#c00}{(g^b)^a} &\equiv\, \color{#0a0}{(g^a)^b}\!\!\pmod{\!n} \end{align}\qquad\qquad$$

Since congruence arithmetic inherits all common (ring) arithmetic laws (commutative, associative, distributive), as above, it is much easier to use our well-honed arithmetical intuition to first prove these properties in congruence equation form, then at the last moment - if need be - compute their normal form reps by applying a $\!\bmod\!$ operation.

See here for much further discussion of $\!\bmod\!$ as an operator vs. (congruence) relation.

See here for how to interpret the above as transporting the ring operations on cosets in the quotient ring $\,\Bbb Z/n\,$ to corresponding operations on their normal-form (remainder) reps in $\,\Bbb Z_n$.

Bill Dubuque
  • 282,220
  • alright i should really read a book or something before trying a task because i have troubles understanding your solution and the task too. but thx for it and for the link as well! – berndgr Nov 02 '16 at 20:22
  • @berndgr The only thing you need to know from the link is the proof of the Sum Rule. By definition $\ a\equiv b\pmod n\iff n\mid a-b.\ $ Let me know if you need help learning that. Once you master congruences problems like this will become straightforward. – Bill Dubuque Nov 02 '16 at 20:24
1

I will assume that $x\pmod n$ stands for element of $\{0,1\ldots,n-1\}$ which I will denote with $x'$ such that $x = kn + x'$. But, it doesn't actually matter at all.

First, let me clarify definitions: $x\equiv x'\pmod n$ if and only if $n\mid x - x'$. Note that since we have Euclidean division (division with remainder) in $\Bbb Z$, for every $x\in\Bbb Z$, there is a unique number $x'\in\{0,\ldots,n-1\}$ such that $x = kn + x'$ for some $k\in\Bbb Z$ (which you denote by $x\pmod n$). But, $x-x' = kn$ which implies that $x\equiv x'\pmod n$. Conversely, if $x\equiv x'\pmod n$ and $x'\in\{0,1,\ldots,n-1\}$, then $x' = x\pmod n$. So, to prove your statement, I will use this more general notion of congruence.

I claim that whenever $x\equiv x'\pmod n$ and $y\equiv y'\pmod n$, then $x+y\equiv x' + y'\pmod n$ (i.e., addition is well defined in modular arithmetic). This will give your result as a special case.

So, $x-x' = kn$, $y - y' = ln$, with $k,l\in\Bbb Z$. Add this two to get $(x+y)-(x'+y') = (k+l)n$ which implies that $x + y\equiv x'+y'\pmod n$.

Ennar
  • 24,364
  • thank you i will translate to my language and try to understand :) – berndgr Nov 02 '16 at 20:30
  • @berndgr, you can always ask for clarification of particular points I make. All we do is proclaim numbers with the same remainder equal. But we need to check that we can still do addition, i.e., if we switch any number with another with same remainder, it won't change result of the addition. Loosely speaking, remainder of a sum is a sum of remainders. – Ennar Nov 02 '16 at 20:35