0

Let $a,b \in \mathbb {Z} $ and let $m$ be an integer greater than $2$. I found a counterexample to the equation

$$(a+b)\mathrm {mod} m = a\mathrm {mod} m + b \mathrm {mod} m $$

where $m>2$. But that was only after I thought I had proven that the equation does hold, so I was wondering if someone could point out to me where the flaw is in the following.

If we divide $a $ and $b $ by $m $, then we have by the division algorithm

$$a=mc+x $$ $$b=md+y $$

Adding the equations together renders

$$a+b=me+(x+y) $$

And since $a\mathrm {mod} m + b \mathrm {mod} m= x+y $, then from the third equation, it seemes that the proposition holds.

J. Dunivin
  • 3,211

2 Answers2

2

$a\mod m+b\mod m=x+y$
This part is not always true.

Suppose $x=m-1$ and $y = m-1$

$x+y = 2m-2$

But
$a\mod m+b\mod m$
would actaully be $m-2$.

1

Actually, the formula should be $$(a+b)\bmod m\equiv (a\bmod m+b\bmod m)\bmod m.$$ That's why computing in the ring $\mathbf Z/m\mathbf Z$ is simpler than computing with congruence classes in $\mathbf Z$.

Bernard
  • 179,256