0% found this document useful (0 votes)
3 views30 pages

couting slides

The document discusses counting principles in combinatorics, focusing on the Product Rule and Sum Rule for solving counting problems. It provides examples of how to apply these rules to various scenarios, such as course selection and labeling items. Additionally, it explores exercises related to counting arrangements, license plates, and variable names.

Uploaded by

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

couting slides

The document discusses counting principles in combinatorics, focusing on the Product Rule and Sum Rule for solving counting problems. It provides examples of how to apply these rules to various scenarios, such as course selection and labeling items. Additionally, it explores exercises related to counting arrangements, license plates, and variable names.

Uploaded by

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

COUNTING

Lecture # 21

1
COUNTING
 In combinatorics we generally solved counting problems.

 Example: How many books you have you can easily


count them.

 Sometimes counting problems become complex and it is


difficult to solve it.

 In counting problem the important step is we must


realized that which thing we are counting, if you do that
step then to solve the actual problem is not a big deal.
2
INTRODUCTION
 Combinatorics is the mathematics of counting and arranging
objects.

 Counting of objects with certain properties (enumeration) is


required to solve many different types of problem.

 For example: Counting is used to:


 Determine number of ordered or unordered arrangement of
objects.

 Generate all the arrangements of a specified kind which is


important in computer simulations.
3
 How many such passwords are there.

 Analyze the chance of winning games, lotteries etc.

 Determine the complexity of algorithms.

4
BASIC COUNTING PRINCIPLES
 The two basic counting principles are:

 Product Rule
 Sum Rule

 They can be used to solve many different counting


problems.

5
EXAMPLE
 Your institute is offering 7 courses in computer science
and 3 courses in mathematics.You are asked to choose
only one course.
 How many choices you have?

 You can select either one computer science course or


mathematics.
7 cs courses = 7 choices
3 math courses = 3 choices
Total number of choices = 7 + 3 (basically by applying
sum rule)
6
THE SUM RULE
 If one event can occur in n1 ways.
 A second event can occur in n2 (different) ways.

 Then the total number of ways in which exactly one of


the events (i.e., first or second) can occur is

n 1 + n 2.

7
EXAMPLE
 A student can choose a computer project from one of
the three lists. The three lists contain 23, 15 and 19
possible projects, respectively.

 How many possible projects are there to choose from?


 SOLUTION:
23 choices are in first list,
15 choices are in second list,
19 choices are in third list. Hence, there are
So, we have total number of choices
= 23 + 15 + 19 = 57 projects to choose from.
8
GENERALIZED SUM RULE
 If one event can occur in n1 ways,
a second event can occur in n2 ways,
a third event can occur in n3 ways,
……………………………………..
then there are
n1 + n2 + n3 + …

ways in which exactly one of the events can occur.

9
SUM RULE IN TERMS OF SETS
 If A1, A2, …, Am are finite disjoint sets, then the number of
elements in the union of these sets is the sum of the
number of elements in them.

 If n(Ai) denotes the number of elements in set Ai, then

 n(A1A2 … Am) = n(A1) + n(A2) + … + n(Am)


where
AiAj =  if i  j

10
EXAMPLE
 Suppose
There are 7 different optional courses in Computer
Science and
3 different optional courses in Mathematics.

A student who wants to take one optional course of each


subject, there are:

7  3 = 21 choices.

11
THE PRODUCT RULE
 If one event can occur in n1 ways and if for each of these
n1 ways, a second event can occur in n2 ways.

 Then the total number of ways in which both events


occur is n1· n2

12
EXAMPLE
 The chairs of an auditorium are to be labeled with two
characters, a letter followed by a digit.

 What is the largest number of chairs that can be labeled


differently?

13
SOLUTION
 The procedure of labeling a chair consists of two events,
namely,

Assigning one of the 26 letters: A, B, C, …, Z and


Assigning one of the 10 digits: 0, 1, 2, …, 9

By product rule, there are 26  10 = 260 different ways


that a chair can be labeled by both a letter and a digit.

14
GENERALIZED PRODUCT RULE
 If some event can occur in n1 different ways, and if,
following this event, a second event can occur in n2
different ways, and following this second event, a third
event can occur in n3 different ways, …, then the number
of ways all the events can occur in the order indicated is

n1· n2· n3· …

15
PRODUCT RULE IN TERMS OF SETS
 If A1, A2, …, Am are finite sets, then the number of
elements in the Cartesian product of these sets is the
product of the number of elements in each set.

 If n(Ai) denotes the number of elements in set Ai, then

n(A1  A2 … Am) = n(A1)· n(A2)· …· n(Am)

16
EXERCISE
 Find the number n of ways that an organization consisting of
15 members can elect a president, treasurer, and secretary.
(assuming no person is elected to more than one position)

 SOLUTION:
The president can be elected in 15 different ways;
The treasurer can be elected in 14 different ways;
The secretary can be elected in 13 different ways.
Thus, by product rule, there are
n = 15 x 14 x 13 = 2730
different ways in which the organization can elect the officers.

17
EXERCISE
 There are four bus lines between A and B; and three bus
lines between B and C.

 Find the number of ways a person can travel:

(a) By bus from A to C by way of B;


(b) Round trip by bus from A to C by way of B;
(c) Round trip by bus from A to C by way of B, if the
person does not want to use a bus line more than
once.

18
SOLUTION
(a) There are 4 ways to go from A to B and 3 ways to go from B
to C;
hence there are
4 x 3 = 12 ways to go from A to C by way of B.

(b) The person will travel from A to B to C to B to A for the


round trip.
i.e (A →B →C →B →A)
The person can travel 4 ways from A to B and 3 way from B to
C and back. 4 3 3 4
i.e., A→ B → C → B → A
Thus there are 4 x 3 x 3 x 4 = 144 ways to travel the round
trip.
19
(c) The person can travel 4 ways from A to B and 3 ways
from B to C, but only 2 ways from C to B and 3 ways
from B to A,

Since bus line cannot be used more than once. Thus

4 3 2 3
i.e., A→ B → C → B → A

Hence there are 4 x 3 x 2 x 3 = 72 ways to travel the


round trip without using a bus line more than once.

20
EXERCISE
 How many bit strings of length 8

(i) begin with a “1”?


(ii) begin and end with a “1”?

21
SOLUTION
(i) If the first bit (left most bit) is a 1, then it can be filled in
only one way.

Each of the remaining seven positions in the bit string can


be filled in 2 ways (i.e., either by 0 or 1).

Hence,
there are 1 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 27 = 128
different bit strings of length 8 that begin with a 1.

22
(ii) If the first and last bit in an 8 bit string is a 1, then only
the intermediate six bits can be filled in 2 ways, i.e. by a 0
or 1.

Hence there are 1 x 2 x 2 x 2 x 2 x 2 x 2 x 1 = 26 = 64


different bit strings of length 8 that begin and end with a
1.

23
EXERCISE
 Suppose that an automobile license plate has three letters
followed by three digits.

 How many different license plates are possible?

24
SOLUTION
Each of the three letters can be written in 26 different
ways, and each of the three digits can be written in 10
different ways.
letters digits

26 ways each 10 ways each

Hence, by the product rule, there is a total of


26 x 26 x 26 x 10 x 10 x 10 = 17,576,000
different license plates possible.

25
(b) How many license plates could begin with A and end on
0?
 SOLUTION:
The first and last place can be filled in one way only, while
each of second and third place can be filled in 26 ways
and each of fourth and fifth place can be filled in 10 ways.
letters digits

A 0

one way 26 ways each 10 ways each one way

Number of license plates that begin with A and end in 0


are 1 x 26 x 26 x 10 x 10 x 1 = 67600
26
EXERCISE
 A variable name in a programming language must be
either a letter or a letter followed by a digit.

 How many different variable names are possible?

27
SOLUTION
 First consider variable names one character in length.
 Since such names consist of a single letter, there are 26
variable names of length 1.

 Next, consider variable names two characters in length.


Since the first character is a letter, there are 26 ways to
choose it. The second character is a digit, there are 10 ways to
choose it.
Hence, to construct variable name of two characters in length,
there are 26 x10 = 260 ways.

 Finally, by sum rule, there are 26 + 260 = 286 possible variable


names in the programming language.
28
EXERCISE
 A computer access code word consists of from one to
three letters of English alphabets with repetitions allowed.

 How many different code words are possible.

29
SOLUTION
Number of code words of length 1 = 261
Number of code words of length 2 = 262
Number of code words of length 3 = 263

Hence, the total number of code words


= 261 + 262 + 263
= 18,278

30

You might also like