# Binary modulo operation [duplicate]

Empirically, I can know that (a+b+c) mod 2 = (a-b-c) mod 2.

e.g.,)

1+2+3 = 6, 6 mod 2 = 0
1-2-3 = -4, -4 mod 2 = 0

1+2+4 = 7, 7 mod 2 = 1
1-2-4 = -5, -5 mod 2 = 1

It seems that it is only possible when we use binary modulo (mod 2).

Is there any formal proof for this?

Because $$a-b-c=a+b+c-2(b+c)\equiv(a+b+c)\operatorname{mod}2.$$
Sure! Simply add $b+c$ to both sides and note that $2x=0$ mod $2$ for all numbers $x$. So you get $a=a$ mod $2$ implies that $a+2(b+c)= a$ mod $2$. Now subtract $b+c$ on both sides to obtain $a+b+c=a-b-c$ mod $2$. Note that it really didn't matter that we had three numbers instead of $2$ in other words $a+b= a-b$ mod $2$. Another way to see it is the simple rule that addition and subtraction happen to coincide module $2$ ($+=-$ mod $2$). This last rule is often applied in for instance algebraic topology courses when people do not want to care about signs.
For higher numbers $n$ there are of course the very similar identities $a+(n-1)b=a-b$ mod $n$. Altough you won't in general have $a+b=a-b$ mod $n$ if $n>2$.