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?
 A: Let $(\mathbb{Z}_2,+)$ be a group, where $\mathbb{Z}_2=\{0,1\}$. As mentioned in the comments, since addition over the integers is associative, addition over the integers $\pmod{2}$. Let's see what happens when we add elements of $\mathbb{Z}_2$ together.
Let $a,b\in\mathbb{Z}_2$. It is clear $(a+a)+b\equiv2a+b\pmod{2}\equiv0+b=b\pmod{2}$. Working the other direction, $b=0+b\equiv2a+b\pmod{2}\equiv a+a+b\pmod{2}\equiv a+(a+b)\pmod{2}$. Observe $2a$ is a multiple of two, so $2a\equiv0\pmod{2}$.
It is known that an element of $\mathbb{Z}_2$ added to itself returns the additive identity element, $0$, because this sum will always be a multiple of two regardless if $a$ is even or odd: If $a$ is even, then $a+a=2k+2k=2\cdot2k$. If $a$ is odd, then $a+a=(2k+1)+(2k+1)=4k+2=2\cdot(2k+1)$. In short, associativity hinges on $2\equiv0\pmod{2}$ for this group.
A: *

*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$.
