Quick Recap — Sets: Counting & Relations

  • Inclusion–exclusion: n(ABC)=nn(pairs)+n(ABC)n(A\cup B\cup C)=\sum n-\sum n(\text{pairs})+n(A\cap B\cap C).
  • Relation counts on an nn-set: all =2n2=2^{n^2}; reflexive =2n2n=2^{n^2-n}; symmetric =2n(n+1)/2=2^{n(n+1)/2}.
  • Function counts ABA\to B: all BA|B|^{|A|}; one-one =B(B1)=|B|(|B|-1)\cdots; onto by inclusion–exclusion.
  • Equivalence relation = reflexive + symmetric + transitive; it partitions the set into classes.