How to prove that addition modulo 2 is associative I learned that |a⊕(a⊕b)⟩=|(a⊕a)⊕b⟩ as addition modulo 2 is associative. However, I am wondering why addition modulo 2 is associative?

*

*Try them all; there are only eight cases

a) $(0\oplus0)\oplus0=0\oplus0=0;0\oplus(0\oplus0)=0\oplus0=0$
b) $(0\oplus0)\oplus1=0\oplus1=1;0\oplus(0\oplus1)=0\oplus1=1$
c) $(0\oplus1)\oplus0=1\oplus0=1;0\oplus(1\oplus0)=0\oplus1=1$
d) $(0\oplus1)\oplus1=1\oplus1=0;0\oplus(1\oplus1)=0\oplus0=1$
e) $(1\oplus0)\oplus0=1\oplus0=1;1\oplus(0\oplus0)=1\oplus0=1$
f) $(1\oplus0)\oplus1=1\oplus1=0;1\oplus(0\oplus1)=1\oplus1=0$
g) $(1\oplus1)\oplus0=0\oplus0=0;1\oplus(1\oplus0)=1\oplus1=0$
h) $(1\oplus1)\oplus1=0\oplus1=1;1\oplus(1\oplus1)=1\oplus0=1$


*Reason it out. But handwave a little bit.

Let $(a \oplus b) \oplus c \equiv k \pmod 2$.  THen by definition $[(a+b)+c]-k$ is divisible by $2$ where $a,b,c,k$ are integers and $+,-$ are integer operations.  As $+$ is associative over $\mathbb Z$ we have that $[(a+b) + c] -k = [a+(b+c)]-k$ and $[a+(b+c)] -k$ is divisible by $2$.  So $a\oplus (b\oplus c)\equiv k \equiv a\oplus (b\oplus c)\pmod 2$.
In other words.  Addition modulo $2$ "inherits" associativity from addition over the integers.


*Reason it out with technical overkill

Let $a\oplus b = k$.  Then by definition that means $a+b - k$ is divisible by $2$ ($a,b,k$ are regular old integers and $+,-$ is addition and subtraction. $k$ is either $0$ or $1$).
Let $(a+b)-k = 2w$ where $w$ is some integer.  Then $k = (a+b)-2w$
Let $(a\oplus b)+c = k\oplus c = m$ ($m$ is either $0$ or $1$).  Then by definition $k+c -m$ is even. Replace $k$ with $a+b-2w$ and we get $[(a+b)-2w]+c-m = ((a+b)+c) -2w -m$ is even. Let $((a+b)+c)-2w - m = 2\omega$.  And that means $m = (a+b+c)-2(w+\omega)$. (Note, integer addition is just addition and it is commutative and associative.)
Now $m$ is either $0$ or $1$.  $2(w+\omega)$ is even.  So if $a+b+c$ is odd, then $m =1$.  If $a+b+c$ is even then $m = 0$.
Now let $b\oplus c = j$.  $a\oplus(b\oplus c)=a\oplus j= h$.  That means $(b+c)-j$ is an even number.  Let $(b+c)-j=2v$ so $j=(b+c)-2v$.  And it means $(a+j)-h=(a+(b+c)-2v)-h$ is even.  Let $((a+(b+c)-2v)-h = 2\alpha$ and that means $h = (a+b+c)-2(v-\alpha)$.
Again $h$ is either equal to $0$ or $1$ and if $a+b+c$ is odd then $h=1 = m$.  Or if $a+b+c$ is even then $h = 0 = m$.
Either way $ a\oplus(b\oplus c) =h = m = (a\oplus b)\oplus c$.
