Proving that $A+B - (A \cap B) = A \cup B$ for binary integers

50 Views Asked by At

I hope computing questions are fine here. I'm trying to show that for all binary numbers $A$ and $B$, $A+B - (A \cap B) = A \cup B$.

It's confusing me firstly because I'm not sure what the "set theoretical equivalent" of binary addition is.

I assumed this could be treated as a type of group theory problem, since binary numbers are sets of $1$'s and $0$'s, and the operations $\cap$ and $\cup$ are defined on those sets.

1

There are 1 best solutions below

0
On

This would make sense if we interpret $A \cap B$ as the bitwise "and" ($\land$) (or intersection, if you look at sets interpretation), $A \cup B$ as the bitwise "or" ($\lor$) of the numbers (which is their union in the set interpretation).

E.g. $7 \cap 11 =$ 0b0111 $\land$ 0b1011 $=$ 0b0011 $= 3$, $7 \cup 11 =$ 0b0111 $\lor$ 0b1011 $=$ 0b1111 $=15 $ , so we'd need $7 + 11 - 3 = 15$