| A | B | A xor B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
We can add two binary numbers, X and Y as follows:
(X) 10110100
(Y) 00101010 +
(Z) 10011110
(X) 10110100
(Z) 10011110 +
(Y) 00101010
The addition example shows us that X + Y = Z so Y = Z - X.
However, the subtraction example shows us that Y = Z + X.
As neither Z nor X is zero, the addition and subtraction operators must behave in the same way.
Modulo 2 division can be performed in a manner similar to arithmetic long division. Subtract the denominator (the bottom number) from the leading parts of the enumerator (the top number). Proceed along the enumerator until its end is reached. Remember that we are using modulo 2 subtraction. For example, we can divide 100100111 by 10011 as follows:
10001 remainder 100
10011|100100111
10011
10111
10011
100
This has the effect that X/Y = Y/X. For example:
1 remainder 1011
11001|10010
11001
1011
1 remainder 1011
10010|11001
10010
1011