You are on page 1of 53

Discrete Structures

Chapter 6
Counting

Prof. Dr. Malik Sikander Hayat Khiyal


Faculty of Computer Science,
Preston University, Islamabad Campus,
85, Street 3, Sector H-8/1,
Islamabad, PAKISTAN.
drsikandarhayat@preston.edu.pk
01/31/24 Discrete Mathematics Chapter 6 1
Discrete Structures Contents
Chapter 1. The Foundations: Logic and Proofs
Chapter 2. Basic Structures: Sets, Functions, Sequences, and Sums
Chapter 3. The Fundamentals: Algorithms, the Integers, and Matrices
Chapter 4. Number Theory and Cryptography
Chapter 5. Induction and Recursion
Chapter 6. Counting
Chapter 7. Discrete Probability
Chapter 8. Advanced Counting Technique
Chapter 9. Relations
Chapter 10. Graphs
Chapter 11. Trees
Chapter 12. Boolean Algebra

01/31/24 Discrete Mathematics Chapter 6 2


Basic Counting Principles
Counting problems are of the following kind:
“How many different 8-letter passwords are there?”
“How many possible ways are there to pick 11 soccer
players out of a 20-player team?”
Most importantly, counting is the basis for computing
probabilities of discrete events.
(“What is the probability of winning the lottery?”)

01/31/24 Discrete Mathematics Chapter 6 3


Basic Counting Principles
The sum rule:
If a task can be done in n1 ways and a second task in n2
ways, and if these two tasks cannot be done at the same
time, then there are n1 + n2 ways to do either task.
Example:
The department will award a free computer to either a CS
student or a CS professor.
How many different choices are there, if there are 530
students and 15 professors?
There are 530 + 15 = 545 choices.

01/31/24 Discrete Mathematics Chapter 6 4


Basic Counting Principles
Example: 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.
01/31/24 Discrete Mathematics Chapter 6 5
Basic Counting Principles
Generalized sum rule:
If we have tasks T1, T2, …, Tm that can be done in n1, n2, …,
nm ways, respectively, and no two of these tasks can be done
at the same time, then there are n1 + n2 + … + nm ways to do
one of these tasks.
Example: 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.
01/31/24 Discrete Mathematics Chapter 6 6
Basic Counting Principles
Example: What is the value of k after the following
code, where n1, n2, … , nm are positive integers,
has been executed?
k := 0
for i1 := 1 to n1
k := k + 1
for i2 := 1 to n2
k := k + 1
...
for im := 1 to nm
k := k + 1

01/31/24 Discrete Mathematics Chapter 6 7


Basic Counting Principles
Solution: The initial value of k is zero. This
block of code is made up of m different loops.
Each time a loop is traversed, 1 is added to k.
To determine the value of k after this code
has been executed, we need to determine how
many times we traverse a loop. Note that
there are ni ways to traverse the ith loop.
Because we only traverse one loop at a time,
the sum rule shows that the final value of k,
which is the number of ways to traverse one
of the m loops is n1 + n2 + ⋯ + nm.
01/31/24 Discrete Mathematics Chapter 6 8
Basic Counting Principles
The product rule:
Suppose that a procedure can be broken down into two
successive tasks. If there are n1 ways to do the first task
and n2 ways to do the second task after the first task has
been done, then there are n1n2 ways to do the procedure.

Example: How many different license plates are there


that containing exactly three English letters ?
Solution:
There are 26 possibilities to pick the first letter, then 26
possibilities for the second one, and 26 for the last one.
So there are 262626 = 17576 different license plates.
01/31/24 Discrete Mathematics Chapter 6 9
Basic Counting Principles
Example: A new company with just two employees,
Sanchez and Patel, 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
Sanchez, which can be done in 12 ways, then
assigning an office to Patel different from the office
assigned to Sanchez, which can be done in 11 ways.
By the product rule, there are 12 ⋅ 11 = 132 ways to
assign offices to these two employees.

01/31/24 Discrete Mathematics Chapter 6 10


Basic Counting Principles
Example: There are 32 computers in a data center in
the cloud. Each of these computers has 24 ports.
How many different computer ports are there in
this data center?
Solution: The procedure of choosing a port consists
of two tasks, first picking a computer and
then picking a port on this computer. Because
there are 32 ways to choose the computer and 24
ways to choose the port no matter which computer
has been selected, the product rule shows that
there are 32 ⋅ 24 = 768 ports.

01/31/24 Discrete Mathematics Chapter 6 11


Basic Counting Principles
Generalized product rule:
If we have a procedure consisting of sequential tasks
T1, T2, …, Tm that can be done in n1, n2, …, nm ways,
respectively, then there are n1  n2  …  nm ways to
carry out the procedure.
Example: 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.

01/31/24 Discrete Mathematics Chapter 6 12


Basic Counting Principles
Example: Counting Functions How many functions
are there from a set with m elements to a set with
n elements?
Solution: A function corresponds to a choice of one
of the n elements in the codomain for each of the
m elements in the domain. Hence, by the product
rule there are n ⋅ n ⋅ ⋯ ⋅ n = nm functions from a
set with m elements to one with n elements. For
example, there are 53 = 125 different functions
from a set with three elements to a set with five
elements.

01/31/24 Discrete Mathematics Chapter 6 13


Basic Counting Principles
Example: Counting One-to-One Functions How many one-to-one
functions are there from a set with m elements to one with n
elements?
Solution: First note that when m>n there are no one-to-one functions
from a set with m elements to a set with n elements.
Now let m≤n. Suppose the elements in the domain are a1,a2, … ,am.
There are n ways to choose the value of the function at a1. Because
the function is one-to-one, the value of the function at a2 can be
picked in n−1 ways.
In general, the value of the function at ak can be chosen in n−k+1
ways. By the product rule, there are n(n−1)(n−2) ⋯ (n−m+1) one-to-
one functions from a set with m elements to one with n elements.
For example, there are 5⋅4⋅3 = 60 one-to-one functions from a set
with three elements to a set with five elements.

01/31/24 Discrete Mathematics Chapter 6 14


Basic Counting Principles
Example: What is the value of k after the following
code, where n1, n2, …, nm are positive integers, has
been executed?
k := 0
for i1 := 1 to n1
for i2 := 1 to n2
⋅⋅⋅
for im := 1 to nm
k := k + 1

01/31/24 Discrete Mathematics Chapter 6 15


Basic Counting Principles
Solution: The initial value of k is zero. Each time the
nested loop is traversed, 1 is added to k. Let Ti be
the task of traversing the ith loop. Then the
number of times the loop is traversed is the
number of ways to do the tasks T1, T2, … , Tm. The
number of ways to carry out the task Tj, j = 1, 2,
… , m, is nj, because the jth loop is traversed once
for each integer ij with 1 ≤ ij ≤ nj. By the product
rule, it follows that the nested loop is traversed
n1n2…nm times. Hence, the final value of k is
n1n2…nm.
01/31/24 Discrete Mathematics Chapter 6 16
Basic Counting Principles
The sum and product rules can also be phrased in terms of
set theory.
Sum rule: Let A1, A2, …, Am be disjoint sets. Then the
number of ways to choose any element from one of these
sets is |A1  A2  …  Am | =
|A1| + |A2| + … + |Am|.

Product rule: Let A1, A2, …, Am be finite sets. Then the


number of ways to choose one element from each set in
the order A1, A2, …, Am is
|A1  A2  …  Am | = |A1|  |A2|  …  |Am|.
01/31/24 Discrete Mathematics Chapter 6 17
Basic Counting Principles
Example: Each user on a computer system has a password, which is
six to eight characters long, where each character is an uppercase
letter or a digit. Each password must contain at least one digit.
How many possible passwords are there?
Solution: Let P be the total number of possible passwords, and let
P6, P7, and P8 denote the number of possible passwords of length
6, 7, and 8, respectively. By the sum rule, P = P6+P7+P8 . We
will now find P6, P7, and P8 . Finding P6 directly is difficult. To
find P6 it is easier to find the number of strings of uppercase
letters and digits that are six characters long, including those
with no digits, and subtract from this the number of strings with
no digits. By the product rule, the number of strings of six
characters is 366, and the number of strings with no digits is 266.
Hence,

01/31/24 Discrete Mathematics Chapter 6 18


Basic Counting Principles
P6 = 366 − 266 = 2,176,782,336 − 308,915,776
= 1,867,866,560.
Similarly, we have
P7 = 367 − 267 = 78,364,164,096 − 8,031,810,176
= 70,332,353,920
and
P8 = 368 − 268 = 2,821,109,907,456 − 208,827,064,576
= 2,612,282,842,880.
Consequently,
P = P6 + P7 + P8 = 2,684,483,063,360.

01/31/24 Discrete Mathematics Chapter 6 19


Inclusion-Exclusion

THE SUBTRACTION RULE


If a task can be done in either n1 ways or n2 ways,
then the number of ways to do the task is n1 + n2
minus the number of ways to do the task that are
common to the two different ways.
The subtraction rule is also known as the principle
of inclusion–exclusion, especially when
it is used to count the number of elements in the
union of two sets

01/31/24 Discrete Mathematics Chapter 6 20


Inclusion-Exclusion
Example: How many bit strings of length 8 either start with a
1 or end with 00?
Task 1: Construct a string of length 8 that starts with a 1.
There is one way to pick the first bit (1),
two ways to pick the second bit (0 or 1),
two ways to pick the third bit (0 or 1),
.
.
.
two ways to pick the eighth bit (0 or 1).
Product rule: Task 1 can be done in 127 = 128 ways.

01/31/24 Discrete Mathematics Chapter 6 21


Inclusion-Exclusion
Task 2: Construct a string of length 8 that ends with 00.
There are two ways to pick the first bit (0 or 1),
two ways to pick the second bit (0 or 1),
.
.
.
two ways to pick the sixth bit (0 or 1),
one way to pick the seventh bit (0), and
one way to pick the eighth bit (0).
Product rule: Task 2 can be done in 26 = 64 ways.

01/31/24 Discrete Mathematics Chapter 6 22


Inclusion-Exclusion
Since there are 128 ways to do Task 1 and 64 ways to do
Task 2, does this mean that there are 192 bit strings either
starting with 1 or ending with 00 ?
No, because here Task 1 and Task 2 can be done at the
same time.
When we carry out Task 1 and create strings starting with 1,
some of these strings end with 00.
Therefore, we sometimes do Tasks 1 and 2 at the same
time, so the sum rule does not apply.

01/31/24 Discrete Mathematics Chapter 6 23


Inclusion-Exclusion
If we want to use the sum rule in such a case, we have to
subtract the cases when Tasks 1 and 2 are done at the same
time.
How many cases are there, that is, how many strings start
with 1 and end with 00?
There is one way to pick the first bit (1),
two ways for the second, …, sixth bit (0 or 1),
one way for the seventh, eighth bit (0).
Product rule: In 25 = 32 cases, Tasks 1 and 2 are carried
out at the same time.

01/31/24 Discrete Mathematics Chapter 6 24


Inclusion-Exclusion
Since there are 128 ways to complete Task 1 and 64 ways
to complete Task 2, and in 32 of these cases Tasks 1 and 2
are completed at the same time, there are
128 + 64 – 32 = 160 ways to do either task.

In set theory, this corresponds to sets A1 and A2 that are not


disjoint. Then we have:
|A1  A2| = |A1| + |A2| - |A1  A2|

This is called the principle of inclusion-exclusion.

01/31/24 Discrete Mathematics Chapter 6 25


The Division Rule
THE DIVISION RULE There are n∕d ways to do a task if it
can be done using a procedure that can be carried out in
n ways, and for every way w, exactly d of the n ways
correspond to way w.
We can restate the division rule in terms of sets: “If the
finite set A is the union of n pairwise disjoint subsets
each with d elements, then n = |A|∕d.”
We can also formulate the division rule in terms of
functions: “If f is a function from A to B where A and B
are finite sets, and that for every value y ∈ B there are
exactly d values x ∈ A such that f (x) = y (in which case,
we say that f is d-to-one), then |B| = |A|∕d.”

01/31/24 Discrete Mathematics Chapter 6 26


The Division Rule
Example : Suppose that an automated system has
been developed that counts the legs of cows in a
pasture. Suppose that this system has determined
that in a farmer’s pasture there are exactly 572
legs. How many cows are there is this pasture,
assuming that each cow has four legs and that
there are no other animals present?
Solution: Let n be the number of cow legs counted in
a pasture. Because each cow has four legs, by the
division rule we know that the pasture contains n∕4
cows. Consequently, the pasture with 572 cow
legs has 572∕4 = 143 cows in it.
01/31/24 Discrete Mathematics Chapter 6 27
Tree Diagrams
How many bit strings of length four do not have two
consecutive 1s?
Task 1 Task 2 Task 3 Task 4
(1st bit) (2nd bit) (3rd bit) (4th bit)
0
0
0
1
0 1
0
1 0 0
1
0 0
1 0
1
1
0
There are 8 strings.
01/31/24 Discrete Mathematics Chapter 6 28
The Pigeonhole Principle
The pigeonhole principle: If (k + 1) or more objects are
placed into k boxes, then there is at least one box containing
two or more of the objects.
Example 1: If there are 11 players in a soccer team that
wins 12-0, there must be at least one player in the team who
scored at least twice.
Example 2: If you have 6 classes from Monday to Friday,
there must be at least one day on which you have at least
two classes.

01/31/24 Discrete Mathematics Chapter 6 29


The Pigeonhole Principle
The generalized pigeonhole principle: If N objects are
placed into k boxes, then there is at least one box containing
at least N/k of the objects.
Example: In our 60-student class, at least 12 students will
get the same letter grade (A, B, C, D, or F).

01/31/24 Discrete Mathematics Chapter 6 30


The Pigeonhole Principle
Example: Assume you have a drawer containing a random
distribution of a dozen brown socks and a dozen black
socks. It is dark, so how many socks do you have to pick to
be sure that among them there is a matching pair?

There are two types of socks, so if you pick at least 3 socks,


there must be either at least two brown socks or at least two
black socks.

Generalized pigeonhole principle: 3/2 = 2.

01/31/24 Discrete Mathematics Chapter 6 31


The Pigeonhole Principle
THEOREM: Every sequence of n2 + 1 distinct real
numbers contains a subsequence of length n + 1
that is either strictly increasing or strictly
decreasing.

Example: The sequence 8, 11, 9, 1, 4, 6, 12, 10, 5, 7


contains 10 terms. Note that 10 = 3 2 + 1. There are
four strictly increasing subsequences of length
four, namely, 1, 4, 6, 12; 1, 4, 6, 7; 1, 4, 6, 10; and
1, 4, 5, 7. There is also a strictly decreasing
subsequence of length four, namely, 11, 9, 6, 5.
01/31/24 Discrete Mathematics Chapter 6 32
Permutations and Combinations
How many ways are there to pick a set of 3 people from
a group of 6?
There are 6 choices for the first person, 5 for the second
one, and 4 for the third one, so there are 654 = 120
ways to do this.
This is not the correct result!
For example, picking person C, then person A, and then
person E leads to the same group as first picking E, then
C, and then A.
However, these cases are counted separately in the
above equation.

01/31/24 Discrete Mathematics Chapter 6 33


Permutations and Combinations
So how can we compute how many different subsets of
people can be picked (that is, we want to disregard the
order of picking) ?

To find out about this, we need to look at permutations.

A permutation of a set of distinct objects is an ordered


arrangement of these objects.

An ordered arrangement of r elements of a set is called


an r-permutation.

01/31/24 Discrete Mathematics Chapter 6 34


Permutations and Combinations
Example: Let S = {1, 2, 3}.
The arrangement 3, 1, 2 is a permutation of S.
The arrangement 3, 2 is a 2-permutation of S.

The number of r-permutations of a set with n distinct


elements is denoted by P(n, r).

We can calculate P(n, r) with the product rule:


P(n, r) = n(n – 1)(n – 2) …(n – r + 1).
(n choices for the first element, (n – 1) for the second
one, (n – 2) for the third one…)
01/31/24 Discrete Mathematics Chapter 6 35
Permutations and Combinations
Example: How many ways are there to select a
first-prize winner, a second-prize winner, and a
third-prize winner from 100 different people
who have entered a contest?
Solution: Because it matters which person wins
which prize, the number of ways to pick the
three prize winners is the number of ordered
selections of three elements from a set of 100
elements, that is, the number of 3-permutations
of a set of 100 elements. Consequently, the
answer is P(100, 3) = 100 ⋅ 99 ⋅ 98 = 970,200.

01/31/24 Discrete Mathematics Chapter 6 36


Permutations and Combinations
Example: Suppose that there are eight runners in a
race. The winner receives a gold medal, the second-
place finisher receives a silver medal, and the third-
place finisher receives a bronze medal. How many
different ways are there to award these medals, if
all possible outcomes of the race can occur and
there are no ties?
Solution: The number of different ways to award the
medals is the number of 3- permutations of a set
with eight elements. Hence, there are
P(8,3) = 8⋅7⋅6 = 336 = (87654321)/(54321)
possible ways to award the medals.
01/31/24 Discrete Mathematics Chapter 6 37
Permutations and Combinations
General formula:
P(n, r) = n!/(n – r)!

Knowing this, we can return to our initial question:


How many ways are there to pick a set of 3 people from a
group of 6 (disregarding the order of picking)?

01/31/24 Discrete Mathematics Chapter 6 38


Permutations and Combinations
An r-combination of elements of a set is an unordered
selection of r elements from the set.
Thus, an r-combination is simply a subset of the set with r
elements.
Example: Let S = {1, 2, 3, 4}.
Then {1, 3, 4} is a 3-combination from S.
The number of r-combinations of a set with n distinct
elements is denoted by C(n, r).
Example: C(4, 2) = 6, since, for example, the 2-
combinations of a set {1, 2, 3, 4} are {1, 2}, {1, 3}, {1, 4},
{2, 3}, {2, 4}, {3, 4}.
01/31/24 Discrete Mathematics Chapter 6 39
Permutations and Combinations
How can we calculate C(n, r)?
Consider that we can obtain the r-permutation of a set in the
following way:
First, we form all the r-combinations of the set
(there are C(n, r) such r-combinations).
Then, we generate all possible orderings in each of these r-
combinations (there are P(r, r) such orderings in each case).

Therefore, we have:
P(n, r) = C(n, r)P(r, r)

01/31/24 Discrete Mathematics Chapter 6 40


Permutations and Combinations
C(n, r) = P(n, r)/P(r, r)
= n!/(n – r)!/(r!/(r – r)!)
= n!/(r!(n – r)!)

Now we can answer our initial question:


How many ways are there to pick a set of 3 people from a
group of 6 (disregarding the order of picking)?
C(6, 3) = 6!/(3!3!) = 720/(66) = 720/36 = 20

There are 20 different ways, that is, 20 different groups to


be picked.

01/31/24 Discrete Mathematics Chapter 6 41


Permutations and Combinations
Corollary:
Let n and r be nonnegative integers with r  n.
Then C(n, r) = C(n, n – r).

Note that “picking a group of r people from a group of n


people” is the same as “splitting a group of n people into a
group of r people and another group of (n – r) people”.

01/31/24 Discrete Mathematics Chapter 6 42


Permutations and Combinations
Example:
A soccer club has 8 female and 7 male members. For
today’s match, the coach wants to have 6 female and 5
male players on the grass. How many possible
configurations are there?

C(8, 6)  C(7, 5) = 8!/(6!2!)  7!/(5!2!)


= 2821
= 588

01/31/24 Discrete Mathematics Chapter 6 43


Permutations and Combinations
Example: How many poker hands of five cards can be
dealt from a standard deck of 52 cards? Also, how
many ways are there to select 47 cards from a
standard deck of 52 cards?
Solution: Because the order in which the five cards are
dealt from a deck of 52 cards does not matter, there
are
C(52, 5) = (52!)/(5!47!)
different hands of five cards that can be dealt. To
compute the value of C(52, 5), first divide the
numerator and denominator by 47! to obtain
C(52, 5) = (52 ⋅ 51 ⋅ 50 ⋅ 49 ⋅ 48)/(5 ⋅ 4 ⋅ 3 ⋅ 2 ⋅ 1)
01/31/24 Discrete Mathematics Chapter 6 44
Permutations and Combinations
It can be written as
C(52, 5) = 26 ⋅ 17 ⋅ 10 ⋅ 49 ⋅ 12 = 2,598,960.
Consequently, there are 2,598,960 different poker
hands of five cards that can be dealt from a
standard deck of 52 cards.
Note that there are C(52, 47) = (52!)(47!5!)
different ways to select 47 cards from a standard
deck of 52 cards. We do not need to compute this
value because C(52, 47) = C(52, 5).

01/31/24 Discrete Mathematics Chapter 6 45


Combinations
We also saw the following:

This symmetry is intuitively plausible. For example, let us consider a


set containing six elements (n = 6).
Picking two elements and leaving four is essentially the same as
picking four elements and leaving two.
In either case, our number of choices is the number of possibilities to
divide the set into one set containing two elements and another set
containing four elements.

01/31/24 Discrete Mathematics Chapter 6 46


Combinations

Pascal’s Identity:

Let n and k be positive integers with n  k.


Then C(n + 1, k) = C(n, k – 1) + C(n, k).

How can this be explained?

What is it good for?

01/31/24 Discrete Mathematics Chapter 6 47


Combinations
Imagine a set S containing n elements and a set T
containing (n + 1) elements, namely all elements in S plus
a new element a.
Calculating C(n + 1, k) is equivalent to answering the
question: How many subsets of T containing k items are
there?
Case I: The subset contains (k – 1) elements of S
plus the element a: C(n, k – 1) choices.
Case II: The subset contains k elements of S and
does not contain a: C(n, k) choices.
Sum Rule: C(n + 1, k) = C(n, k – 1) + C(n, k).
01/31/24 Discrete Mathematics Chapter 6 48
Pascal’s Triangle
In Pascal’s triangle, each number is the sum of the
numbers to its upper left and upper right:

1 1

1 2 1

1 3 3 1

1 4 6 4 1
… … … … … …

01/31/24 Discrete Mathematics Chapter 6 49


Pascal’s Triangle
Since we have C(n + 1, k) = C(n, k – 1) + C(n, k) and
C(0, 0) = 1, we can use Pascal’s triangle to simplify the
computation of C(n, k):

C(0, 0) = 1
C(1, 0) = 1 C(1, 1) = 1
n
C(2, 0) = 1 C(2, 1) = 2 C(2, 2) = 1
C(3, 0) = 1 C(3, 1) = 3 C(3, 2) = 3 C(3, 3) = 1
C(4, 0) = 1 C(4, 1) = 4 C(4, 2) = 6 C(4, 3) = 4 C(4, 4) = 1

01/31/24 Discrete Mathematics Chapter 6 50


Binomial Coefficients
Expressions of the form C(n, k) are also called binomial
coefficients.
How come?
A binomial expression is the sum of two terms, such as
(a + b).
Now consider (a + b)2 = (a + b)(a + b).
When expanding such expressions, we have to form all
possible products of a term in the first factor and a term in
the second factor:
(a + b)2 = a·a + a·b + b·a + b·b
Then we can sum identical terms:
(a + b)2 = a2 + 2ab + b2
01/31/24 Discrete Mathematics Chapter 6 51
Binomial Coefficients
For (a + b)3 = (a + b)(a + b)(a + b) we have
(a + b)3 = aaa + aab + aba + abb + baa + bab + bba + bbb
(a + b)3 = a3 + 3a2b + 3ab2 + b3
There is only one term a3, because there is only one
possibility to form it: Choose a from all three factors: C(3,
3) = 1.
There is three times the term a2b, because there are three
possibilities to choose a from two out of the three factors:
C(3, 2) = 3.
Similarly, there is three times the term ab2
(C(3, 1) = 3) and once the term b3 (C(3, 0) = 1).
01/31/24 Discrete Mathematics Chapter 6 52
Binomial Coefficients
This leads us to the following formula:
n
(a  b) n   C (n, j )  a n  j b j (Binomial Theorem)
j 0

With the help of Pascal’s triangle, this formula can considerably


simplify the process of expanding powers of binomial expressions.
For example, the fifth row of Pascal’s triangle
(1 – 4 – 6 – 4 – 1) helps us to compute (a + b)4:
(a + b)4 = a4 + 4a3b + 6a2b2 + 4ab3 + b4

01/31/24 Discrete Mathematics Chapter 6 53

You might also like