Sie sind auf Seite 1von 26

Session 30

Principle of Inclusion-Exclusion
Principle of Inclusion and Exclusion
• The Principle of Inclusion and Exclusion (PIE) is a counting
technique that computes the number of elements that satisfy at least
one of several properties while guaranteeing that elements satisfying
more than one property are not counted twice.
Principle of Inclusion & Exclusion
| A B || A |  | B |  | A B |
The above equation represents the principle of inclusion
and exclusion for two sets A and B.
The name comes from the fact that to calculate the
elements in a union, we include the individual elements
of A and B but subtract the elements common to A and
B so that we don’t count them twice.
This principle can be generalized to n sets.

Section 3.3 Principle of Inclusion & Exclusion; Pigeonhole Principle 4


Inclusion-Exclusion

A A
A B
B | A B || A |  | B |  | A B |

It’s simply a matter of not over-counting the blue area in the intersection.
Problem 1
If F is faculty who speak French and R is the faculty who speak
Russian, then given that
n(F) = |F| = 200
n(R) = |R|= 50
n (F∩R) = | F∩R | = 20
we need to find |F U R|
Then by the PIE,
we have | F∩R | = |F| + |R| - |F U R|
Thus |F U R| = 200+50-20=230
Problem2
Total number of committees possible is
C(10,5) = 252 ways
Let A be the set of committees that include Professor A
B be the set of committees that include Professor B.
Then n(A) = C (9,4)=126
n(B) = C (9,4)=126
n(A ∩ B) = C(8,3) = 5

Thus by inclusion and exclusion principle,


n(A U B) = 126 + 126 – 56 = 196
Example on
Inclusion/Exclusion Rule (2 sets)
Question: How many integers from 1 through 100
are multiples of 3 or multiples of 7 ?
Solution:
Let A=the set of integers from 1 through 100 which are
multiples of 3;
B = the set of integers from 1 through 100 which are
multiples of 7.
Then we want to find n(A U B).
First note that A ∩ B is the set of integers
from 1 through 100 which are multiples of 21 .
n(A U B) = n(A) + n(B) - n(A ∩ B) (by incl./excl. rule)
n(AUB) = n(A) + n(B) - n(A ∩ B) (by incl./excl. rule)
= 33 + 14 – 4 = 43 (by counting the elements

From 1 to 100, every third integer is a multiple of 3,


each of this multiple can be represented as 3p,
or any integer p from 1 through 33,
Hence |A| = 33.
Similarly for multiples of 7, each multiple of 7 is of the form
7q for some integer q from 1 through 14.
Hence, we have |B| = 14.) and the multiple of 21… n(A ∩ B) = 4
3 sets
Problem 3
Let F be the set of faculty who speak French, R be the set
of faculty who speak Russian, and S be the set of faculty
that speak Spanish.
Thus we have |F | = 200, | R | = 50, |S|= 100
|F ∩ R | = 20
|F ∩ S | = 60
|R∩ S | = 35
|F ∩ R∩ S | = 10
Thus | F U R U S | = 200 + 50+ 100- 20 -60 -
35 + 10
= 245.

Section 3.3 Principle of Inclusion & Exclusion; Pigeonhole Principle 14


Example 2:
• In a class of students undergoing a computer course the
following were observed.
– Out of a total of 50 students: 30 know Pascal, 18
know Fortran, 26 know COBOL, 9 know both Pascal
and Fortran, 16 know both Pascal and COBOL, 8
know both Fortran and COBOL, 47 know at least one
of the three languages.
• From this we have to determine
– a. How many students know none of these
languages?
– b. How many students know all three languages?
a. We know that 47 students know at least one of the three languages in
the class of 50. The number of students who do not know any of three
languages is given by the difference between the number of students in
class and the number of students who know at least one language.
Hence, the students who know none of these languages =
50 – 47 = 3.
b. Students know all three languages, so we need to
find |A  B  C|.
A = All the students who know Pascal in class.
B = All the students who know COBOL in the class.
C = All the students who know FORTRAN in class.
We have to derive the inclusion/exclusion formula for three sets
|A  B  C| = |A  (B  C)|= |A|+|B  C|- |A  (B  C)|

Section 3.3 16
|A  B  C| = |A  (B  C)| = |A| + |B  C| - |A  (B  C)|
= |A| + |B| + |C| - |B  C| - |(A  B)  (A  C)|
= |A| + |B| + |C| - |B  C| - (|A  B| + |A  C| - |A  B  C|)
= |A| + |B| + |C| - |B  C| - |A  B| - |A  C| + |A  B  C|
Given in the problem are the following:
|B  C| = 8
|A  B| = 9
|A  C| =16
|A  B  C| = 50
Hence, using the above formula, we have
47 = 30 + 26 + 18 -9 -16 -8 + |A  B  C|
Hence, |A  B  C| = 6

Section 3.3 Principle of Inclusion & Exclusion; Pigeonhole Principle 17


Solution
Practice Problems
Solutions

Das könnte Ihnen auch gefallen