Proof of (B != C) => (A XOR B) != (A XOR C)

112 Views Asked by At

I have a conjecture: If $B \neq C$, then

$$ A\ \text{XOR}\ B \neq A\ \text{XOR}\ C $$

Is it true? If so, how to prove it?


What I tried:

I think I have proven the contrapositive qualitatively by writing a binary representation of $A$. Let $a_i, b_i, c_i$ be $i$th bit of $A, B, C$. To make $A\ \text{XOR}\ B = A\ \text{XOR}\ C$, $b_i = c_i$ shall be satisfied for all $i$.

But I have no quantitative proof.

2

There are 2 best solutions below

1
On BEST ANSWER

The standard algebraic proof is by the contrapositive and uses the following properties of XOR (which I'll denote using $\oplus$):

  • $\oplus$ is associative
  • There is an element $0$ such that $0 \oplus x = x$ for any $x$
  • For any $x$, $x \oplus x = 0$.

From this, we assume $A \oplus B = A \oplus C$. Then $$\begin{align*}B &= 0 \oplus B \\ &= (A \oplus A)\oplus B \\ &=A \oplus (A \oplus B) \\ &= A \oplus (A \oplus C) \\ &= (A \oplus A) \oplus C \\ &= 0 \oplus C \\ &= C. \end{align*}$$

2
On

Suppose $A,B,C\in\{0,1\}$ and suppose $B \neq C$.

$B \neq C$ $\Rightarrow$ $B,C$ are elements of a set with at least 2 elements. So $B,C\in \{0,1\}$ $\Rightarrow$ $B=0,C=1$ or $B=1,C=0$ must be true.

Because $A\in\{0,1\}$, $A=0$ or $A=1$ must be true.

Note that $A\ \ XOR\ \ B=0 \iff A=B$ and $A\ \ XOR\ \ B=1 \iff A \neq B$. Similar relation with $A$ and $C$.

Because $B\neq C$, we have $A=B$ or $A=C$.

If $A=B$, we have $A=B\neq C \Rightarrow A\ \ XOR\ \ B=0$ and $A\ \ XOR\ \ C=1$.

Similarly, if $A=C$, we have $B\neq C=A \Rightarrow A\ \ XOR\ \ B=1$ and $A\ \ XOR\ \ C=0$.

Hence, $0\neq 1 \Rightarrow A\ \ XOR\ \ B \neq A\ \ XOR\ \ C$.