Lecture 8: Combinatorics

Finite cardinality

Definition: We say the cardinality (or size) of a set \(X\) is \(n\) (written \(|X| = n\)) if \(|X| = |\{1,2,\dots,n\}|\). Here we are using the definition of same-cardinality defined in lecture 5; that is, there must exists a bijection between \(X\) and \(\{1,2,3,\dots,n\}\).

If this is the case, we say \(X\) is finite.

Sum rule

Claim: if \(A\) and \(B\) are disjoint (that is, if \(A \cap B = \emptyset\)) then \(|A| + |B| = |A \cup B|\).

Proof: Suppose \(|A| = i\) and \(|B| = j\). Then there exists bijections \(f_A : \{1,\dots,i\} → A\) and \(f_B : \{1,\dots,j\} → B\). We can define a bijection \(f : \{1, \dots, i+j\} → A \cup B\) as follows: on input \(n\), if \(1 \leq n \leq i\) then let \(f(n) ::= f_A(n)\), and if \(i+1 \leq n \leq i+j\) then let \(f(n) ::= f_B(n-i)\).

We can easily check that \(f\) is a bijection:

Basic inclusion/exclusion

Claim: in general, \(|A \cup B| = |A| + |B| - |A \cap B|\).

Note: several students pointed out that we are am using the fact that \(A \cup B = (A \setminus B) \cup (A \cap B) \cup (B \setminus A)\), and also that these three sets are disjoint. I did not prove these facts, but they are certainly provable, using the definitions of intersection, union, and difference. For example, to show that \(A \cap B\) and \(A \setminus B\) are disjoint, we could do a proof by contradiction. Assume that there is some \(x\) in \(A \cap B\) and \(A \setminus B\). By the definition of \(\cap\), this means \(x \in B\), but by the definition of \(\setminus\), we see that \(x \notin B\). This is a contradiction.

Proof: We could construct a bijection as we did above, but it's easier to reuse what we've already proven. Let \(|A \setminus B| = i\), \(|A \cap B| = j\) and \(|B \setminus A| = k\).

Clearly (see note above) \(A = (A \setminus B) \cup (A \cap B)\). Note these are disjoint sets, so by above, \(|A| = i + j\). Similarly, \(|B| = j + k\). Moreover, \(A \cup B = (A \setminus B) \cup (A \cap B) \cup (B \setminus A)\) so \(|A \cup B| = i + j + k = (i + j) + (j + k) - j = |A| + |B| - |A \cap B|\) as required.