Definition4.1.4.1.Principle of Inclusion-Exclusion.
If a task can be done in \(n_1\) ways or \(n_2\) ways, then the number of ways to do the task is \(n_1 + n_2 - k\text{,}\) where \(k\) is the number of ways to do the task that is common to the \(n_1\) and \(n_2\) ways.
From Exampleย 4.1.2.3, there are \(2^7\) bit strings of length \(8\) that start with \(1\text{.}\) From Exampleย 4.1.2.5, there are \(2^6\) bit strings of length \(8\) that end with \(00\text{.}\) From Exampleย 4.1.2.6, there are \(2^5\) bit strings that start with \(1\) and end with \(00\text{.}\) By the Principle of Inclusion-Exclusion, there are \(2^7 + 2^6 - 2^5= 160\) bit strings that start with \(1\) or end with \(00\text{.}\)
Suppose there are \(350\) undergraduates in an auditorium. Of these, \(220\) are computer science majors, \(147\) are math majors, and \(51\) are double majoring in computer science and math. How many are neither computer science nor math majors?
First count the number of computer science or math majors. By the Principle Inclusion-Exclusion, there are \(220 + 147 - 51 = 316\) computer science or math majors. Then there are \(350 - 316 = 34\) students that are neither computer science nor math majors.