Q:

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

I am utterly confused on how to solve this problem. I found a lemma that says $|A\cup B|=|A|+|B|$ is true if the two sets are disjoint which makes sense, but how do I prove the entire statement. 

A:

If the sets are not disjoint, in the right-hand side  $\lvert A\rvert+\lvert B\rvert$, formula, the elements of $A\cap B$ are counted twice.

A:

Write the disjoint unions and use your original result. That is:

$$\begin{cases}A\cup B=A\setminus B\cup B\setminus A \cup A\cap B \\ A = A\setminus B \cup A\cap B\\ B=B\setminus A\cup A\cap B\end{cases}.$$

Since you know that these are all disjoint, you can use the original result to write your proof as

$$|A\cup B|=|A\setminus B|+|B\setminus A|+|A\cap B|=(|A\setminus B|+|A\cap B|)+(|B\setminus A|+|A\cap B|)-|A\cap B|.$$

A:

$|A|+|B|$ contains twice those elements that are contained in both sets. So, if you want to calculate the true number of elements of $A\cup B$, $|A\cup B|$ then you have to subtract the number of elements that are taken into account twice, that is, you have to subtract $|A\cap B|$ form $|A|+|B|$. As a result
$$|A\cup B|=|A|+|B|-|A\cap B|.$$

