# Finding the cardinality of exactly one or two elements of two or three finite sets

IF $A$,$B$,$C$ are finite sets then,

Number of elements in exactly one of sets $A$,$B$,$C$:$$n(A)+n(B)+n(C)-2 \times n(A \cap B)-2 \times n(A \cap C)-2 \times n(C \cap B) + 3 \times n(A \cap B \cap C)$$

Number of elements in exactly two of the sets $A$,$B$,$C$: $$n(A \cap B)+(A \cap C)+n(C \cap B) - 3 \times n(A \cap B \cap C)$$

Could somebody explain how can we prove them? I think it's something with inclusion and exclusion but am not getting how to get those results.Also I think we can have a generalized results for these kinds ?!

-
It is exactly PIE (inclusion-exclusion). This is trivial though with a Venn diagram. – picakhu Dec 21 '10 at 20:07
Please change the title to something more descriptive. – Aryabhata Dec 21 '10 at 23:06
@Moron:Please check. – Quixotic Dec 22 '10 at 5:42
Deb: Seems ok... – Aryabhata Dec 22 '10 at 6:03

For the number of elements in exactly one of the sets, you first count all $n(A) + n(B) + n(C)$ elements. You disregard the $n(A \cap B)$ elements twice, as you need to disregard them from your count for both $A$ and $B$. The logic is similar for $A \cap C$ and $B \cap C$. Finally, you've disregarded the $n(A \cap B \cap C)$ elements in all three sets twice, so you have to correct the count by adding this quantity back in.