Download as pdf or txt
Download as pdf or txt
You are on page 1of 138

Discrete Mathematics

Board of Studies

Prof. H. N. Verma Prof. M. K. Ghadoliya


Vice- Chancellor Director,
Jaipur National University, Jaipur School of Distance Education and Learning
Jaipur National University, Jaipur
Dr. Rajendra Takale
Prof. and Head Academics
SBPIM, Pune

___________________________________________________________________________________________
Subject Expert Panel

Dr. Ramchandra G. Pawar Ashwini Pandit


Director, SIBACA, Lonavala Subject Matter Expert
Pune

___________________________________________________________________________________________
Content Review Panel

Gaurav Modi Shubhada Pawar


Subject Matter Expert Subject Matter Expert

___________________________________________________________________________________________
Copyright ©

This book contains the course content for Discrete Mathematics.

First Edition 2013

Printed by
Universal Training Solutions Private Limited

Address
05th Floor, I-Space,
Bavdhan, Pune 411021.

All rights reserved. This book or any portion thereof may not, in any form or by any means including electronic
or mechanical or photocopying or recording, be reproduced or distributed or transmitted or stored in a retrieval
system or be broadcasted or transmitted.

___________________________________________________________________________________________
Index

I. Content....................................................................... II

II. List of Figures...........................................................VI

III. List of Tables......................................................... VII

IV. Abbreviations.......................................................VIII

V. Application. ............................................................ 119

VI. Bibliography.......................................................... 124

VII. Self Assessment Answers................................... 127

Book at a Glance

I
Contents
Chapter I........................................................................................................................................................ 1
Logic............................................................................................................................................................... 1
Aim................................................................................................................................................................. 1
Objectives....................................................................................................................................................... 1
Learning outcome........................................................................................................................................... 1
1.1 Introduction............................................................................................................................................... 2
1.2 Statement/Proposition............................................................................................................................... 2
1.3 Truth Value . .............................................................................................................................................. 2
1.4 Venn Diagrams.......................................................................................................................................... 2
1.5 Compound Statements and Logical Connectives..................................................................................... 5
1.6 Truth Tables............................................................................................................................................... 7
1.7 Tautology, Contradiction and Contingency.............................................................................................. 8
1.8 Logical Equivalence.................................................................................................................................. 9
1.9 Negation of a Compound Statement......................................................................................................... 9
1.10 Some Standard Equivalent Statements in Logic................................................................................... 10
1.11 The Use of Logic in Circuits................................................................................................................. 10
1.12 Quantifiers..............................................................................................................................................11
Summary...................................................................................................................................................... 14
References.................................................................................................................................................... 14
Recommended Reading.............................................................................................................................. 14
Self Assessment............................................................................................................................................ 15

Chapter II.................................................................................................................................................... 17
Combinatorics............................................................................................................................................. 17
Aim............................................................................................................................................................... 17
Objectives..................................................................................................................................................... 17
Learning outcome......................................................................................................................................... 17
2.1 Introduction............................................................................................................................................. 18
2.2 Basic Counting Principles....................................................................................................................... 18
2.2.1 The Sum Rule......................................................................................................................... 18
2.2.2 The Product Rule.................................................................................................................... 18
2.2.3 Inclusion and Exclusion.......................................................................................................... 19
2.2.4 Tree Diagrams......................................................................................................................... 20
2.3 The Pigeonhole Principle........................................................................................................................ 21
2.4 Permutations and Combinations............................................................................................................. 22
2.4.1 Permutation............................................................................................................................. 22
2.4.2 Combinations.......................................................................................................................... 24
2.4.3 Permutations with Indistinguishable Objects......................................................................... 24
Summary...................................................................................................................................................... 26
References.................................................................................................................................................... 26
Recommended Reading.............................................................................................................................. 26
Self Assessment............................................................................................................................................ 27

Chapter III................................................................................................................................................... 29
Mathematical Induction............................................................................................................................. 29
Aim............................................................................................................................................................... 29
Objectives..................................................................................................................................................... 29
Learning outcome......................................................................................................................................... 29
3.1 Introduction............................................................................................................................................. 30
3.2 First Principle of Mathematical Induction.............................................................................................. 30
3.3 Second Principle of Mathematical Induction.......................................................................................... 32
3.4 Different Perspective of Applying Mathematical Induction Principles ................................................. 33
3.5 Steps to Use Mathematical Induction..................................................................................................... 35

II
Summary...................................................................................................................................................... 40
References.................................................................................................................................................... 40
Recommended Reading.............................................................................................................................. 40
Self Assessment............................................................................................................................................ 41

Chapter IV................................................................................................................................................... 43
Recurrence Relation................................................................................................................................... 43
Aim............................................................................................................................................................... 43
Objectives..................................................................................................................................................... 43
Learning outcome......................................................................................................................................... 43
4.1 Introduction............................................................................................................................................. 44
4.2 Definition of Recurrence Relation ......................................................................................................... 44
4.2.1 Linear Recurrence Relation with Constant Coefficients........................................................ 44
4.3 Construction of Recurrence Relation...................................................................................................... 44
4.3.1 Degree of Recurrence Relation............................................................................................... 45
4.3.2 Characteristic Equation of Recurrence Relation..................................................................... 45
4.3.3 Characteristic Roots of Recurrence Relation.......................................................................... 45
4.3.4 Homogeneous Recurrence Relation........................................................................................ 46
4.3.5 Non-homogenous Recurrence Relation.................................................................................. 46
4.4 Solution of Recurrence Relation............................................................................................................. 46
4.4.1 Solution of Homogenous Recurrence Relation...................................................................... 46
4.4.2 Solution of Non-homogenous Recurrence Relation............................................................... 47
4.5 Applications of Recurrence Relation...................................................................................................... 48
Summary...................................................................................................................................................... 50
References.................................................................................................................................................... 50
Recommended Reading.............................................................................................................................. 50
Self Assessment............................................................................................................................................ 51

Chapter V..................................................................................................................................................... 53
Graphs.......................................................................................................................................................... 53
Aim............................................................................................................................................................... 53
Objectives..................................................................................................................................................... 53
Learning outcome......................................................................................................................................... 53
5.1 Introduction............................................................................................................................................. 54
5.2 Terminologies in Graph.......................................................................................................................... 54
5.3 Representation of Graph......................................................................................................................... 56
5.4 Uses of Graphs........................................................................................................................................ 57
5.5 Some Important Graphs.......................................................................................................................... 58
5.6 Degree Sequence..................................................................................................................................... 59
5.6.1 Graphical Degree Sequence.................................................................................................... 59
5.7 Isomorphism in Graphs........................................................................................................................... 60
5.7.1 Isomorphism by Using Adjacency Matrix.............................................................................. 61
5.8 Applicability of Graphs........................................................................................................................... 62
Summary...................................................................................................................................................... 64
References.................................................................................................................................................... 64
Recommended Reading.............................................................................................................................. 64
Self Assessment............................................................................................................................................ 65

Chapter VI................................................................................................................................................... 67
Tree............................................................................................................................................................... 67
Objectives . ............................................................................................................................................ 67
Learning outcome......................................................................................................................................... 67
6.1 Introduction............................................................................................................................................. 68
6.2 Tree......................................................................................................................................................... 68
6.2.1 Properties of Tree Graph......................................................................................................... 69

III
6.2.2 Equivalent Properties of Tree................................................................................................. 69
6.3 Spanning Tree......................................................................................................................................... 71
6.3.1 Terminologies in Spanning Tree............................................................................................. 71
6.4 Fundamental Circuits.............................................................................................................................. 72
6.5 Shortest Spanning Tree........................................................................................................................... 73
6.6 Kruskal’s Algorithm................................................................................................................................ 74
6.7 Binary Tree............................................................................................................................................. 76
6.7.1 Binary Rooted Tree................................................................................................................. 76
6.7.2 Height of Binary Tree............................................................................................................. 76
6.8 Graph/Tree Search Techniques............................................................................................................... 77
Summary...................................................................................................................................................... 81
References.................................................................................................................................................... 81
Recommended Reading.............................................................................................................................. 81
Self Assessment . ......................................................................................................................................... 82

Chapter VII................................................................................................................................................. 85
Connected and Disconnected Graphs....................................................................................................... 85
Aim............................................................................................................................................................... 85
Objectives..................................................................................................................................................... 85
Learning outcome......................................................................................................................................... 85
7.1 Connected and Disconnected Graph....................................................................................................... 86
7.1.1 Walk........................................................................................................................................ 86
7.1.2 Trail......................................................................................................................................... 86
7.1.3 Path ........................................................................................................................................ 87
7.1.4 Cycle (Circuit)........................................................................................................................ 87
7.2 Connected Graph.................................................................................................................................... 87
7.2.1 Component.............................................................................................................................. 88
7.2.2 Cut Vertex............................................................................................................................... 88
7.3 Weight Graph.......................................................................................................................................... 88
7.3.1 Dijkstra’s Algorithm............................................................................................................... 89
7.4 Connectivity............................................................................................................................................ 91
7.4.1 Edge Connectivity................................................................................................................... 91
7.4.2 Vertex Connectivity................................................................................................................ 92
7.4.3 Degree of Graph...................................................................................................................... 93
Summary...................................................................................................................................................... 95
References.................................................................................................................................................... 95
Recommended Reading.............................................................................................................................. 95
Self Assessment............................................................................................................................................ 96

Chapter VIII................................................................................................................................................ 98
Introduction to Probability........................................................................................................................ 98
Aim............................................................................................................................................................... 98
Objectives..................................................................................................................................................... 98
Learning outcome......................................................................................................................................... 98
8.1 Introduction............................................................................................................................................. 99
8.2 Terminologies in Probability................................................................................................................... 99
8.3 Probability ............................................................................................................................................ 100
8.3.1 Definition of Probability Using an Event............................................................................. 100
8.3.2 Definition of Probability Using Sample Space..................................................................... 101
8.3.3 Rules of Probability.............................................................................................................. 101
8.3.4 Conditional Probability......................................................................................................... 103
8.3.5 Axiomatic Approach of Probability...................................................................................... 105
8.4 Bayes’ Theorem.................................................................................................................................... 105
8.5 Probability Distributions....................................................................................................................... 106
8.5.1 Binomial Distribution........................................................................................................... 107

IV
8.5.1.1 Probability Function of Binomial Distribution...................................................... 107
8.5.1.2 Parameters of Binomial Distribution..................................................................... 108
8.5.1.3 Important Measures or Constants of Binomial Distribution.................................. 109
8.5.2 Poisson Distribution...............................................................................................................110
8.6 Other Types of Distribution...................................................................................................................112
8.6.1 Multinomial Probabilities......................................................................................................112
8.6.2 Hypergeometric Probabilities................................................................................................112
8.7 Random Walk.........................................................................................................................................113
Summary.....................................................................................................................................................116
References...................................................................................................................................................116
Recommended Reading.............................................................................................................................116
Self Assessment...........................................................................................................................................117

V
List of Figures
Fig. 1.1 All X’s are Y’s................................................................................................................................... 3
Fig. 1.2 All scientists are scholars................................................................................................................... 3
Fig. 1.3 No X’s are Y’s................................................................................................................................... 4
Fig. 1.4 No wicket keeper is a bowler, in a cricket team................................................................................ 4
Fig. 1.5 (a) Some X’s are Y’s.......................................................................................................................... 4
Fig. 1.5 (b) Some X’s are Y’s.......................................................................................................................... 4
Fig. 1.6 (a) Some quadratic equations have two imaginary roots................................................................... 5
Fig. 1.6 (b) Some quadratic equations have two imaginary roots ................................................................. 5
Fig. 2.1 Basic rules of counting principles................................................................................................... 18
Fig. 2.2 Bit strings of length four without consecutive 1s............................................................................ 21
Fig. 2.3 More pigeons than pigeonholes....................................................................................................... 21
Fig. 4.1 Homogenous and non-homogenous recurrence relation................................................................. 46
Fig. 6.1 Tree.................................................................................................................................................. 68
Fig. 6.2 Graphs are not trees......................................................................................................................... 69
Fig. 6.3 Spanning tree................................................................................................................................... 71
Fig. 8.1 Bayes’ theorem illustration-I......................................................................................................... 105
Fig. 8.2 Bayes’ theorem illustration-II........................................................................................................ 105
Fig. 8.3 Bayes’ theorem illustration-III....................................................................................................... 106
Fig. 8.4 Probability distribution.................................................................................................................. 106
Fig. 8.5 Positively skewed binomial distribution....................................................................................... 108
Fig. 8.6 Symmetrical binomial distribution................................................................................................ 108
Fig. 8.7 Negatively skewed binomial distribution...................................................................................... 109
Fig. 8.8 Bell-Shaped binomial distribution................................................................................................. 109
Fig. 8.9 Different paths leading to a final position......................................................................................113
Fig. 8.10 Estimate lies in a range around µ.................................................................................................115

VI
List of Tables
Table 4.1 Solution to Example 1................................................................................................................... 45
Table 4.2 Solution to solve non-homogenous recurrence relation................................................................ 47
Table 5.1 Different types of graphs............................................................................................................... 59

VII
Discrete Mathematics

Abbreviations
BFS - Breadth First Search
DFS - Depth First Search
FIFO - First In, First Out
LHS - Left Hand Side
MST - Minimum Spanning Tree
RHS - Right Hand Side
SP - Shortest Path
w.r.t - With respect to

VIII
Chapter I
Logic

Aim
The aim of this chapter is to:

• explicate the concept of propositional logic

• explain truth table and venn diagram

• elucidate the concept of logical connectives and quantifiers

Objectives
The objectives of this chapter are to:

• explain tautology

• explicate De Morgan’s law and truth table

• enlist the logical equivalence in simple and compound statement

Learning outcome
At the end of this chapter, you will be able to:

• understand contradiction and contingency

• identify truth table and logical equivalence

• describe the use of logic in electronic circuits

1
Discrete Mathematics

1.1 Introduction
In order to understand mathematics like any other language, one must learn the vocabulary and its application. Math
logic is the structure that allows us to describe concepts in terms of maths. We will start with very basic ideas and
build on them.

Logic defines the ground rules for establishing truths. Mathematical logic spells out these rules in complete detail,
defining what constitutes a formal proof. Learning mathematical logic is a good way to learn logic because it creates
a firm foundation. Writing formal proofs in mathematical logic is like computer programming to a great extent.

1.2 Statement/Proposition
A simple sentence which is declarative or assertive and is either true or false (but not both), is called as a statement
or a proposition in logic. We denote the statements by lower case letters like p, q, r etc. They are called statement
letters.

Example:
Consider the following sentences:
• My new shirt is blue in colour.
• Is the shirt blue in colour?
• How beautiful is the new shirt!
In above sentences,
Sentence 1 is a simple assertive sentence, hence, it is a statement.
Sentence 2 is an interrogative sentence (question form) hence, it is not a statement.
Sentence 3 is an exclamatory sentence (a common). Hence, it is not a statement.

Thus, for a sentence to be a statement, it should be assertive. Moreover, it should be true or false. Sentence which
is interrogative or exclamatory is not a statement. Mathematical identities are considered to be statements.

1.3 Truth Value


The truth or falsity of a statement is called its truth value.
When a statement is true, its truth value is ‘TRUE’ and is denoted by ‘T’.
When a statement is false, its truth value is ‘FALSE’ and is denoted by ‘F’.

Example:
Consider the following sentences:
• The earth is round.
• Every set is a finite set.
• 2 is a prime number.

Sentences 1, 2 and3 are simple assertive sentences. Therefore, they are statements. The truth value of sentence 1
and 3 is ‘T’ and that of sentence 2 is ‘F.

1.4 Venn Diagrams


We can represent statements having truth value T by sets and hence, by Venn diagrams. Venn diagrams are thus
useful to check the validity of the given statements.
Let,
U: Universal set
X: Set of elements x
Y: Set of elements y

2
Type I: “All X’s are Y’s”
This statement is assumed to be true with true value T. In the language of sets, the statement means that X is a subset
of Y. Hence, each element of X belongs to Y. This is represented by the following Venn diagram. The validity of the
statement: All X’s are Y’s are shown in the figure below.

We observe that X is a subset of Y. Further, each element of the set X belongs to the set Y, does not belong to X.
Only some elements of Y belong to X. In general, when the statement: All X’s are Y’s is given with truth value T,
the statement: All Y’s are X’s does not follow from it.

U
Y
X x

Fig. 1.1 All X’s are Y’s

Example:
Consider the statement: “All scientists are scholars”.
It is assumed to be true with truth value T.
Let U = Set of all the people
X = Set of all the scientists
Y = Set of all the scholars
We can draw the Venn diagram as shown in the figure below.
We observe that there is a scholar say y, who is not a scientist. Hence, the statement: All scholars are scientists follow
from statement 1. However, the statement: Some scholars are scientists follows from 1.

U
Y
X x

Fig. 1.2 All scientists are scholars

Type II: “No X’s are Y’s”


This statement is assumed to be true with truth value ‘T’.
In the language of sets, the statement means that not a single element of set X belongs to set Y. The figure below
represents the truth of the statement: No X’s are Y’s. We observe that not a single element of Y belongs to set X,
i.e., No Y’s are X’s. In general, when the statement: No X’s are Y’s is given with truth value T, the statement: ‘No
Y’s are X’s follows.

3
Discrete Mathematics

U
X

Fig. 1.3 No X’s are Y’s

Example:
Consider the statement: “No wicket keeper is a bowler, in a cricket team”.
This statement is of the type “No X’s are Y’s”. It is assumed to be true with truth value T.
Let U= Set of all the players
W= Set of wicket keepers
B= Set of bowlers.
The Venn diagram in the figure below represents the truth of the statement: “No wicket keeper is a bowler”. We
know that the statement: No Y’s are X’s follows from the statement: No X’s are Y’s. Hence, the figure below also
represents the truth of the statement. ‘No Bowler is a Wicket-keeper’.

U
W

Fig. 1.4 No wicket keeper is a bowler in a cricket team

Type III: Some X’s are Y’s


This statement is assumed to be true with the truth value T. In the language of sets, the statement means that some
elements of X belong to the set Y. This can be represented by two Venn diagrams as follows.

U
U
X

Y Y
X


(a) (b)
Fig. 1.5 Some X’s are Y’s

4
Fig. 1.5 (a) and (b) both represent the truth of the statement: “Some X’s are Y’s”.
From Fig.1.5 (a), we observe that the statement: “Some X’s are Y’s” follows from the statement: “Some X’s are Y’s”.
In Fig.1.5 (b) we observe that the statement: All Y’s are X’s follows from the statement: “Some X’s are Y’s”.

Example:
Consider the statement: “Some quadratic equations have two imaginary roots”. This statement is of the type, Some
X’s are Y’s. It is assumed to be true with the truth value T.
Let, U= Set of all equations
X= Set of quadratic equations
Y= Set of quadratic equations having two imaginary roots
The Venn diagram Fig.1.6 (a) represents the truth of the statement: “Some quadratic equations have two imaginary
roots”

U U
X

Y X Y


(a) (b)

Fig. 1.6 Some quadratic equations have two imaginary roots

Consider the statement: “Some professors are absent minded”.


This statement is of the type ‘Some X’s are Y’s. It is assumed to be true with the truth value T.
Let, U= Set of all people,
X= Set of professors,
Y= Set of absent minded people.
The Venn diagram in Fig.1.6 (b) represents the truth of the statement: ‘Some professors are absent minded’.

1.5 Compound Statements and Logical Connectives


Logical connectives: The words or phrases which combine two simple statements are called logical connectives or
sentential connectives.
Example: ‘and, not, of, but, if, then, either, or’, etc are some connectives which are commonly used.
Compound Statements: A combination of simple statements formed by using connectives is called a compound
statement. The statements which form a compound statement are called its prime components.
While forming a compound statement, we are not concerned with its truth or falsity.
We consider the following five types of compound statements:
Negation (~p): If p is a statement then the statement ‘not p’ (obtained by making the statement p negative) is called
the negation of p. It is denoted by ~p and read as ‘not p’.
Then negation of a given statement can also be obtained with the help of phrase “It is not true that” or “It is false
that”.
Example:
Consider p : 2 is a prime number.
Then, ~p : 2 is not a prime number.
Consider q : Logic is interesting.
Then ~q : Logic is not interesting.

5
Discrete Mathematics

Disjunction or Alternation (p ∨ q): If p and q are two simple statements, then the compound statement ‘p or q’ is
called their disjunction.
It is denoted by p ∨ q and read as p or q. the statement p and q are called its disjuncts.
Example:
Consider, p: I will watch the cricket match on TV.
q: I will go to the Wankhede stadium.
Then, p ∨ q: I will watch the cricket match on TV or go to the Wankhede stadium.

Conjunction (p ∧ q):
If p and q are two simple statements, then the compound statement ‘p and q’ is called their conjunction.It is denoted
by p ∧ q and read as ‘p and q’. The statement p and q are called its conjuncts.
Example:
Consider, p: 12 is an even number.
q: 12 is a perfect square.
Then, p ∧ q: 12 is an even number and it is a perfect square.

Implication or Conditional (p → q):


If p and q are two simple statements then the compound statement ‘if p then q’ is called a conditional statement or an
implication. It is denoted by p → q and it is read as ‘p implies q’. Statement p is called the antecedent or hypothesis
and statement q is called the consequent or conclusion.
Example:
Consider, p: Lines L1 ­and L2 are parallel,
q: Lines L1 and L2 have no point in common.
Then, p → q: If lines L1 and L2 are parallel, then they have no point in common.

Double Implication or Bi-conditional (p ⟷ q):


If p and q are two simple statements, then the compound statement ‘p if and only if q’ is called the bi-conditional or
double implication or equivalence. It is denoted by p ↔ q means p → q and q → p. thus, a bi-conditional statement
is the conjunction of two conditional statements.
Example:
Consider, p: A triangle is isosceles,
q: The base angles are congruent.
Then, p ⟷ q: A triangle is isosceles if and only if the base angles are congruent.

The various connectives have been listed in the following table.


Connective Symbol Compound Statement

1 NOT ~ Negation

2 OR ∨ Disjunction

3 AND ∧ Conjunction

4 IF … THEN → Implication

5 IF AND ONLY IF ↔ Double Implication

6
Example:
Using the statements,
p: Akshay is rich
q: Akshay is happy
and assuming that ‘not rich’ is ‘poor’,
write the following statements in symbolic form.

Solution:
We have, p: Akshay is rich.
~p: Akshay is poor.
q: Akshay is happy.
~q: Akshay is unhappy.
Thus,
p ∧ ~q : Akshay is rich and unhappy.
~p ∧ q : Akshay is poor but happy.
~p ∧ ~q : Akshay is neither rich nor happy.
~p ∨ ~q : Akshay is unhappy or poor.
~ (~p ∧ q) : It is not true that Akshay is poor and happy.
~q ↔ p : Akshay is unhappy if and only if he is rich.

1.6 Truth Tables


The truth value of a compound statement can be expressed conveniently in the form of a table known as Truth Table.
A truth shows all possible truth values of prime components and the corresponding truth values of the compound
statement.
We shall consider truth tables for the five types of compound statements discussed earlier.

Truth table for Negation (~p):


p ~p
T F
F T

Truth table for Disjunction (p ∨ q):

p q p∨q
T T T
T F T
F T T
F F F

Truth table for Conjunction (p ∧ q):

p q p∧q
T T T
T F F
F T F
F F F

7
Discrete Mathematics

Truth table for Implication (p → q):

p q p→q
T T T
T F F
F T T
F F T

Truth table for Double Implication (p ↔ q):

p q p↔q
T T T
T F F
F T F
F F T

1.7 Tautology, Contradiction and Contingency


Tautology
A statement pattern which is always true (i.e., which always takes truth value T) irrespective of truth values of its
component statement letters is called a tautology.

Example:
Consider the statement pattern p ∨ ~p
The truth table for p ∨ ~p is as follows.
Since p ∨ ~p always takes value T for all possible truth values of p, it is a tautology.
Note: The disjunction of a statement pattern and its negation is always a tautology.

Thus, (p ∧ q) ∨ ~ (p ∧ q), (p → q) ∨ ~ (p → q) etc. are tautologies.

p ~p p ∨ ~p
T F T
F T T

Contradiction
A statement pattern which is always false (i.e., always takes truth value F) irrespective of truth values of its component
statement letters is called a contradiction.

Example:
Consider the statement pattern p ∧ ~p.
The truth table for p ∧ ~p is given along side. Since p ∧ ~p always takes a value F for all possible truth values of
p, it is a contradiction.

Note:
i. The conjunction of a statement pattern and its negation is always contradiction. Thus, (p ∨ q) ∧ ~
(p ∨ q), (p → q) ∧ ~(p → q) etc. are contradictions.
ii. Negation of a tautology is a contradiction and vice- versa.

8
iii. A statement pattern is a tautology by virtue of the property of logical connectives and their positions
in the statement pattern. It is independent of the statement letters it contains.

p ~p p ∧ ~p

T F F
F T F

Contingency
A statement pattern which is neither a tautology nor a contradiction is called a Contingency. Thus, a contingency is
a statement pattern which is either true or false depending on the truth values of its component statement letters.

Note: If a statement pattern is not a tautology, then it may be either a Contradiction or a Contingency.

1.8 Logical Equivalence


Any two simple statements p and q are said to be logically equivalent if they have same truth values. This is denoted
by p ≡ q and read as ‘p is equivalent to q’.

Example:
Let p: 6 is an even number,
q: 6 is a multiple of 3.
Hence, p and q are logically equivalent.

Two statement patterns are said to be logically equivalent if their truth values are identical for each combination of
the truth values of their component statement letters.
If A, B are logically equivalent statement patterns, we denote it by A≡B or A⟺B.

Example:
Consider the following truth table:

p q A: p → q B: ~p ∨ q A↔B
T T T T T
T F F F T
F T T T T
F F T T T

1.9 Negation of a Compound Statement


The negation of negation of a statement is logically equivalent to the statement itself,
i.e., ~ (~p) ≡ p
Proof:
We construct the truth table as follows, using the rule for truth value of negation.
The entries in the columns for p and ~ (~p) are identical.
Hence, ~ (~p) ≡ p
P ~p ~(~p)
T F T
F T F

9
Discrete Mathematics

The negation of the disjunction of two statements is logically equivalent to the conjunction of their negations.
i.e., ~(p ∨ q) ≡ ~p ∧ ~q (De Morgan’s Law)
Proof:
We construct the truth table as follows, using the rule for truth value of negation for column 3, 4 and 6,
disjunction for column 5, conjunction for column 7.

1 2 3 4 5 6 7

p q ~p ~q p∨q ~ (p ∨ q) ~ p ∧ ~q

T T F F T F F

T F F T T F F

F T T F T F F

F F T T F T T

1.10 Some Standard Equivalent Statements in Logic


The following is a comprehensive list of standard equivalent statements:
Commutative Laws:
p∧q=q∧p
p∨q=q∨p
Associative Laws:
(p ∧ q) ∧ r = p ∧ (q ∧ r)
(p ∨ q) ∨ r = p ∨ (q ∨ r)
Idempotent Laws:
p∧p=p
p∨p=p
Distribution Laws:
p ∧ (q ∨ r) = (p ∧ q) ∨ (p ∧ r)
p ∨ (q ∧ r) = (p ∨ q) ∧ (p ∨ r)
Double Negation Law:
~p (~p) = p
De Morgan’s Laws:
~ (p ∧ q) = ~p ∨ ~q
~ (p ∨ q) = ~p ∧ ~q

1.11 The Use of Logic in Circuits


Consider an electronic circuit with various switches that may be on (closed) or off (open).

INPUT OUTPUT

Current will flow along a particular path when the switches are closed. Current will flow from the input to the output
when all switches along some path from input to output are closed.
Let c, p, q, r be the following propositions:
c: current flows from input to output.
p: current flows through switch p.
q: current flows through switch q.

10
r: current flows through switch r. Consider the circuits given below and overleaf.

Suppose there are two switches in the circuit connected in parallel.

INPUT OUTPUT

Current flows from input to output when p alone is closed, or q alone is closed or both switches are closed.
Here, c = p ∨ q.

Suppose there are two switches in the circuit connected in series.

INPUT OUTPUT

Current will only flow from input to output when both p and q are closed. Here, c = p ∧ q.

Suppose three switches are connected as shown below.


p

q
INPUT OUTPUT

Here, c = p ∨ q ∨ r.

Suppose three switches are connected as shown below.


p

INPUT OUTPUT

q r

Here, c = p ∨ (q ∧ r).

1.12 Quantifiers
• The language of propositions allows us to model a great variety of properties about specific objects; however,
it doesn’t allow us to state general properties such as “Every cloud has a silver lining”.
• These general properties are known as universal properties, since they describe properties that must be satisfied
by every individual in some universe of discourse.
• In order to symbolise universal and existential properties we shall need two new symbols i.e. ∀ (called as ‘For
all’) and ∃ (called as ‘there exist’).
• The quantifier symbols are used to build predicates; a predicate is like a“∀” is the universal quantifier, and
“∃” is the existential quantifier.

11
Discrete Mathematics

• Any quantifier that starts with “∃” (such as “∃x”) is an existential quantifier. “∃x” is translated as “there exists
an x such that..” We can combine a quantifier with a predicate to make a well-formed formula, as in ‘∃xBx’
• To understand such a well-formed formula, we can rewrite it as a semi-formal statement: There exists an x
such that Bx. Or alternatively, There is at least one x such that Bx. So what it says is that, there is some object
x, and x is B.
• In other words, it simply says that something is B. If the predicate “Bx” means x is a boy, then the well-formed
formula can be translated as there is at least one boy, or a boy exists.
• Notice that “∃xBx”, “∃yBy”, “∃zBz”, etc. all say the same thing. They are different well-formed formulae since
they employ different variables. But they are logically equivalent nonetheless.
• Also notice that the truth of “∃xBx” is consistent with the claim that there is more than one B. It is just that this
is not what “∃xBx” says. The latter well-formed formula says that there is one or more. It might be the case
that there is just one, or it might be that there is more than one.

Any quantifier that starts with “∀” is a Universal Quantifier. “∀x” means “for all x, ... “. Again we can combine a
universal quantifier with a predicate to form a well-formed formula, such as : ∀xBx

In semi-formal notation, this means the same as “for all x, Bx”. What this says is that for any object x, x is B. If
“Bx” means x is a boy, this well-formed formula would mean for every x, x is a boy. In other words, take any object
whatsoever; it is a boy, which is just the same as saying that everything is a boy. Under such a translation, the well-
formed formula is of course actually false.
Now consider the following formula, what do you think it means? (Suppose “Dy” means y is dirty, and “By” as
before.)
For all y, (By→Dy)
For all y, if y is a boy, then y is dirty.
Everything is such that if it is a boy, then it is dirty.

We might find the interpretation of well-formed formula difficult at first, but if you try to understand them step-by-
step, then it might become easier. We can see in the above example that the last sentence says the same as “Every
boy is dirty”, which is just what the well-formed formula means. We will use the same translation scheme as before
to understand the meaning of the well-formed formula.
1. ∀zDz
Everything is dirty.
2. ∀z(Dz→Dz)
Everything that is dirty is dirty.

Here are some more examples.


∀y ~ Dy: Everything is not D
~∀y Dy: Not everything is D

The second well-formed formula above actually means “It is not the case that EVERYTHING IS D.” So it says that
not everything is D. This is of course the same as saying that something is not D. Refer to the figure below. 

12
D

Suppose the gray region represents everything that is D. The area outside the gray region represents things that are
not D.
To say that not everything is D is to say that something exists in the class represented by the region outside the D
circle. So this is the same as saying that something is not D.
• ~∀y ~ Dy: It is not the case that everything is not D (In other words, something is D!)
• ∃yDy: Something is D
• ∃y ~ Dy: Something is not D
• ~∃yDy: It is not the case that something is D (So everything is not D)
• ~∃y ~ Dy: It is not the case that something is not D (So everything is D)

As you can see, some of these wffs are equivalent to each other:
• ∀yDy ≡ ~∃y ~ Dy
• ~∀yDy ≡ ∃y ~ Dy
• ∀y ~ Dy ≡ ~∃yDy
• ~∀y ~ Dy ≡ ∃yDy

Example:
The following are all examples of universal properties:
1. Every cloud has a silver lining.
2. All the bells in heaven shall ring.
3. Each student must hand in homework.
4. Nobody knows the trouble I seen.
5. Roses are red.
6. Jim doesn’t know anybody who can sign his bail application.

Example:
The following are all examples of existential properties:
1. Something’s got into the tank.
2. There is a tavern in the town.
3. I heard it from one of your friends.
4. A mad dog has bitten Robert.
5. Some people prefer logic.

13
Discrete Mathematics

Summary
• In mathematical logic, a propositional calculus or logic (also called sentential logic) is a formal system in which
formulas of a formal language may be interpreted as representing propositions.
• In mathematics, a logical value, also called a truth value, is a value indicating the relation of a proposition to
truth. In classical logic, the truth values are true and false.
• Venn diagrams or set diagrams are diagrams that show all hypothetically possible logical relations between
finite collections of sets (aggregation of things).They are used to teach elementary set theory, as well as illustrate
simple set relationships in probability, logic, statistics, linguistics and computer science.
• In logic, a logical connective (also called a logical operator) is a symbol or word used to connect two or more
sentences (of either a formal or a natural language) in a grammatically valid way, such that the compound
sentence produced has a truth value dependent on the respective truth values of the original sentences.
• Each logical connective can be expressed as a function, called a truth function. For this reason, logical connectives
are sometimes called truth-functional connectives. The most common logical connectives are binary connectives
(also called dyadic connectives) which join two sentences whose truth values can be thought of as the function’s
operands.
• Tautology is an unnecessary or unessential repetition of meaning, using different and dissimilar words that
effectively say the same thing.
• In logic, quantification is the binding of a variable ranging over a domain of discourse. The variable thereby
becomes bound by an operator called a quantifier. Academic discussion of quantification refers more often to
this meaning of the term than the preceding one.
• In grammar, a quantifier is a type of determiner, such as all or many, that indicates quantity. These items have
been argued to correspond to logical quantifiers at the semantic level.

References
• Simpson, S. G., 2010. Mathematical Logic, Logic, Pennsylvania state university press.
• Schwichtenberg, H., 2004. Mathematical Logic, Logic, Mathematics Institute University Munchen.
• Lal, A. K., Lecture Notes on Discrete Mathematics, [Pdf] Available at: <http://home.iitk.ac.in/~arlal/book/
mth202.pdf> [Accessed 20 June 2013].
• Lovasz, L. & Vesztergombi, K., Discrete Mathematics, [Pdf] Available at: <http://www.cims.nyu.edu/~regev/
teaching/discrete_math_fall_2005/dmbook.pdf> [Accessed 20 June 2013].
• nptelhrd, 2007. Lecture 1 - Propositional Logic, [Video online] Available at: <http://www.youtube.com/
watch?v=xlUFkMKSB3Y> [Accessed 20 June 2013].
• nptelhrd, 2007. Lecture 1 - Propositional Logic, [Video online] Available at: <http://www.youtube.com/watch
?v=xlUFkMKSB3Y&list=PL0862D1A947252D20> [Accessed 20 June 2013].

Recommended Reading
• Nerode, A. & Shore, R. A., Logic for Applications, Mathematical Logic, 2nd ed., Springer Textbooks.
• Hinman, P. G., 2005. Fundamentals of Mathematical logic, Logic, A K Peters, Ltd.
• Kleene, S. C., 2002. Mathematical logic, Proof and theory, Courier Dover Publications.

14
Self Assessment

A] If p: Prakash is obedient. q: Prakash is handsome.


Write the statements in symbolic form for the following.

1. Prakash is obedient but not handsome.


a.
b.
c.
d.

2. Prakash is obedient as well as handsome.


a.
b.
c.
d.

3. Prakash is neither obedient nor handsome.


a.
b.
c.
d.

4. What is the logical negation of the following statement?


“Indians are intelligent and obedient”
a.
b.
c.
d.

B] Negate the following statements.


5. ∀x, ∃y, (x + y > xy)
a. ∀x, ∃y, (x - y > xy)
b. ∀x, ∃y, (x + y < xy)
c. ∃x, ∀y, (x + y ≤ xy)
d. ∃y, ∀x, (x - y ≤ xy)

6. ∃x, ∀y, (x2 + y2 +2 = 0)


a. ∃x, ∀y, (x + y +2 = 0)
b. ∃x, ∀y, (x - y - 2 = 0)
c. ∃x, ∀y, (x2 - y2 - 2 = 0)
d. ∃x, ∀y, (x2 + y2 +2 ≠ 0)

15
Discrete Mathematics

7. ∃x, ∀y, (x + y ≤ xy)


a. ∀x, ∃y, (x + y > xy)
b. ∃x, ∀y, (x - y > xy)
c. ∀x, ∃y, (x + y ≥ xy)
d. ∃x, ∀y, (x - y ≥ xy)

8. ∀x, ∃y, (x2 + y2 +2 ≠ 0)


a. ∃x, ∀y, (x2 + y2 +2 ≠ 0)
b. ∃x, ∀y, (x2 - y2 - 2 = 0)
c. ∀x, ∃y, (x2 + y2 +2 ≠ 0)
d. ∃x, ∀y, (x2 + y2 +2 = 0)

9. What is the contrapositive form of “If study then I pass”


a. ~p → q
b. ~p ← q
c. ~p → ~q
d. ~p ↔ ~q

10. Translate the following statement into symbolic form using quantifiers.
“Some men do not like cat”, if M is set of all men, C = cats
a. ∃x ∈ ~C
b. ∃x ∋ ~C
c. ∃x ∈ M, (C(x))
d. ∃x ∈ M, (~C(x))

16
Chapter II
Combinatorics

Aim
The aim of this chapter is to:

• explain counting theory

• highlight the idea of pigeonhole principle

• explicate the techniques, permutation and combination

Objectives
The objectives of this chapter are to:

• explain the basic principles of counting theory

• describe the concept of permutation and combination

• elucidate problems using tree diagrams

Learning outcome
At the end of this chapter, you will be able to:

• understand the probabilities of discrete events

• identify counting problems using sum and product rules

• recognise the techniques to solve problems using permutation and combination theorems

17
Discrete Mathematics

2.1 Introduction
Combinatorics is the study of arrangements of objects, which is an important part of discrete mathematics. This
subject was studied in seventeenth century, when combinatorial questions arose in the study of gambling games.
The important part of combinatorics is counting of objects with certain properties. Counting theory has several uses.
Few of them have been mentioned below:
• It is used to determine the complexity of algorithms
• It is also required to determine whether there are enough telephone numbers or internet protocol addresses to
meet demand.

Another important combinatorial tool is the pigeonhole principle which we will study in this chapter, this states
that when objects are placed in boxes and there are more objects than boxes, then there is a box containing at least
two objects.
We can phrase many counting problems in terms of ordered or unordered arrangements of the objects of a set. These
arrangements, called permutations and combinations, are used in many counting problems.

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 technique needed to answer such questions and a wide variety of other counting problems will be
introduced in this chapter.

2.2 Basic Counting Principles


In counting theory, we will focus on two basic counting principles, which are explained below:

Counting
Principle

SUM PRODUCT
Rule Rule

Fig. 2.1 Basic rules of counting principles


2.2.1 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 of the tasks.

Example:
The department will award a free computer to either a Computer Science (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.

Generalised 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.

2.2.2 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 n1.n2 ways to do the procedure.

18
Example:
How many different license plates are there which contain 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.

Generalised 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.

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|.

2.2.3 Inclusion and Exclusion


When two tasks can be done at the same time, we cannot use the sum rule to count the number of ways to do one
of the two tasks. Adding the number of ways to do each task leads to an over count, since the ways to do both tasks
are counted twice. To correctly count the number of ways to do one of the two tasks, we add the number of ways
to do each of the two tasks and then subtract the number of ways to do both tasks. This technique is called the
Principle of 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.

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),

19
Discrete Mathematics

..

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



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. 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.

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.

2.2.4 Tree Diagrams


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.
Example:
How many bit strings of length four do not have two consecutive 1s?

20
0
0

0 1

1 0
0
0
1 0
1

0
0
1 0 1
1 0
1st 2nd 3rd 4th
bit bit bit bit

Fig. 2.2 Bit strings of length four without consecutive 1s


There are 8 strings.

2.3 The Pigeonhole Principle


The first version of this principle was written by Dirichlet in 1834 who called it “Schubfachprinzip” (drawer
principle), according to an observation he made of how socks were arranged in his drawers. In some countries like
Russia, it is called the “Dirichlet’s principle” or “the Dirichlet-Schlafli’s box principle”. In English, it is called the
pigeonhole principle, inspired by a pigeon house.

In mathematics, the pigeonhole principle states that if n objects are placed into m boxes, and if n > m, then there is
at least one box with at least two objects in it.
Another formulation would be that m boxes cannot contain more than m objects with a single object in each; add
an object and one of the boxes must be used twice.

Illustration:
Suppose that a flock of pigeons flies into a set of pigeonholes to roost. The pigeonhole principle states that if there
are more pigeons than pigeonholes, then there must be at least one pigeonhole with at least two pigeons in it (refer
to the figure below.). This principle applies to other objects besides pigeons and pigeonholes.

Fig. 2.3 More pigeons than pigeonholes

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”.

21
Discrete Mathematics

Prove by Contradiction
Suppose that the theorem is false and derive a contradiction. Suppose that none of the k boxes contains more than
one object. Then, the total number of objects would be at the most k. This is a contradiction, because there are at
least k + 1 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.
Example 3:
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.
Generalised pigeonhole principle: ⋅3/2⋅ = 2.

The Generalised 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.
Prove by contradiction:
Suppose that the theorem is false and derive a contradiction. Suppose that none of the boxes contains more than
⎡N/k⎤ − 1 objects. Using the inequality ⎡N/k⎤ < (N/k) + 1, the total number of objects is at most

This is a contradiction because there are a total of N objects.


Example 1:
In a 60-student class, at least 12 students will get the same letter grade (A B C D or F)
Example 2:
In a 61-student class, at least 13 students will get the same letter grade.

2.4 Permutations and Combinations


Before understanding Permutation and combination, it is important to understand the term ‘Factorial’.
Factorial Notation
n!, pronounced n factorial can be represented as follows;
(n)(n - 1)(n - 2). . . (3)(2)(1)

Example:
3! = (3)(2)(1) = 6
4! = (4)(3)(2)(1) = 24
5! = (5)(4)(3)(2)(1) = 120
6! = (6)(5)(4)(3)(2)(1) = 720

The Multiplication Principle


Suppose n choices must be made, with m1 ways to make choice 1, and for each of these ways, m2 ways to make
choice 2, and so on, with mn ways to make choice n.
Then there are m1⋅m2⋅…⋅mn different ways to make the entire sequence of choices.

2.4.1 Permutation
“A permutation is one of the different arrangements of a group of items where order matters”.
When order matters, AB ≠ BA

22
Example:
Consider the following:
Given 3 people, Bob, Mike and Sue, how many different ways can these three people be arranged, as far as an order
matters?
Let BMS stand for the order of Bob on the left, Mike in the middle and Sue on the right. Since order matters, a
different arrangement is BSM. Where Bob is on the left, Sue is in the middle and Mike is on the right. If we find all
possible arrangements of Bob, Mike and Sue where order matters, we have the following:
BMS,    BSM,    MSB,    MBS,    SMB,    SBM
The number of ways to arrange three people three at a time is:
3! = (3)(2)(1) = 6   ways

A permutation of r (where r ≥ 1) elements from a set of n elements is any specific ordering or arrangement, without
any repetition of the r elements. Each rearrangement of the r elements is a different permutation. The number of
permutations of n things taken r at a time (with r ≤ n) is written as:
P (n, r) or

If P (n, r) (where r ≤ n) is the number of permutations of n elements taken r at a time, then,

P (n, r) =

Points to be remember
• If you want to arrange 3 people in groups of 3 at a time, there are 3! ways to accomplish this task.
• If you want to arrange 4 people in groups of 4 at a time, there are 4! ways to accomplish this task.
• If you want to arrange n objects in groups of n at a time, there are n! ways to accomplish this task.
• = n!

Example:
I. Three married couples have bought six seats in a row for a performance of a musical comedy.
a. In how many ways can they be seated?
6! = 720

b. In how many ways can they be seated if each couple is to sit together with the husband to the left of his
wife?
3! = 6

c. In how many ways can they be seated if each couple is to sit together?
3! !2! !2! ×2! = 48

d. In how many ways can they be seated if all the men are to sit together and all the women are to sit
together?
2! ×3! ×3! = 72

II. In how many ways can 8 people A, B, C, D, E, F, G and H be seated in a row if


a. there are no restrictions on seating arrangement:
8! = 40320

b. persons A and B must not sit next to each other:


8! − 7! × 2! = 30240

23
Discrete Mathematics

2.4.2 Combinations
A combination is an arrangement of a group of items where order does not matter.
When order does not matter, AB = BA.

Example:
Consider the following:
Given 3 people, Bob, Mike and Sue, how many different ways can these three people be arranged where order
does not matter?

Solution:
Since order does not matter, any arrangement with Bob, Mike and Sue is considered the same arrangement. Therefore,
the only arrangement is BMS.
Now suppose we want to take four people, Bob, Mike, Sue and Alice, and arrange them in groups of three at a time
where order does not matter.   The following demonstrates all the possible arrangements.
BMS,    MSA,    BMA,    BSA
There are 4 ways to arrange 4 people in groups of 3 at a time.

A combination of r (where r ≥1) elements from a set of n elements is a subset of r elements without regard to order.
If C (n, r) or ( ) denotes the number of combinations of n elements taken r at a time, where r ≤ n, then

Remark: and

Example:
Find the number of ways to pick 4 people and place them in groups of 3 at a time, where order does not matter.
Solution:
Since order does not matter, use the combination formula.
C (4,3) =
There are 4 ways to arrange 4 items; taken 3 at a time, when order does not matter.

Example:
Find the number of ways to take 20 objects and arrange them in groups of 5 at a time where order does not matter.

Solution:
C (20,5) =
There are 15,504 ways to arrange 20 objects; taken 5 at a time, when order does not matter.

Example:
In the State Lotteries, will we use a combination or a permutation?

Solution:
If order matters, then it is a permutation. If order does not matter, then it is a combination. Do the
numbers on a ticket have to be in the same order as the order in which they became the winning numbers?
In other words, let’s say the winning numbers rolled out of the machine in the order of: 1,2,3,4,5,6. Do the numbers
on your ticket have to be in this same order to win?   Or will any order such as 2,3,1,5,6,4 also be a winning
ticket? The answer is, any order of the winning numbers will produce the winning ticket. Thus, the lotteries are
combinations.

2.4.3 Permutations with Indistinguishable Objects


Theorem 1:
The number of different permutations of n objects, where there are n1 indistinguishable objects of type 1, n2
indistinguishable objects of type 2, and nk indistinguishable objects of type k, is

24
Examples:
I. How many strings can be made by reordering the letters of the word “daricks”?
II. How many strings can be made by reordering the letters of the word “darickschan”?
III. How many strings can be made by reordering the letters of the word “darickswaihongchan”?

Theorem 2:
The number of ways to distribute n distinguishable objects into k distinguishable boxes so that ni objects are placed
into box i,
i = 1,2,…, k ,
equals

Examples:

In a class of 20 students, 5 of them will get Grade A, 10 of them Grade B, 3 of them Grade C, and 2 will be fail.
How many grade distributions are possible among 20 students?

How many ways can we distribute a standard deck of 52 playing cards into 4 sets of 13 cards each?

25
Discrete Mathematics

Summary
• In Combinatorics, the rule of sum or addition principle is a basic counting principle. Stated simply, it is the
idea that if we have a ways of doing something and b ways of doing another thing and we can not do both at
the same time, then there are a + b ways to choose one of the actions.
• The inclusion-exclusion principle can be thought of as a generalisation of the rule of sum in that it too enumerates
the number of elements in the union of some sets (but does not require the sets to be disjoint).
• In mathematics and computer science, the pigeonhole principle states that if n items are put into m pigeonholes
with n > m, then at least one pigeonhole must contain more than one item. This theorem is exemplified in
real-life by truisms like “there must be at least two left gloves or two right gloves in a group of three gloves”.
It is an example of a counting argument, and despite seeming intuitive it can be used to demonstrate possibly
unexpected results.
• In elementary combinatorics, the name “permutations and combinations” refers to two related problems, both
counting possibilities to select k distinct elements from a set of n elements, where for k-permutations the order of
selection is taken into account, but for k-combinations it is ignored. However k-permutations do not correspond
to permutations of n objects unless k = n.

References
• Johnsonbaugh, R., 2008. Discrete Mathematics, 7th ed., Basic Counting Principle, Prentice Hall.
• Vatsa, B. S. & Vatsa, S., 2009. Discrete Mathematics, Pigeonhole Principle, New Age International.
• Combinatorics , [Pdf] Available at: <http://www.dartmouth.edu/~chance/teaching_aids/books_articles/
probability_book/Chapter3.pdf> [Accessed 20 June 2013].
• Cameron, P. J., Notes on Combinatorics, [Pdf] Available at: <http://www.maths.qmul.ac.uk/~pjc/notes/comb.
pdf> [Accessed 20 June 2013].
• eHow, 2012. Introduction to Combinatorics : Principles of Math, [Video online] Available at: <http://www.
youtube.com/watch?v=jrLYCzCc77g> [Accessed 20 June 2013].
• bethjonesmath, 2008. Introduction to Combinatorics (part 1) [Video online] Available at: <http://www.youtube.
com/watch?v=cErUmuxraQ0> [Accessed 20 June 2013].

Recommended Reading
• Koshy, T., 2004. Discrete mathematics with applications, Combinatorics and Discrete Mathematics, Elsevier
Academic Press.
• Hein, J. L., 2009. Discrete Structures, Logic, and Computability, Permutation and Combinations, Jones and
Bartlett Learning.
• Merris, R., 2004. Combinatorics, 2nd ed., John Wiley & Sons.

26
Self Assessment
1. When building a house, Bob can choose from four different lots, three different house styles, and five different
floor plans. How many different possibilities are there for building a house?
a. 60
b. 30
c. 40
d. 50

2. Alan and Mike have ten major league baseball ballparks that they would like to visit over the next few years. If
they have not visited any of the parks previously and would like to visit four parks this summer, in how many
ways can they organise their trip?
a. 1000
b. 2000
c. 5000
d. 5040

3. In the state track meet, eight sprinters will run the 100-yard dash. How many ways can gold, silver, and bronze
medals be awarded?
a. 333
b. 336
c. 400
d. 433

4. How many five-digit zip codes can be made where all digits are unique if the possible digits are 0 through 9?
a. 1340
b. 10300
c. 30240
d. 3240

5. If n=5 and r=2, what is the value of 5P2? The symbol 5P2 means the number of permutations of 5 items taken
2 at a time.
a. 10
b. 20
c. 30
d. 35

6. How many different ways can a chairperson and an assistant chairperson be selected for a research project, if
there are seven scientists available?
a. 32
b. 40
c. 42
d. 50

27
Discrete Mathematics

7. In how many ways can three class representatives be chosen from a group of twelve students? If the order of
the arrangement is not important, how many outcomes will there be?
a. 150
b. 220
c. 200
d. 500

8. Calculate the value of 9C5.


a. 126
b. 226
c. 124
d. 224

9. Determine whether the following scenarios represent permutation.


a. Selecting two types of yogurt from the grocery’s dairy case from a selection of nine.
b. Choosing two books to take with you on vacation from the nine books on your shelf.
c. Choosing three CDs to purchase from the music store.
d. Arranging seven photographs on a page of your senior memory book.

10. Determine whether the following scenarios represent combination.


a. Selecting two types of yogurt from the grocery’s dairy case from a selection of nine.
b. Selecting your favourite yogurt and then your second favourite yogurt from a selection of nine.
c. Selecting three members from your class to work specific homework problems on the board.
d. Arranging seven photographs on a page of your senior memory book.

28
Chapter III
Mathematical Induction

Aim
The aim of this chapter is to:

• explain the concept of mathematical induction

• enlist various principles of mathematical induction

• explicate various perspectives of mathematical induction

Objectives
The objectives of this chapter are to:

• explain applicability of mathematical induction

• describe methods of solving problems on mathematical induction

• explicate the principles of mathematical induction

Learning outcome
At the end of this chapter, you will be able to:

• understand the principles of mathematical induction and its application

• identify truth and falsity of statement by using induction principles

• classify the sequence and expression of a statement

29
Discrete Mathematics

3.1 Introduction
Mathematical induction is the process of proving a general formula from particular cases. It  is a technique for
showing a statement, a theorem, or a formula that is asserted about every natural number.

Moreover, mathematical induction is used to establish that a given statement is true of all natural numbers. It is the
method of proving that the first statement in the infinite sequence of statements is true, and then proving that if any
one statement in the infinite sequence of statements is true, then so is the next one.

3.2 First Principle of Mathematical Induction


Let, p (n) be a statement involving a natural number n.
If
i. p (1) is true.
ii. p (k) is true.
iii. ∴ p (k+1) is true, ∵ For k > 1.
Then,
p (n) is true for all n ≥ 1

Working rule:
Let p (n): given statement to be proved.
Step I : Prove statement for n=1
Step II : Assume that statement is true for n = k; n ∈ ℕ.
Step III : Prove statement for n = k+1.
Then by first principle of mathematical induction, the result is true for all n ≥ 1.

Example 1:
Prove that sum of first n natural numbers in .

Solution:
Let p (n) = 1 + 2 + 3 + … + n

=
Step I: For n=1.
LHS =1

RHS =
∴ LHS = RHS
∴ Statement is true for n=1.

Step II: Assume tat statement is true for n = k, k ∈ ℕ.

∴ 1 +2 +3 +… +k =

Step III: Now to prove statement for n = k+1

i.e., to prove 1+ 2+ 3+…+ k+ (k+1) =


Consider,
LHS = 1+ 2+ 3+ …+ (k+1)
= [1+2+3+…+k] + (k+1)

30
=

= RHS

∴ Result is true for n = k + 1


∴ By principle of mathematical induction, statement is true for any natural number n.

Example 2:
Prove that sum of squares of first n natural numbers is

Solution:
Let,
P (n) = 12 + 22 + 32 + … + n2

=
i.e. to prove 12 + 22+ 32+ … + n2

Step I: For n =1
LHS = 12=1

RHS =

=
=1
∴ LHS = RHS
∴ the statement is true for n = 1.

Step II: Assume that statement is true for n = k, k ∈ ℕ.

∴ 12 +22 +32 +… +k2 =

Step III: Now to prove statement is true for n = k+1

i. e., to prove 12+22+32+ … + k2 + (k+1)2 =

Consider,
LHS = 12+22+32+ … + k2 + (k+1)2
= (12+22+32+ … + k2) + (k+1)2

=
= RHS

31
Discrete Mathematics

∴ Statement is true for n= k+1


∴ By first principle of mathematical induction, statement is true for all natural numbers n.

3.3 Second Principle of Mathematical Induction


Statement:
Let p (n) be a statement involving a natural number n.
If,
i. p (1) is true. (i.e., statement is true for n = 1)
ii. p (k) is true for all 1<k<m then p (m) is true.
Then p (n) is true ∀ n ≥ 1.

Working rule:
Consider p (n)
Step I : Prove statement for n = 1
Step II : Assume statement for 1 < k < 1
i.e., for k = 2,3,4,5 …., (m-2), (m-1) statement is true.
Step III : Now to prove statement or n = m
Then statement p (n) is true ∀ n ≥ 1

Example 1:
Prove that integer ‘n’ can be expressed as a product of positive primes, n ≥ 2.

Solution:
Let p (n): n can be expressed as product of primes n ≥ 2.
: n = p1.p2.p3 … pr where pi’s are prime numbers.

Step I : For n = 2
Here ‘2’ itself a prime number.
Result holds for n = 2.

Step II : Assume statement for 2 < k < m


(i.e., if k < m, it can be expressed as product of primes)

Step III : Now to prove statement for n = m


If m is a prime number then result is clear.
Suppose m in not a prime.
∴ m is composite.
∴ m is product of two integers.
Say, m = r.s … (1)
Where r < m < s and r, s ∈ ℤ
Here, r < m and s < m
∴ From Step II. R, s can be expressed as product of primes.
Say, r = r1.r2… ri
s = s1.s2… sj
Where r1 … ri, s1…sj are primes.
With these equation (1) becomes,
m = (r1.r2…ri). (s1.s2…sj)
= (Product of Primes)
∴ Statement is true for n = k +1.
∴ by second principle of mathematical induction statement is true for all n ≥ 2.

32
Example 2:
If u1=3, u2=5, un = 3un-1 – 2n-2 for n ≥ 3.
Then using induction, show that, un = 2n +1 ∀ n ≥ 3.

Solution:
Let p (n) : un = 2n +1

Step I: For n = 3.
Um = 3um-1 – 2um-2 (by definition)
= 3.2m-1 – 2.2m-2
= 3.2m-1 – 2m-2+1
= 3.2m-1 – 2m-2
= (3-1). 2m-1
= 2.2m-1
= 2m
∴ Statement is true for n = m.
∴ By second principle of Mathematical induction p (n) is true ∀ n ≥ 3.

3.4 Different Perspective of Applying Mathematical Induction Principles


Principle of Mathematical Induction (English)
• Show something works the first time.
• Assume that it works for this time.
• Show it will work for the next time.
• Conclusion, it works all the time.

Principle of Mathematical Induction (Mathematics)


• Show true for n = 1
• Assume true for n = k
• Show true for n = k + 1
• Conclusion: Statement is true for all n >= 1
(The key word in step 2 is assume)
You are not trying to prove it’s true for n = k, you’re going to accept on faith that it is, and show it’s true for the next
number, n = k + 1. If it later turns out that you get a contradiction, then the assumption was wrong.

Example:
Prove that 1 + 4 + 9 + ... + n2 = for all positive integers n.
Another way to write “for every positive integer n” is ∀ n ∈ ℤ +. This works because ℤ is the set of integers, so ℤ
+
 is the set of positive integers.

The ‘∀’ is the symbol for “for all” or “for every” or “for each” and the symbol that looks like a weird e is the “element
of” symbol. So technically, the statement is saying “for every n that is an element of the positive integers”, but it’s
easier to say “for every positive integer n”.

Solution:
Identify the general term and nth partial sum before beginning the problem
The general term, an, is the last term on the left hand side. an = n2

The nth partial sum, Sn, is the right hand side. Sn =

Find the next term in the general sequence and the series
The next term in the sequence is ak+1 and is found by replacing n with k+1 in the general term of the sequence,

33
Discrete Mathematics

an.ak+1 = ( k + 1 )2
The next term in the series is Sk+1 and is found by replacing n with k+1 in the nth partial sum, Sn. You may wish to
simplify the next partial sum, Sk+1

Sk+1 =

Sk+1 = (This will be our Goal in step 3)

We will use these definitions later in the mathematical induction process. We’re now ready to begin.

1. Show the statement is true for n = 1, that is, Show that a1 = S1.
a1  is the first term on the left or you can find it by substituting n=1 into the formula for the general term, an.
S1 is found by substituting n=1 into the formula for the nth partial sum, Sn.
LHS: a1 = 1
RHS: S1 = = =1
So, you can see that the left hand side equals the right hand side for the first term, so we have established the first
condition of mathematical induction.

2. Assume the statement is true for n = k


The left hand side is the sum of the first k terms, so we can write that as Sk. The right hand side is found by substituting
n=k into the Sn formula.

Assume that Sk =

3. Show the statement is true for n = k+1


What we are trying to show is that,

Sk+1 = .

This was our goal from earlier.

We begin with something that we know (assume) is true and add the next term, ak+1, to both sides.

Sk + ak+1 = + ak+1

On the left hand side, Sk + ak+1 means the “sum of the first k terms” plus “the k+1 term”, which gives us the sum of
the first k+1 terms, Sk+1.
Assume k=10. Then Sk would be S10, the sum of the first 10 terms and ak+1 would be a11, the 11th term in the sequence.
S10 + a11 would be the sum of the 10 terms plus the 11th term which would be the sum of the first 11 terms. On the
right hand side, replace ak+1 by (k+1)2, which is what you found it was before beginning the problem.

Sk+1 = + (k + 1)2


Now, try to turn your right hand side into goal of .
You need to get a common denominator, so multiply the last term by

Sk+1 = +

Now simplify. It is almost always easier to factor rather than expand when simplifying.
This is especially aided by the fact that your goal is in factored form. You can use that to help you factor.

You know that you want a (k+1) (k+2) (2k+3) in the final form.

We see right now that there is a (k+1) that is common to both of those, so let’s begin by factoring it out.

34
Sk+1 =

What’s left inside the brackets [ ] doesn’t factor, so we expand and combine like terms.

Sk+1 =

Sk+1 =

Now, try to factor 2k2 + 7k + 6, keeping in mind that you need a (k+2) and (2k+3) in the goal that you don’t have
yet.

Sk+1 =

Conclusion
The conclusion is found by saying “Therefore, by the principle of mathematical induction” and restating the original
claim.

Therefore, by the principle of mathematical induction, 

1 + 4 + 9 + ... + n2 = for all positive integers n

3.5 Steps to Use Mathematical Induction


Any infinite sequence of statement is proved true or false by mathematical induction through 2 steps.

• Basis or Base step is to prove that the statement is true for the lowest value of the statement.
• Inductive step is to show that, if the statement is true for some natural number n then it is also true when n+1
is substituted in place of n.

The assumption in second step that the statement is true for some n is called Induction Hypothesis.
Let's use the Mathematical induction to prove the following statement.
1 + 3 + 5 + .............. + (2n - 1) = n2 is true for all natural numbers.
This statement gives the formula for sum of odd natural numbers less than or equal to n.
To prove the statement by mathematical induction, first step is to prove Base step. Let the statement be P(n).
Base step: In this step, it should be proved that the statement is true for lowest value, that is P(1) = 1, substitute 1
in place of n.
1 = 12
1=1
Both sides are equal, so the statement is true for n = 1.
Inductive step: Let us assume that P(n) is true.
1 + 3 + 5 +................. + (2n - 1) = n2
It must than be shown that P(n + 1) is also true.
1 + 3 + 5 + ................ + (2n -1) + (2n + 1)
= n2 + (2n + 1)
= n2 + 2n + 1
= (n + 1)2
Thereby, showing that P(n + 1) is true.

Since both, the Base and Inductive step have been proved, it has been proved by mathematical induction that P (n)
is true for all natural number.

35
Discrete Mathematics

The Inductive step is another way to say that, if P (1) is true then P (2) is true, if P (2) is true then P (3) is true, if P
(3) is true then P (4) is true and so on.

Mathematical induction is just a shortcut that defines infinite number of such steps into two steps above.

Solved examples on Mathematical Induction

1. Use mathematical induction to prove that, 1+2+3+ … + n = for all positive integers n.
Solution:
Let the statement P (n) be

1 + 2 + 3 + ... + n =

STEP 1: We first show that p (1) is true.

LHS = 1

RHS = =1

Both sides of the statement are equal. Hence, p (1) is true.

STEP 2: We now assume that p (k) is true.

1 + 2 + 3 + ... + k = and show that p (k + 1) is true by adding k + 1 to both sides of the above
statement.

1 + 2 + 3 + ... + k + (k + 1) = + (k + 1)

= (k + 1) ( + 1)

The last statement may be written as

1 + 2 + 3 + ... + k + (k + 1) =

This is the statement p(k + 1)

2. Prove that 12 + 22 + 32 + ... + n2 = , for all positive integers n.


Solution:
Statement P (n) is defined by

12 + 22 + 32 + ... + n2 =

36
STEP 1: We first show that p (1) is true.
LHS = 12 = 1

RHS = =1

Both sides of the statement are equal. Hence, p (1) is true.

STEP 2: We now assume that p (k) is true.

12 + 22 + 32 + ... + k2 = and show that p (k + 1) is true by adding (k + 1) 2 to both sides


of the above statement.

12 + 22 + 32 + ... + k2 + (k + 1)2 = + (k + 1)2

Set common denominator and factor k + 1 on the right side.

Expand k (2k + 1) + 6 (k + 1)

Now factor 2k2 + 7k + 6.

We have started from the statement P (k) and have shown that,

12 + 22 + 32 + ... + k2 + (k + 1)2 =

This is the statement P (k + 1).

1. Use mathematical induction to prove that,

13 + 23 + 33 + ... + n3 = for all positive integers n.


Solution:
Statement P (n) is defined by,

13 + 23 + 33 + ... + n3 =

STEP 1: We first show that p (1) is true.


LHS = 13 = 1

RHS = =1

37
Discrete Mathematics

Hence, p (1) is true.

STEP 2: We now assume that p (k) is true.

13 + 23 + 33 + ... + k3 =
Add (k + 1)3 to both the sides.

13 + 23 + 33 + ... + k3 + (k + 1)3 = + (k + 1)3

factor (k + 1)2 on the right side

= (k + 1)2 [ + (k + 1)]

Set to common denominator and group.

We have started from the statement P(k) and have shown that

13 + 23 + 33 + ... + k 3 + (k + 1) 3 =

This is the statement P (k + 1).

2. Prove that for any positive integer number n, n3 + 2 n is divisible by 3.


Solution:
Statement P (n) is defined by,

n3 + 2 n is divisible by 3

STEP 1: We first show that p (1) is true. Let n = 1 and calculate n3 + 2n

13 + 2(1) = 3

3 is divisible by 3

Hence, p (1) is true.

STEP 2: We now assume that p (k) is true

k3 + 2 k is divisible by 3 is equivalent to k3 + 2k = 3 M, where M is a positive integer.

We now consider the algebraic expression (k + 1)3 + 2 (k + 1); expand it and group it like terms:

(k + 1)3 + 2 (k + 1) = k 3 + 3 k 2 + 5 k + 3

38
= [k3 + 2 k] + [3k2 + 3 k + 3]

= 3 M + 3 [k2 + k + 1] = 3 [M + k2 + k + 1]
Hence, (k + 1)3 + 2(k + 1) is also divisible by 3 and therefore, statement P (k + 1) is true.

39
Discrete Mathematics

Summary
• Mathematical induction is a method of mathematical proof typically used to establish that a given statement is
true of all natural numbers (non-negative integers).
• The method can be extended to prove statements about more general well-founded structures, such as trees; this
generalisation, known as structural induction, is used in mathematical logic and computer science. Mathematical
induction in this extended sense is closely related to recursion.
• Mathematical induction should not be misconstrued as a form of inductive reasoning, which is considered non-
rigorous in mathematics.
• Mathematical induction is a form of rigorous deductive reasoning.
• The principle of mathematical induction is usually stated as an axiom of the natural numbers.
• The simplest and most common form of mathematical induction proves that a statement involving a natural
number n holds for all values of n.
• The proof consists of two steps, a) the basis (base case): showing that the statement holds when n is equal to
the lowest value that n is given in the question. Usually, n = 0 or n = 1. b) The inductive step: showing that if
the statement holds for some n, then the statement also holds when n + 1 is substituted for n.

References
• Langote, U. B. & Vhanmane, M. M., 2009. Discrete Mathematics, Mathematical Induction, 2nd ed., Tech-Max
Publication.
• Rosen, K., 2007. Discrete Mathematics, Mathematical Induction, 6th ed., McGraw Hill publication.
• Davis, T., Mathematical Induction, [Pdf] Available at: <http://www.math.utah.edu/mathcircle/notes/induction.
pdf> [Accessed 20 June 2013].
• Mathematical Induction, [Pdf] Available at: <http://www.people.vcu.edu/~rhammack/BookOfProof/Induction.
pdf> [Accessed 20 June 2013].
• bullcleo1, 2010. Mathematical Induction [Video online] Available at: <http://www.youtube.com/
watch?v=QHkG0d5kZvE> [Accessed 20 June 2013].
• AbsoluteMathematics, 2011. Mathematical Induction [Video online] Available at: <http://www.youtube.com/
watch?v=Uqn3f2k4vrA> [Accessed 20 June 2013].

Recommended Reading
• Fomin, D., Genkin, S. & Itenberg, I., 1996. Mathematical Circles (Russian Experience), AMS.
• Graham, R., Knuth, D. & Patashnik, O., 1994. Concrete Mathematics, 2nd ed., Addison-Wesley.
• Courant, R. & Robbins, H., 1996. What is Mathematics?, Oxford University Press.

40
Self Assessment
1. Let S (n) = 2n − 1. Evaluate S(k)
a. k - 1
b. k - 2
c. 2k - 1
d. (k – 1)2

2. Let S (n) = 2n − 1. Evaluate S(k + 1)


a. k + 2
b. 2k + 1
c. k + ½
d. (k + 1)2

3. The sum of the first n odd numbers is equal to the nth square. 1 + 3 + 5 + 7 + . . . + (2n − 1) = n². To prove this
by mathematical induction, what will be the induction assumption?
a. 2k
b. k2
c. k + 2
d. k/2

4. How many properties are there in induction principle?


a. One
b. Two
c. Three
d. Four

5. Induction is a defining difference between discrete and _____________mathematics.


a. continuous
b. non-continuous
c. real
d. non-real

6. Mathematical induction is based on which of the following concepts?


a. Hypothesis
b. Real time
c. Induction principle
d. Others

41
Discrete Mathematics

7. Contradictory proof of mathematics can be formulated by ___________.


a. induction
b. function
c. relation
d. differentiation

8. Mathematical induction is the method of proving statement true for all ___________ numbers.
a. even
b. odd
c. natural
d. prime

9. In mathematical induction, which of the following is true, if p (n) is a statement involving a natural number?
a. P(1)
b. P (r)
c. P (k) ≠ 0
d. P (k+1) ≠ 0

10. According to second principle of mathematical induction, statement is true for all ____________.
a. n
b. n – 1
c. n > 1
d. n ≥ 1

42
Chapter IV
Recurrence Relation

Aim
The aim of this chapter is to:

• explain the concept of recurrence relation

• describe the construction of recurrence relation

• introduce homogeneous and non-homogeneous recurrence relation

Objectives
The objectives of this chapter are to:

• explicate the characteristic equation of recurrence relation

• explain discrete and constant functions of variables in recurrence relation

• emphasise on various terminologies and concepts of recurrence relation

Learning outcome
At the end of this chapter, you will be able to:

• differentiate between homogeneous and non-homogenous recurrence relation

• solve problems on characteristic roots and characteristic equation

• calculate the degree of recurrence relation

43
Discrete Mathematics

4.1 Introduction
In computer science, recursive techniques are useful in algorithms, programmes etc.The recursive formula is called
recurrence relation, in which if we know the first few terms of a sequence, then by using previous terms, we can
find all remaining terms. Recurrence relations arise naturally in many counting problems and programme analysis
problems and programme analysis problems.

4.2 Definition of Recurrence Relation


If a1, a2, a3… ar be a sequence, then relation that relates ar to one or more previous terms of sequence is called
Recurrence Relation.

To define sequence corresponding to recurrence relation, it is important to know first few terms, which are called
as initial conditions of recurrence relation.

Example:
1) ar = ar-1 + with initial condition a0 = 10. It generates the sequence a0 = 10, a1 = 15, a2 = 20 …
i.e., <10, 15, 20, 25, …>
2) Fibonacci sequence: fn = fn-1 + fn-2 with initial conditions f0 = 1, f1 =1.
It generates f0 = 1, f1 =1, f2 =2, f3 = 3, f4 = 5, f5 = 8 …
i.e., <1, 1, 2, 3, 5, 8, 13, 21, … >

If we change initial conditions, then the corresponding sequence also changes.

Example:
ar = ar-1 +2 with a0 =1
Corresponding sequence is,
<1, 3, 5, 7, 9, 11 ...> sequence of odd numbers.
Now if we take the same recurrence relation:
Ar = ar-1 +2 with a0 = 2
Corresponding sequence is,
<2, 4, 6, 8 … >, sequence of even numbers.

4.2.1 Linear Recurrence Relation with Constant Coefficients


Let a1, a2, a3 … an … be infinite sequence then recurrence relation of the form c0 ar + c1 ar-1 + c2 ar-2 + c3 ar-3 + … + ck
ar-k = f(r). Where are constants, such function is called linear recurrence relation with constant coefficient.

4.3 Construction of Recurrence Relation


Example 1:
Sharma invests Rs.10,0000/- to purchase a land. Land cost increases by 20% per year. From recurrence relation,
what will be the cost of land after ‘n’ years?

Solution:
Initially land cost = Rs.100000/- i.e., a0 = 100000, suppose an is the land cost after n years.

44
We observe following table:
No. of years Initial land cost at starting of nth year 20% increases land cost Land cost at end of nth year
0 100000 00 100000

1 100000 100000 + 20000 = 120000

2 120000

: : :
n-1 --- ---

N an-1

Table 4.1 Solution to Example 1

∴ Land cost at the end of nth year will be


with initially a0 = 100000.

4.3.1 Degree of Recurrence Relation


Number of previous terms required to find next term of sequence in recurrence relation is called degree recurrence
relation.
i.e., Let, c0 ar + ci ar-1 + c2ar-2 + ... + ck ar-k = f (r) is recurrence relation. To find the value of ar, it is important to know
the previous terms, namely, ar-1, ar-2 ... ar-k. Hence, k is a degree of above recurrence relation.

Example:
Find degree of recurrence relation.

Solution:
Here, we require two values of ar-1, ar-2, to find value of ar. Hence, degree of recurrence relation is 2.

4.3.2 Characteristic Equation of Recurrence Relation


If c0 ar + c1 ar-1 + c2 ar-2 + ... + ck ar-k + f(r)
Be recurrence relation with constant coefficient of degree k then equation of the type
c0 αk + c1 αk-1 + c2 αk-2 + c3 αk-3 + ... + ck α(k-k) = 0
where, α is constant.
Such equation is called characteristic equation of recurrence relation.

4.3.3 Characteristic Roots of Recurrence Relation


Roots of characteristic equation of recurrence relation are called as Characteristic roots of recurrence relation. i.e.,
values of variable α which satisfy the characteristic equation are called as characteristic roots. Say α1, α2, α3, ..., αk
are k characteristic roots.

Degree of recurrence relation = number of characteristic roots


All characteristic roots may not be distinct.

Example:
Find characteristic equation and characteristic roots of recurrence relation.
ar- 7 ar-1 +12 ar-2 = 0

45
Discrete Mathematics

Solution:
Degree of recurrence relation is k =2.
Characteristic equation is,
⇒ 1. αk - 7 αk-1 + 12 αk-2 = 0 as k=2
⇒ 1. α 2 - 7 α2-1 + 12 α2-2 = 0
⇒ α - 7 α + 12 = 0

Characteristic roots are,


⇒ α2 - 7 α + 12 =0
⇒ (α – 3) (α – 4) = 0
⇒ α = 3 or α = 4
⇒ α = (3, 4) are two characteristic roots.

4.3.4 Homogeneous Recurrence Relation


Recurrence relation of the type
c0 ar + c1 ar-1 +c2 ar-2 + ... + ck ar-k = f(r) is non homogenous recurrence relation, if f(r)=0.
i.e.,
c0 ar + c1 ar-1 +c2 ar-2 + ... + ck ar-k = 0, is a homogenous recurrence relation.

4.3.5 Non-homogenous Recurrence Relation


Recurrence relation of the type
c0 ar + c1 ar-1 +c2 ar-2 + ... + ck ar-k = f(r) is a non-homogenous recurrence relation, if f(r) ≠ 0
i.e., f(r) may be constant or any function of variable ‘r’.

4.4 Solution of Recurrence Relation


Numeric function described by recurrence relation together with an appropriate set of initial conditions is called a
solution of recurrence relation.

Homogenous Solution ( ):
A solution that satisfies the recurrence relation when right hand side of recurrence relation is zero, is called
homogeneous solution. And is denoted as .

Particular Solution (
A solution which satisfies the recurrence relation with non zero f(r) on right hand side is called particular solution.
It is denoted by

Recurrence Relation
c0 ar + c1 ar-1 +c2 ar-2 + ... + ck ar-k = f(r)

Homogenous recurrence relation Non-homogenous recurrence relation


f(r) = 0 f (r) ≠ 0
Total solution = Homogenous solution Total solution = Homogenous solution + Particular solution
That is T.S. = a(h)r That is T.S. = ar(h)+ar(p)

Fig. 4.1 Homogenous and non-homogenous recurrence relation

4.4.1 Solution of Homogenous Recurrence Relation


Solution of homogenous recurrence relation is only a homogenous solution .
That is, total solution ar = .
Working steps:
Step I : Consider homogenous recurrence relation.

46
c0 ar + c1 ar-1 + c2 ar-2 +c3 ar-3 + ... + ck ar-k = 0
with k initial conditions.

Step II : Find order, characteristic equation, characteristic roots (say α1, α2, α3... αk) of recurrence relation.
Characteristic roots are may or may not be distinct.

Step III : (A) If all characteristic roots are not distinct that is α1 ≠ α2 ≠ α3 ≠... αk then,
c1 (α1) r + c2 (α2) r + c3 (α3) r +...+ck (αk) r
(B) If all characteristic roots are not distinct, say α1 occurs t times and remaining are distinct. Then,
c1 (α1) r + c2 (α2) r + (αi-1) r + ( + r+ r2 + ... + r (t-1)) + ci+1 (αi+1)r+ ...+ ck is homogenous
solution, with all c0, c1, c2, c3, ... ck are constant.

4.4.2 Solution of Non-homogenous Recurrence Relation


Recurrence relation of the type,
c0 ar + c1 ar-1 + c2 ar-2 +c3 ar-3 + ... + ck ar-k = f (r)
f (r) ≠ 0 is called non-homogenous recurrence relation. Its total solution is:
T.S = ar =
i.e., a sum of homogenous solution and particular solution.

Steps to solve Non-homogenous recurrence relation:


Step I : Consider non homogenous recurrence relation. c0 ar + c1 ar-1 + c2 ar-2 + ... + ck ar-k = f(r) where f(r)=0
Step II : To find homogenous solution, consider f(r) =0. Then recurrence relation becomes homogenous. Its solution
is (refer steps to find homogenous solution of homogenous recurrence relation.)
Step III : To find particular solution, consider f®. Depending on nature of f(r), the form of particular solution is as
follows:

f (r) Form of particular solution


d
constant
d0 + d1r
linear equation
d0 + d1 r + d2 r2 + ... +dn rn (polyno-
mial of degree n)
ar
(exponential)
d.ar

(d0+d1r) ar

(d0 + d1r + d2r2+ ... + dn rn) ar

Table 4.2 Solution to solve non-homogenous recurrence relation



are all constants.
Step IV : using given recurrence relation find values of constants p0, p1, p2... pn. IF all values of p1, p2... pn exists, put
it in of step III.
Step V : If there is some contradiction to find values of p1, p2... pn , then use another form of particular solution r.
(r times previous term of particular solution) continues the above process to get all values of p1, p2... pn and
put them in

47
Discrete Mathematics

Step VI : Form ar = +
Step VII: Find values of c0, c2 ... ck from ar, using initial conditions which gives required solution of given recurrence
relation.

4.5 Applications of Recurrence Relation


Recurrence relation equations are applicable universally to different fields such as, Economics, Digital signal
processing, Biology etc.

Economics
Recurrence relations, especially linear recurrence relations, are used extensively in both theoretical and empirical
economics.
In particular, in macroeconomics, one might develop a model of various broad sectors of the economy (the financial
sector, the goods sector, the labor market, etc.) in which some agents’ actions depend on lagged variables.
The model would then be solved for current values of key variables (interest rate, real GDP, etc.) in terms of
exogenous variables and lagged endogenous variables. Refer to time series analysis.

Digital signal processing


In digital signal processing, recurrence relations can model feedback in a system, where outputs at one time become
inputs for future time. They thus arise in infinite impulse response (IIR) digital filters.
Example: The equation for a “feed forward” IIR comb filter of delay T is:
yt = (1 − α)xt + αyt − T
Where xt is the input at time t, yt is the output at time t, and α controls how much of the delayed signal is fed back
into the output. From this we can see that
yt = (1 − α) xt + α((1 − α) xt − T + αyt − 2T)
yt = (1 − α) xt + (α − α2) xt − T + α2yt − 2T etc.

Biology
Some of the best-known difference equations have their origins in the attempt to model population dynamics.
Example: The Fibonacci numbers were once used as a model for the growth of a rabbit population.
The logistic map is used either directly to model population growth, or as a starting point for more detailed models.
In this context, coupled difference equations are often used to model the interaction of two or more populations.
For example, the Nicholson-Bailey model for a host-parasite interaction is given by
Nt+1 = λ Nt e-aPt,
Pt+1 = Nt (1-e-aPt),
with Nt representing the hosts, and Pt the parasites, at time t.
Integro difference equation is a form of recurrence relation important to spatial ecology. These and other difference
equations are particularly suited to modelling univoltine populations.

Solved Examples:
1. Paresh opened a bank account by investing Rs.1000. He deposits Rs.100 in it each month. Bank pays 2% interest
monthly. Find the recurrence relation for the amount of money on Paresh’s account after n years.
Solution:
Let N = Number of months
P = Principle amount
R = Rate of interest
T = Total amount
I = Interest
I= and
T=P+I

48
Consider following table for some months.

N P I= T=P+I

No. of Months Principle amount Interest Total Amount


0 1000 0 1000 + 0 = 1000

1 1000+100 = 1100 1100 + 22 = 1122

1222 + 24.44 =
2 1122 + 100 = 1222
1246.44
: : : :
n -1 …. …. an-1

( +
n 1000 + an-1

⇒an =

=
⇒an = 1020+ 1.02 an-1­ with a0 = 1000

2. Solve the recurrence relation. an – 2an-1 + an-2 = 0


Solution:
Here f(r) = 0
∴ Homogeneous recurrence relation.
Its degree is 2 i.e., k =2
∴ Its characteristic equation is,
αk - 2αk-1 + αk-2 = 0
α2 - 2α + 1 = 0
(α - 1)2 = 0
α = 1, α = 1 are repeated character toots.

3. If characteristic roots of recurrence relation are 2, 2, 3 with f(r) = (r2 + 1) 2r. Then what will be particular solution
of such recurrence relation.

Solution:
Here 𝛂 = 2 is a characteristic root, with multiplicity 2, and f(r) = (r2 + 1) 2r contains one of the term 2r hence two
time contradiction occur in

∴ Required form of particular solution is,

49
Discrete Mathematics

Summary
• In mathematics, a recurrence relation is an equation that recursively defines a sequence i.e., each term of the
sequence is defined as a function of the preceding terms.
• The term difference equation sometimes (and for the purposes of this article) refers to a specific type of recurrence
relation.
• “Difference equation” is frequently used to refer to any recurrence relation.
• If the recurrence is inhomogeneous, a particular solution can be found by the method of undetermined coefficients
and the solution is the sum of the solution of the homogeneous and the particular solutions.
• Another method to solve an inhomogeneous recurrence is the method of symbolic differentiation.
• Many linear homogeneous recurrence relations may be solved by means of the generalised hypergeometric series.
Special cases of these lead to recurrence relations for the orthogonal polynomials, and many special functions

References
• Ramana, B. V. & Grimaldi, R. P., 2008. Discrete and Combinatorial Mathematics, Recurrence Relations, 5th
ed., Pearson Education India.
• Rosen, K. H. & Michaels, J. G., 2000. Handbook of discrete and combinatorial mathematics, Recurrence
Relations, CRC Press.
• Recurrence Relations, [Pdf] Available at: <http://www.mathdb.org/resource_sharing/training/se_rr.pdf>
[Accessed 20 June 2013].
• Moura, L., Recurrence Relations, [Pdf] Available at: <http://www.site.uottawa.ca/~lucia/courses/2101-10/lect
urenotes/07RecurrenceRelations.pdf> [Accessed 20 June 2013].
• tjkearns1, 2013. Introduction to Recurrence Relations-1 [Video online] Available at: <http://www.youtube.com/
watch?v=loh8rYkghHg> [Accessed 20 June 2013].
• nptelhrd, 2007. Lecture 32 - Recurrence Relations [Video online] Available at: <http://www.youtube.com/
watch?v=qvw1GX93JSY> [Accessed 20 June 2013].

Recommended Reading
• Gupta, S. B., 2005. Comprehensive Discrete Mathematics and Structures, Recurrence Relations, 2nd ed., Laxmi
Publication.
• Veerarajan., 2006. Discrete Mathematics, Recurrence Relations, 7th ed., Tata McGraw-Hill.
• Gupta, S. B., 2008. Discrete Mathematics And Structures, Recurrence Relations, 5th ed., Laxmi Publications
Ltd.

50
Self Assessment
1. Roots of characteristic equation of recurrence relation are called _____________.
a. roots
b. root equation
c. characteristic roots
d. recurrence roots

2. A solution that satisfies the recurrence relation when right hand side of recurrence relation is zero, is called
_________________.
a. particular solution
b. zero solution
c. recurrence solution
d. homogeneous solution

3. A solution which satisfies the recurrence relation with non zero f(r) on right hand side is called
_______________.
a. particular solution
b. zero solution
c. recurrence solution
d. homogeneous solution

4. Non homogeneous recurrence relation = _______________


a. f (r) = 1
b. f (r) ≠ 0
c. f (r) = 0
d. f (r) ≠ 1

5. Find the characteristic equation for, ar – 7 ar-1 + 12 ar-2 = 0.


a. k -7k +12k = 0
b. α2 - 7α - 12α = 0
c. α2 - 7α - 12 = 0
d. α2 + 7α2 + 12α2 = 0

6. Find the characteristic roots of recurrence relation ar – 7 ar-1 + 12 ar-2 = 0.


a. 1, 2
b. 7, 11
c. 12, 6
d. 3, 4
7. Sum of homogeneous solution and particular solution is _______________.
a. homogeneous recurrence relation
b. total solution of non homogenous recurrence relation
c. non homogenous recurrence relation
d. total solution of homogeneous recurrence relation

51
Discrete Mathematics

8. Find the characteristic roots of recurrence relation ar + 6 ar-1 + 12 ar-2 + 12 ar-3= 0.


a. 6, 2
b. -6 , 12
c. – 6, - 2
d. 6, -2

9. Find the characteristic roots of recurrence relation ar - 6 ar-1 + 12 ar-2 = 0.


a. 6, 2
b. -6 , 12
c. – 6, - 2
d. 6, -2

10. Find the characteristic roots of recurrence relation ar - 3 ar-1 + 21 ar-2 = 0.


a. 9, 12
b. 3, 7
c. 8, 13
d. -9, -12

52
Chapter V
Graphs

Aim
The aim of this chapter is to:

• explicate the basics of graph theory

• explain the concepts of representing data by graphs

• focus on terminologies involved in graph theory

Objectives
The objectives of this chapter are to:

• describe graph theory and its applications in computer science

• explain various types of graphs and their uses

• introduce isomorphism in graph theory

Learning outcome
At the end of this chapter, you will be able to:

• enlist the various types of graphs

• understand information in graphs by getting various inputs with specific object

• recognise the complex graphs and understand the intricacy of information or complexity of problem

53
Discrete Mathematics

5.1 Introduction
In everyday life, we have to translate descriptive data into various types of symbolic forms. Graph is also one of
the forms of symbolic representation of descriptive data in terms of points (verticals) and line segments (edges). It
is widely used in many fields like Electrical Engineering, telecommunication, genetics, computer science etc.

A graph is simply a collection of finite points (called vertices) and line segments (called edges) in which each edge
is assigned to pair of points called end vertices or terminal (not necessarily distinct). Informally, a graph is a bunch
of dots connected by lines. Here is an example of a graph:

Sadly, this definition is not precise enough for mathematical discussion. Formally, a graph is a pair of sets (V, E),
where:
• V is a non-empty set whose elements are called vertices.
• E is a collection of two-element subsets of V called edges.
The vertices correspond to the dots in the picture, and the edges correspond to the lines.
Thus, the dots-and-lines diagram above is a pictorial representation of the graph (V, E) where,
V = {A, B, C, D, E, F, G, H, I}
E = {{A, B}, {A, C}, {B, D}, {C, D}, {C, E}, {E, F}, {E, G}, {H, I}}.

5.2 Terminologies in Graph


Graph: A graph G is an ordered pair (V,E) where V is the non-empty set of vertices and E is the set of edges in
which each element of E is assigned to a unique unordered pair of elements (not necessarily distinct) of V.
An element of a set E is generally denoted as e – (u, v) or e = (v, u) where u, v ∈ V.
Here u, v are called end vertices of edge e.
Example:
(1)
u w

Here, V = {u, v, w}
E = {e1, e2,}
e1 e2

(2)
v1 v2 e2 Here, V = {v1, v2, v3, v4, v5}
E = {e1, e2, e3, e4, e5}
e1
e5 e3 Observe in G2 edge
G2
v5 e2 = (v2, v2) has end vertices v2 and v2 i.e., same and
vertices.
v4 e4 v3

54
Loop: If both the end vertices of an edge are same then the edge is called a loop.
Example:
Here, V = {v1, v2, v3} , E = {e1, e2, e3, e4, e5} Hence edge
v1 e4 is a loop.
e4 e5 Observe that in G3 , edges e1 and e2 have same pair of end
e1 G3 vertices.
e2 i.e., e1 = (v1, v2)
v3 e2 = (v1, v2)
e3

Parallel edges: If two or more edges have same terminal vertices, then these edges are called as parallel edges.
Simple graph: A graph without loops and parallel edges is called simple graph.
Compound graph: A graph which contains loops or parallel edges is called compound graph or multigraph.
Adjacency and incidence: Tow vertices v1 and v2 in a graph G are said to be adjacent to each other, if they are
end vertices of the same edge e.
If the vertex u is an end vertex of the edge e then the edge e is said to be incident on vertex u.
Degree of a vertex: The number of edges incident on a vertex v is called degree of vertex v, with loop being counted
twice.
Notation: Degree of v = d (v)

Example:

Here,
d (v1) = 4
v1 d (v2) = 6
v2 d (v3) = 3
v6 d (v4) = 4
d (v5) = 1
d (v6) = 0
v5 v4 v3

Isolated vertex: A vertex with degree zero is called as isolated vertex.

Pendent vertex: A vertex with degree one is called as pendent vertex.

10. Degree of the graph: Sum of the degrees of all vertices of graph G is called degree of the graph G.
Notation: d (G) = degree of graph G.
i.e.,

Example:

Here,
v1 v2 d (v1) = 2
d (v2) = 4
d (v3) = 1
v3 d (v4) = 2
d (v5) = 3
d (G) = 2 + 4 +1 + 2 + 3 = 12
v5 v4 ∴ = 12.

55
Discrete Mathematics

5.3 Representation of Graph


Graph can be represented in following methods:
• Ordered pair representation
• Structure representation
• Matrix representation (i. Adjacency, ii. Incidence)

Ordered pair representation


A graph G can be represented in ordered pair (V, E) where V is non-empty set of vertices and E is set of edges.
Example:
G (V, E) with V = {v1, v2, v3, v4}
E = {(v1, v2) (v2, v4) (v3, v3) (v2, v3)}

Structure representation
A graph can be represented by structure with points and lines each line has two end points.
Example: Above order form of graph represented by structure.

Matrix representation
Depending on adjacency of vertices and incidency of an edge, a graph can be represented in two types of
matrices:
Adjacency matrix: If G is a graph on n vertices say v1, v2, v3, .... vn then adjacency matrix of G is the n
× n matrix A(G) =

Where,

Example: Consider the above graph,

v2

v4
A (G) =

v3

Observations:
The sum of the entries in the ithcolumn or ithrow gives the degree of vertex vi­ (diagonal entries counted twice).
aij= 0 if there is no loop at vi.
Since the number of edges joining vi to vj= no. of edges joining vj to vi.i.e. aij = aji
∴ Adjacency matrix is symmetric.
If G is a simple graph, then A (G) is a matrix containing 0s and 1s (Binary matrix in which each diagonal entry is
0).

Incidence matrix:
Let G be a graph in structural form with n vertices v1, v2 ...vn and m edges e1, e2, ...em then the incidence matrix of
G denoted by I(G) is,

56
I(G) = [aij]n×m where,

aij=

Example:
e1

v1 e3 e1 e2 e3 e4 e5
e2 v2 v1 1 1 0 0 1
I = (G) v2 1 1 2 1 0
e5 e4 v3 0 0 0 1 1

v3
Observations:
• Any column’s sum must be 2.
• The sum if the entries in a row indicate the degree of the corresponding vertex.
• If two columns are identical, then the corresponding edges are parallel edges.
• If a row contains only zero’s then the corresponding vertex must be an isolated vertex.
• If a row contains a single ‘1’ the corresponding vertex must be pendent vertex.
• If an edge is a loop there will be a single ‘2’ in the column remaining entries being zero’s.

5.4 Uses of Graphs


Graphs are the most useful mathematical objects in computer science. One can model an enormous number of
real-world systems and phenomena using graphs. Once we’ve created such a model, we can tap the vast store of
theorems about graphs to gain insight into the system you’re modelling.

Here are some practical situations where graphs arise:


• Data Structures: Each vertex represents a data object. There is a directed edge from one object to another if the
first contains a pointer or reference to the second.

• Attraction: Each vertex represents a person, and each edge represents a romantic attraction. The graph could be
directed to model the unfortunate asymmetries.

• Airline connections: Each vertex represents an airport. If there is a direct flight between two airports, then there
is an edge between the corresponding vertices. These graphs often appear in airline magazines.

• The web: Each vertex represents a web page. Directed edges between vertices represent hyperlinks.

People often put numbers on the edges of a graph; put colours on the vertices; or add other ornaments that capture
additional aspects of the phenomenon being modelled.
For example, a graph of airline connections might have numbers on the edges to indicate the duration of the

57
Discrete Mathematics

corresponding flight. The vertices in the attraction graph might be coloured to indicate the person’s gender.

5.5 Some Important Graphs


There are different types of graphs used in mathematics for representing descriptive data, which are explained
below:

Type of Graph Details Figure

1. Null Graph A graph with n


vertices without
edges is called as null
graph.
Notation: Nn = Null
graph with n vertices.

A simple graph G
2. Complete Graph is called a complete
graph, if there is an
edge between each
pair of vertices.
Notation: Kn =
complete graph on n
vertices.

3. Regular Graph If all vertices of a


graph G have same
degree, then G is
called as a regular
graph.
Notation: mRnor
R regular graph on
m n
n vertices.

4. Bipartite Graph A graph G(V, E) is


said to be bipartite,
if the vertex set V
can be partitioned
in to two non-empty
disjoint subsets V1
and V­2
(V= V1∪ V2, V1 ∩ V2
= ∅), such that each
edge in G has end
vertex in V1 and other
end vertex in V2.
There is no edge
between two vertices
of V1 as
­
well as
there is no edge
between two vertices
of V2. Here, V1, V2
bipartition of V.

58
5. n-partite Graph Graph G(V, E) is 1
said to be n-partite.
2 5
If vertex set V is
partitioned in to n
disjoint vertex sets
3 4
say V1, V2, V3, ... Vn.

6. Complete bipartite A bipartite graph


Graph is called complete
bipartite, if each
1 4
vertex of vertex set
V1 is adjacent to
2 5
every vertex set V2
contain n vertices,
3 6
then this bipartite
graph is denoted as
7
Km,n.

Table 5.1 Different types of graphs

5.6 Degree Sequence


If d1, d2, d3 ... dn are the degrees of the vertices of the graph on on vertices then increasing or decreasing sequence
of {di}in is called a degree sequence of the graph.

Example:

V2 d (v1) = 2
d (v2) = 2
d (v3) = 2
V1 d (v4) = 3
V4
d (v5) = 5
d (v6) = 2,
V6
Decreasing sequence of degree is
V5
5, 3, 2, 2, 2, 2

5.6.1 Graphical Degree Sequence


Let d1, d2...dn be finite sequence of non-negative integers. Then the sequence is called graphical degree sequence,
if there is a simple graph G of which d1, d2, ... dn is degree sequence.

We can solve graphical degree sequence problems by using Havel-Hakimi theorem.

Havel-Hakimi Theorem
Let S =(d1, d2, …, dn) be a sequence of n integers written in decreasing order: d1 ≥ d2 ≥ … ≥ dn-1 ≥ dn.
Then, S is a graphic sequence if and only if the following sequence S’ of n-1 integers is graphic, where k = d1:
S’ = (d2-1, d3-1 … dk+1-1… dn-1, dn).

Steps to determine whether degree sequence is graphical:


Step 1 : Consider decreasing degree sequence.
Step 2 : Use Havel-Hakimi theorem for modified sequence.
Step 3 : Rearrange terms in decreasing in order.

59
Discrete Mathematics

Step 4 : Continue steps 2 and 3.


Step 5 : If we get all terms zero, the original sequence is graphical otherwise is not graphical.

Example:
Show that the following sequence is graphical 5, 5, 4, 4, 3, 2, 2, 1.

Solution:
Consider degree sequence.

5, 5, 4, 4, 3, 2, 2, 1 Use Havel-Hakimi theorem

4, 3, 3, 2, 1, 2, 1 Arrange terms

4, 3, 3, 2, 2, 1, 1 Use theorem

2, 2, 1, 1, 1, 1 Use theore

1, 0, 1, 1, 1 Arrange terms

1, 1, 1, 1, 0 Use theorem

0, 1, 1, 0 Arrange terms

1, 1, 0, 0 Use theorem

0, 0, 0

At last, we get all zero.


∴ given degree sequence is graphical.

5.7 Isomorphism in Graphs


Definition:
Let G1(V1, E1) and G2(V2, E2) be two graphs. The graphs G1 and G2are said to be isomorphic, if there is bijective
function fv: V1→ E1such that if u and v are end vertices of some edge e ∈ E1 then fv(u), fv(v) end vertices of fE(e).
Sometimes, two graphs look different but they represent the same graph, then these two graphs are isomorphic
graphs.
ISO ≈ same morph ≈ structure

Example:
Following two graphs G1 and G2 are isomorphic.

G1 G2
p q w x

r s
z y
Here,
Number of vertices in G1 = 4 =number of vertices in G2
Number of edges in G1 = 4 = number of edges in G2

60
In graph G1

Vertex Degree Degree of adjacent vertices

P 2 2, 2

Q 2 2, 2

R 2 2, 2

S 2 2, 2

In graph G2

Vertex Degree Degree of adjacent vertices

W 2 2, 2

X 2 2, 2

Y 2 2, 2

Z 2 2, 2
i.e., adjacency of vertices preserves.
⇒f (p) = w, f (q) = x, f (r) = y, f (s) = z is bijection.
∴ G1 and G2 are isomorphic graphs.

5.7.1 Isomorphism by Using Adjacency Matrix


Two graphs G1 and G2 are isomorphic, if their adjacency matrices are equivalent (equivalent matrices = one matrix
is obtained from another matrix by interchanging rows or by interchanging columns).

Example:
Using adjacency matrices show that following two graphs are isomorphic:

q
b

t
p r
e c
a

s
d

Solution:
Adjacency matrix of G1 is,

61
Discrete Mathematics

Adjacency matrix of G2 is,

Consider A1 and apply R1,2 , R3,4

C1,2, C3,4

Last matrix is A2
∴ Graphs G1 and G2 are isomorphic.

5.8 Applicability of Graphs


Graphs are among the most ubiquitous models of both, natural and human-made structures. They can be used to
represent many types of relations and process dynamics in physical, biological and social systems. Many problems
of practical interest can be represented by graphs.

• In computer science, graphs are used to represent networks of communication, data organisation, computational
devices, the flow of computation, etc.

Example:
The link structure of a website could be represented by a directed graph. The vertices are the web pages available
at the website and a directed edge from page A to page B exists if and only if A contains a link to B.

• A similar approach can be taken to problems in travel, biology, computer chip design, and many other fields.
The development of algorithms to handle graphs is therefore of major interest in computer science.
• The transformation of graphs is often formalised and represented by graph rewrite systems. They are either
directly used or properties of the rewrite systems (e.g. confluence) are studied.
• Complementary to Graph Transformation Systems focussing on rule-based in-memory manipulation of graphs
are graph databases geared towards transaction-safe, persistent storing and querying of graph-structured data.
• Graph-theoretic methods, in various forms, have proven particularly useful in linguistics, since natural language
often lends itself well to discrete structure.
• Traditionally, syntax and compositional semantics follow tree-based structures, whose expressive power lies
in the Principle of Compositionality, modelled in a hierarchical graph. Within lexical semantics, especially as
applied to computers, modelling word meaning is easier when a given word is understood in terms of related
words; semantic networks are therefore important in computational linguistics. Still other methods in phonology
(e.g. Optimality Theory, which uses lattice graphs) and morphology (e.g. finite-state morphology, using finite-
state transducers) are common in the analysis of language as a graph. Indeed, the usefulness of this area of
mathematics to linguistics has borne organisations such as text graphs, as well as various ‘Net’ projects, such
as WordNet, VerbNet, and others.

62
• Graph theory is also used to study molecules in chemistry and physics. In condensed matter physics, the three
dimensional structure of complicated simulated atomic structures can be studied quantitatively by gathering
statistics on graph-theoretic properties related to the topology of the atoms.

Example:
Franzblau’s shortest-path (SP) rings.
• In chemistry, a graph makes a natural model for a molecule, where vertices represent atoms and edges bonds.
This approach is especially used in computer processing of molecular structures, ranging from chemical editors
to database searching.
• In statistical physics, graphs can represent local connections between interacting parts of a system, as well as
the dynamics of a physical process on such systems.

63
Discrete Mathematics

Summary
• In mathematics and computer science, graph theory is the study of graphs, mathematical structures used to
model pair wise relations between objects from a certain collection.
• Graphs are one of the prime objects of study in Discrete Mathematics.
• A graph may be undirected, meaning that there is no distinction between the two vertices associated with each
edge, or its edges may be directed from one vertex to another.The graphs studied in graph theory should not be
confused with [graphs of functions] or other kinds of graphs.
• Graphs are represented by drawing a dot or circle for every vertex, and drawing an arc between two vertices if
they are connected by an edge. If the graph is directed, the direction is indicated by drawing an arrow.
• A common problem, called the subgraph isomorphism problem, is finding a fixed graph as a subgraph.
• One reason to be interested in such a question is that many graph properties are hereditary for subgraphs, which
means that a graph has the property if and only if all subgraphs have it too.

References
• Gross, J. L. & Yellen, J., 2003. Handbook of Graph Theory, Graphs, CRC Press.
• Gross, J. L., 2007. Combinatorial Methods with computer applications, Graph theory, Chapman and Hall
CRC.
• Chapter IV – Graph Theory, [Pdf] Available at: <http://www.math.hkbu.edu.hk/~zqiao/Math1130_2009/Chap4.
pdf> [Accessed 20 June 2013].
• Graphs - Terminology and Representation, [Online] Available at: <http://www.radford.edu/~nokie/classes/360/
graphs-terms.html> [Accessed 20 June 2013].
• patrickJMT, 2010. Graph Theory - An Introduction! [Video online] Available at: <http://www.youtube.com/
watch?v=HmQR8Xy9DeM> [Accessed 20 June 2013].
• StatsLabDublin, 2013. Discrete Mathematics : Important Graph Theory Terms [Video online] Available at:
<http://www.youtube.com/watch?v=TwLYYOMAK4o> [Accessed 20 June 2013].

Recommended Reading
• Liu, C. L., 1968. Introduction to Combinatorial Mathematics, Graph theory, McGraw Hill New York.
• Deo N., 1974. Graph Theory with applications to Engineering and Computer Science, Graphs, Prentice Hall,
Englewood Cliffs, N.J.
• Rosen, K., Discrete Mathematics and its applications with Combinatorics and graph theory, Graph theory, 6th
ed., Tata McGraw Hill publication.

64
Self Assessment
1. ____________ is a collection of finite points and line segments in which edge is assigned to a pair of points.
a. Vertices
b. Vertex
c. Graph
d. Cut Edge

2. If two or more edges have same terminal vertices, then these edges are called ______________.
a. graph
b. complete graph
c. loop
d. parallel edges

3. Two vertices v1 and v2 in a graph G are said to be ______________ to each other if and only if they are end
vertices of the same edge e.
a. parallel
b. adjacent
c. ordered
d. composite

4. A graph with n vertices without edges is called a _____________.


a. null graph
b. simple graph
c. compound graph
d. complete graph

5. A simple graph G is called a _______________ graph, if there is an edge between each pair of vertices.
a. null graph
b. regular graph
c. complete graph
d. n-partite graph

6. If all vertices of a graph G have same degree then G is called a _____________ graph.
a. simple
b. regular
c. complete
d. bipartite

7. What are the number of edges for K5,8 graph?


a. 12
b. 13
c. 40
d. 3

65
Discrete Mathematics

8. Every regular graph is ____________ graph.


a. partite
b. bipartite
c. complete
d. incomplete

9. How many vertices are there for 3R6 graph?


a. 3
b. 6
c. 9
d. 5

10. How many regular graphs are there for 4R6 graph?
a. 4
b. 6
c. 2
d. 3

66
Chapter VI
Tree

Aim
The aim of this chapter is to:

• explain spanning tree in graph theory

• classify the properties of trees that are useful in computer science

• describe binary tree in graph theory

Objectives
The objectives of this chapter are to:

• explain “tree” and properties of a tree in graph theory

• highlight the uses of Kruskal’s algorithm

• explain idea of calculating shortest spanning tree

Learning outcome
At the end of this chapter, you will be able to:

• enlist various types of trees in graph theory

• solve problems related to spanning tree and using Kruskal’s algorithm

• understand binary rooted tree and its applications

67
Discrete Mathematics

6.1 Introduction
Mathematically speaking, a tree is a geometric figure consisting of vertices and edges, but of a special kind. We
think of vertices as points in the plane and edges as line segments.

Most of the trees we use in computer science have a special vertex called a root. Such trees are usually called “rooted
trees.” We could certainly describe what we mean by a rooted tree in ordinary English.
Tree is special type of graph. It has various applications in
• technology
• classifications and distribution study
• managerial problems etc.

A connected, acyclic graph is called a tree. (A graph is acyclic if no subgraph is a cycle.) Below mentioned is a
figure for a tree.

Fig. 6.1 Tree

A vertex of degree one is called a leaf. In the above figure, there are 5 leaves. The graph shown above would no longer
be a tree if any edge were removed, because it would no longer be connected. The graph would also not remain a
tree if any edges were added between two of its vertices, because then it would contain a cycle. Furthermore, note
that there is a unique path between every pair of vertices. These features of the example tree are actually common
to all trees.

6.2 Tree
A connected graph without any cycle is called as a Tree.
Notation: Tree graph on n vertices is denoted as Tn.

Example:
1. Trees on 1, 2 and 3 vertices

T1 T2 T3

2. Non isomorphic tree on 4 vertices (T4)

T4
T4

3. Non isomorphic tree on 5 vertices (T5)

T5

T5
T5

68
4. Non isomorphic tree 6 vertices (T6)

T6 T6 T6 T6

Following are not trees:

Disconnected hence
not tree.

Connected but contains


cycle hence not tree

Disconnected as well as contains cycle


So it is not tree.

Fig. 6.2 Graphs are not trees

6.2.1 Properties of Tree Graph


Properties of Tree Graph are as follows:
• Tree is simple graph, which does not contain loops or parallel edges.
• Each edge of tree is isthmus.
• Tree on n vertices has (n-1) edges.
• There exists a unique path between any pair of vertices.
• After joining any two non-adjacent vertices of a tree by an edge, there exists only one circuit in resulting
graph.
• Other than pendent vertices, each vertex is cut vertex.
• Every tree contains at least one pendent vertex.

6.2.2 Equivalent Properties of Tree


Theorem 1:
Let T be a graph on p vertices and q edges. If T is tree then T has no circuit and q = p-1.
Proof:
As T is a tree, T is acyclic and connected.
Only remains to show q = p-1.
Prove this by the method of induction.
Step I : Prove that tree on p=1 vertex has p-1 = 0 edges.
∴ Result is true for p =1.

Step II : Assume that result is result true for p >k.


That is, assume that tree on k vertices has k-1 edges for all p>k.

Step III : Prove that the result is true for p = k+1.


That is, prove that, tree with k+1 vertices has (k+1)-1 edges.

69
Discrete Mathematics

Let T be a tree with k+1 vertices. Each edge of T is bridge (isthmus), hence, T-e is dis-
connected having two components T1 and T2 are tree.

Suppose T1 has K1 vertices and T2 and K2 vertices and
K1 + k2 = k +1 and k1, k2 < k.
By step 2, T1 has k1-1 edges and T2 has K2-1 edges.
∴ Edge set of T contains
(k1-1) + (k2-1) + 1 edges.
= (k1 + k2) -1
= (k + 1) -1
=k
∴ Tree on k+1 vertices has (k+1) -1=k edges is proved.
∴ By the method of mathematical induction result is true for any number of vertices.
∴ Tree with p vertices p-1 edges.

Theorem 2:
Let T be a graph on p vertices and q edges. If T is acyclic and q = p-1, then T is connected and q = p-1.
Proof:
Let T be a graph on p vertices and q edges. As T is acyclic and q = p-1, then only remains to show that T
is connected.
Prove this by the method of contradiction. Contradictorily, assume that T is disconnected and has 2 ≤ k
components say T1, T2, T3, ... Tk. Suppose each component has p1, p2, p3, .... pk vertices respectively.
⇒ p1 +p2 +p3 +...+pk = p
Clearly, each Ti is tree and has (p1 -1), (p2 -1), (pk -1 ) edges respectively.
∴ Total number of edges in T are,
(p1- 1) + (p2-1) + (p3-1) + ... + (pk-1)
= (p1 +p2 +p3 + ...+ pk) - k
= p- k
∴ Total number of edges in T are p-k
For k ≥ 2, which is contradiction.
∴k=1
∴ T has only one component, i.e., T is connected.

Theorem 3:
Let T be a graph on p vertices and q edges. If T is connected and p = q-1, then T is connected and every edge is an
isthmus.
Proof:
Let T be a graph on p vertices and q edges.
If T is connected and p = q-1, then only remains to show that each edge of T is isthmus. We prove this by
the method of contradiction.
Contradictorily assume that edge e of graph is not isthmus.
∴ T – e is connected and edges in T – e are (p-1) -1 = p-2 which is contradiction that p-1 which is contra-
diction that p-1 ≥ p-2.
∴ e must be isthmus.
∴ every edge of T is isthmus.

Theorem 4:
Let T be a graph on p vertices and q edges. If T is connected and each edge is isthmus, then there exist exactly one
path between any pair of vertices of T.
Proof:
Let T be a connected graph with p vertices and q edges, in which each edge is isthmus. Prove that there
exists a unique path between any pair of vertices of T.
Let u and v be any two vertices of T. Since T is connected, there exists u-v path.
Prove this by the method of contradiction.

70
Contradictorily assume that there exists more than one paths say p1 and p2 from u-v in T.
Union of p1 and p2 forms a circuit. Edge of cycle is not isthmus, which is contradiction.
∴ There exists a unique path between any two vertices of T.

Theorem 5:
A connected graph G with p vertices and p-1 edges is tree.
Proof:
Let G be a connected graph with p vertices and p-1 edges.
Claim that G is tree. That is only to show that G is cyclic.
Prove this by the method of contradiction.
Contradictorily assume that G contains circuit C.
If e is edge contained in the circuit, then C-2 is connected.
∴ G – e is a graph connected with n vertices and n-2 edges. This is contradiction.
∴ G does not contain any circuit.
∴ G is connected and acyclic.
∴ G is a tree.

6.3 Spanning Tree

Definition:
Let G be a connected graph. T is the one that is spanning sub-graph of G. Then T is called as spanning tree of G.
Example:

Fig. 6.3 Spanning tree

6.3.1 Terminologies in Spanning Tree


Spanning tree has following terminologies used, which are defined below:

Spanning sub-graph:
Let G be a graph. H is a sub-graph of G containing all vertices of G, then H is called as spanning sub-graph of G.

Branches of spanning tree:


Let G be a connected graph. T is spanning tree of G, then edges of G which are in T are called as branches of T in
G.
In other words, edges of spanning tree are called branches of T in G.

Chords of spanning tree:


Let G be a connected graph. T is spanning tree of G, then edges of G which are not in T are called as chords of T
in G.
Remarks:
1. For connected graph G, there exists one or more than one spanning trees.
2. Depending upon various spanning trees for single graph G, set of branches as well as set of chords changes.

71
Discrete Mathematics

3. Let G be a connected graph with n vertices and m edges, then any spanning tree of G has n-1 branches and
(m-(n-1)) = m-n+1 chords.

Example:
For following graph G, find any two spanning tree of G. List all branches and chords for corresponding spanning
tree.

e1 e2
v1 v3
e7 e8

e6 e3

e9 e10
v6 v4
e5 e4
v5

Solution:

First spanning tree of graph G is


Branches of T1 in G are
e1, e2, e7, e5, e4
Chords of T1 in G are
e3, e6, e8, e9, e10.

Second Spanning tree of graph


Branches of T2 in G are,
e2, e3, e6, e9, e10
Chords of T2 in G are,
e1, e4, e5, e7, e8

6.4 Fundamental Circuits


Let G be a connected graph. T is spanning tree of G. Let an edge ‘e’ be a chord of T in G, then T + e contains exactly
one circuit. Such circuit of T + e is called as fundamental circuit of G w.r.t. spanning tree T. In other words, each chord
of spanning tree T forms one circuit in T + e graph, such circuit is called as fundamental circuit of G w.r.t. T.
1. Every fundamental circuit contains only one chord and all remaining edges of circuit are the branches of
spanning tree T.
2. Each chord gives unique fundamental circuit. Therefore, connected graph with n vertices and m edges has
(m-n+1) number of fundamental circuits w. r. t. any spanning tree of G.

72
Example:
Find all fundamental circuits w. r. t. spanning tree T of graph G.

v1 e1 v2 v1 v2

e4 e5 e2 e4 e5 e2

v4 e3 v3 v4 v3

Solution:
Fundamental circuit w. r. t. e1 is
e1
v1 v2

e4 e5 e2

v4 v3

i.e., v1, e1, v2, e2, v3, e5, v1



Fundamental circuit w. r. t. e3 is
v1 v2

e4 e5 e2

v4 e3 v3

i.e., v1, e5, v3, e3, v4, v1

6.5 Shortest Spanning Tree


“Spanning tree with minimum weight is called shortest spanning tree”.
Connected weighted graph can have more than one spanning trees.
Let G be a weighted connected graph. T is spanning tree of G. Sum of the weights of branches of T is called weight
of T and is called weighted spanning tree.
• Different spanning trees of G will have different weights.

Example:
v2
4 5

v1 v3
3

7 6
5

v5 3 v4

73
Discrete Mathematics

Following are some weighted spanning trees:


v2

v1 v3
Weight of T1
3
=7+3+3+6
T1
= 19
= 7 6

v5 3 v4

v2
4

v1 v3
Weight of T2
=4+7+3+6
T2 =
= 20
7 6

v5 3 v4

v2

4 5
Weight of T3
v1 v4
=4+5+3+3
3 = 15
T3 =

v5 3 v3

v2

4 5
Weight of T4
v1 v3
=7+4+5+6
= 22
T4 = 7
6

v5 v4

v2

5
Weight of T5
v1 v3
=7+5+5+6
= 23
T5 = 7 5 6

v5 v4

Problems arise to find minimum weighted spanning tree of weighted graph.

6.6 Kruskal’s Algorithm


Using Kruskal’s Algorithm, we can find shortest spanning tree.
Step 1 : Consider given connected weighted graph on n vertices.

74
Step 2 : Find increasing sequence of weights of all edges of G, say w1, w2, w3, ... , wm.
Step 3 : Select edge ei of minimum weight w1 which is not loop.
Step 4 : Suppose the edges e1, e2, e3 ... ei have been chosen. Then choose next edge ei +1
such that,
a) ei + 1 ≠ ek k = 1, 2, ... i
b) Induced sub-graph G < e1, e2, e3... ei+1> does not contain circuit.
c) W (ei+1) is of smallest weight satisfying a), b).

Step 5 : Stop if (n-1) edges have been chosen. Else, continue with step 4.

Example:
Using Kruskal’s algorithm, find shortest spanning tree of following graph.
v3 3 v4
e3
5
e2 e4
v2 2 e10 6 v5 e5 v6
v1 10 e7
e1 e11 2 e6 12
e9
8 3
e8
v8 1 v7

Solution:
Plot all vertices of graph G.
Increasing sequence of weights of given graph is:
1, 2, 2, 3, 3, 4, 5, 6, 8, 10, 12
Corresponding edge sequence of increasing weights of graph is:

Vertex e8 e7 e10 e3 e6 e4 e2 e11 e9 e1 e5

Weight 1 2 2 3 3 4 5 6 8 10 12

v3 v4

5
v2 e2
10 2 e10 6
e7
v5 e5 v6
v1 e1 2 12
e11 e6
3
e8
v8 1 v7

Minimum weighted spanning tree.


Trace edge e8 of minimum weight 2.
Trace next edge e7 of next minimum weight 2.
Trace next edge e10 of next minimum weight 2.
Next minimum weighted edge is e3 of weight 3, but it forms circuit. Hence, select next minimum weight edge e6
of weight 3.
Next minimum weighted edge is e4 of weight 4, but it forms circuit, avoid it.
Next minimum weighted edge is e2. It is of weight 5, trace it. Next minimum weighted edges e11 and e9 forms circuit,
avoid it.

Trace next edge e1 of next minimum weight 10. Trace next edge e5 of next minimum weight 12.
Graph becomes connected, without any cycle, contains all vertices of G i.e., spanning tree.
Weight of spanning tree is 1 + 2 + 2 + 3 + 5 + 10 + 12 = 35
Weight of minimum spanning tree = 35.

75
Discrete Mathematics

6.7 Binary Tree


A tree in which exactly one vertex is distinguishable form all their vertices is called rooted tree, such particular
vertex is called the root of that tree. There are exactly two branches coming out of root. Each intermediate vertex
has degree 3, remaining are all pendent vertices. Binary tree is special case of rooted tree. Binary rooted tree has
very important applications in binary search procedure in software.

6.7.1 Binary Rooted Tree


A tree in which exactly one vertex is of degree 2, and remaining vertices are of degree 3 or 1 is called binary rooted
tree.

Example: Root

Remarks:
1. Every binary tree has odd number of vertices.
2. Every binary tree with n vertices has exactly one root (vertex of degree 2), pendent vertices and vertices
are degree of 3.
Example: verify above remarks for above binary trees.

6.7.2 Height of Binary Tree


The maximum level in a binary tree is known as the height of a binary tree.
i.e., height of binary tree = max {lv/lv is height of vector v}
Maximum height of binary tree with n vertices = .
Minimum height of binary tree with n vertices = log2 (n+1) -1.

Example:

v1
v2 v11
0 LE V E L

1 LE V E L
v4 v13
v3 2 LE V E L
v5 v12 v14 3 LE V E L
v6
v8 v16 4 LE V E L
v7 v15 5 LE V E L

v9 v10

Solution:
Oth level vertices is v1
1st level vertices are v2 and v11
2nd level vertices are v3, v4, v12, v13
3rd level vertices are v5, v6, v14
4th level vertices are v7, v8, v15, v16
5th level vertices are v9, v10
∴ Maximum number of levels = 5

76
∴ Height of binary tree = 5

6.8 Graph/Tree Search Techniques


We have seen connectedness of graphs is a basic property, but how does one determine whether the graph is connected
or not? In case of small graphs, we can do so by inspection, searching for paths between all pairs of vertices.
However, in large graphs, such an approach could be time consuming, because a number of paths to examine might
be prohibitive.
Therefore, it’s desirable to have systematic procedure, or algorithm, which is both efficient and applicable to all
graphs.

In this topic we are going to focus on two methods or techniques of graph or tree search. i.e., Breadth First Search
and Depth First Search.

Breadth First Search


BFS is an uninformed search method that aims to expand and examine all nodes of a graph or combination of
sequences by systematically searching through every solution.

In other words, it exhaustively searches the entire graph or sequence without considering the goal until it finds it.
It does not use a heuristic algorithm.From the standpoint of the algorithm, all child nodes obtained by expanding a
node are added to a FIFO (i.e., First In, First Out) queue.

In typical implementations, nodes that have not yet been examined for their neighbours are placed in some container
(such as a queue or linked list) called “open” and then once examined are placed in the container “closed”.

Applications:
Breadth-first search can be used to solve many problems in graph theory, such as:
• Finding connected components: The set of nodes reached by a BFS (breadth-first search) form the connected
component containing the starting node.
• Finding all nodes within one connected component.
• Finding the shortest path between two nodes u and v.
• Testing a graph for bi-partiteness: BFS can be used to test bi-partiteness, by starting the search at any vertex and
giving alternating labels to the vertices visited during the search. That is, give label 0 to the starting vertex, 1 to
all its neighbours, 0 to those neighbours’ neighbours, and so on. If at any step a vertex has (visited) neighbours
with the same label as itself, then the graph is not bipartite. If the search ends without such a situation occurring,
then the graph is bipartite.

Example:
This search technique has two steps to follow which are:
a. Visit start vertex and put into a FIFO queue.
b. Repeatedly remove a vertex from the queue, visit its unvisited adjacent vertices, put newly visited vertices
into the queue.

77
Discrete Mathematics

Start Search vertex (1)

Visit/mark/label start vertex and put


in a FIFO queue.

Remove (1) from Q: visit adjacent


unvisited vertices: put in Q.

Remove 2 from Q visit unvisited


vertices: put in Q.

Likewise, remove 3, 5, 6 from Q:


visit unvisited vertices and put in Q.
we will get

If we randomly follow the above pro-


cedure with all connected vertices,
at last we will get empty queue as
shown the adjacent graph.

So from above graph it is cleared


that, Queue is empty so search termi-
nates.

Depth First Search


DFS is an uninformed search that progresses by expanding the first child node of the search tree that appears and
thus going deeper and deeper until a goal node is found, or until it hits a node that has no children. Then the search
backtracks, returning to the most recent node it hasn’t finished exploring.

In a non-recursive implementation, all freshly expanded nodes are added to a stack for exploration. The time and
space analysis of DFS differs according to its application area. In theoretical computer science, DFS is typically
used to traverse an entire graph, and takes time O (|V| + |E|), linear in the size of the graph.

Applications:
Algorithms that use depth-first search as a building block include:
• finding connected components

78
• topological sorting
• finding 2-(edge or vertex)-connected components
• finding strongly connected components
• solving puzzles with only one solution, such as mazes (DFS can be adapted to find all solutions to a maze by
only including nodes on the current path in the visited set.)

Example:

Depth First Search

Start search at vertex 1.


Label vertex 1 and do a depth first
search from either 2 or 4.
Suppose that vertex 2 is selected.

Label vertex 2 and do a depth first


search from either 3, 5, or 6.
Suppose that vertex 5 is selected.

Label vertex 5 and do a depth first


search from either 3, 7, or 9.
Suppose that vertex 9 is selected.

Label vertex 9 and do a depth first


search from either 6 or 8.
Suppose that vertex 8 is selected.

Label vertex 8 and return to vertex 9.


From vertex 9 do a DFS (6).

Label vertex 6 and do a depth first


search from either 4 or 7.
Suppose that vertex 4 is selected.

79
Discrete Mathematics

Label vertex 4 and return to 6.


From vertex 6 do a DFS (7).

Label vertex 7 and return to 6.


Return to 9.

Return to 5.

Do a DFS (3).

Label 3 and return to 5.


Return to 2.

Return to 1.

Return to invoking method.

80
Summary
• In mathematics, more specifically graph theory, a tree is an undirected graph in which any two vertices are
connected by exactly one simple path. In other words, any connected graph without cycles is a tree.
• A spanning tree of a connected graph G is a maximal set of edges of G that contains no cycle, or as a minimal
set of edges that connect all vertices.
• A Shortest Spanning Tree or Minimum Spanning Tree (MST) or minimum weight spanning tree is then a
spanning tree with weight less than or equal to the weight of every other spanning tree.
• More generally, any undirected graph (not necessarily connected) has a minimum spanning forest, which is a
union of minimum spanning trees for its connected components.
• In computer science, a binary tree is a tree data structure in which each node has at most two child nodes,
usually distinguished as “left” and “right”. Nodes with children are parent nodes, and child nodes may contain
references to their parents. Outside the tree, there is often a reference to the “root” node (the ancestor of all
nodes), if it exists.
• A rooted binary tree is a tree with a root node in which every node has at most two children.
• A full binary tree (sometimes proper binary tree or 2-tree or strictly binary tree) is a tree in which every node
other than the leaves has two children.
• A perfect binary tree is a full binary tree in which all leaves are at the same depth or same level.(This is
ambiguously also called a complete binary tree).
• Kruskal’s algorithm is an algorithm in graph theory that finds a minimum spanning tree for a connected weighted
graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total
weight of all the edges in the tree is minimised. If the graph is not connected, then it finds a minimum spanning
forest (a minimum spanning tree for each connected component).

References
• Dr. Sharma, G. C. & Dr. Jain, M., 2009. Advance Discrete Mathematics, Trees, 1st ed., Laxmi Publications,
Ltd.
• Singh, S. G., 2010. Graph Theory, Trees, PHI Learning Pvt. Ltd.
• IEEM 2012 Discrete Mathematics:Trees [Pdf] Available at: <http://chern.ie.nthu.edu.tw/DM/9-Tree.pdf>
[Accessed 23 June 2013].
• 2009. Discrete Mathematics. 5 Graphs & Trees [Pdf] Available at: <http://vplab.snu.ac.kr/lectures/09-1/
discrete_math/dm09_slide5.pdf> [Accessed 23 June 2013].
• 2007. Lecture 16-Trees [Video online] Available at: <https://www.youtube.com/watch?v=q0woiOp7sqU>
[Accessed 23 June 2013].
• 2007. Lecture 17- Trees and Graphs [Video online] Available at: <https://www.youtube.com/watch?v=fZqfkJ-
cb28> [Accessed 23 June 2013].

Recommended Reading
• Veerarajan, T., 2008. Discrete Mathematics with Graph Theory and Combinotorics, Tata McGraw-Hill Publishing
Company Limited.
• Babu, R., 2011. Discrete Mathematics, Dorling Kindersley (India) Pvt. Ltd.
• Simpson, A., 2010. Discrete Mathematics By Examples, Tata McGraw-Hill Publishing Company Limited.

81
Discrete Mathematics

Self Assessment
1. Trees are simple graphs and they do not contain ___________.
a. loop
b. parallel edges
c. vertex
d. pendent vertex

2. A spanning tree with weight less than or equal to the weight of every other spanning tree is called a
__________.
a. binary tree
b. weighted tree
c. shortest spanning tree
d. sub graph

3. The maximum level of binary tree is known as ________________ of binary tree.


a. length
b. vertex
c. branch
d. height

4. Which of the following is the minimum number of vertices in kth level binary tree?
a. k+1
b. 2k+1
c. (k+1)2
d. 2(k+1)

5. What is the diameter of the given tree?


v2 v7 v12
v6 v8

v1 v3 v5 v10 v11 v14


v16 v9 v13

v4 v15
a. 6
b. 7
c. 8
d. 9

82
6. What is the radius of the given tree?
v2 v7 v12
v6 v8

v1 v3 v5 v10 v11 v14


v16 v9 v13

v4 v15
a. 5
b. 4
c. 3
d. 6

7. What is the centre of this tree?


v2 v7 v12
v6 v8

v1 v3 v5 v10 v11 v14


v16 v9 v13

v4 v15
a. v9
b. v7
c. v5, v10
d. v16, v13, v9

8. For given graph T, find centre.


v3 v9
v5 v6 v8
v4

v1 v2
v7 v10
a. V6
b. V4
c. V5
d. V7

83
Discrete Mathematics

9. If T is spanning tree of K9, how many bridges does T contain?


a. 6
b. 8
c. 9
d. 4

10. If T is spanning tree of K9, how many vertices will be there for a tree T?
a. 8
b. 7
c. 9
d. 10

84
Chapter VII
Connected and Disconnected Graphs

Aim
The aim of this chapter is to:

• explain the concepts of connected and disconnected graphs

• give a brief description of walk, path, trail and cycle

• describe connected graphs

Objectives
The objectives of this chapter are to:

• explain the components of connected graphs

• explicate the method of solving problems on calculating shortest path on graphs

• describe Dijsktra’s algorithm

Learning outcome
At the end of this chapter, you will be able to:

• calculate shortest path on graphs

• enlist the terminologies in connectivity of graphs

• identify the use of connected and disconnected graphs

85
Discrete Mathematics

7.1 Connected and Disconnected Graph


Connected and disconnected graph contains the following types:
• Walk
• Trail
• Path
• Cycle

7.1.1 Walk
Let G be a graph. A finite alternating sequence W: {v1, e1, v2, e2, v3, e3 ... vi ei ... vi+1 ... vn} of vertices and edges of
G beginning and ending with a vertex in such a way, that every edge in W is incident on a vertex which precedes
and succeeds, is called as walk in G.
Note:
1. The walk is called v1 – vn walk.
2. v1 and vn are called terminal vertices of the walk and v2, v3, ... vn-1 are called intermediate vertices.
3. If terminal vertices are same in a walk, then it is called as closed walk.
4. In a walk, an edge or a vertex may be repeated more than once.
5. The number of edges in the walk (including repetition) is called the length of the walk.

Example:
Consider,

v2 e2
e1
v1

e6 e5 e4 e3

v5 e7 e8
v4

Then following are some walks:


1. W1: v1 e1 v2 e2 v2 e3 v3 e8 v4 It is v1-v4 walk; length = 4
2. W2: v5 e7 v4 e5 v1 e1 v2 It is v5-v2 walk; length = 3
3. W3: v2 e2 v2 It is v2-v2 closed walk; length = 1
4. W4: v2 e2 v2 e1 v1 e5 v4 e7 v5 e6 v1 e1 v2 It is v2-v2 closed walk; length = 6

7.1.2 Trail
A walk in which no edge is repeated is called a trail. If terminal vertices in a trail are same, it is called a closed trail,
otherwise it is called an open trail.

86
Example:
Consider,

v1 e1 v2

e2
e6 e7 e4
e3
v3

v5 e5 v4 e8

Now,
1. v3, e3, v3 e2 v2 e7 v5 e5 v4 e4 v2 e1 v1 here edges are not repeated, therefore, it is a trial (∴it is trail).
2. v2 e2 v3 e3 v3 e2 v2: not a trail (∵ e2 is repeated twice)

7.1.3 Path
The walk in which no vertex is repeated more than once is called a path. Since vertex does not repeat, edge cannot
repeat more than once.
∴ Every path is a trial. Loop cannot be included in a path.

Length of Path: Number of edges in the path is called length of path. Any two paths with the same number of
vertices are isomorphic.

7.1.4 Cycle (Circuit)


A closed path is called a cycle or a circuit. The number of edges in the path is called length of path.
Length of a cycle: Length is a number of edges in cycle.

7.2 Connected Graph


The graph is said to be a connected graph, if there is a path between every pair of vertices in G.
Otherwise, it is called a disconnected graph. Thus, a graph G is disconnected, if there is a pair of vertices in G such
that there is no path between them.

Example:

v1

v8 v2

v6

v7 v3

v5 v4

In the above graph, there is no path joining vertices v3 and v4.


∴ It is a disconnected graph.
In a graph, the vertex ‘u’ is said to be connected with vertex ‘v’ if there is a path form u to v.

87
Discrete Mathematics

7.2.1 Component
Let G be a graph and u be a vertex of G. Let v(u) denote the set of all vertices in G which are connected to the vertex
u. Then, the sub-graph G’ of G induced by v(u) is called a component of G.

Example:
1. Following are connected graphs, (Graph is only one component)

G1 G2 G3

2. Following are disconnected graphs (Graph contains more than one components)

G1 G2 G3 G4

7.2.2 Cut Vertex


Let G be a connected graph. Vertex v is cut vertex if and only if G-v is a disconnected graph.
In each of the following graphs, vertex v is cut vertex.

V
V V V V V V
V

7.3 Weight Graph


Weighted graph is a graph in which each edge of a graph is assigned a positive real number.
Positive real number is called as weight of edge ‘e’.

Example:
u u v
2 3
3 5
x v 1 4 y

4 5 2
w x w

Weight of a path is sum of weights of all edges in the path.


Weight of minimum weighted path is called as shortest path.

88
7.3.1 Dijkstra’s Algorithm
Dijkstras’s algorithm gives shortest path between a vertex to all other vertices of connected graph.
Steps of Dijkstras’s algorithm:
Step 1 : Consider given connected weighted graph. G.V is set of vertices of G.
S. and t are any two vertices of G.
Step 2 : Initially λ(s)= 0 and λ(v) =∞. Pv denotes shortest path from S to V.
Assign T = V.
Step 3 : Select vertex u in T for which λ(u) is minimum.
Step 4 : If u = t then STOP. And Pt is desired path.
Step 5 : For every vertex V ∈ T which is adjacent to u, Consider edge e = {u,v} If λ(u) + W(e) < λ(v) then,
λ (v) = λ (u) +W(e) and Pv = Pu ∪ {e}
Step 6 : Modify T by T = T(u) and go to step 2.

Example:
By using Dijkstra’s algorithm, find the shortest path from vertex a to all vertices of the graph given below.

b 2 c

2 4
2 3 1

a d 4 e h

1 3 7
6

f 5 g

Solution:
Initially λ (a) = 0

Vertex a b c d e F g h
λ 0 ∞ ∞ ∞ ∞ ∞ ∞ ∞
T a b c d e F g h

Vertices b and f are adjacent to a,


λ (b) = min {∞, 2} = 2
λ (f) = min {∞, 1} = 1

Vertex a b c d e F g h

λ 0 2 ∞ ∞ ∞ 1 ∞ ∞

T a b c d e F g h

λ(f) = 1 is minimum
Vertex d and g are adjacent to f
∴ λ (d) = min {∞, 4} = 4
∴ λ (g) = min {∞, 6} = 6

89
Discrete Mathematics

Vertex a b c d e f g h

λ(v) 0 2 ∞ 4 ∞ 1 6 ∞

T - b c d e - g h

λ (b) = 2 is minimum
The vertex in T adjacent to b are c, d, e.
∴ λ (c)= min {∞, 4} = 4
λ (d) = min {4, 4} = 4
λ (e) = min {∞, 6} = 6

Vertex a b c d e f g h

λ(v) 0 2 4 4 6 1 6 ∞

T - - c d e - g h

The vertex in T adjacent to b are c, e, h.


λ (e) = min (6, 7) = 6
λ (h) = min {∞, 5}= 5

Vertex a b c d e f g h

λ(v) 0 2 4 4 6 1 6 5

T - - - d e - g h

λ(d) = 4 is minimum
The vertices in T adjacent to d is e only.
Λ(e) = min {6, 8}= 6

Vertex a b c d e f g h

λ(v) 0 2 4 4 6 1 6 5

T - - - - e - g h

λ(h) = 5 in minimum
The vertices in T adjacent to h is g only.
λ (g) = min {6,11} = 6

Vertex a b c d e f g h

λ(v) 0 2 4 4 6 1 6 5

T - - - - e - g -

λ (e) = λ (g)= 6
Suppose λ (e) = 6 is minimum and g ∈ T is adjacent to e.
∴ λ (g) = min {6,13} = 6

90
Vertex a b c d e f g h

λ(v) 0 2 4 4 6 1 6 5

T - - - - - - g -

Finally,
Vertex a b c d e f g h

λ(v) 0 2 4 4 6 1 6 5

T - - - - - - - -

At the last shortest path from a to all other vertices is

b 2 2 c
4

c
6
0 5
a
d e h
4

f 1 g 6

7.4 Connectivity
Connectivity of a graph includes following terminologies:

7.4.1 Edge Connectivity


Let G be a connected graph. E is a set of minimum number of edges required to disconnect the graph. Number of
edges in such minimum disconnecting set edges is called as edge connectivity of graph G.
Removal of a minimum number of edges required to disconnect the graph, such number is called edge
connectivity.
It is denoted as λ (G).

Example 1:

e2

e3 e1

e4

Removal of only one edge e1 is sufficient to disconnect the graph G.


∴ λ (G) = 1

Example 2:
e1

e2

91
Discrete Mathematics

Removal of minimum two edges e1 and e2 requires to disconnect the graph.


∴ λ (G) = 2

Example 3:
e1

e2
e3

Removal of minimum three edges e1, e2, e3 are required to disconnect the graph.
∴ λ (G) = 3

7.4.2 Vertex Connectivity


Let G be a connected graph. Minimum number of vertices whose removal from G leaves disconnected graph such
number of vertices is called vertex is called connectivity of G.
Notation: Vertex connectivity denoted by k (G)
Removal of a minimum number of vertices required to disconnect the graph. Such number is called vertex
connectivity.

Example 1:

Removal of only one vertex v is sufficient to disconnect the graph G.


∴ k (G) = 1

Example 2:

v1

v2

Removal of minimum two vertices v1 and v2 requires to disconnect the graph.


∴ k (G) = 2

Example 3:
v1

v3 v2

Removal of minimum three vertices v1, v2, v3 requires to disconnect the graph
∴ k (G) = 3

92
7.4.3 Degree of Graph
Let G be a connected graph. Degree of minimum degree vertex of graph G is called degree of graph G.
Notation: δ (G) = degree of graph G.

Example 1:
v1 v4

v5
v3 v7

v2 v6

d (v1) = 2, d (v2) = 2 , d (v3) = 3


d (v4) = 1, d (v5) = 1, d (v6) = 1
d (v7) = 4
min {2, 2, 3, 1, 1, 1, 4} =1
∴ δ(G) = 1

Example 2:
v1 v2

v4 v3

d(v1) = 2, d(v2) =3
d(v3) = 2, d(v4) = 3
Min {2, 2, 3, 3} = 2
∴ δ (G) = 2

Example 3:

v1 v2

v5

v4 v3

d (v1) = 3, d (v2) =3
d (v3) = 3, d (v4) = 3, d (v5) = 4
min {3, 3,3, 3, 4} = 3
∴ δ (G) = 3

Theorem 1:
The edge connectivity of a graph G can not exceed the smallest degree of a vertex in G.

Proof:
Let G be a connected graph with n vertices. Degrees of these vertices is d1, d2, d3, d4, ... dn.
Suppose v1 is vertex of smallest degree vertex in G.

93
Discrete Mathematics

∴ δ (G) = d1
∴ there are d1 edges incident on vertex v1.
The removal of such d1 edges graph becomes disconnected.
∴ λ (G) ≤ δ (G)

Theorem 2:
The vertex connectivity of graph G cannot exceed the edge connectivity of G. i.e., k (G) ≤ λ (G).

Proof:
Let G be a connected graph with edge connectivity λ (G) = t.
∴ Removal of t edges from graph G becomes disconnected and vertex set is partitioned into two disjoint subsets
v1 and v2.
End vertices of above t edges in v1 are at the most t in number.
∴ removing t edges from G graph becomes disconnected.
k (G) ≤ δ (G)
k (G) ≤ λ (G) ≤ δ (G)

94
Summary
• A walk is an alternating sequence of vertices and edges, beginning and ending with a vertex, where each vertex
is incident to both the edge that precedes it and the edge that follows it in the sequence, and where the vertices
that precede and follow an edge are the end vertices of that edge. A walk is closed if its first and last vertices
are the same, and open if they are different.
• A trail is a walk in which all the edges are distinct. A closed trail has been called a tour or circuit, but these are
not universal, and the latter is often reserved for a regular subgraph of degree two.
• Traditionally, a path referred to what is now usually known as an open walk. Nowadays, when stated without
any qualification, a path is usually understood to be simple, meaning that no vertices (and thus no edges) are
repeated.
• A walk that starts and ends at the same vertex but otherwise has no repeated vertices or edges is called a
cycle.
• If it is possible to establish a path from any vertex to any other vertex of a graph, the graph is said to be connected;
otherwise, the graph is disconnected. A graph is totally disconnected if there is no path connecting any pair of
vertices. This is just another name to describe an empty graph or independent set.

References
• Kenneth, R., 2008. Discrete Mathematics and its applications, Graphs, 6th ed., Tata McGraw Hill
Publications.
• Deo, N., 2004. Graph Theory with Applications to Engineering and Computer Science, Connected and
Disconnected Graphs, PHI Learning Pvt. Ltd.
• Graphs, [Pdf] Available at: <https://courses.cit.cornell.edu/info2950_2012sp/graph.pdf> [Accessed 23 June
2013].
• Graph concepts, [Pdf] Available at: <http://users.phys.psu.edu/~ralbert/phys597_08/c02_graph_conc.pdf >
[Accessed 23 June 2013].
• 2011. Disconnected Graphs-Graph Theory [Video online] Available at: <https://www.youtube.com/
watch?v=iR7o8rPi2PI > [Accessed 23 June 2013].
• 2009.Connected Graph [Video online] Available at: <https://www.youtube.com/watch?v=wG-82q-0Dhg >
[Accessed 23 June 2013].

Recommended Reading
• Marcus, D., 2008. Graph Theory: A Problem Oriented Approach, Mathematical Association of America.
• Balakrishnan, V. K., 1997. Schaum’s outline of theory and problems of graph theory. McGraw-Hill
Professional.
• Gross, J. L. & Yellen, J., 2006. Graph theory and its applications, Graph theory, Chapman and Hall/CRC.

95
Discrete Mathematics

Self Assessment
1. If terminal vertices are same in a walk, it is called a/ an ____________ walk.
a. identical
b. uniform
c. open
d. closed

2. The number of edges in the path is called __________ of a path.


a. range
b. length
c. distance
d. width

3. A walk in which no edge is repeated is called a/ an _________.


a. closed walk
b. open trail
c. trail
d. path

4. The graph is said to be a connected graph, if there is a path between every _________.
a. point
b. pair of vertices
c. pair of edge
d. component

5. A ________ is an edge whose removal disconnects a graph.


a. bridge
b. cut vertex
c. vertex
d. pointer

6. Find the bridges of the graph.

e5
e6

e3
e2 e4
e1

a. e1
b. e3, e6
c. e1, e4
d. e1, e2, e6

96
7. Which of the following is an expression of the given graph?

a. connected
b. disconnected
c. bipartite
d. complete

8. Find the number of components for the following graph:

a. 1
b. 3
c. 2
d. 5

9. Find number of components for the following graph:

a. 2
b. 6
c. 1
d. 3

10. Find the number of components for the following graph:

a. 1
b. 6
c. 5
d. 4

97
Discrete Mathematics

Chapter VIII
Introduction to Probability

Aim
The aim of this chapter is to:

• highlight the concept of discrete probability

• focus on solving the problems using discrete probability distribution

• explain different types of probability distribution

Objectives
The objectives of this chapter are to:

• explain the term of probability distribution with its main types

• elaborate various applications of poisons and binomial distribution

• explain the students to solve practical problems using binomial and poisons distribution

Learning outcome
At the end of this chapter, you will be able to:

• understand the knowledge of probability and their types

• formulate and solve problems related to probability distribution

• calculate binomial distribution, poisson distribution and normal distribution

98
8.1 Introduction
Probability is basically concerned with drawing conclusions (or inference) from experiments involving uncertainties.
For these conclusions and inferences to be reasonably accurate, an understanding of probability theory is essential.
Study of probability in computer science is important for software development phases since it is used to extract
requirements from the customers which are used by the next phases for designing and implementation of the system.
Because of its importance, this chapter focuses on the various aspects required in computer science and help students
to get familiar with basic concepts of discrete probability in the long run.

8.2 Terminologies in Probability


To become familiar with the discrete probability, we should know about probabilistic experiments,
sample spaces, simple events and compound events.

a. Probabilistic experiment
A probabilistic experiment, or random experiment, or simply an experiment, is the process by which an observation
is made. In probability theory, any action or process that leads to an observation is referred to as an experiment.
Example:
• tossing a pair of fair coins
• tossing a balanced dice
• counting cars that drive past a toll booth

b. Sample space
The sample space associated with a probabilistic experiment is the set consisting of all possible outcomes of the
experiment and is denoted by S. The elements of the sample space are referred to as sample points. A discrete sample
space is one that contains either a finite or a countable number of distinct sample points.

c. Event
An event in a discrete sample space S is a collection of sample points, i.e., any subset of S. In other words, an event
is a set consisting of possible outcomes of the experiment.

I. Simple Event and Compound Event


A simple event is an event that cannot be decomposed. Each simple event corresponds to one and only one sample
point. Any event that can be decomposed into more than one simple event is called a compound event.

II. Complementary Event


Let A be an event connected with a probabilistic experiment E and let S be the sample space of E. The event B of
non-occurrence of A is called the complementary event of A. This means that the subset B is the complement of A
in S.

Example:
Experiment 1: Tossing a coin
Sample space: S = {Head or Tail} or we could write:
S = {0, 1} where 0 represents a tail and 1 represents a head.

Experiment 2: Tossing a coin twice


Sample Space:
S = {HH, TT, HT, TH} where
H represents head and
T represents tail.
Some events:
E1 = {Head},

99
Discrete Mathematics

E2 = {Tail},
E3 = {All heads}

Experiment 3: Tossing a dice


Sample space:
S = {1, 2, 3, 4, 5, 6} or S = {Even, odd}
Some events:
Even numbers, E1 = {2, 4, 6}
Odd numbers, E2 = {1, 3, 5}
The number 1, E3 = {1}
At least 3, E4 = {3, 4, 5, 6}

Experiment 4:
Two items are picked, one at a time, at random from a manufacturing process, and each item is inspected and
classified as defective or non-defective.
Sample space:
S = {NN, ND, DN, DD} where
N = Non-defective
D = Defective
Some events:
E1 = {only one item is defective} = {ND, DN}
E2 = {both are non-defective} = {NN}

8.3 Probability
Let S be the sample space in probabilistic experiment E. Suppose each outcome of an experiment is equally likely
and the number of outcomes is finite. If A is an event connected with E, then the probability of the occurrence of
A, P (A), is given by:

Example:
Consider the experiment of tossing a single balanced dice and recording the number on the top face.
A: The number on the top face is an even number. Then A = {2, 4, 6} the probability of occurrence of A, P (A), is
given by

8.3.1 Definition of Probability Using an Event


Suppose an event E can happen in r ways out of a total of n possible equally likely ways. Then the probability of
occurrence of the event (called its success) is denoted by:

P (E) =
The probability of non-occurrence of the event (called its failure) is denoted by:

P( )= .
Notice the bar above the E, indicating the event does not occur.
Thus,
P ( ) + P (E) =1
In other words, this means that the sum of the probabilities in any experiment is 1.

100
8.3.2 Definition of Probability Using Sample Space
When an experiment is performed, we set up a sample space of all possible outcomes.
In a sample of n equally likely outcomes, we assign a chance (or weight) of to each outcome.

We define the probability of an event for such a sample as follows:


The probability of an event E is defined as the number of outcomes favourable to E divided by the total number of
equally likely outcomes in the sample space S of the experiment.
That is, P (E) =
Where,
n (E) is the number of outcomes favourable to E and
n (S) is the total number of equally likely outcomes in the sample space S of the experiment.

8.3.3 Rules of Probability


The rules of probability includes following:

1. All probabilities between 0 and 1 are inclusive.


0 ⇐P (E) ⇐ 1

2. The sum of all the probabilities in the sample space is 1.


There are some other rules which are also important.

3. The probability of an event which cannot occur is 0.


The probability of any event which is not in the sample space is zero.

4. The probability of an event which must occur is 1.


The probability of the sample space is 1.

5. The probability of an event not occurring is one minus the probability of it occurring.
P (E’) = 1 – P (E)

6. Mutually exclusive events


Two events are mutually exclusive if they cannot occur at the same time. Another word that means mutually
exclusive is disjoint. If two events are disjoint, then the probability of them both occurring at the same time is
0.

Disjoint: P (A and B) = 0

If two events are mutually exclusive, then the probability of either occurring is the sum of the probabilities of
each occurring.

7. Specific addition rule


Only valid when the events are mutually exclusive.
P (A or B) = P (A) + P (B)

Example:
Given: P (A) = 0.20, P (B) = 0.70, A and B are disjoints.
B B’ Marginal
A 0.00 0.20 0.20
A’ 0.70 0.10 0.80
Marginal 0.70 0.30 1.00

101
Discrete Mathematics

The values in BOLD are given in a problem. The grand total is always 1.00 and the remaining values are
obtained after addition and subtraction.

8. Non-mutually exclusive events


In the events which aren’t mutually exclusive, there is some overlap. When P(A) and P(B) are added, the
probability of the intersection (and) is added twice. To compensate for that double addition, the intersection
needs to be subtracted.

General addition rule


P (A or B) = P (A) + P (B) – P (A and B)

Interpreting the table


Certain things can be determined from the joint probability distribution. Mutually exclusive events will have
a probability of zero. All inclusive events will have a zero opposite the intersection. All inclusive means that
there is nothing outside of those two events: P (A or B) = 1.

B B’ Marginal
A and B are mutually exclusive
A
if this value is 0
A and B are all inclusive
A’
if this value is 0
Marginal 1.00

9. Independent events
Two events are independent if the occurrence of one does not change the probability of the other occurring. An
example would be rolling a 2 on a dice and flipping a head on a coin. Rolling the 2 does not affect the probability
of flipping the head.
If events are independent, then the probability of them both occurring is the product of the probabilities of each
occurring.

Specific multiplication rule


P (A and B) = P (A) × P (B)

Example:
P (A) = 0.20, P (B) = 0.70, A and B are independent.

B B’ Marginal

A 0.14 0.06 0.20

A’ 0.56 0.24 0.80

Marginal 0.70 0.30 1.00

The 0.14 is because the probability of A and B is the probability of A times the probability of B or 0.20 × 0.70
= 0.14.

10. Dependent events


If the occurrence of one event affects the probability of the other occurring, then the events are dependent.

Conditional probability
The probability of event B occurring that event A has already occurred is read “the probability of B given A”

102
and is written: P (B|A)
General multiplication rule
P (A and B) = P (A) × P (B|A)

Example:
P (A) = 0.20, P (B) = 0.70, P (B|A) = 0.40
A good way to think of P (B|A) is that 40% of A is B. 40% of the 20% which was in event A is 8%, thus the
intersection is 0.08.

B B’ Marginal
A 0.08 0.12 0.20
A’ 0.62 0.18 0.80
Marginal 0.70 0.30 1.00

11. Independence Revisited


The following four statements are equivalent

A and B are independent events.


P (A and B) = P (A) × P (B)
P (A|B) = P (A)
P (B|A) = P (B)

The last two are because if two events are independent, the occurrence of one doesn’t change the probability of the
occurrence of the other. This means that the probability of B occurring, whether A has happened or not, is simply
the probability of B occurring.

Example:
Given P (A) = 0.20, P (B) = 0.70, P (A and B) = 0.15

B B’ Marginal
A 0.15 0.05 0.20
A’ 0.55 0.25 0.80
Marginal 0.70 0.30 1.00

8.3.4 Conditional Probability


Let A and B be two events connected with a probabilistic experiment. Then the conditional probability of A, when
it is given that event B has occurred, i.e., P(B) ≠ 0, is denoted by symbol P(A|B) and is given by,
P (A|B) =

Example:
Consider the toss of two distinct balanced dice. For finding the probability of getting a sum of 7, when it is given
that the digit in the first dice is greater than that in the second dice. In the probabilistic experiment of tossing two
dice the sample space S consists of 6 × 6 = 36 outcomes.

Assume that each of these outcomes is equally likely.


• Let A be an event: The sum of the digits of the two dice is 7,
A: {(6, 1), (5, 2), (4, 3), (3, 4), (2, 5), (1, 6)}

103
Discrete Mathematics

• Let B be an event: The digit in the first dice is greater than the second.
B : {(6, 1), (6, 2), (6, 3), (6, 4), (6, 5), (5 , 1), (5 , 2), (5 , 3),(5 , 4), (4, 1), (4, 2), (4, 3), (3, 1), (3, 2), (2, 1)}.
• Let C be the event: The sum of the digits in the two dice is 7 but the digit in the first dice is greater than the
second.
C: {(6, 1), (5, 2), (4, 3)} = A ∩ B.
• Recall that the probability of an event occurring given that another event has already occurred is called a
conditional probability.
• The probability that event B occurs, given that event A has already occurred is,
P (B|A) =
• This formula comes from the general multiplication principle and a little bit of algebra.
• Since we are given that event A has occurred, we have a reduced sample space. Instead of the entire sample
space S, we now have a sample space of A since we know A has occurred.
• So the old rule about being the number in the event divided by the number in the sample space still applies. It
is the number in A and B (must be in A since A has occurred) divided by the number in A.
• If you then divide numerator and denominator of the right hand side by the number in the sample space S, then
you have the probability of A and B divided by the probability of A.

Example 1:
The question, “Do you smoke?” was asked of 100 people. Results are shown in the table.

Yes No Total
Male 19 41 60
Female 21 28 40
Total 31 69 100

1. What is the probability of a randomly selected individual being a male who smokes?
Solution: This is just a joint probability.
The number of “Male and Smoke” divided by the total = = 0.19

2. What is the probability of a randomly selected individual being a male?


Solution: This is the total for male divided by the total = = 0.60. Since no mention is made of smoking or not
smoking, it includes all the cases.

3. What is the probability of a randomly selected individual smoking?


Solution: Again, since no mention is made of gender, this is a marginal probability, the number of people who smoke
divided by the total number o people= = 0.31.

4. What is the probability of a randomly selected male smoking?


Solution: This time, the randomly selected person is a male -think of stratified sampling.

5. What is the probability that the male smokes?


Solution: 19 males smoke out of 60 males, so = 0.31666.

6. What is the probability that a randomly selected smoker is male?


Solution: This time we are told that we have a smoker and asked to find the probability that the smoker is also a
male. There are 19 male smokers out of 31 total smokers, so ≅ 0.6129.

104
8.3.5 Axiomatic Approach of Probability
Analysing the concept of equally likely probability, we see that three conditions must hold.
1. The probability of occurrence of any event must be greater than or equal to 0.
2. The probability of the whole sample space must be 1.
3. If two events are mutually exclusive, the probability of their union is the sum of their respective probabilities.
These three fundamental concepts form the basis of the definition of probability.

8.4 Bayes’ Theorem


Let E1 and E2 be two mutually exclusive events forming a partition of the sample space S and let E be any event of
the sample space such that P (E) ≠ 0.

Fig. 8.1: Bayes’ theorem illustration-I


Example:
The sample space S is described as “the integers 1 to 15” and is partitioned into:
E1 = “the integers 1 to 8” and
E2 = “the integers 9 to 15”
If E is the event “even number” then we have the following:

Fig. 8.2 Bayes’ theorem illustration-II

Statement of Bayes’ Theorem


The probability for the situation described above is given by Bayes’ theorem, which can be calculated in two
ways:

P (E1|E) =

So for our example above, checking both items of this equation:

P (E1|E) =

105
Discrete Mathematics

=
Example:
Of all the smokers in a particular district, 40% prefer brand A and 60% prefer brand B. Of those smokers who prefer
brand A, 30% are females, and of those who prefer brand B, 40% are females.

What is the probability that a randomly selected smoker prefers brand A, given that the person selected is a
female?

Solution:

Fig. 8.3 Bayes’ theorem illustration-III


S = “smokers in the district”
E1 = “prefer brand A”
E2 = “prefer brand B” and
E is the event “female”.
P (E1|E) =

8.5 Probability Distributions


There are two main types of probability distributions i.e., Discrete and Continuous. These two types are further
divided into further subtypes as shown in the figure below:

106
Fig. 8.4 Probability distribution
In this chapter we focus only 2 types of discrete distribution, i.e., Binomial and Poisson’s Distribution

8.5.1 Binomial Distribution


This distribution was discovered by a Swiss mathematician James Bernoulli. Binomial probability distribution is
concerned with a discrete random variable and describes discrete data resulting from what is often called as the
Bernoulli process.

For example, the tossing of a fair coin for a fixed number of times is a Bernoulli process and the outcome of such
tosses can be represented by the binomial distribution. This distribution applies in situations where there are repeated
trials of any experiment for which only one of two mutually exclusive outcomes (denoted as ‘success’ and ‘failure’)
can result on each trial.
The Bernoulli process has following characteristics:
• Dichotomy: This means that each trial has only two mutually exclusive possible outcomes, viz., ‘success’ or
‘failure’, ‘yes’ or ‘no’, ‘heads’ or ‘tails’ and the like.
• Stability: This means that the probability of the outcome of any trial is known (or given) and remains fixed
over time i.e., remains the same for all the trials.
• Independence: This means that the trials are statistically independent, i.e., to say the happening of an outcome
or the event in any particular trial is independent of its happening in any other trial or trials.

8.5.1.1 Probability Function of Binomial Distribution


The random variable, say X, of interest in the Binomial distribution is the number of ‘successes’ in n trials. The
probability function of the binomial distribution is written as under-
f (X = r) = n
r = 0, 1, 2… n
where
n = number of trials
p = probability of success in a single trial
q = (1 - p) = probability of failure in a single trial ( p + q = 1)
r = number of successes in n trials

107
Discrete Mathematics

8.5.1.2 Parameters of Binomial Distribution


The binomial distribution depends upon the values of p and n. Knowledge of p truly defines the probability of X
since n is known by definition of the problem. The probability of the happening of exactly r events in n trials can
be found out using the above stated binomial function. The value of p also determines the general appearance of
the binomial distribution, if shown graphically as follows:
(i) When p < 0.5, the binomial distribution is skewed to the right or it is positively skewed and the graph takes
the following form as shown in the figure below.

Fig. 8.5 Positively skewed binomial distribution


(ii) When p = 0.5, the binomial distribution is symmetrical and the graph takes the following form as shown
in the figure below.

Fig. 8.6 Symmetrical binomial distribution


(iii) When p > 0.5, the binomial distribution is skewed to the left or it is negatively skewed and the graph takes
the following form as shown in the figure below.

108
Fig. 8.7 Negatively skewed binomial distribution
(iv) But if p stays constant and n increases, the shaded portion tends to bunch up together to form a bell shape,
i.e., the binomial distribution tends to become symmetrical and the graph will be something like as shown
in the figure below.

Fig. 8.8 Bell-Shaped binomial distribution

8.5.1.3 Important Measures or Constants of Binomial Distribution


• Mean =

• Variance =

• Standard Deviation =

• Coefficient of Skewness =

• Coefficient of Kurtosis =

Example 1:
Five coins are tossed 3200 times. Find the frequency of distribution of heads and tales and tabulate the results.

Answer:
Here,
n = 5, N = 3200
p=
q=

109
Discrete Mathematics

r = 0, 1, 2, 3, 4, 5

No. of heads Probability

0 5

1 5

2 5

3 5

4 5

5 5

Total 3200
Example 2:
The probability of a defective volt is 0.2. Find the mean, variance and standard deviation for the distribution of
defective volts in a total of 1000, and also find coefficient of skewness and kurtosis.

Answer:
Here,
p = 0.2
q = 1 – 0.2 = 0.8
n = 1000
Mean = n.p = 1000 0.2 = 200
Variance = n.p.q = 1000 0.2 0.8 = 160
Standard Deviation = = = 12.6

8.5.2 Poisson Distribution


Poisson distribution is appropriate, specially when probability of happening of an event is very small so that q is
almost equal to unity and n is very large such that the average of series i.e., n.p is a finite number. Experience has
shown this distribution is good for calculating the probabilities associated with x occurrences in a given time period
or specified area.

The random variable of interest in Poisson distribution is the number of occurrences of a given event during a given
interval (this interval may be time, distance, area etc). We use X to represent the discrete random variable and r to
represent a specific value that X can take. The probability function of this distribution is written as-
f (X = r) =
Where,
e = 2.7183 being the basis of natural logarithms.
r = 0, 1, 2, 3... ∞
m = average number of occurrences per specified interval or we can say it is th mean of the distribution and m ≥
0.

110
The Poisson process has following characteristics:
• Concerning a given random variable, the mean relating to a given interval can be estimated on the basis of past
data concerning the variable under study.
• If we divide the given interval into very small intervals, we will find:
‚‚ The probability that exactly one event will happen during the very small interval is a very small number
and is constant for every other very small interval.
‚‚ The probability that two or more events will happen within a very small interval is so small, that we can
assign it a zero value.
‚‚ The event that happens in a given very small interval does not depend on when the very small interval falls
during a given interval.
‚‚ The number of events in any small interval does not depend on the number of events in any other small
interval.
The Poisson distribution has following uses:
The use of Poisson distribution is resorted to those cases when we do not know the value of ‘n’ or when ‘n’ cannot
be estimated with any degree of accuracy. In fact, in certain cases, it does not make any sense in asking the value
of ‘n’. For example,
• The goals scored by one team in a football match are given, it cannot be stated how many goals could not be
scored.
• If one watches carefully one may find out how many times the lightning flashed, but it is not possible to state
how many times it did not flash.
• The number of deaths per day in a district in one year due to a disease
• The number of scooters passing through a road per minute during a certain part of the day for a few months
• The number of typing mistakes per page in a book containing many pages by an experienced typist
• The number of suicides per day in a city
• The number of telephone calls per minute in a telephone booth
• The number of bacteria in a drop of clean water

Example 1:
A book distributed randomly, contains 100 misprints throughout its 100 pages. What is the probability that a page
observed at random contains at least 2 misprints?

Answer:
m=

Probability that a page contains at least 2 misprints is given by-

P (r ≥ 2) = 1 – [P(0) + P(1)] -------------(equation-1)

Applying Poisson’s distribution,

P (r) =

Put r = 0,

P (0) =

P (1) =

111
Discrete Mathematics

Substitute the value of P (0) and P (1), we get,

P (r ≥ 2) = 1 –

=1–

Example 2:
If the mean of Poisson distribution is 4, find standard deviation, coefficient of skewness and kurtosis.

Answer:
Here, mean = m = 4

∴Standard deviation =

β1 =

β2 =

8.6 Other Types of Distribution


Other types of probabilities distribution or simply probabilities includes following subtypes:
i.e., Multinomial and Hyper geometric probabilities

8.6.1 Multinomial Probabilities


A multinomial experiment is an extended binomial probability. The difference is that in a multinomial experiment,
there are more than two possible outcomes. However, there are still a fixed number of independent trials, and the
probability of each outcome must remain constant from trial to trial. Instead of using a combination, as in the case of
the binomial probability, the number of ways the outcomes can occur is done using distinguishable permutations.

Example:
The probability that a person will pass a College Algebra class is 0.55, the probability that a person will withdraw
before the class is completed, is 0.40, and the probability that a person will fail is 0.05. Find the probability that in
a class of 30 students, exactly 16 pass, 12 withdraw, and 2 fail.

Outcome X P(outcome)
Pass 16 0.55
Withdraw 12 0.40
Fail 2 0.05
Total 30 1.00

The probability is found using this formula:


P= × [(0.55)16 × (0.40)12 × (0.05)2]

8.6.2 Hypergeometric Probabilities


Hypergeometric experiments occur when the trials are not independent of each other and occur due to sampling
without replacement, as in a five card poker hand. Hypergeometric probabilities involve the multiplication of two
combinations together and then division by the total number of combinations.

Example:
How many ways can 3 men and 4 women are selected from a group of 7 men and 10 women?

112
Solution:

P = ≅ 0.3779.

Note that the sum of the numbers in the numerator are the numbers used in the combination in the denominator.
This can be extended to more than two groups and called an extended hyper geometric problem.

8.7 Random Walk


Tossing a coin N times has a physical interpretation. Consider a particle that can move in only one-dimension. Let
us also assume the particle can move only a fixed distance, and can only move either to the right or the left.

To decide which way the particle will move, we toss a coin. If toss comes up with H, the particle moves to the right;
if the toss comes up with a tail, the particle moves to the left. In other words, the outcome is +1with probability P
(H) and outcome is –1 with probability P (T).

In effect, the particle moves on a lattice of equally spaced points. This process that the particle is undergoing is
called a Random walk also called Brownian motion.

Random walk is precisely the way the molecules from an open bottle of perfume spread the smell into the entire
room, and is called a diffusion process. Tossing the coin N times corresponds to taking N steps.

Suppose the particle starts the random walk at the origin, takes k steps to the right, and concomitant N - k steps to
the left. If NH is the number of heads and NT is the number of tails, then clearly, the distance from the origin is NH
– NT = 2k -N. There are many paths which lead to the final position of l = 2k -N, and correspond to the number of
different ways that k heads can come up in N toss.

Fig. 8.9 Different paths leading to a final position


The Probability that the particle, after doing a random walk of N-steps, will end up at position l= 2k –N is given
by choosing k = .

Assume N is even, which implies, since with l = even. Define N = 2M and l = 2m.
Then we have,
PRW = (m, N) = probability of reaching position 2m

=P(

­= ; –M ≤ m ≤ M

Fair Coin
For simplicity, consider the special case when the probability to step to the right or left is equal, that is, p =q =

113
Discrete Mathematics

Then we have,
PRW (m, N) =
The interpretation of the formula above is the following. Since in every toss there are two outcomes, the
probability of a specific outcome is . A specific path is the result of taking N steps, and hence the
probability of it occurring is .
The probability of reaching a point l is given by multiplying the probability for a specific path to occur by all the
possible ways (paths) that go from the origin to the point l. We thus obtain P (l, N).
For a particle undergoing a random walk, its position m at every point in its N-steps is a random variable. An important
tool for studying the behaviour of random variables is to compute the average values of quantities of interest.
For a function of the random variable m, say f (m), let us denote its average value by <f (m)>.
Then we have,
<f (m)> = -----equation (1)
The above expression means that the average value of f(m) is given by the summing the value of f(m) for every
outcome m, weighted by the likelihood of that value occurring. We have the following natural definition for P
(H).
P (H) = ------- equation (2)

The two most important properties of any random variable is its average and its standard deviation. Let us return
to the random walk with p =q = .
The average position of the particle is given by,
<m> = -------equation (3)
<m> = 0 -------- equation (4)
The reason we get zero is because we have assumed equal probability to step to the right or to the left.

Hence, on the average, its steps on either side of the origin cancel, with the average being at the starting point.
However, we intuitively know that even though the average position of the particle undergoing random walk is zero,
it will deviate more and more from the origin as it takes more and more steps.

The reason being that every step the particle takes is random; it is highly unlikely that the particle will take two
consecutive steps in opposite directions. The measure of the importance of the paths that are far from the origin is
measured by the average value of the square of the position of the particle.

The reason this measure is useful, is because every time the particle deviates from the origin, be it in the right or left
directions, the square of the deviation is always be positive. We hence have the standard deviation given by,

2
------------- equation (5)

= --------- -equation (6)

= 2M------------ equation (7)

= N -------------- equation (8)

We have the important result from equation (9) and (12) that, since, for
k= ,m≡ , we have the following,

<( ) 2 > = N ------------- equation (9)

⇒<( ---------------equation (10)

The equation above has an important interpretation. In any particular experiment, all we can obtain is NH= number
of heads for N trial. So how do we compute P (H)?

114
We would like to set <NH> = NH, but there are errors inherent in this estimate, since in any particular set of toss, we
can get any value of NH which need not be equal to <NH>. In other words, what is the error we make if set P (H) =
?

Equation (14) tells us that for a fair coin, with , if we compute , we have

P (H) = ----------------equation (11)

= ---------------equation (12)

In other words, the estimate that we obtain for PH from our experiment, namely is withinthe errors which are
approximately equal to the actual value.

The point to note that the errors that are inherent in any estimate are quantified above, and go down as the ,

Where,

In general, for any random variable with standard deviation given by , the estimate for the probability ,
where NH is the number of times that the outcome has occurred, is given by,

P (H) = --------------- equation (13)


In general, let be an estimate of some quantity μ that has a standard deviation given by σ and derived from a
sample of size N.

with 66% likelihood -------------------- equation (14)

= with 95% likelihood ------------------ equation (15)

The relation of with what it is estimating, namely , is graphically shown in the figure below.

mest lies in this range with probability 95%


µ-σ µ +σ

µ - 2σ µ µ + 2σ

m est lies in this range with probability 2/3

Fig. 8.10 Estimate lies in a range around µ

115
Discrete Mathematics

Summary
• The  binomial distribution  is the  discrete probability distribution  of the number of successes in a sequence
of n independent yes/no experiments, each of which yields success with probability p.
• The Poisson distribution is a discrete probability distribution that expresses the probability of a number of events
occurring in a fixed period of time if these events occur with a known average rate and independently of the
time since the last event.
• A  probability distribution  identifies either the probability of each value of a  random variable  (when the
variable is  discrete), or the probability of the value falling within a particular interval (when the variable
is continuous).
• The probability distribution describes the range of possible values that a  random variable  can attain and
the probability that the value of the random variable is within any (measurable) subset of that range.
• A random walk is a mathematical formalisation of a trajectory that consists of taking successive random steps.
The results of a random walk analysis have been applied to computer science, physics, ecology, economics,
psychology and a number of other fields as a fundamental model for random processes in time.

References
• Yakov, G. S., 1992. Probability theory: An introductory Course, Introduction to Probability, Springer
Textbooks.
• Grinstead, C. M., 1997. Introduction to Probability, Conditional Probability. AMS Bookstore.
• Introduction to Probability [Pdf] Available at: <http://www.dartmouth.edu/~chance/teaching_aids/books_articles/
probability_book/amsbook.mac.pdf> [Accessed 23 June 2013].
• Bertsekas, D.P. & Tsitsiklis, J. N., Introduction to Probability [Pdf] Available at: <http://vfu.bg/en/e-Learning/
Math--Bertsekas_Tsitsiklis_Introduction_to_probability.pdf > [Accessed 23 June 2013].
• 2011.Introduction to Probability [Video online] Available at: <https://www.youtube.com/watch?v=-8eSOmTPUbk
> [Accessed 23 June 2013].
• 2010.Introduction to Probability [Video online] Available at: <https://www.youtube.com/watch?v=YWt_u5l_jHs
> [Accessed 23 June 2013].

Recommended Reading
• Freund, J.E., 1993. Introduction to Probability, Dover publications.
• Rota G. C., 1998. Probability Theory, Preliminary Edition.
• Roussas, G.G., 2007. Introduction to Probability, Elsevier Inc.

116
Self Assessment
1. What is the probability of getting an ace if a person chooses a card at random from a standard pack of 52 playing
cards?
a.
b.
c.
d.

2. What is the probability of getting a 5 when one rolls a dice?


a.
b.
c.
d.

3. There are 15 balls numbered 1 to 15, in a bag. If a person selects one at random, what is the probability that the
number printed on the ball will be a prime number greater than 5?
a.
b.
c.
d.

4. In a class of 100 students, suppose that 60 are French, and suppose that 10 of the French students are females.
Find the probability that if I pick a French student, it will be a girl, that is, find P(A|B).
a.
b.
c.
d.

5. What is the probability that the total of two dices will be greater than 8, given that the first dice is a 6?
a.
b.
c.
d.

6. If the probability that person A will be alive in 20 years, is 0.7, and the probability that person B will be alive
in 20 years is 0.5. What is the probability that they will both be alive in 20 years?
a. 0.35
b. 0.45
c. 0.30
d. 0.25

117
Discrete Mathematics

7. A fair dice is tossed twice. Find the probability of getting a 4 or 5 on the first toss and a 1, 2, or 3 in the second
toss.
a.
b.
c.
d.

8. Two balls are drawn successively without replacement from a box which contains 4 white balls and 3 red balls.
Find the probability that the first ball drawn is white and the second is red.
a.
b.
c.
d.

9. A bag contains 5 white marbles, 3 black marbles and 2 green marbles. In each draw, a marble is drawn from the
bag and not replaced. In three draws, find the probability of obtaining white, black and green in that order.
a.
b.
c.
d.

10. The probability that a student passes in Mathematics is and the probability that he passes in English is . If
the probability that he will pass at least in one subject is , what is the probability that he will pass in both the
subjects? (We assume it is based on probability only).
a.
b.
c.
d.

118
Application I
Medical Testing
There is a deadly disease called ‘X’ that has infected 10% of the population. There are no symptoms; victims just
drop dead one day. Fortunately, there is a test for the disease. The test is not perfect, however:
• If John has the disease, there is a 10% chance that the test will say NO! (These are called “false negatives”.)
• If John does not have disease, there is a 30% chance that the test will say YES! (These are “false positives”.)
A random person is tested for the disease. If the test is positive, then what is the probability that the person has the
disease?

Solution:
For finding mere solution, follow the steps below:
Step 1: Find the sample space
The sample space is found with the tree diagram below.

pos
.09   
.9

.1
yes neg
.1
.01 

.9 .27
no pos
.3

.7
person neg
.63
has X? outcome event A: event B:
test result event A ∩ B ?
probability has test
disease? positive?

Step 2: Define events of interest


Let A be the event that the person has the disease.
Let B be the event that the test waspositive. The outcomes in each event are marked in the tree diagram.
We want to find P(A | B), the probability that a John has disease X, given that the test was positive.

Step 3: Find outcome probabilities


First, we assign probabilities to edges. These probabilities are drawn directly from the problem statement.
By the product rule, the probability of an outcome is the product of the probabilities on the corresponding root-to-
leaf path. All probabilities are shown in the figure.

Step 4: Compute event probabilities


P(A | B) ===
If the test is positive, then there is only a 25% chance that he has the disease.
This answer is initially surprising, but makes sense on reflection. There are two ways that he could test positive.
• First, it could be that he is sick and the test is correct.
• Second, it could be that he is healthy and the test is incorrect.
The problem is that almost everyone is healthy; therefore, most of the positive results arise from incorrect tests of
healthy people.

119
Discrete Mathematics

We can also compute the probability that the test is correct for a random person. This event consists of two outcomes.
The person could be sick and the test can be positive (probability 0.09), or the person could be healthy and the test
can be negative (probability 0.63).

Therefore, the test is correct with the probability 0.09 + 0.63 = 0.72. The test is correct almost three-quarters of
the time. But there is a simple way to make the test correct 90% of the time: always return a negative result. This
“test” gives the right answer for all healthy people and the wrong answer only for the 10% that actually have the
disease.

120
Application II
A Chess Problem
In how many different ways can we place a pawn (p), a knight (k), and a bishop (b) on a chessboard so that no two
pieces share a row or a column?

Solution:
A valid configuration is shown below in the left figure, and an invalid configuration is shown in the right figure.
First, we map this problem about chess pieces to a question about sequences. There is an abijection from configurations

k
p

b
b k
p

valid invalid

to sequences.
(rp, cp, rk, ck, rb, cb)where rp, rk, and rb are distinct rows and cp, ck, and cb are distinct columns.
In particular, rp is the pawn’s row, cp is the pawn’s column, rk is the knight’s row, etc. Now we can count the number
of such sequences using the generalised product rule:
• • rp is one of 8 rows
• • cp is one of 8 columns
• • rkis one of 7 rows (any one but rp)
• • ck is one of 7 columns (any one but cp)
• • rb is one of 6 rows (any one but rp or rk)
• • cb is one of 6 columns (any one but cp or ck)

Thus, the total number of configurations is (8 · 7 · 6)2.

121
Discrete Mathematics

Application III
Boxing
Flo, famed 6.042 TA, has decided to try out for the US Olympic boxing team. Flo figures that n people (including
himself) are competing for spots on the team and only k will be selected. Thus, there are two cases to consider:
• Flo is selected for the team and his k −1 teammates are selected from among the other n −1 competitors. The
number of different teams that be formed in this way is:
• Flo is not selected for the team, and all k team members are selected from among the other n − 1 competitors.
The number of teams that can be formed this way is:

All teams of the first type contain Flo, and no team of the second type does; therefore, the two sets of teams are
disjoint. Thus, by the sum rule, the total number of possible olympics boxing teams is:

Claire, equally-famed 6.042 TA, thinks Flo isn’t so tough and so she might as well try out also. She reasons that n
people (including her) are trying out for k sports. Thus, the number of ways to select the team is simply:

Claire and Flo each correctly counted the number of possibly boxing teams; thus, their answers must be equal.
So we know:
+=

This is called Pascal’s Identity. Here, we relied purely on counting techniques.

122
Application IV
Pass the Broccoli
Here’s a game that involves a random walk. There are n+1 people, numbered 0, 1. . .n sitting in a circle:

0
n 1
B
n – 1 2
. 3

. .

k + 1 .
k k – 1

The B indicates that person 0 has a big stalk of nutritious broccoli, which provides 250%of the US recommended
daily allowance of vitamin-C and is also a good source of vitamin-A and iron.
(Typical for a random walk problem, this game originally involved a pitcher of beer instead of a broccoli.)
Person 0 passes the broccoli either to the person on his left or the person on his right with equal probability. Then,
that person also passes the broccoli left or right at randomand so on. After a while, everyone in an arc of the circle
has touched the broccoli and everyone outside that arc has not. Eventually, the arc grows until all but one person
has touched the broccoli. That final person is declared the winner and gets to keep the broccoli!

Suppose that we are allowed to position ourself anywhere in the circle. Where we should stand in order to maximise
the probability that we win? We shouldn’t be person 0; we can’t win in that position. The answer is “intuitively
obvious”: we should stand as far as possible from person 0 at position .

Let’s verify this intuition. Suppose that we stand at position k ≠ 0. At some point, the broccoli is going to end up
in the hands of one of our neighbors. This has to happen eventually; the game can’t end until at least one of them
touches it. Let’s say that person k − 1 gets the broccoli first. Now let’s cut the circle between ourself and our other
neighbor, person k + 1:

k (k − 1) . . . 3 2 1 0 n (n − 1) . . . (k + 1)
B

Now there are two possibilities. If the broccoli reaches to us before it reaches person k + 1, then we lose.
But if the broccoli reaches person k + 1 before it reaches to us, then we and every other person who has touched
the broccoli will win!

This is just the flea problem: the probability that the broccoli hops n − 1 people to the right (reaching person k +1)
before it hops 1 person to the left (reaching to us) is. Therefore, our intuition was completely wrong: our probability
of winning is regardless of where we’re standing!

123
Discrete Mathematics

Bibliography
References
• 2007. Lecture 1 - Propositional Logic, [Video online] Available at: <http://www.youtube.com/
watch?v=xlUFkMKSB3Y> [Accessed 20 June 2013].
• 2007. Lecture 1 - Propositional Logic, [Video online] Available at: <http://www.youtube.com/watch?v=xlUFk
MKSB3Y&list=PL0862D1A947252D20> [Accessed 20 June 2013].
• 2007. Lecture 16-Trees [Video online] Available at:< https://www.youtube.com/watch?v=q0woiOp7sqU>
[Accessed 23 June 2013].
• 2007. Lecture 17- Trees and Graphs [Video online] Available at:< https://www.youtube.com/watch?v=fZqfkJ-
cb28> [Accessed 23 June 2013].
• 2007. Lecture 32 - Recurrence Relations [Video online] Available at: <http://www.youtube.com/
watch?v=qvw1GX93JSY> [Accessed 20 June 2013].
• 2009. Discrete Mathematics. 5 Graphs & Trees [Pdf] Available at:< http://vplab.snu.ac.kr/lectures/09-1/
discrete_math/dm09_slide5.pdf> [Accessed 23 June 2013].
• 2009.Connected Graph [Video online] Available at:< https://www.youtube.com/watch?v=wG-82q-0Dhg >
[Accessed 23 June 2013].
• 2010. Graph Theory - An Introduction! [Video online] Available at: <http://www.youtube.com/
watch?v=HmQR8Xy9DeM> [Accessed 20 June 2013].
• 2010.Introduction to Probability [Video online] Available at:< https://www.youtube.com/watch?v=YWt_u5l_jHs
> [Accessed 23 June 2013].
• 2011. Disconnected Graphs-Graph Theory [Video online] Available at:< https://www.youtube.com/
watch?v=iR7o8rPi2PI > [Accessed 23 June 2013].
• 2011.Introduction to Probability [Video online] Available at:< https://www.youtube.com/watch?v=-8eSOmTPUbk
> [Accessed 23 June 2013].
• 2013. Introduction to Recurrence Relations-1 [Video online] Available at: <http://www.youtube.com/
watch?v=loh8rYkghHg> [Accessed 20 June 2013].
• AbsoluteMathematics, 2011. Mathematical Induction [Video online] Available at: <http://www.youtube.com/
watch?v=Uqn3f2k4vrA> [Accessed 20 June 2013].
• Bertsekas, D.P. & Tsitsiklis, J. N., Introduction to Probability [Pdf] Available at:< http://vfu.bg/en/e-Learning/
Math--Bertsekas_Tsitsiklis_Introduction_to_probability.pdf > [Accessed 23 June 2013].
• bethjonesmath, 2008. Introduction to Combinatorics (part 1) [Video online] Available at: <http://www.youtube.
com/watch?v=cErUmuxraQ0> [Accessed 20 June 2013].
• bullcleo1, 2010. Mathematical Induction [Video online] Available at: <http://www.youtube.com/
watch?v=QHkG0d5kZvE> [Accessed 20 June 2013].
• Cameron, P. J., Notes on Combinatorics, [Pdf] Available at: <http://www.maths.qmul.ac.uk/~pjc/notes/comb.
pdf> [Accessed 20 June 2013].
• Chapter IV – Graph Theory, [Pdf] Available at: <http://www.math.hkbu.edu.hk/~zqiao/Math1130_2009/Chap4.
pdf> [Accessed 20 June 2013].
• Combinatorics , [Pdf] Available at: <http://www.dartmouth.edu/~chance/teaching_aids/books_articles/
probability_book/Chapter3.pdf> [Accessed 20 June 2013].
• Davis, T., Mathematical Induction, [Pdf] Available at: <http://www.math.utah.edu/mathcircle/notes/induction.
pdf> [Accessed 20 June 2013].
• Deo, N., 2004. Graph Theory with Applications to Engineering and Computer Science, Connected and
Disconnected Graphs, PHI Learning Pvt. Ltd.
• Dr. Sharma, G. C. & Dr. Jain, M., 2009. Advance Discrete Mathematics, Trees, 1st ed., Laxmi Publications,
Ltd.

124
• eHow, 2012. Introduction to Combinatorics : Principles of Math, [Video online] Available at: <http://www.
youtube.com/watch?v=jrLYCzCc77g> [Accessed 20 June 2013].
• Graph concepts, [Pdf] Available at:< http://users.phys.psu.edu/~ralbert/phys597_08/c02_graph_conc.pdf >
[Accessed 23 June 2013].
• Graphs - Terminology and Representation, [Online] Available at: <http://www.radford.edu/~nokie/classes/360/
graphs-terms.html> [Accessed 20 June 2013].
• Graphs, [Pdf] Available at:< https://courses.cit.cornell.edu/info2950_2012sp/graph.pdf> [Accessed 23 June
2013].
• Grinstead, C. M., 1997. Introduction to Probability, Conditional Probability. AMS Bookstore.
• Gross, J. L. & Yellen, J., 2003. Handbook of Graph Theory, Graphs, CRC Press.
• Gross, J. L., 2007. Combinatorial Methods with computer applications, Graph theory, Chapman and Hall
CRC.
• IEEM 2012 Discrete Mathematics: Trees [Pdf] Available at:< http://chern.ie.nthu.edu.tw/DM/9-Tree.pdf>
[Accessed 23 June 2013].
• Introduction to Probability [Pdf] Available at:< http://www.dartmouth.edu/~chance/teaching_aids/books_articles/
probability_book/amsbook.mac.pdf> [Accessed 23 June 2013].
• Johnsonbaugh, R., 2008. Discrete Mathematics, 7th ed., Basic Counting Principle, Prentice Hall.
• Kenneth, R., 2008. Discrete Mathematics and its applications, Graphs, 6th ed., Tata McGraw Hill
Publications.
• Lal, A. K., Lecture Notes on Discrete Mathematics, [Pdf] Available at: <http://home.iitk.ac.in/~arlal/book/
mth202.pdf> [Accessed 20 June 2013].
• Langote, U. B. & Vhanmane, M. M., 2009. Discrete Mathematics, Mathematical Induction, 2nd ed., Tech-Max
Publication.
• Lovasz, L. & Vesztergombi, K., Discrete Mathematics, [Pdf] Available at: <http://www.cims.nyu.edu/~regev/
teaching/discrete_math_fall_2005/dmbook.pdf> [Accessed 20 June 2013].
• Mathematical Induction, [Pdf] Available at: <http://www.people.vcu.edu/~rhammack/BookOfProof/Induction.
pdf> [Accessed 20 June 2013].
• Moura, L., Recurrence Relations, [Pdf] Available at: <http://www.site.uottawa.ca/~lucia/courses/2101-10/lect
urenotes/07RecurrenceRelations.pdf> [Accessed 20 June 2013].
• Ramana, B. V. & Grimaldi, R. P., 2008. Discrete and Combinatorial Mathematics, Recurrence Relations, 5th
ed., Pearson Education India.
• Recurrence Relations, [Pdf] Available at: <http://www.mathdb.org/resource_sharing/training/se_rr.pdf>
[Accessed 20 June 2013].
• Rosen, K. H. & Michaels, J. G., 2000. Handbook of discrete and combinatorial mathematics, Recurrence
Relations, CRC Press.
• Rosen, K., 2007. Discrete Mathematics, Mathematical Induction, 6th ed., McGraw Hill publication.
• Schwichtenberg, H., 2004. Mathematical Logic, Logic, Mathematics Institute University Munchen.
• Simpson, S. G., 2010. Mathematical Logic, Logic, Pennsylvania state university press.
• Singh, S. G., 2010. Graph Theory, Trees, PHI Learning Pvt. Ltd.
• StatsLabDublin, 2013. Discrete Mathematics : Important Graph Theory Terms [Video online] Available at:
<http://www.youtube.com/watch?v=TwLYYOMAK4o> [Accessed 20 June 2013].
• Vatsa, B. S. & Vatsa, S., 2009. Discrete Mathematics, Pigeonhole Principle, New Age International.
• Yakov, G. S., 1992. Probability theory: An introductory Course, Introduction to Probability, Springer
Textbooks.

125
Discrete Mathematics

Recommended Reading
• Babu, R., 2011. Discrete Mathematics, Dorling Kindersley (India) Pvt. Ltd.
• Balakrishnan, V. K., 1997. Schaum’s outline of theory and problems of graph theory. McGraw-Hill
Professional.
• Courant, R. & Robbins, H., 1996. What is Mathematics?, Oxford University Press.
• Deo N., 1974. Graph Theory with applications to Engineering and Computer Science, Graphs, Prentice Hall,
Englewood Cliffs, N.J.
• Fomin, D., Genkin, S. & Itenberg, I., 1996. Mathematical Circles (Russian Experience), AMS.
• Freund, J.E., 1993. Introduction to Probability, Dover publications.
• Graham, R., Knuth, D. & Patashnik, O., 1994. Concrete Mathematics, 2nd ed., Addison-Wesley.
• Gross, J. L. & Yellen, J., 2006. Graph theory and its applications, Graph theory, Chapman and Hall/CRC.
• Gupta, S. B., 2005. Comprehensive Discrete Mathematics and Structures, Recurrence Relations, 2nd ed., Laxmi
Publication.
• Gupta, S. B., 2008. Discrete Mathematics And Structures, Recurrence Relations, 5th ed., Laxmi Publications
Ltd.
• Hein, J. L., 2009. Discrete Structures, Logic, and Computability, Permutation and Combinations, Jones and
Bartlett Learning.
• Hinman, P. G., 2005. Fundamentals of Mathematical logic, Logic, A K Peters, Ltd.
• Kleene, S. C., 2002. Mathematical logic, Proof and theory, Courier Dover Publications.
• Koshy, T., 2004. Discrete mathematics with applications, Combinatorics and Discrete Mathematics, Elsevier
Academic Press.
• Liu, C. L., 1968. Introduction to Combinatorial Mathematics, Graph theory, McGraw Hill New York.
• Marcus, D., 2008. Graph Theory: A Problem Oriented Approach, Mathematical Association of America.
• Merris, R., 2004. Combinatorics, 2nd ed., John Wiley & Sons.
• Nerode, A. & Shore, R. A., Logic for Applications, Mathematical Logic, 2nd ed., Springer Textbooks.
• Rosen, K., Discrete Mathematics and its applications with Combinatorics and graph theory, Graph theory, 6th
ed., Tata McGraw Hill publication.
• Rota G. C., 1998. Probability Theory, Preliminary Edition.
• Roussas, G.G., 2007. Introduction to Probability, Elsevier Inc.
• Simpson, A., 2010. Discrete Mathematics By Examples, Tata McGraw-Hill Publishing Company Limited.
• Veerarajan, T., 2008. Discrete Mathematics with Graph Theory and Combinotorics, Tata McGraw-Hill Publishing
Company Limited.
• Veerarajan., 2006. Discrete Mathematics, Recurrence Relations, 7th ed., Tata McGraw-Hill.

126
Self Assessment Answers
Chapter I
1. d
2. b
3. c
4. a
5. c
6. d
7. a
8. d
9. c
10. d

Chapter II
1. a
2. d
3. b
4. c
5. b
6. c
7. b
8. a
9. d
10. a

Chapter III
1. c
2. b
3. b
4. b
5. a
6. a
7. a
8. c
9. a
10. d

Chapter IV
1. c
2. d
3. a
4. b
5. c
6. d
7. b
8. c
9. a
10. b

127
Discrete Mathematics

Chapter V
1. c
2. d
3. b
4. a
5. c
6. b
7. c
8. d
9. b
10. a

Chapter VI
1. b
2. c
3. d
4. b
5. c
6. b
7. a
8. c
9. b
10. c

Chapter VII
1. d
2. b
3. c
4. b
5. a
6. d
7. c
8. d
9. c
10. a

Chapter VIII
1. b
2. c
3. a
4. c
5. d
6. a
7. c
8. b
9. d
10. a

128

You might also like