A proof about congruences got me wondering about the linearity property:

for

Here's how it went:

If (mod m) and (mod m), then (mod m)

By assumption and .

By the linearity property, . Re-arranging we get

Can you just rearrange that easily??? Sure the total sum (a+c)-(b+d) stays the same, and it also does when you convert it back to mods.

(mod m)

But what if I went and did

and

Then so.... (mod m) ???

Which is not true.

I've rearranged it so that there are two terms, x = 12 and y = 8+5-3. That's what happened in the proof. But my version doesn't work.

What the associativity rules and restrictions on this arithmetic?