0% found this document useful (0 votes)
4 views21 pages

Lecture 5 Sum Product Pigeon Principle

The document discusses the importance of counting in solving various problems, including algorithm complexity and resource availability. It introduces basic counting principles such as the Product Rule and the Sum Rule, providing examples for each. Additionally, it covers the Pigeonhole Principle and its generalized form, illustrating how these principles can be applied to real-world scenarios.

Uploaded by

karim22214121074
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views21 pages

Lecture 5 Sum Product Pigeon Principle

The document discusses the importance of counting in solving various problems, including algorithm complexity and resource availability. It introduces basic counting principles such as the Product Rule and the Sum Rule, providing examples for each. Additionally, it covers the Pigeonhole Principle and its generalized form, illustrating how these principles can be applied to real-world scenarios.

Uploaded by

karim22214121074
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Counting

1
WHY?
To solve different types of problem
• Counting is used to determine the complexity of
algorithms.
• Counting is also required to determine whether there are
enough telephone numbers or Internet protocol
addresses to meet demand.
• Furthermore, counting techniques are used extensively
when probabilities of events are computed.

2
BASIC COUNTING PRINCIPLES: THE PRODUCT
RULE
The Product Rule
Suppose that a procedure can be broken down into a sequence of
two tasks. If there are n1 ways to do the first task and for each of
these ways of doing the first task, there are n2 ways to do the
second task, then there are n1.n2 ways to do the procedure.

3
THE PRODUCT RULE : EXAMPLE
Problem : How many different license plates can be made if each plate
contains a sequence of three uppercase English letters followed by three
digits (and no sequences of letters are prohibited)?

Solution: There are 26 choices for each of the three uppercase


English letters and ten choices for each of the three digits. Hence,
by the product rule there are a total of 26·26·26·10·10·10 =
17,576,000 possible license plates.

4
THE PRODUCT RULE : EXAMPLE
Problem : Suppose a college has 3 different history courses, 4 different
literature courses, and 2 different sociology courses. What is the number of
ways a student can choose just one of each kind of courses?

Solution: 3 · 4 · 2 = 24 possible ways

5
THE PRODUCT RULE : EXAMPLE
Problem : There are 32 microcomputers in a computer center. Each
microcomputer has 24 ports. How many different ports to a
microcomputer in the center are there?

Solution: The procedure of choosing a port consists of two tasks,


first picking a microcomputer and then picking a port on this
microcomputer. Because there are 32 ways to choose the
microcomputer and 24 ways to choose the port no matter which
microcomputer has been selected, the product rule shows that
there are
32·24=768 ports.

6
THE PRODUCT RULE : EXAMPLE
Problem : A new company with just two employees, Anik and Arafat,
rents a floor of a building with 12 offices. How many ways are there to
assign different offices to these two employees?

Solution: The procedure of assigning offices to these two


employees consists of assigning an office to Anik, which can be
done in 12 ways, then assigning an office to Arafat different from
the office assigned to Anik, which can be done in 11 ways. By the
product rule, there are 12·11 = 132 ways to assign offices to
these two employees.

7
THE PRODUCT RULE : EXAMPLE
Problem : How many different bit strings of length seven are there?

Solution: Each of the seven bits can be chosen in two ways,


because each bit is either 0 or 1. Therefore, the product rule shows
there are a total of 2^7=128 different bit strings of length seven.

8
BASIC COUNTING PRINCIPLES: THE SUM RULE
The Sum Rule
If a task can be done either in one of n1 ways or in one of n2 ways,
where none of the set of n1 ways is the same as any of the set of n2
ways, then there are n1 + n2 ways to do the task.

9
THE SUM RULE : EXAMPLE
Problem : A student can choose a computer project from one of three lists. The
three lists contain 23, 15, and 19 possible projects, respectively. No project is on
more than one list. How many possible projects are there to choose from?

Solution: The student can choose a project by selecting a project


from the first list, the second list, or the third list. Because no
project is on more than one list, by the sum rule there are
23+15+19=57 ways to choose a project.

10
THE SUM RULE : EXAMPLE
Problem : Suppose a college has 3 different history courses, 4 different
literature courses, and 2 different sociology courses. What is the number of
ways a student can choose just one of the courses?

Solution: 3 + 4 + 2 = 9

11
THE SUM RULE VS. PRODUCT RULE
Problem : Fatema wants to go to Chattogram. She can choose from 3 bus
services or 2 train services to head from Rajshahi to downtown Dhaka. From
there, she can choose from 2 bus services or 3 train services to head to
Chattogram. How many ways are there for Fatema to get to Chattogram?

Solution: She has 3 + 2= 5 ways to get to downtown Dhaka . (Rule of


sum)
From there, She has 2+3=5 ways to get to Chattogram. (Rule of sum)
Hence, she has 5×5=25 ways to get to Chattogram in total. (Rule of
product)

12
The Pigeonhole Principle

The principle proves the existence (or impossibility) of a particular phenomenon


13
The Pigeonhole Principle

Theorem
If k is a positive integer and k+1 or more objects are placed into k boxes, then there
is at least one box containing two or more of the objects.

14
The Pigeonhole Principle

Example
• Suppose a department contains 13 professors, then two of the professors
(pigeons) were born in the same month (pigeonholes)
• Among any group of 367 people, there must be at least two with the same
birthday, because there are only 366 possible birthdays.

15
The Pigeonhole Principle

Example
• Suppose a department contains 13 professors, then two of the professors
(pigeons) were born in the same month (pigeonholes)
• Among any group of 367 people, there must be at least two with the same
birthday, because there are only 366 possible birthdays.

16
The Pigeonhole Principle

Example
• Among any group of 367 people, there must be at least two with the same
birthday, because there are only 366 possible birthdays.
• How many students must be in a class to guarantee that at least two students
receive the same score on the final exam, if the exam is graded on a scale from 0
to 100 points?
• Solution: There are 101 possible scores on the final. The pigeonhole principle
shows that among any 102 students there must be at least 2 students with the
same score.

17
The Generalized Pigeonhole Principle

Theorem
If N objects are placed into k boxes, then there is at least one box containing at least
objects.

18
The Generalized Pigeonhole Principle

Example
• Among 100 people there are at least 100/12=9 who were born in the same month.
• What is the minimum number of students required in a discrete mathematics class to
be sure that at least six will receive the same grade, if there are five possible grades, A,
B, C, D, and F?
Solution: The minimum number of students needed to ensure that at least six students
receive the same grade is the smallest integer N such thatN/5=6. The smallest such
integer is N=5·5+1=26. If you have only 25 students, it is possible for there to be five who
have received each grade so that no six students have received the same grade. Thus, 26
is the minimum number of students needed to ensure that at least six students will
receive the same grade.
19
The Generalized Pigeonhole Principle

Example
• What is the minimum number of students required in a discrete mathematics class to
be sure that at least six will receive the same grade, if there are five possible grades, A,
B, C, D, and F?
Solution: The minimum number of students needed to ensure that at least six students
receive the same grade is the smallest integer N such that N/5=6. The smallest such
integer is N=5·5+1=26. If you have only 25 students, it is possible for there to be five who
have received each grade so that no six students have received the same grade. Thus, 26
is the minimum number of students needed to ensure that at least six students will
receive the same grade.

20
21

Any Questions?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy