title: What's the insight behind A XOR B in bitwise operation?
body: <p>What I know for <code>A XOR B</code> operation is that the output is 1 if <code>A != B</code>, and 0 if <code>A == B</code>. However, I have no insight about this operation when A and B are not binary.</p>
  
  <p>For example, if <code>A = 1</code>, <code>B = 3</code>, then <code>A XOR B = 2</code>; also, if <code>A = 2</code>, <code>B = 3</code>, then <code>A XOR B = 1</code>. Is there any pattern to the XOR operation for non-binary values?</p>
  
  <p>I have a good understanding of boolean mathematics, so I already understand how XOR works. What I am asking is that how do you, for example, predict the outcome of A XOR B without going through the manual calculation, if A and B are not binaries? Let's pretend that 2 XOR 3 = 1 is not just a mathematical artifact.</p>
  
  <p>Thanks!</p>