Engineering Mathematics Exam  >  Engineering Mathematics Notes  >  Engineering Mathematics  >  Principle of Inclusion & Exclusion

Principle of Inclusion & Exclusion

Overview

The Principle of Inclusion and Exclusion (PIE) is a fundamental counting technique used to compute the cardinality of the union of finite sets by correcting for over-counting of elements that belong to multiple sets. It is widely used in combinatorics, probability, and counting problems that arise in computer science and engineering mathematics.

Two sets

For two finite sets A and B the principle gives:

n(A ∪ B) = n(A) + n(B) - n(A ∩ B)

Here n(X) denotes the number of elements (cardinality) of set X. The formula adds the elements of A and B, then subtracts the elements counted twice - those in A ∩ B.

Two sets

Three sets

For three finite sets A, B and C the formula is:

n(A ∪ B ∪ C) = n(A) + n(B) + n(C) - n(A ∩ B) - n(B ∩ C) - n(C ∩ A) + n(A ∩ B ∩ C)

The signs alternate to remove over-counting: single sets are added, pairwise intersections are subtracted, and the triple intersection is added back because it was subtracted three times.

Three sets

General form for n sets

Let A1, A2, ..., An be finite sets. Then

n(A1 ∪ A2 ∪ ... ∪ An) =

Σ n(Ai) - Σ n(Ai ∩ Aj) + Σ n(Ai ∩ Aj ∩ Ak) - ... + (-1)n-1 n(A1 ∩ ... ∩ An)

The first summation runs over all single sets, the second over all distinct pairs, the third over all distinct triples, and so on. The sign of each term is determined by the parity of the size of the intersection.

Proof idea (counting or indicator functions)

Every element x that belongs to exactly m of the sets contributes to the right-hand side an amount equal to

Σk=1^{m} (-1)^{k-1} C(m, k) = 1.

Hence the element is counted exactly once on the right-hand side. Summing over all elements yields the formula. The identity above follows from the binomial expansion of (1 - 1)m = 0.

Derangement

Definition

A derangement is a permutation of n distinct objects with no object in its original position. The number of derangements of n objects is denoted by Dn (also called the subfactorial and sometimes written !n).

Formula via inclusion-exclusion

Use PIE by counting all permutations (n!) and subtracting permutations that fix at least one element.

Dn = n! × [1 - 1/1! + 1/2! - 1/3! + ... + (-1)n 1/n!]

This is an exact formula. As n grows large, Dn is approximately n!/e, and Dn is the nearest integer to n!/e.

Recurrence

The derangement numbers satisfy the recurrence:

Dn = (n - 1) × (Dn-1 + Dn-2)

with initial values D0 = 1 and D1 = 0.

Small values

  • D0 = 1
  • D1 = 0
  • D2 = 1
  • D3 = 2
  • D4 = 9
  • D5 = 44

Solved Examples of the Principle of Inclusion-Exclusion and Derangement

Example 1: Among a group of students, 49 study Physics, 37 study English and 21 study Biology. If 9 of these students study Maths Physics and English, 5 study English and Biology, 4 study Physics and Biology and 3 study Physics, English and Biology, find the number of students in the group.
(a) 91
(b) 92
(c) 86
(d) none of these

Solution.

P represent students who study Physics, E represent students who study English and B represent students who study Biology.

n(P) = 49

n(E) = 37

n(B) = 21

n(P ∩ E) = 9

n(E ∩ B) = 5

n(P ∩ B) = 4

n(P ∩ E ∩ B) = 3

Using PIE for three sets:

n(P ∪ E ∪ B) = n(P) + n(E) + n(B) - n(P ∩ E) - n(E ∩ B) - n(P ∩ B) + n(P ∩ E ∩ B)

n(P ∪ E ∪ B) = 49 + 37 + 21 - 9 - 5 - 4 + 3

n(P ∪ E ∪ B) = 92

Option b is the answer.

Example 2: Find the number of ways that you can put 7 letters into their respective envelopes such that exactly 3 go into the right envelope.
(a) 350
(b) 102
(c) 315
(d) 530

Solution.

Select which 3 letters are placed correctly. The number of ways to choose these 3 is C(7, 3).

C(7, 3) = 7 × 6 × 5 / (1 × 2 × 3) = 35

For the remaining 4 letters, none may be in the correct envelope, so we need the derangement D4.

D4 = 9

Total number of ways = C(7, 3) × D4 = 35 × 9

Total number of ways = 315

Option c is the answer.

Applications and remarks

  • Counting with restrictions: PIE is useful when we must count elements that avoid several properties (for example, counting strings that avoid certain substrings or permutations avoiding positions).
  • Probability: To compute the probability that none of a set of events occur, PIE converts event probabilities into alternating sums of intersection probabilities.
  • Algorithmic view: Inclusion-exclusion can be implemented in algorithms by iterating over subsets; it appears in exponential-time algorithms for some NP-hard problems and in dynamic programming on bitmasks.
  • Derangements in practice: Derangements model problems such as secret Santa assignments, matching problems where fixed points are forbidden, and error-correcting arrangements.

Derivation of Dn by inclusion-exclusion (sketch)

Count all permutations of n objects: n!.

Let Ai be the set of permutations fixing element i. A permutation fixes at least one element if it lies in ∪ Ai. Use PIE to exclude permutations fixing one or more elements.

Dn = n! - C(n,1)(n-1)! + C(n,2)(n-2)! - ... + (-1)n C(n,n)(n-n)!.

Factor out n!: Dn = n! × [1 - 1/1! + 1/2! - ... + (-1)n 1/n!].

Useful identities

  • Nearest integer formula: Dn = nearest integer to n!/e.
  • Alternate closed form: Dn = ⌊n!/e + 1/2⌋ for n ≥ 1 (where ⌊·⌋ is floor), so Dn = round(n!/e).

Practice suggestions

  • Use the PIE formula for unions of sets with up to 3-4 sets by hand; for larger numbers consider symmetry or complementary counting where possible.
  • When counting derangements with additional constraints (for example some specific elements are forced or forbidden), combine combinations (to choose fixed items) with derangement numbers for the remainder.
  • For algorithmic problems, implement inclusion-exclusion by iterating over all subsets and adding or subtracting counts according to subset parity; use bitmasks for efficiency.
The document Principle of Inclusion & Exclusion is a part of the Engineering Mathematics Course Engineering Mathematics.
All you need of Engineering Mathematics at this link: Engineering Mathematics

FAQs on Principle of Inclusion & Exclusion

1. What is a derangement in combinatorial mathematics?
Ans. A derangement is a permutation of a set of elements such that none of the elements appear in their original position. For example, if we have three items labelled A, B, and C, a derangement would rearrange them to something like B, C, A, where none of the items remain in their initial place.
2. How is the principle of inclusion-exclusion used to count derangements?
Ans. The principle of inclusion-exclusion provides a systematic way to count the number of derangements by considering the total permutations and subtracting the cases where at least one item is in its original position. The formula for the number of derangements of n items, denoted as !n, can be expressed as !n = n! ∑ (-1)ᵏ / k! for k = 0 to n, where n! is the factorial of n.
3. Can you provide an example of how to calculate a derangement using the principle of inclusion-exclusion?
Ans. Certainly! For three items (A, B, C), we start with the total permutations, which is 3! = 6. Next, we subtract the cases where at least one item is in its original position. If A is fixed, we can arrange B and C in 2! = 2 ways. By symmetry, the same applies if B or C is fixed. Thus, we subtract 3 × 2 = 6. Now we must add back the cases where two items are fixed, which is 3 (ABC, ACB, BAC). Therefore, using inclusion-exclusion, we have 6 - 6 + 3 = 3 derangements: BCA, CAB, and CBA.
4. What is the significance of derangements in real-world applications?
Ans. Derangements have practical applications in various fields such as cryptography, scheduling problems, and game theory. They can help in scenarios where items must be distributed or assigned without allowing any item to remain in its original position, thereby ensuring complete randomness or fairness in allocation.
5. What are some common misconceptions about derangements?
Ans. A common misconception is that derangements are the same as random arrangements. However, a true derangement specifically requires that no element retains its original position, while a random arrangement may allow some elements to remain fixed. Additionally, some may confuse derangements with permutations; while all derangements are permutations, not all permutations are derangements.
Explore Courses for Engineering Mathematics exam
Get EduRev Notes directly in your Google search
Related Searches
Exam, video lectures, Summary, Free, Sample Paper, Principle of Inclusion & Exclusion, practice quizzes, mock tests for examination, past year papers, Previous Year Questions with Solutions, study material, shortcuts and tricks, Semester Notes, pdf , Viva Questions, Principle of Inclusion & Exclusion, Extra Questions, Important questions, Objective type Questions, Principle of Inclusion & Exclusion, MCQs, ppt;