TITLE: Prove XOR is commutative and associative?
QUESTION [27 upvotes]: Through the use of Boolean algebra, show that the XOR operator ⊕ is both commutative
and associative.
I know I can show using a truth table.
But using boolean algebra?
How do I show? I totally have no clue.
Any help please?

REPLY [4 votes]: An intuitive way to convince yourself that $\oplus$ is associative is the following. (Note: we're not really proving it through rigid algebra here - but I think it's a very intuitive argument and shows another nice way to look at $\oplus$.)
Let's first have a look at the truth table again:
\begin{array}{cc|c}
x & y & x\oplus y\\
\hline
0 & 0 & 0\\
0 & 1 & 1\\
1 & 0 & 1\\
1 & 1 & 0\\
\end{array}
Commutativity: From the truth table, we can easily convince us that we may commute the arguments. Since in any case, commuting it will give us the same result.
Associativity: Further, we see from the truth table we can see that we may rewrite $x\oplus y$ as a predicate and an addition:
$$
x\oplus y \quad\Longleftrightarrow \quad
\text{odd}(x+y)
$$
Now using this way of rewriting the $\oplus$, we can easily see that $\oplus$ is associative.
$$
\begin{align*}
x\oplus (y\oplus z)
&\Longleftrightarrow
\text{odd}(x+\text{odd}(y+z))\\
&\Longleftrightarrow
\text{odd}(x+y+z)\\
&\Longleftrightarrow
\text{odd}(\text{odd}(x+y)+z)\\
&\Longleftrightarrow
(x\oplus y)\oplus z
\end{align*}
$$