### Theory:

Cardinality of the Union of Two Sets: Consider two sets $$A$$ and $$B$$, and their union $$A∪ B$$. We want to count the number of elements in the union; that is, to calculate $$n(A∪ B)$$. It seems sensible to count the elements in $$A$$, and then count the elements in $$B$$, and add the two quantities together. However, there is the possibility that some elements have been counted twice, specifically, those elements that lie in both sets $$A$$ and $$B$$ simultaneously – the intersection $$A∩ B$$. To balance this over-count, we subtract the number of elements in the intersection.

The result is a useful formula called the cardinal of the union: $n\left(A\cup B\right)=n\left(A\right)+n\left(B\right)-n\left(A\cap B\right)$.

Let $$A =$$ $\left\{\right\$$$1$$, $$2$$, $$3$$$}$ and $$B =$$ $\left\{\right\$$$2$$, $$4$$, $$6$$, $$7$$$}$. Calculate the number of elements in the union $$A∪B$$.

Set $$A$$ has $$3$$ elements and set $$B$$ has $$4$$ elements, so we write $$n(A) = 3$$ and $$n(B) = 4$$.

$$A∩B = A =$$ $\left\{\right\$$$1$$, $$2$$, $$3$$$}$ $$∩ B =$$ $\left\{\right\$$$2$$, $$4$$, $$6$$, $$7$$$}$ $$=$$ $\left\{\right\$$$2$$$}$.

The set $$A∩B$$ has $$1$$ element, so we write $$(A∩B) = 1$$

The formula then gives:

$n\left(A\cup B\right)=n\left(A\right)+n\left(B\right)-n\left(A\cap B\right)$

$$n(A∪B)$$ $$=$$ $$3 + 4 - 1$$

$$n(A∪B)$$ $$=$$ $$7 - 1$$

$$n(A∪B)$$ $$=$$ $$6$$

Hence there are $$6$$ elements in the union. By observation, we see that it is true.

$$A∪B =$$ $\left\{\right\$$$1$$, $$2$$, $$3$$$}$ $$∪$$ $\left\{\right\$$$2$$, $$4$$, $$6$$, $$7$$$}$

In this, the common elements being taken only once.

$$(A∪B) =$$ $\left\{\right\$$$1$$, $$2$$, $$3$$, $$4$$, $$6$$, $$7$$$}$ which contains $$6$$ elements.
Important!
• $n\left(A-B\right)=n\left(A\right)-n\left(A\cap B\right)$;
• $n\left(B-A\right)=n\left(B\right)-n\left(A\cap B\right)$;
• $n\left({A}^{\prime }\right)=n\left(U\right)-n\left(A\right)$.