# How to prove the equation for the union of two sets?

Given the Sets A and B, how do you prove that $|A \cup B| = |A| + |B| - |A \cap B|$

I know that if the sets are pairwise disjoint, the last term would be 0 and hence not be necessary for the equation. Hence I think you have to assume the sets are not pairwise disjoint. It seems like a very basic equation and I understand what it means but I am not sure how to prove it and the necessary theorems needed.

I would appreciate any help I can get.

Well $$A\cup B = (A\setminus B)\cup (A\cap B)\cup (B\setminus A)$$ Since $(A\setminus B, (A\cap B), (B\setminus A)$ are disjoint we have:
Assuming that you are working with finite sets, let $A=\{a_1,a_2,, \ldots, a_k,c_1,c_2, \ldots c_j\}$ and $B=\{b_1,b_2,, \ldots, b_p,c_1,c_2, \ldots c_j\}$. So $c_i's$ are the only common elements, i.e. $A \cup B=\{a_1,a_2,, \ldots, a_k,b_1,b_2,, \ldots, b_p,c_1,c_2, \ldots c_j\}$ \begin{align*} |A \cup B|&=k+p+j\\ &=(k+j)+(p+j)-j\\ &=|A|+|B|-|A \cap B|. \end{align*}