Chapter 1
Chapter 1
Introduction
How many two digit even numbers are there that are greater than 58?
How many four digit password can we create using numbers 1, 2, 3 and 4?
We can solve the above problems using counting rules. The basic rules of counting can solve a
tremendous variety of problems in mathematics and computer science.
We will see an efficient way of counting large masses of statistical data. The techniques we develop
in this section will enable us to count:
The number of ways to perform different tasks
The number of samples space of an experiment
The number possible outcomes of an event.
Some key terminologies:
Experiment
An experiment is any process or activity that generates well defined outcomes. For instance, tossing a
coin, rolling a die, play a football match, choosing a prime number less than 100, etc. can be taken as
experiments.
Outcome
An outcome is a particular result of an experiment. For example, getting either head or tail is a
possible outcome of the experiment tossing a coin. Winning, loosing or tie/draw is the possible
1
outcomes of the experiment playing a football match, and getting 1, 2, 3, 4, 5 or 6 are possible
outcomes of the rolling a die experiment.
Event
Event (E) is a set of desired outcomes of an experiment. It is a specific collection of basic outcomes,
that is, a set containing one or more of the basic outcomes from the sample space. For example, in the
rolling a die experiment, an even number occurs or head occurs when we toss a coin can be taken as
an event.
Sample Space
A sample space (S) is the set of all possible outcomes of an experiment. The sample space of an
experiment is usually illustrated either by a list or some type of diagram- Venn diagrams and tree
diagrams.
The following example shows an illustration of an experiment, outcomes, events and sample space.
Example
Tossing/Flipping a coin twice-------------------- Experiment
Heads or Tails -------------------------------------Outcomes
------------------------------------4 Events
* +---------------------------------- Sample Space
Exercise
Identify the experiment, outcomes, events and sample space for the following questions.
1. Sitting for an exam -----------------------------
Scoring ----------------------------
* + ----------------------------------
Scoring and above ---------------------------
Scoring and above ---------------------------
Scoring or below ----------------------------
2. Football game ------------------------------------------
Win, Lose, Tie/Draw -----------------------------------
* +-------------------------------------------------
Not winning (L, D) -------------------------------------
Not losing (W, D) --------------------------------------
2
Combined Events
We can combine events to form new events using set operations such as union, intersection, etc.
Let and be two events:
is the event that either or occurs (or both)
is the event that both and occurs.
the complement of event , is the event that occurs if does not occur.
Mutually exclusive events/ Disjoint Events
Two events and are called mutually exclusive if they are disjoint. In other words, mutually
exclusive events cannot occur simultaneously and therefore can have no intersection.
That is . In the toss of a single coin, the events of heads and tails are mutually exclusive.
The person tossing the coin gets either a head or a tail but never both.
Exercise
Experiment: Toss a die and observe the number that appears on the top. Then find
a. The sample space S
b. The event that an even number occurs
c. The event that an odd number occurs
d. The event that a prime number occurs.
Notation: The number of outcomes of event E is denoted by ( ) or | |.
1.1 Basic counting principle
Let 𝐸 and 𝐸 be two mutually exclusive events and let 𝐸 describes the situation where either event 𝐸
or event 𝐸 Suppose
Example: will occur. Theare
there number
maleofand event 𝐸
timesfemale will occurteaching
instructors can be given bymathematics
discrete the expression:
in AAU.
In how many ways can a |𝐸|
student|𝐸choose
| + |𝐸a |discrete instructor in order to take the course?
3
Example: Suppose there are 4 male and 3 female instructors teaching discrete mathematics in AAU.
In how many ways can a student choose a discrete instructor in order to take the course?
Solution: The student faced with two tasks and he/she is forced to choose either male or female
instructors.
Given | | and | | . Thus, by addition rule, the student can perform the task in
| | | |+| | + ways.
Example: If there are boys and girls in a class, there are + ways of selecting
student (either a boy or a girl) as class representative.
Example: If is the task of choosing a positive composite number less than and is the task of
choosing a positive odd number less than in how many ways either event or event can be
accomplished.
Solution: The task can be performed in ( ) ways since * + and the task can
be performed in ( ) ways, since * +. However, or cannot be
accomplished in | | + | | + ways. This is because the number is both a composite and an
odd number less than Note that the two tasks are not mutually exclusive.
Exercise: In how many ways a number can be choose from 1 to 22 such that
a. If it is a multiple of 3 or 8.
b. If it is a multiple of 4 or 7.
The addition rule can be extended beyond two tasks as long as no pair of tasks can occur
simultaneously.
4
We can give another formulation in terms of sets. Let … be pairwise disjoint sets.
Example: One can reach city from city by sea, air and road. Suppose that there are ways by
sea, ways by air and ways by road. Then by (AP), the total number of ways from to by sea, air
or road is + +
Exercise: In how many ways we can select a number from 1 to 34 which is a multiple of 5, 7 or 11?
Multiplication Rule
Suppose a procedure 𝐸 can be accomplished with two disjoint subtasks. If there are 𝑚 ways of doing
the first task and 𝑛 ways of doing the second task, then there are 𝑚𝑛 ways of doing the overall
procedure.
Example: How many two digit even numbers are there those are greater than
Is there another method? The digits in the units place can be any one of the five digits this
because the numbers are even. The digits in the place is because the number is greater
than
Example: Suppose there are three towns A, B and C. If there are roads from town to town and
roads from town to town , in how many ways a person travel from town to town via
5
Solution: Let‟s count the number of different routes we can take in travelling from A to C. We have
two choices of route from A to B. For each of these we choose, when we reach B we have three
choices of route from B to C. So the total number of routes from A to C is 2 × 3.
Example: Find the number of routes from A to C if there are 3 roads from A to B and 4 from B to C.
Solution: There are 3 choices of route from A to B. For each of these, there are 4 choices from B to
C. So there are 3 × 4 = 12 choices of route from A to C.
Exercise: Suppose there are 3 roads from A to B, 4 roads from B to C and 3 roads from C to another
town, D. How many possible routes are there?
Solution: As above, there are 12 choices of route from A to C. For each of these, there are 3 choices
from C to D. So there are 12×3 (i.e. 3×4×3) choices of route from A to D.
Exercise: How many two digit numbers can be formed using the numbers and so that
a. No number is repeated?
b. Number is repeated?
|𝐸 | |𝐸 | … |𝐸𝑛 | 𝑛 𝑛 … 𝑛𝑘 ways.
Example: How many four-digit must positive integers both start and end in even digits?
Solution: The first digit must come from the 4-element set * +, whereas the last digit must
come from the 5-element set * + The second and the third digits must come from the 10-
element set * … +. Therefore, the total number of such positive integers is
Example: A license plate has 3 letters followed by three numbers. How many different license plates
are there?
6
Solution: There are 26 choices for each letter and 10 choices for each digit. You can use the
fundamental counting principle to find the number of different plates.
Example: A license plate has 3 letters followed by three numbers. Every letter and number must now
be unique. How many different license plates are there?
Solution: If you cannot repeat digits there are still 10 choices for the first digit, but then only 9
remaining choices for the second digit and only 8 remaining choices for the third digit. Similarly,
there are 26 choices for the first letter, 25 choices for the second letter, and 24 choices for the third
letter. You can use the fundamental counting principle to find the number of different plates.
Solution: We first note that the number has a unique prime factorization, namely,
Remark: BY applying (MP) in a similar way, one obtains the following general result.
𝑘1 𝑘2
In general, if a natural number 𝑛 has as its prime factorization, 𝑛 𝑝 𝑝 … 𝑝𝑟 𝑘𝑟 where the 𝑝𝑖 𝑠 are
distinct primes and the 𝑘𝑖 𝑠 are positive integers, then the number of positive divisors of 𝑛 is given by:
𝑟
(𝑘 + )(𝑘 + ) … (𝑘𝑟 + ) 𝑖= (𝑘𝑖 + )
7
Summary of Addition and Product Rules
Exercise: Suppose a college has Chinese books, English books and French books. Then find
a. The number of ways a student can choose just one of the books.
b. The number of ways a student can choose one of each kind of languages.
c. The number of ways a student can choose two books of different languages.
Factorial
The product of the first consecutive positive integers is called n-factorial denoted by and defined
as:
𝑛 … (𝑛 − ) 𝑛 𝑛 (𝑛 − ) … or
𝑛 𝑛(𝑛 − )
If 𝑛 , then we define
Example:
Many counting problems can be solved by finding the number of ways to arrange a specified number
of distinct elements of a set of a particular size, where the order of the elements matter and does not
matter.
8
Exercise: How many different committees of three students can be formed from a group of five
students?
Permutation
An arrangement of a set of objects in a given order is called permutation of the objects (taken all at
a time). The fundamental counting principle can be used to determine the number of permutations of
n objects. For instance, you can find the number of ways you can arrange the letters A, B, and C by
multiplying. There are 3 choices for the first letter, 2 choices for the second letter, and 1 choice for
the third letter, so there are 3 x 2 x 1 = 6 ways to arrange the letters.
𝑛
𝑃(𝑛 𝑟) 𝑛𝑃𝑟 𝑛𝑃𝑟 or 𝑃 𝑟
.
Now let‟s work out a general formula for the number of arrangements of different objects taken at
a time. Here there are boxes to fill.
···
9
So the total number of arrangements is
( − ) ( − )… ( − + )
( − )( − ) … ( − + )( − ) …
( − )
( )
Therefore, the number of permutations of 𝑟 objects taken from a group of 𝑛 distinct objects is denoted by 𝑛𝑃𝑟
and is given by:
𝑛
𝑛𝑃𝑟 (𝑛 𝑟)
Remark: One can show that there are exactly permutations of the distinct objects. In fact, we
can use the Generalized Product Rule. There are possible outcomes of experiment 1, − for the
second, etc.
( − ) …
permutations of n objects.
Example: Evaluate a) ( ) b) ( )
Solution: a) ( ) ( )
b) ( ) ( )
a) ( ) b) ( )
10
Solution: a) ( )
( )
, by definition
( )( )
( )
( − ) −
− −
( + )( − )
− or .
b) Exercise
Example: You are considering 10 different colleges. Before you decide to apply to the colleges, you
want to visit some or all of them. In how many orders can you visit (a) 6 of the colleges and (b) all 10
colleges?
( )
( )
Example: There are boys and girls in a gathering. In how many ways can they be arranged in a
row so that
a. the girls form a single block(i.e. there is no boy between any two of the girls)?
b. the two end-positions are occupied by boys and no girls are adjacent?
Solution: a) Since the girls must be together, we can treat them as a single entity. The number of
ways to arrange boys together with this entity is ( + ) As the girls can permute among
themselves within the entity in Ways, then the total number of ways is, by (MP),
11
c) We first consider the arrangements of boys and then those of girls. There are Ways to
arrange the boys. Fix an arbitrary one of the arrangements. Since the end-positions are
occupied by boys, there are only spaces between the boys are available for the girls
and .
has choices. Since no two girls are adjacent, has choices and has Thus by (MP), the
number of such arrangements is
The number of permutations of 𝑛 different objects taken 𝑟 at a time, when each object can be repeated any
number of times in an arrangement is: 𝑛 𝑛 … 𝑛 𝑛𝑟
Example: A multiple-choice test has questions with four possible answers for each question.
How many different sets of answers are possible?
Exercise: In how many ways can three awards be given to artist, when each artist is eligible for all
a wards?
So far you have been finding permutations of distinct objects. If some of the objects are repeated,
then some of the permutations are not distinguishable.
12
Only three are distinguishable without bold: MOM, OMM, and MMO. In this case, the number of
permutations is , not
Consider a collection of 𝑛 objects, in which 𝑛 are of type , 𝑛 are of type … and 𝑛𝑟 are of type 𝑟
where 𝑛 + 𝑛 + ⋯ + 𝑛𝑟 𝑛 The number of different permutations of the collection of objects, denoted
by 𝑃(𝑛; 𝑛 𝑛 … 𝑛𝑟 ), is given by
𝑛
𝑛 𝑛 … 𝑛𝑟
Find the number of distinguishable permutations of the letters in (a) OHIO and (b) MISSISSIPPI.
Solution: a. OHIO has 4 letters of which O is repeated 2 times. So, the number of distinguishable
permutations is
Exercise: (permutations without repetition) find the number of distinguishable permutations of the
letters in the word:
a. HI e. PENCIL
b. JET f. FLORIDA
c. IOWA g. MAGNETIC
d. TEXAS h. GOLDFINCH
Exercise: (permutations with repetition) find the number of distinguishable permutations of the
letters in the word:
13
a. DAD e. ALGEBRA
b. PUPPY f. ALABAMA
c. OREGON g. MISSOURI
d. LETTER h. CONNECTICUT
Exercise: How many distinct arrangement we can perform using green, 3 yellow and 2 red balls.
CIRCULAR PERMUTATIONS
You have learned that represents the number of ways that n objects can be placed in a linear order,
where it matters which object is placed first. There are permutations which require arranging objects
in a circle so it does not matter which object is placed first. Circular permutation (arrangement) is an
arrangement of distinct objects on a circle. Two circular arrangements are the same if each element
has the same „clockwise adjacent‟ element. In other words, two circular permutations are identical if
any one of them can be obtained by a rotation of the other.
Consider the problem of arranging distinct objects around a circle. Then the three
arrangements of : are different in a line, but are identical around a circle.
To calculate the number of ways in which n objects can be arranged in a circle, we arbitrarily fix the
position of one object, so the remaining (n-1) objects can be arranged as if they were on a straight line
in ( − ) ways.
Therefore, the number of permutation of 𝑛 objects around a circle, taken altogether, is given by:
𝑄𝑛𝑛 (𝑛 − )
Exercise: In how many ways can boys and girls be seated around a table?
Example: At a dinner party 6 boys and 6 girls sit at a round table. In how many ways can they sit if:
14
Solution: A girl must follow a boy and vice versa. First the boys arranged in ( − ) ways.
Then the girls must fill up spaces, one between each two adjacent boys. Since there are spaces
for girls to fill, there are ways to arrange the girls. The total number of such arrangement is their
product .
Exercise: How many ways are there to arrange boys and girls around a table such that no two
boys are next to each other?
Solution: The boys can first be seated in ( − ) ways. The girls can then be seated in the
spaces between two boys in Ways. Thus the number of such arrangements is ( − ) .
Exercise: How many ways can 8 people sit around a circular table if
Solution: Treat Alice and Bob as a single entity and then arrange “people” in a circle. There are
two ways to combine Alice and Bob (Alice on the left or Bob on the left) and ways to arrange
people in a circle giving a total of
Solution: Simply subtract the number of ways the 8 people can be seated with Alice and Bob
adjacent which we computed in problem from the total number of ways 8 people can sit around a
circular table without any restriction to get − ( − )
Combination
A combination of elements taken at a time is any selection of of the elements where order does
not matter. Such a selection is called an r-combination; it is simply a subset with elements.
It is denoted by ( )
15
Solution: There are combinations of the objects taken at a time:
and .
Any combination of objects taken at a time determines permutations of the objects in the
combination. Thus the formula for combinations of n objects taken r at a time can be found by first
looking at the permutations of n objects taken r at a time and then dividing by the number of
permutations of r objects taken r at a time.
( ) ( )
( )
( ) ( )
𝑛
𝐶(𝑛 𝑟) 𝑟 (𝑛 𝑟)
Note: The difference between a permutation and a combination of a set of objects is that: A
permutation is an arrangement of certain objects and thus the ordering of objects is important,
whereas a combination is just a set of objects and thus the ordering of objects is immaterial.
Example: In how many ways can a committee of five be chosen from a group of members of an
association?
Solution:
( )
( − )
Example: A farmer buys cows, pigs, and hens from a man who has cows, pigs and hens.
Find the number of choices that the farmer has.
Solution:
Exercise: A class has male students and female students. How many ways can the class select
a committee of people if the committee has to include males and females?
16
Solution:
Exercise: In how many ways can players be chosen from a group of players if
Exercise: In how many ways a committee of be formed from a group of people consisting of
teachers and students if
Solution: There are two cases: either teachers or teachers are in the committee. In the first case,
the number of ways is while in the second case, the number of ways is
Solution: Let be the particular teacher and be the particular student. First find a committee of
which includes both and . This can be formed by taking both and from the
remaining people. Thus the number of ways to form a committee of including is
.
17
The number of ways to form a committee of which does not include both and is
− −
Complementary Combinations
Example:
+ where with
( ) ( )
Proof: + ( )( )
+ ( )
( ) ( )( )
( )
+ ( )
( ) ( )( )
( )( )
( )( )
( )( ) ( )
Exercise: Decide whether each of the following problems involves a permutation or a combination
and then work out the answer.
a. How many 4 digit numbers can be made from the digits 2, 3, 5, 6, 7 and 9 if no repetition of
digits is allowed.
b. A student has to answer 8 out of 10 questions in an exam. How many different choices has
she?
c. How many different car number plates can be made if each plate contains 3 different letters
followed by 3 distinct digits?
d. How many ways are there of playing a game of lotto requiring you to select 6 correct numbers
out of 44?
18
The Binomial Theorem
The quantities are called binomial coefficients in the expansion of positive integer powers
of ( + ) , where
Example: ( + ) + +
( + ) + + +
( + ) + + + +
𝑛 𝑛 𝑛 𝑛 𝑛
(𝑥 + 𝑦)𝑛 ( ) 𝑥𝑛 + ( ) 𝑥𝑛 𝑦 + ( ) 𝑥𝑛 𝑦 + ⋯ ( ) 𝑥𝑦 𝑛 + ( ) 𝑦𝑛
𝑛− 𝑛
𝑛
𝑛
∑ ( ) 𝑥𝑛 𝑟 𝑦𝑟
𝑟
𝑟=
1. If , then
( + ) ( )+( ) + ( ) +⋯ ( ) + ( )
−
2. If , then
( ) ( )+( )+ ( )+⋯ +( )+ ( ) ∑( )
−
=
3. If and − , then
( ) − ( ) + ( ) − ( ) + … + (− ) ( ) ∑(− ) ( )
=
( + ) ( ) +( ) + ( ) +( ) + ( ) + ( )
+ + + + +
19
Example: Find the expansion of ( + ) .
( + ) ( ) +( ) ( )+ ( ) ( ) +( ) ( ) + ( )( )
+ ( )+ ( )+ ( ) + ( )
+ + + +
Exercise: Expand ( + )
Ans. ( + ) + + + + + +
Exercise: Expand ( − )
The binomial coefficients can be in a triangular form from top to bottom and left to right in
increasing order of the values of and respectively, as shown in the figure below. This diagram is
called the Pascal triangle, after the renowned French mathematician Blaise Pascal.
20
( )
( ) ( )
( ) ( ) ( )
( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( )
( ) ( ) ( ) ( ) ( ) ( )
Recall the addition principle (AP): if … are pairwise disjoint finite sets, then (
… ) ∑= ( ). Can we find a formula for ( … ) in the case where
the given sets are not necessarily disjoint? The answer is provided by the inclusion-exclusion
formula, which we discuss now. The inclusion-exclusion formula extends the sum rule to a rule for
computing ( … ) in the case where the sets need not be pairwise disjoint.
How do we calculate ( ) for arbitrary finite sets and if ? If , then
in the counting of ( ) and ( ), the elements in are counted exactly twice.
21
The Inclusion-Exclusion Formula
Consider 𝐴 𝐵 and C any finite sets and 𝑈 a universal set. If 𝑛(𝑈) 𝑁, then
1. For each , the number of integers in which are divisible by (or multiples of n) is given
by ⌊ ⌋
⌊ ⌋ {
For instance, ⌊ ⌋ ⌊ ⌋
⌊− ⌋ − ⌊ ⌋
3. For , is divisible by both and if and only if is divisible by the LCM of
and .
22
By observation (1), ( ) ⌊ ⌋ ( ) ⌊ ⌋
( ) ( )+ ( )− ( )
+ −
( ) ⌊ ⌋ ( ) ⌊ ⌋ ( ) ⌊ ⌋
( ) ( ) ⌊ ⌋
( ) ( ) ⌊ ⌋ and ( ) ( ) ⌊ ⌋
Now, by (PIE),
( )
( )+ ( )+ ( )− ( ) − ( ) − ( )
+ ( )
+ + − − − +
Exercise: How many integers are there in which are divisible by none of
( )− ( ) −
23
Exercise: Suppose that in a group of students; taking mathematics, taking computer
science, taking information science, taking mathematics and computer science, taking
maths and information science, taking computer science and information science and taking all.
Inclusion-Exclusion Formula: Suppose 𝑛 > and 𝐴 𝐴 … 𝐴𝑛 are any finite sets. Then
Proof: If no boxes contain two or more objects, then each box contains or objects. This implies
that the total number of objects put into boxes is at most , and that is a contradiction (since we
assumed that we had + objects.)
Example: Suppose that a flock of pigeons flies into a set of pigeonholes to rest. Then at least
one of these pigeonholes must have at least two pigeons in it.
Example: If a mathematics department consists of instructors, then at least two of the instructors
(pigeons) were born in the same month (pigeonholes).
24
Example: Among any group of people, there must be at least of the same sex.
Example: In any group of English words, there must be at least two that begin with the same
letter.
Exercise: How many students must be in a class to be sure that at least two students receive the same
score on the final exam, if the exam is graded on a scale to points?
⌈ ⌉ {
For instance, ⌊ ⌋ ⌊ ⌋
⌊− ⌋ − ⌊ ⌋
Example: Among any group of 7 people, there must be at least of the same sex.
Exercise: Among people at least how many people were born in the same month.
Solution: Since there are months as boxes then at least ⌈ ⌉ people were born in the same
month.
Exercise: What is the minimum number of students required in a discrete class to be sure that at least
six will receive the same grade, if there are five possible grades, and
Solution: Let be the minimum number of students such that ⌈ ⌉ Then the smallest such
integer is ( − )+ Thus, is the minimum number of students needed to ensure
that at least six students will receive the same grade.
Exercise: What is the minimum number of students, each of whom comes from one of the regions
of Ethiopia, who must be enrolled in Addis Ababa University to guarantee that there are at least 100
who come from the same state?
Exercise: Find the minimum number of students in a class to be sure that three of them are born in
the same month?
25