0% found this document useful (0 votes)
25 views22 pages

Basics of Counting Part 1 and Part 2 For IT 1R4

The document provides an overview of combinatorics, focusing on counting techniques essential for solving various problems, such as algorithm complexity and DNA sequencing. It introduces the basic counting principles, including the product rule, sum rule, subtraction rule, and division rule, along with practical examples. Additionally, it discusses the use of tree diagrams for visualizing counting problems.

Uploaded by

Lovely Alabe
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)
25 views22 pages

Basics of Counting Part 1 and Part 2 For IT 1R4

The document provides an overview of combinatorics, focusing on counting techniques essential for solving various problems, such as algorithm complexity and DNA sequencing. It introduces the basic counting principles, including the product rule, sum rule, subtraction rule, and division rule, along with practical examples. Additionally, it discusses the use of tree diagrams for visualizing counting problems.

Uploaded by

Lovely Alabe
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/ 22

The Basics

of Counting
Introduction
Combinatorics, the study of arrangements of objects, is an important
part of discrete mathematics. This subject was studied as long ago as
the seventeenth century, when combinatorial questions arose in the
study of gambling games. Enumeration, the counting of objects with
certain properties, is an important part of combinatorics.
Introduction
We must count objects to solve many different types of problems. For
instance, 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.
Recently, it has played a key role in mathematical biology, especially in
sequencing DNA. Furthermore, counting techniques are used
extensively when probabilities of events are computed.
The Basics of Counting
Introduction
Suppose that a password on a computer system consists of six, seven,
or eight characters. Each of these characters must be a digit or a letter
of the alphabet. Each password must contain at least one digit. How
many such passwords are there?

The techniques needed to answer this question and a wide variety of


other counting problems will be introduced in this section.
Basic Counting Principle – Product Rule

A new company with just two employees, Sanchez and Patel, rents a floor of a building with 5
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
Sanchez, which can be done in 5 ways, then assigning an office to Patel different from the
office assigned to Sanchez, which can be done in 4 ways. By the product rule, there are
5·4=20 ways to assign offices to these two employees
Product Rule
The chairs of an auditorium are to be labeled with an uppercase English letter followed by
a positive integer not exceeding 100. What is the largest number of chairs that can be
labeled differently?

Solution:
The procedure of labeling a chair consists of two tasks, namely, assigning to the seat one of the 26
uppercase English letters, and then assigning to it one of the 100 possible integers. The product rule
shows that there are 26·100=2600 different ways that ac hair can be labeled. Therefore, the
largest number of chairs that can be labeled differently is 2600.

How many different bit strings of length seven are there?

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 𝟐𝟕 =128 different bit strings of length seven.
Product Rule
If I have 4 different T-shirts and 3 different pairs of shorts, how many different outfits do I
have?

During a local campaign, 3 Republican and 2 Democratic candidates are nominated for president of
the school board. How many possibilities exist for a pair of candidates (one from each party) to
oppose each other for the eventual election.
Product Rule
A student ID is made up of 3 upper-case letters followed by two digits.

1. How many possible IDs exist?

2. How many IDs are possible if duplicate letters or numbers aren’t allowed?
Basic Counting Principle – Sum Rule

Suppose that either a member of the mathematics faculty or a student who is a mathematics
major is chosen as a representative to a university committee. How many different choices are
there for this representative if there are 37 members of the mathematics faculty and 83
mathematics majors and no one is both a faculty member and a student?

Solution:
There are 37 ways to choose a member of the mathematics faculty and there are 83 ways to
choose a student who is a mathematics major. Choosing a member of the mathematics
faculty is never the same as choosing a student who is a mathematics major because no one
is both a faculty member and a student. By the sum rule it follows that there are
37+83=120 possible ways to pick this representative.
Sum Rule
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.
Sum Rule
If we roll two dice, one green and one red, how many ways are there to get a sum of 7
or 11?

During a local campaign, 3 Republican and 2 Democratic candidates are nominated for
president of the school board. If the president is to be one of these candidates, how
many possibilities are there for an eventual winner?
Sum Rule
A woman has decided to shop at one store today, either in the north part of town or the
south part of town. If she visits the north part of town, she will shop at either a mall, a
furniture store, or a jewelry store. If she visits the south part of the town then she will
shop at either a clothing store or shoe store. How many possible shops are there?

A computer science instructor has two colleagues. One colleagues has 3 textbooks on
the analysis of algorithms and the other has 5 textbooks. If n denotes the maximum
number of different books on this topic that this instructor can borrow, give possible
value (s) for n.
Subtraction Rule/Principle of Inclusion-Exclusion

Note: The subtraction rule is also known as the principle of inclusion–exclusion


Subtraction Rule
How many bit strings of length eight either start with a 1 bit or end with the two bits 00?

We can construct a bit string of length eight that begins with a 1 in 27 = 128 ways.

We can construct a bit string of length eight ending with the two bits 00, in 26 =64 ways.

Some of the ways to construct a bit string of length eight starting with a 1 are the same
as the ways to construct a bit string of length eight that ends with the two bits 00.
There are 25 =32 ways to construct such a string.

Consequently, the number of bit strings of length eight that begin with a 1 or end with a 00, which equals the
number of ways to construct a bit string of length eight that begins with a 1 or that ends with 00, equals
128+64−32=160.
Subtraction Rule
How many bit strings of length 7 either start with “1” bit or end with 3 bits “000”?

A software company receives 200 applications from collage graduations for a job planning
a new education technology application. If 107 of the applicants majored in web
development, 116 majored in computer science, and 23 majored in something else, how
many applicants majored in both web development and computer science?
Basic Counting Principle – Division Rule

How many different ways are there to seat four people around a circular table, where two
seatings are considered the same when each person has the same left neighbor and the same
right neighbor?
Solution:
We arbitrarily select a seat at the table and label it seat 1. We number the rest of the seats in numerical order,
proceeding clockwise around the table. Note that are four ways to select the person for seat 1, three ways to select
the person for seat 2, two ways to select the person for seat 3, and one way to select the person for seat 4. Thus,
there are 4!=24 ways to order the given four people for these seats. However, each of the four choices for seat 1
leads to the same arrangement, as we distinguish two arrangements only when one of the people has a different
immediate left or immediate right neighbor. Because there are four ways to choose the person for seat 1, by the
division rule there are 24/4=6 different seating arrangements of four people around the circular table.
Division Rule
Let's say we want to arrange (1,1,2,3,4) in a row.
Tree Diagram
Counting problems can be solved using tree diagrams. A tree
consists of a root, a number of branches leaving the root, and
possible additional branches leaving the endpoints of other branches.
To use trees in counting, we use a branch to represent each possible
choice. We represent the possible outcomes by the leaves, which are
the endpoints of branches not having other branches starting at them.
Tree Diagram
How many bit strings of length four do not have two consecutive 1s?

Solution:
The tree diagram in Figure 2 displays all bit strings of length four without
two consecutive 1s. We see that there are eight bit strings of length
four without two consecutive 1s
Tree Diagram
Suppose that “I Love New Jersey” T-shirts come in five different sizes: S, M, L, XL, and XXL.
Further suppose that each size comes in four colors, white, red, green, and black, except for
XL, which comes only in red, green, and black, and XXL, which comes only in green and
black. How many different shirts does a souvenir shop have to stock to have at least one of
each available size and color of the T-shirt?

Solution:
The tree diagram displays all possible
size and color pairs. It follows that the
souvenir shop owner needs to stock
17 different T-shirts.
Exercise
1. There are 18 mathematics majors answers for each question.
and 325 computer science majors at a) In how many ways can a student answer
a college. the questions on the test if the student
a) In how many ways can two answers every question?
representatives be picked so that one is b) In how many ways can a student answer
a mathematics major and the other is a the questions on the test if the student
computer science major? can leave answers blank?
b) In how many ways can one 4. A particular brand of shirt comes in
representative be picked who is either a 12 colors, has a male version and a
mathematics major or a computer
science major? female version, and comes in three
sizes for each sex. How many
2. An office building contains 27 floors different types of this shirt are
and has 37 offices on each floor. How made?
many offices are in the building?
3. A multiple-choice test contains 10
questions. There are four possible

You might also like