118. Counting with partitions
P.2 in Definition 117.1 implies that, in the statement of the Principle of Inclusion and Exclusion, the sums over families with more than one element disappear. This gives the following theorem, which is obvious anyway:
118.1 Theorem
If $\Pi =\langle A_{i}\rangle_{i\in\mathbf{n}}$ is a partition of a finite set $C$ , then $|C|=\Sigma_{i=1}^{n}|A_{i}|$.
This Theorem together with the phenomenon of Example 117.1.6 gives a method:
118.1.1 Method
To count the number of elements of a subset $A$ of a set $S$, count the number of elements of $S$ and subtract the number of elements of the complement $S -A$.
118.1.2 Worked Exercise How many strings of length $n$ in $\{a,b,c\}^{*}$ are there that have more than one $a$?
Answer We will use Method 118.1.1. We know from Exercises 114.2.2 and 114.3.1 that there are $2^{n}$ strings with no $a$ and $n\cdot 2^{n-1}$ strings with one $a$. Since there are $3^{n}$ strings of length $n$ in $\{a,b,c\}^{*}$, the answer is $3^{n}- 2^{n}-n\cdot 2^{n-1}$.
118.1.3 Exercise How many strings of length $n$ in $\{a,b\}^{*}$ are there that have more than one $a$?
118.1.4 Exercise How many strings of length $n$ in $\{a,b\}^{*}$ are there that satisfy the following requirement: If it has an $a$ in it, it has at least two.
118.1.5 Exercise How many strings of length $n$ in $\{a,b,c\}^{*}$ are there that have exactly two different letters in them (so each one is either all $a$’s and $b$’s, all $a$’s and $c$’s, or all $b$’s and $c$’s.)?
118.1.6 Exercise In the USA the identifying name of a radio station consist of strings of letters of length 3 or 4, beginning with K or W. Upper and lower case are not distinguished. How many legal identifying names are there?
Pages 182–183 of the book (PDF).