# Set theory - proving cardinalities of two non-disjunct sets

I need to prove following formula:

$|A \cup B|=|A|+|B|-|A\cap B|$

I got so far:

$A=(A\cap B) \cup (A \cap !B)$ // !B should be the complement of B

With this I can get to

$|A|=|A\cap B| + |A \cap !B|$

But I do not have any clue on how to go on. Some advises would be nice.

-

Using the same formula on $B$ you have already:

$|A|+|B| = 2|A\cap B|+|A\cap!B|+|A!\cap B| = |A\cap B| + [|A\cap B| + |A\cap !B| + |A!\cap B|]$. The part in $[~]$ can be writen as $|(A\cap B) \cup (A\cap !B) \cup (A!\cap B)|$ which is $|A\cup B|$.

-

Hint:

$A=(A\setminus B)\cup (A\cap B)$, this is disjoint union; and $B=(B\setminus A)\cup(A\cap B)$, again a disjoint union; and $A\cup B=(A\setminus B)\cup(B\setminus A)\cup(A\cap B)$.

-

If A and B may be infinite, the formula is not valid: Let A= the odd natural numbers, B = the prime numbers, without 2. Then, $|A \cup B| =|A| = |B| = |A \cap B| = \aleph_0$. So, $|A|+|B| = \aleph_0$ and $\aleph_0 - \aleph_0$ is undefined.

-