Logic and Propositions in Mathematics
Logic and Propositions in Mathematics
Mathematical logic
Chapter Structure
1.0 Objectives
1.1 Propositions and logical operations
1.1.1 Proposition
1.1.2 Basic Logical Operations
1.1.2.1 Conjunction, p ∧ q
1.1.2.2 Disjunction, p ∨ q
1.1.2.3 Negation, ¬p
1.1.2.4 Tautologies And Contradictions
1.2 Conditional Statements
1.3 Methods of Proof
1.3.1 Direct Proof
1.3.1.1 Counterexample
1.3.2 Indirect Proof
1.3.2.1 Contradiction
1.3.2.2 Contraposition
1.3.2.3 Two Classical Theorems
___________________________________________________________________________
1.0 Objectives
___________________________________________________________________________
Logic rules are used to give definite meaning to any mathematical statements.
Many algorithms and proofs use logical expressions such as:
“IF p THEN q”
or
“If p1 AND p2, THEN q1 OR q2”
Logic rules are used to distinguish between valid and invalid mathematical arguments, i.e. to
know the cases in which these expressions are TRUE or FALSE, that is, to know the “truth
value” of such expressions.
We discuss the study of discrete mathematics with an introduction to logic in this chapter.
Logic has numerous applications to the computer science field such as, design of computer
circuits, the construction of computer programs, the verification of the correctness of
programs, and in many other ways.
___________________________________________________________________________
1.1 Propositions and logical operations
___________________________________________________________________________
Lets n begins with an introduction to the basic building blocks of logic—propositions.
1.1.1 Proposition
A proposition (or statement) is a declarative statement which is true or false, but not both.
Let’s understand this by taking a few examples.
Consider following statements to find out whether they are propositions are not.
1) Is it cold outside? This is not a preposition, as it’s answer can have both the value
true and false.
So If a statement has a question mark it is not considered as
preposition.
4) Read this carefully. This is not a preposition, as this is not a declarative sentence.
It is a command.
___________________________________________________________________________
Exercise:
The fundamental property of a compound proposition is that its truth value is completely
determined by the truth values of its subpropositions together with the way in which they are
connected to form the compound propositions.
Many propositions are composite, that is, composed of subpropositions and various
connectives discussed subsequently. Such composite propositions are called compound
statements or compound propositions.
A proposition is said to be primitive if it cannot be broken down into simpler propositions,
that is, if it is not composite.
For example, the below propositions
(i) Ice floats in water.
(ii) 2+2=6
are primitive propositions.
In this section we are discussing the three basic logical operations as follow:
1. Conjunction (AND) , symbolically ‘∧’
2. Disjunction (OR), symbolically ‘∨’
3. Negation (NOT ), symbolically ‘¬’ or ‘~’
Definition :
Truth Table of p ∧ q:
Since p ∧ q is a proposition it has a truth value, and this truth value depends
only on the truth values of p and q. Note that, p ∧ q is true only when both p
and q are true.
Observe the following truth table for conjunction operation:
p ∧ q (p AND
p q
q)
T T T
T F F
F T F
F F F
Table: Conjunction / AND logical operation
Example :
Consider the following proposition and find out that given statement is having output true/false:
Solution:
In this example let's assume,
p q p ∧ q (p AND q)
F T F
Definition:
Truth Table of p ∨ q:
Since p ∨ q is a proposition it has a truth value, and this truth value depends
only on the truth values of p and q. Note that, p ∨ q is false only when both p and q
are false.
Observe the following truth table for disjunction operation:
p ∨ q (p OR
p q
q)
T T T
T F T
F T T
F F F
Table: Disjunction / OR logical operation
Example :
Consider the following proposition and find out that given statement is having output true/false:
Solution:
In this example let's assume,
p q p ∨ q (p OR q)
F T T
Definition :
The truth value of the negation of p is always the opposite of the truth value of p. It is a unary
operator means it requires only one operand(proposition) to perform this operation.
Observe the following truth table for negation operation:
p ¬p (NOT p)
T F
F T
Table: Negation/NOT logical operation
Example :
Consider the following proposition and find out that given statement is having output true/false:
Solution:
In this example let's assume,
T F
Definition:
A proposition P (p, q, . . .) is called a tautology if it contains only T in the last column of its
truth table or, in other words, if it is True for any truth values of its variables.
Example:
p ~p p v ~p
T F T
F T T
Definition:
A proposition P (p, q, . . .) is called a contradiction if it contains only F in the last column of
its truth table or, in other words, if it is false for any truth values of its variables
Example:
p ~p p∧
~p
T F F
F T F
___________________________________________________________________________
Exercise:
1. Let p be “It is hot” and let q be “It is raining”. Give a simple verbal sentence which
describes each of the following statements:
(a) ~p (b) p ∧ q (c) p ∨ q (d)
q ∨~p.
2. Find the truth table of ~p ∧ q.
3. Verify that the proposition p ∨~(p ∧ q) is a tautology.
4. Find the truth tables for.
(a) p ∨~q (b) ~p ∧~q.
5. Verify that the proposition (p ∧ q)∧~(p ∨ q) is a contradiction
___________________________________________________________________________
1.2 Conditional Statements
___________________________________________________________________________
Many mathematical statements are of the form “If p then q.” Such statements are called
conditional statements and are denoted by p → q
There are some other common ways to express this conditional statement:
“if p, then q” “q whenever p”
“p implies q” “q when p”
“if p, q” “q is necessary for p”
“p only if q” “a necessary condition for p is q”
“p is sufficient for q” “q follows from p”
“a sufficient condition for q is p” “q unless ¬p
“q if p”
Definition:
Let p and q be propositions. The conditional statement p → q is the proposition “if p, then q.”
The conditional statement p → q is false when p is true and q is false, and true otherwise.
In the conditional statement p → q, p is called the hypothesis (or antecedent or premise) and
q is called the conclusion (or consequence).
Truth Table:
Note that the conditional p → q is false only when the first part p is true and the second part q
is false.Accordingly, when p is false, the conditional p → q is true regardless of the truth
value of q.
A conditional statement is also called an implication.
Observe the following truth table for conditional operation:
p q p → q (if p, then q)
T T T
T F F
F T T
F F T
Table: conditional operation
Example:
From the implication p → q for each of the following:
(i) p:I am girl q: I will dance
can be written as , “If I am a girl, then I will dance”.
Biconditionals :
Another common statement is of the form “p if and only if q.” Such statements are called
biconditional statements and are denoted by p ↔ q.
Biconditional statements are also called bi-implications.
There are some other common ways to express p ↔ q:
● “p is necessary and sufficient for q”
● “if p then q, and conversely”
● “p iff q.”
Definition:
Truth Table:
Note that the biconditional p ↔ q is true whenever p and q have the same truth values and
false otherwise.
p q p ↔ q (p if and only if q)
T T T
T F F
F T F
F F T
Table: conditional operation
Example:
From the bi-implication p ↔ q for each of the following:
p: A polygon is a triangle.
q: A polygon has exactly 3 sides.
p ↔ q : "A polygon is a triangle if and only if it has exactly 3 sides."
___________________________________________________________________________
1.3 Methods of Proof
___________________________________________________________________________
Let's discuss this in more detail:methods you can use to write proofs.
Methods of proof are as follow:
Any problem solving method has both discovery and proof as integral parts. When you think
you have discovered that a certain statement is true, try to figure out why it is true. If you
succeed, you will know that your assumption is correct. Even if you fail, the process of trying
will give you insight into the nature of the problem and may lead to the discovery that the
the statement is false.
Few assumptions which we are going to consider in this section. In this text we assume a
familiarity with the laws of basic algebra.
We also use the three properties of equality: For all objects A, B, and C,
➔ (1) A = A,
(2) if A = B then B = A, and
(3) if A = B and B = C, then A = C.
➔ In addition, we assume that there is no integer between 0 and 1 and that the set of all
integers is closed under addition, subtraction, and multiplication. This means that
sums, differences, and products of integers are integers.
➔ Of course, most quotients of integers are not integers. For example, 3 ÷ 2, which
equals 3/2, is not an integer, and 3 ÷ 0 is not even a number.
1. Express the statement to be proved in the form “∀x ∈ D, if P(x) then Q(x).”
2. Start the proof by supposing x is a particular but arbitrarily chosen element of D
for which the hypothesis P(x) is true. (This step is often abbreviated “Suppose x ∈
D and P(x).”)
3. Show that the conclusion Q(x) is true by using definitions, previously established results,
and the rules for logical inference.
Theorem:
The sum of any two even integers is even.
Proof:
Suppose m and n are particular but arbitrarily chosen even integers.
Then
m + n = 2r + 2s by substitution
= 2(r + s) by factoring out a 2.
m + n = 2t where t is an integer.
Theorem:
The sum of any two odd integers is even.
Proof:
Suppose m and n are particular but arbitrarily chosen odd integers.
m = 2*r + 1 and
n = 2*s + 1
Then
m + n = 2t where t is an integer.
___________________________________________________________________________
Exercise:
1.3.1.1 Counterexample
Suppose you have a quantified statement: “All x’s satisfy property P”: ∀xP(x).
The second quantified statement says: “There is an x which does not satisfy property P”.
In other words, to prove that “All x’s satisfy property P” is false, you must find an x which
does not satisfy property P.
Proof:
To give a counterexample,
the “if” part must be true, but the “then” part must be false.
Consider n = 6.
Then n2 = 62
= 36
Proof:
Proving that the given statement is false is equivalent to proving its negation is true. The
negation is
Because the negation is universal, it is proved by generalizing from the generic particular.
We also note that n + 1 and n + 2 are integers (because they are sums of integers) and
that both n + 1 > 1 and n + 2 > 1 (because n ≥ 1).
Thus n2 + 3n + 2 is a product of two integers each greater than 1, and so n2 + 3n + 2 is not
prime.
__________________________________________________________________________
Exercise:
Prove following using counterexample method of proof:
1) For all integers m and n, if 2m + n is odd then m and n are both odd.
𝑛−1
2) For all integers n, if n is odd then is odd.
2
__________________________________________________________________________
In a direct proof you start with the hypothesis of a statement and make one deduction after
another until you reach the conclusion. Indirect proofs are more roundabout or winding.
1.3.2.1 Contradiction
One kind of indirect proof, argument by contradiction, is based on the fact that either a
statement is true or it is false but not both.
So if you can show that the assumption that a given statement is not true leads logically to a
contradiction then that assumption must be false: and, hence, the given statement must be
true.
The point of departure for a proof by contradiction is the supposition that the statement to be
proved is false. The goal is to reason to a contradiction. Thus proof by contradiction has the
following outline:
1. Suppose the statement to be proved is false. That is, suppose that the negation of the
statement is true.
2. Show that this supposition leads logically to a contradiction.
3. Conclude that the statement to be proved is true.
Theorem
There is no greatest integer.
Proof:
Let M = N + 1.
So N is the greatest integer and N is not the greatest integer, which is a contradiction.
This contradiction shows that the supposition is false and, hence, that the theorem is true.
Theorem
There is no integer that is both even and odd.
Proof:
Consequently,
Now since a and b are integers, the difference a − b must also be an integer.
But a − b = 1/2, and 1/2 is not an integer.
___________________________________________________________________________
Exercise:
Proposition
For all integers n, if n2 is even then n is even.
Proof :
Suppose n is any odd integer.
We must show that n2 is odd.
By definition of odd,
n = 2k + 1 for some integer k.
n2 = (2k + 1)2
= 4k2 + 4k + 1
= 2(2k2 + 2k) + 1.
But 2k2 + 2k is an integer because products and sums of integers are integers.
Proof:
We’ll prove the contrapositive of this statement.
We must show that for any integers a and b, a < 8 and b < 8 implies that a + b < 15.
By above statement ,
a and b are integers such that a < 8 and b < 8.
This implies that a ≤ 7 and b ≤ 7.
a + b ≤ 14.
__________________________________________________________________________
Exercise:
Prove following by contrapositive method of proof:
1) If a product of two positive real numbers is greater than 100, then at least one of the
numbers is greater than 10.
2) For all integers m and n, if mn is even then m is even or n is even.
___________________________________________________________________________
1.3.2.3 Two Classical Theorems
This section contains proofs of two of the most famous theorems in mathematics:
that √2 is irrational and that there are infinitely many prime numbers. Both proofs
are examples of indirect arguments.
Theorem : Irrationality of √2
√2 is irrational.
Proof:
We take the negation and suppose it to be true.
That is, suppose √2 is rational.
Then there are integers m and n with no common factors such that
𝑚
√2 = by dividing m and n by any common factors if necessary
𝑛
2 = m2/n2
m2 = 2n2
This implies that m2 is even by definition of even.
m2 = (2k)2 by substituting
= 4k2
= 2n2
n2 = 2k2
Consequently, n2 is even, and so n is even .
Proposition:
1 + 3√2 is irrational.
Proof:
𝑎
1 + 3√2 = for some integers a and b with b ≠ 0.
𝑏
It follows that
𝑎
3√2 = −1 by subtracting 1 from both sides
𝑏
𝑎 𝑏
=𝑏-𝑏 by substitution
𝑎−𝑏
= 𝑏
𝑎−𝑏
√2 = by dividing both sides by 3.
3𝑏
But a − b and 3b are integers since a and b are integers and differences and
products of
integers are integers, and 3b ≠ 0 by the zero product property.
This contradicts the fact that √2 is irrational. This contradiction shows that the
supposition is false.
Hence 1 + 3√2 is irrational.
Unit 1- Chapter 2
Logic
Chapter Structure
2.0 Objectives
2.1 Mathematical Induction
2.2 Mathematical Statements
2.3 Logic and Problem Solving
2.4 Normal Forms
2.4.1 Types of Normal form
_______________________________________________________________________
2.0 Objective
_______________________________________________________________________
Proofs in mathematics are valid arguments that establish the truth of mathematical
statements. By an argument, we mean a sequence of statements that end with a conclusion.
By valid, we mean that the conclusion, or final statement of the argument, must follow from
the truth of the preceding statements, or premises, of the argument.
That is, an argument is valid if and only if it is impossible for all the premises to be true and
the conclusion to be false.
_______________________________________________________________________
2.1 Mathematical Induction
______________________________________________________________________
One of the most important techniques to prove many mathematical statements or formulae
which cannot be easily derived by direct methods is sometimes derived by using the principle
of mathematical induction.
𝑛(𝑛+1)
Prove that 1 + 2 + 3 + . . . + n = 2
for any integer n ≥ 1.
1. Show it is true for n=1
L.H.S. = n = 1
𝑛(𝑛+1) 1(1+1) 1(2)
R.H.S. = = = =1
2 2 2
Hence, L.H.S = R.H.S
We have ,
𝑘(𝑘+1)
1+2+3+...+k= 2
Now we will start solving L.H.S. to check whether it is equal to R.H.S. or not.
Therefore,
L.H.S = 1+2+3+.........k+ (k + 1)
𝑘(𝑘+1)
= +(k+1)
2
(𝑘+1)(𝑘+2)
= 2
(𝑘+1)(𝑘+1+1)
= 2
= R.H.S
Proof:
___________________________________________________________________________
Exercise:
___________________________________________________________________________
2.2 Mathematical Statements
___________________________________________________________________________
● To deduce new statements from statements we already have, we use rules of inference
which are templates for constructing valid arguments.
● Rules of inference are our basic tools for establishing the truth of statements.
● In this section we will look at arguments that involve only compound propositions.
● We will define what it means for an argument involving compound propositions to be
valid.
● Then we will introduce a collection of rules of inference in propositional logic.
● After studying rules of inference in propositional logic, we will introduce rules of
inference for quantified statements.
● We will describe how these rules of inference can be used to produce valid
arguments.
● These rules of inference for statements involving existential and universal quantifiers
play an important role in proofs in computer science and mathematics, although they
are often used without being explicitly mentioned.
● Finally, we will show how rules of inference for propositions and for quantified
statements can be combined.
● These combinations of rules of inference are often used together in complicated
arguments.
Predicate logic
Quantifiers
What we really want is to be able to say when H or P or Q is true for many different values of
their arguments. This means we have to be able to talk about the truth or falsehood of
statements that include variables. To do this,we bind the variables using quantifiers, which
state whether the claim we are making applies to all values of the variable (universal
quantification), or whether it may only apply to some (existential quantification).
Universal quantifier
● If you want to make the universe explicit, use set membership notation.
● An example would be ∀x ∈ Z : x > 0 → x + 1 > 0.
● This is logically equivalent to writing,
∀x : x ∈ Z → (x > 0 → x + 1 > 0) or
to writing ∀x : (x ∈ Z ∧ x > 0) → x + 1 > 0,
but the short form makes it more clear that the intent of x ∈ Z is to restrict the range
of x.
Existential quantifier
● The existential quantifier ∃ called as “there exists”. It means that a statement must be
true for at least one value of the variable.
● So “some human is mortal” becomes ∃x : Human(x) ∧ Mortal(x).
● Note that we use AND rather than implication here;
the statement ∃x : Human(x) → Mortal(x)
makes the much weaker claim that “there is something x, such that if x is human, then
x is mortal,” which is true in any universe that contains an immortal purple penguin
since it isn’t human, Human(penguin) → Mortal(penguin) is true.
___________________________________________________________________________
2.3 Logic and Problem Solving
___________________________________________________________________________
We say that a conclusion is "logical" when it follows from what we already believe.
For example if we believe that light travels faster than sound, then it follows logically that we
should see lightning before we hear thunder.
In everyday life, logical conclusions simply make explicit what is already implicit in one's
beliefs.
Note that logical conclusions may or may not be true.
Our beliefs are really premises, statements from which we draw conclusions.
A conclusion that follows logically from the premises is VALID, but it is TRUE only if the
premises are true.
Conversely, faulty/incorrect logic could lead to a true statement.
An argument form, or argument for short, is a sequence of statements. All statements but
the last one are called premises or hypotheses. The final statement is called the conclusion,
and is often preceded by a symbol '' ''.
An argument is valid if the conclusion is true whenever all the premises are true.
The validity of an argument can be tested through the use of the truth table by checking if the
critical rows, i.e. the rows in which all premises are true, will correspond to the value ''true''
for the conclusion.
For example:
Major premise: If you study hard, then you will get an "A".
Minor premise: You have studied hard.
Conclusion: You will get an "A".
___________________________________________________________________________
Example 1:
Check the validity of given :
Anyone who lives in the city Mulund, also lives on the island of Mumbai.
Ketan lives on the island of Mumbai.
Therefore, Ketan lives in the city Mulund.
Solution:
Invalid
EVEN IF the first statement is true, it does not say that everyone who lives on Mumbai, also
lives in Mulund. There are other cities on Mumbai -- Ghatkopar, Sion , Churchgate etc. So,
even if Ketan lives on Mumbai, we don't know if the conclusion is true.
_______________________________________________________________________
Example 1:
Check the validity of given :
Anyone who lives in the city Mulund, also lives on the island of Mumbai.
Ketan lives in the city Mulund.
Therefore, Ketan lives on the island of Mumbai
Solution:
Valid.
We don't need to know anything about Ketan. If anyone lives in Mulund, he or she lives in
Mumbai.
Ketan lives in Mulund, so he must live in Mumbai.
IF the premises are true, we are locked into the conclusion being true.
_________________________________________________________________________
To help, we mark the critical rows. Notice that all critical rows have a true conclusion and
thus the argument is valid.
___________________________________________________________________________
2.4 Normal Forms
__________________________________________________________________________
Suppose, A (P1, P2, ... , Pn) is a statements formula where P1, P2, ..., P6 are the atomic
variables if we consider all possible assignments of the truth value to P1, P2, ..., Pn and
obtain the resulting truth values of the formula A then we get the truth table for A, such a
truth table contains 2^6 rows.
The formula may have the truth value T for all possible assignments of the truth values to the
variables P1, P2, ..., Pn.
In this case, A is called identically true or tautology.
If A has the truth value T for at least one combinations of truth values assigned to P1, P2, ...,
Pn then A is called satisfiable.
The problem of determining in a finite number of steps, whether a given statement formula is
a tautology or a contradiction or least satisfiable is known as a decision problem.
The conjunctive normal form of a given formula is the one which contains the product of
elementary sums (that formula is equivalent in the given formula).
Observations
1. The procedure for obtaining a formula in conjunctive normal form is quite similar to
that of disjunctive normal form.
2. The conjunctive normal form is not unique.
3. A given formula will be identical if every elementary sum presents in its conjunctive
normal form are identically true.
4. The 3 hold if every elementary sum present in the formula has at least two factors in
which one is the negation of the other.
● Suppose, P and Q are two variables. We construct all possible formulas which consist
of a conjunction of P or in negation and conjunction of Q or its negation.
● Now of the formulas should contains both a variable and its negation.
● For two variables P and Q there is 2^2 such formula.
● These formulas are called minterms or Boolean conjunction of p and Q from the truth
tables of theses minterms, it is clear that no two minterms are equivalent.
● Each minterm has the truth value T for exactly one combination of the truth value of
the variables P and Q.
● For a given formula an equivalent formula consisting of a disjunction of minterms
only is known as its principle disjunction normal form.
● Such a normal form is also said to be the sum-product canonical form.
Things to remember:
● Remember that we also called “or” “disjunction” and “and” “conjunction”.
● A clause that contains only ∨ is called a disjunctive clause and
● A clause that contains only ∧ is called a conjunctive clause.
○ Negation is allowed, but only directly on variables.
○ P ∨ ¬q ∨ r : a disjunctive clause
○ ¬p ∧ q ∧ ¬r: a conjunctive clause
○ ¬p ∧ ¬q ∨ r : neither
● If we put a bunch of disjunctive clauses together with ∧, it is called conjunctive
normal form.
For example:
( p ∨ r ) ∧ ( ¬q ∨ ¬r ) ∧ q is in conjunctive normal form.
● Similarly, putting conjunctive clauses together with ∨ , it is called disjunctive normal
form.
For example:
( p ∧ ¬q ∧ r ) ∨ ( ¬q ∧ ¬r ) is in disjunctive normal form.
● More examples:
○ ( p ∧ q ∧ ¬r ∧ s ) ∨ ( ¬q ∧ s ) ∨ ( p ∧ s ) : It is in disjunctive normal form.
○ ( p ∨ q ∨ ¬r ∨ s ) ∧ ( ¬q ∨ s ) ∧ ¬s : It is in conjunctive normal form.
○ ( p ∨ r ) ∧ ( q ∧ ( p ∨ ¬q ) ) :It is not in a normal form.
___________________________________________________________________________
___________________________________________________________________________
2.4 Exercise:
__________________________________________________________________________
1) Use mathematical induction to show that 1+2+3+⋯+n=n(n+1)/2 for all integers n≥1 .
2) Use induction to prove that the following identity holds for all integers n≥1 :
1+3+5+⋯+(2n−1)=n2
3) Prove or disprove the following statement:
(p∨q)→r and (p→r)∧(q→r) are logically equivalent.
4) Determine whether the following arguments are valid or invalid:
a)
All triangles have angles.
A circle has no angle.
A circle is not a triangle.
b)
If you don’t work hard then you won’t succeed.
You work hard.
Therefore, you will succeed.
c)
If you make an A on the midterm, you won’t have to take the final.
Jose did not take the final.
Therefore, Jose made an A on the midterm.
UNIT 2 - Chapter 3
SETS AND RELATIONS
Unit Structure
3.0 Objective
3.1 Introduction
3.2 Relations
3.2.1 Method of Ordered Pairs
3.2.2 Matrix of a Relation
3.2.3 Digraph of a Relation
3.1 INTRODUCTION
We get elements from a real system. These elements may be numbers, cities, items
used to study a particular system etc. The collection of such well defined objects is
called as a set. Depending up on the number of element of sets we classify sets.
Sometimes we are interested in the relation between elements of two sets, the two
sets may or may not be different.
3.2 RELATIONS
Note that, for any finite, non empty sets A and B, |A×B|=|A||B|
Relation:
Any subset of AB is called as relation from A to B.
We will use capital letter like R, S etc. to denote the relations.
In this method we write all the pairs of the relation in a curly bracket.
For example A={1, 2, 3, 4, 5], B={a, b, c} and R is a relation from A to B, where
R={(1,a), (2,a), (5,c)}. Here relation R is represented using the ordered pairs.
If A={a1, a2, a3, a4, …., am} and B={b1, b2, b3, b4, …., bn} are finite sets containing m
and n elements, respectively, and R is a relation from A to B, we represent R by mn
matrix MR=[mij] which is defined by
mij = 1 if (ai ,b j ) R
0 if (ai ,b j ) R
A relation R on a set A is reflective if (a,a)R for all aA. (i.e. Every element is
related to itself).
A relation R on a set A is symmetric, if whenever (a,b)R then (b,a)R. It then follows that
R is not symmetric if we have a and bA with (a,b)R but (b,a)R.
Note: A relation R is transitive if and only if its matrix MR={mij} has the
property
mij=1 and mjk=1 then mik=1
Example 2.2: Let A be a set of all triangles in the plane and R be the relation on A
defined as follows:
R={(a,b)AA| a is congruent to b}
Show that R is an equivalence relation.
Solution: Step-1: To show that R is reflective.
Since every triangle is congruent to itself we have (a,a)R aA. Hence R is
reflective.
Step-2: To show that R is symmetric.
If triangle a is congruent to triangle b, then triangle b is congruent to triangle a. a,b
A. Hence R is symmetric.
Step-3: To show that R is transitive.
If triangle a is congruent to triangle b and triangle b is congruent to triangle c then
triangle a is congruent to triangle c. a,b,c A. Hence R is transitive.
R is equivalence relation.
If R is an equivalence relation on A, then the set R(a) are called equivalence classes
of R where aA.
Example 2.6: Let S={1, 2, 3, 4} and let A=SS. Define the following relation R on A:
(a,b)R(a’,b’) if and only if a+b=a’+b’
i) Show that R is an equivalence relation.
ii) Compute A/R.
Solution: Step-1. To show that R is reflective.
Since a+b=a+b, we have (a,b)R(a,b). Hence R is reflective.
Step-2: To show that R is symmetric:
If a+b=a’+b’ then a’+b’=a+b i.e. (a,b)R(a’,b’) implies (a’,b’)R(a,b). Hence R is symmetric.
Step-3: To show that R is transitive:
If a+b=a’+b’ and a’+b’=a”+b” then a+b=a”+b” i.e. (a,b)R(a’,b’) and (a’,b’)R(a”,b”) implies
(a,b)R(a”,b”). Hence R is transitive.
Hence R is equivalence relation.
Now R((1,1))={(1,1)} R((1,2))={(1,2), (2,1)};
R((1,3))={(1,3), (2,2), (3,1)} R((1,4))={(1,4), (2,3), (3,2), (4,1)}
R((2,4))={(2,4), (3,3), (4,2)} R((3,4))={(3,4), (4,3)}
R((4,4))={(4,4)}
A/R={ {(1,1)}, {(1,2), (2,1)}, {(1,3), (2,2), (3,1)}, {(1,4), (2,3), (3,2),
(4,1)},
{(2,4), (3,3), (4,2)}, {(3,4), (4,3)}, {(4,4)} }
Let R and S be relations from set A to a set B. Then, if we remember that R and S
are simply subsets of AB, we can use set operations on R and S.
• We can also form the intersection RS and the union RS of the relations R and
S. In relational terms, we see that (a,b)RS means that (a,b)R and (a,b)S. All
our set theoretic operations can be used in this way to produce new relations.
Example 2.8: Let A={1,2,3} and let R and S be the relations on A. Suppose that
matrices of R and S are
1 0 1 0 1 1
MR = 0 1 1 MS = 1 1 0
0 0 0 0 1 0
1 0 0
(iii) MR-1 = 0 1 0 (iv) M S = 1 0 0
1 1 0
0 0 1
1 0 1
0 0 1 1
0 0 1 0
(iv) MS =
--
0 0 0 1
0 0 0 1
Note: If there is no possibility of confusion about partial order, we may refer to the
poset simply as A, rather than (A,R).
(i) Since partial order relation is always reflection, delete edges of the type
(a,a) from the digraph of partial order relation.
(ii) Since partial order relation is always transitive, delete edges of the type
(a,c) from the digraph of partial order relation if (a,b)R and (b,c)R.
(iii) Do not show arrow along the edges of the digraph. Do not use circles to
show vertices of the digraph.
Solution: (i) R is reflective because every element divides itself i.e. (a,a)R for
every aA.
(i) R is antisymmetric because if a|b and b|a then a=b i.e. (a,b)R and
(b,a)R implies a=b.
(ii) R is transitive because if a|b and b|c then a|c i.e. (a,b)R and (b,c)R
implies (a,c)R.
Hence R is a partial order relation.
The Hasse diagram is shown below
12
4 3
2
1
Exercise 2:
(1) Let A={a,b,c,d} and let R be the relation on A that has the matrix
1 0 0 0
0 1 0 0
(i) M R = 0 1 0 1 (ii) MR =
1 1 1 0
0 1 1 0
0 1 0 1
1 1 1 0
1 1 0 1
Construct the diagraph of R , and list in-degrees and out-degrees of all vertices.
(2) Let A=R=Set of real numbers. For the following relation defined on A, find the domain
and range for each,
(i) aRb iff a2+b2=25 (ii) aRb iff 2a+3b=6
(3) Let A=set of real numbers . We define the following relation R on A.
x2 y2
(x,y)R if and only if x and y satisfy the equation 4 + 9 = 1 .
Chapter Overview:
4.0 Objective
4.1 Graph
4.2 Representation of Graph
4.2.1 Adjacency matrix
4.2.2 Adjacency list
4.2.3 Incidence matrix
4.3 Euler paths and Circuits
4.4 Hamiltonian Paths and Circuits
4.5 Exercise
___________________________________________________________________________
4.0 Objective
___________________________________________________________________________
Graphs, directed graphs, play vital roles in mathematics and computer science.In
mathematics, graph theory is the study of graphs, which can represent mathematical
structures which are used to model pairwise relations between objects. Graph is a
mathematical representation of a network and it describes the relationship between lines and
points. A graph consists of some points (known as nodes) and lines (known as edges)
between them. The length of the lines and position of the points do not matter. Each object in
a graph is called a node.
___________________________________________________________________________
4.1 Graph
___________________________________________________________________________
Pictures like the dot and line drawing are called graphs. Graphs are made up of a collection of
dots called vertices and lines connecting those dots called edges. When two vertices are
connected by an edge, we say they are adjacent. The nice thing about looking at graphs
instead of pictures of rivers, islands and bridges is that we now have a mathematical object to
study. We have distilled the “important” parts of the bridge picture for the purposes of the
problem. It does not matter how big the islands are, what the bridges are made out of, if the
river contains alligators, etc. All that matters is which land masses are connected to which
other land masses, and how many times.
Graph Definition.
A graph is an ordered pair G (V, E) consisting of a nonempty set V (called the vertices)
and a set E (called the edges) of two-element subsets of V.
Example.
We have V = {v1, . . . , v5} for the vertices and
E = {(v1, v2),(v2, v5),(v5, v5),(v5, v4),(v5, v4)} for the edges.
Remark. The two edges (u, v) and (v, u) are the same. In other words, the pair is not ordered.
1 End Vertices The two vertices u and v are end v4 and v5 are end vertices of
vertices of the edge (u, v). e5.
2 Parallel Edges that have the same end e4 and e5 are parallel.
Vertices vertices are parallel.
9 Adjacent Edges Edges are adjacent if they share a e1 and e2 are adjacent.
common end vertex.
__________________________________________________________________________
Example 1
Take a look at the following directed graph. Vertex ‘a’ has two edges, ‘ad’ and ‘ab’, which
are going outwards. Hence its outdegree is 2. Similarly, there is an edge ‘ga’, coming
towards vertex ‘a’. Hence the indegree of ‘a’ is 1.
The indegree and outdegree of other vertices are shown in the following table −
a 1 2
b 2 0
c 2 1
d 1 1
e 1 1
f 1 1
g 0 2
__________________________________________________________________________
Example 2
Take a look at the following directed graph. Vertex ‘a’ has an edge ‘ae’ going outwards from
vertex ‘a’. Hence its outdegree is 1. Similarly, the graph has an edge ‘ba’ coming towards
vertex ‘a’. Hence the indegree of ‘a’ is 1.
The indegree and outdegree of other vertices are shown in the following table −
a 1 1
b 0 2
c 2 0
d 1 1
e 1 1
___________________________________________________________________________
Exercise :
1. Consider following graph and answer the followed question:
(i) (ii)
___________________________________________________________________________
4.2 Representation of Graph
___________________________________________________________________________
We can represent graphs in two ways :
1. As an Adjacency Matrix
2. As an Adjacency List
3. As an Incidence Matrix
Let's look at each of them in detail.
Let the adjacency matrix = [aij ] of a graph G is the n × n (n = |V |) zero-one matrix, where
aij = 1 if {vi , vj} is an edge of G, and is 0 otherwise.
The adjacency matrix A of a graph G does depend on the ordering of the vertices of G, that
is, a different ordering of the vertices yields a different adjacency matrix. However, any two
such adjacency matrices are closely related in that one can be obtained from the other by
simply interchanging rows and columns.
On the other hand,the adjacency matrix does not depend on the order in which the edges
(pairs of vertics) are input into the computer.
Let G = (V, E) be an undirected graph with V = {v1, . . . , vn} and E = {e1, . . . , em}. Then the
incidence matrix with respect to this ordering of V and E is the n × m matrix M = [mij ] where
mij = 1 if ej is incident with vi , and is 0 otherwise.
___________________________________________________________________________
Example 1:
Use an adjacency list and adjacency matrix to represent the given graph
Solution:
Example 2:
Draw an undirected graph represented by the given adjacency matrix.
Solution:
Exercise:
1) Use an incidence matrix to represent the graph.
a)
b)
___________________________________________________________________________
4.3 Euler paths and Circuits
___________________________________________________________________________
An Euler path is a path that uses every edge of a graph exactly once.
An Euler circuit is a circuit that uses every edge of a graph exactly once.
· An Euler path starts and ends at different vertices.
· An Euler circuit starts and ends at the same vertex.
Euler Paths and Euler Circuits
● An Euler circuit (or Eulerian circuit) in a graph G is a simple circuit that contains
every edge of G.
○ Reminder: a simple circuit doesn't use the same edge more than once.
○ So, a circuit around the graph passing by every edge exactly once.
○ We will allow simple or multigraphs for any of the Euler stuff.
● In the modern world: you want to walk around the mall without missing any stores, or
wasting time walking the same hall again.
● For example, the first graph has an Euler circuit, but the second doesn't.
Note: you're allowed to use the same vertex multiple times, just not the same edge.
● An Euler path (or Eulerian path) in a graph G is a simple path that contains every
edge of G.
○ The same as an Euler circuit, but we don't have to end up back at the
beginning.
○ The other graph above does have an Euler path.
● Theorem: A graph with an Eulerian circuit must be connected, and each vertex has
even degree.
Proof: If it's not connected, there's no way to create a circuit.
When the Eulerian circuit arrives at an edge, it must also leave. This visits two edges
on the vertex. When it returns to its starting point, it has visited an even number of
edges at each vertex.
● Theorem: A connected graph with even degree at each vertex has an Eulerian circuit.
Proof: We will show that a circuit exists by actually building it for a graph with |V|=n.
For n=2, the graph must be two vertices connected by two edges. It has an Euler
circuit.
For n>2, pick a vertex v as a starting point. Pick an arbitrary edge leaving v. Continue
to pick edges and walk around the graph until you return to v. We know we'll never
get stuck since every vertex has even degree: if we walk in, then there's a way to walk
out.
This process forms part of our circuit. Let Ev be the set of edges visited in our initial
loop.
Consider the graph with edges E−Ev and whatever vertices still have an edge
adjacent. Each vertex in this graph has even degree (since we removed an even
number from each) and it has less than n edges. By strong induction, we can find an
Euler circuit for each connected component of this graph.
Since our graph was connected originally, each of these sub-circuits shares a vertex
with out Ev walk. We can join these together at the shared vertex to form a circuit of
all edges in G.
● An example will help. Suppose we have the graph below start at b and find the initial
walk highlighted.
___________________________________________________________________________
Example 1:
Determine whether the given graph has an Euler circuit. Construct such a circuit when one
exists. If no Euler circuit exists, determine whether the graph has an Euler path and construct
such a path if one exists.
Solution:
By using the Euler path theorem we can say that,
➔ This graph does not have an Euler circuit because we have four vertices of odd
degree.
➔ This graph does not have an Euler path because we have four vertices of odd degree.
___________________________________________________________________________
4.4 Hamiltonian Paths and Circuits
___________________________________________________________________________
● The Euler circuits and paths wanted to use every edge exactly once.
● It seems obvious to then ask: can we make a circuit of a graph using every vertex
exactly once?
○ Such a circuit is a Hamilton circuit or Hamiltonian circuit.
○ Similarly, a path through each vertex that doesn't end where it started is a
Hamilton path.
● It seems like finding a Hamilton circuit (or conditions for one) should be more-or-less
as easy as a Euler circuit.
○ Unfortunately, it's much harder.
● For example, the two graphs above have Hamilton paths but not circuits:
● Somehow, it feels like if there “enough” edges, then we should be able to find a
Hamiltonian cycle. The following two theorem give us some good-enough conditions.
● Theorem: (Ore's Theorem) In a graph with n≥3 vertices, if for each pair of
vertices either deg(u)+deg(v)≥n or u and v are adjacent, then the graph has a
Hamilton circuit.
Proof idea: Suppose there is any graph that had this property but no Hamilton cycle.
Consider such a graph that has as the maximum number of edges without having a
Hamilton cycle. Such a graph must have a Hamilton path: if not, we could add more
edges without creating a cycle.
By the pigeonhole principle, there must be vertices adjacent to the ends of the path in
such a way that we can construct a circuit. [Google “Ore's Theorem” for details of the
proof if you're interested.]
● Corollary: (Dirac's Theorem) In a graph with n≥3 vertices, if each vertex has
deg(v)≥n/2, then the graph has a Hamilton circuit.
Proof: If a graph has deg(v)≥n/2 for each vertex, then it meets the criteria for
Ore's theorem, and thus has a Hamilton cycle.∎
● Note that these conditions are sufficient but not necessary: there are graphs that have
Hamilton circuits but do not meet these conditions.
○ C6 for example (cycle with 6 vertices): each vertex has degree 2 and 2<6/2,
but there is a Ham cycle.
Solution:
This graph has a Hamilton circuit. a, b, c, d, e, a is a circuit.
___________________________________________________________________________
4.5 Exercise
___________________________________________________________________________
Solve the following :
1) Determine whether the given graph has an Euler circuit. Construct such a circuit when
one exists. If no Euler circuit exists, determine whether the graph has an Euler path
and construct such a path if one exists
a) b)
2) Determine whether the given graph has an Hamilton circuit. If it does, find such a circuit.
It it does not, give an argument to show why no such circuit exists.
Unit 4 - Chapter 5
Mathematical Models
Chapter Overview:
5.0 Objective
5.1 Mathematical Models
5.2 Vehicular Stopping Distance Modelling using decision theory
5.3 Limitations in our model
5.4 Conclusion : Vehicular Stopping Distance Model
5.5 Exercise
___________________________________________________________________________
5.0 Objective
___________________________________________________________________________
We can describe A mathematical model as a system using mathematical concepts and
language. Mathematical modelling is the process of developing a mathematical model. These
methods are used in the natural sciences like physics, biology, earth science, chemistry and
engineering disciplines such as computer science, electrical engineering.
Mathematical models are also used in non-physical systems such as the social sciences such
as economics, psychology, sociology, political science.
As well as they are also used in music,linguistics and philosophy.
A model may help to explain a system and to study the effects of different components, and
to make predictions about behavior.
___________________________________________________________________________
5.1 Mathematical Models
___________________________________________________________________________
● In mathematical modelling, we translate our beliefs about how the world functions
into the language of mathematics.
● Mathematics can prove general results, though these results depend critically on the
form of equations used. Small changes in the structure of equations may require
enormous changes in the mathematical methods.
● Using computers to handle the model equations may never lead to elegant results, but
it is much more robust against alterations.
● Mathematical modelling can be used for a number of different reasons.
● How well any particular objective is achieved depends on both the state of knowledge
about a system and how well the modelling is done.
● Examples of the range of objectives are:
1. Developing scientific understanding - through quantitative expression of current
knowledge of a system ,as well as displaying what we know, this may also show up
what we do not know
2. test the effect of changes in a system
3. aid decision making, including
(i) tactical decisions by managers; (ii) strategic decisions by planners.
___________________________________________________________________________
5.2 Vehicular Stopping Distance Modelling using decision theory
___________________________________________________________________________
Let's discuss mathematical modelling by following an example.
Example. Vehicular Stopping Distance
Problem statement :
In driver’s training, you learn a rule for how far behind other cars you are supposed to stay.
➔ Stay back one car length for every 10 mph of speed.
➔ Use the two-second rule: stay two seconds behind.
This is an easy-to-follow rule; it is a safe rule?
Steps to follow :
1. Formulation:
State the question.
Identify factors.
2. Describe mathematically:
Culminates with a mathematical model.
3. Mathematical Manipulation
Determine mathematical conclusions.
4. Evaluation.
Translate into real-world conclusions.
How good is the model?
5.2.1 Formulation:
Subproblem 1:
Determine reaction distance dr
Assume speed is constant throughout reaction distance.
Then,
reaction distance is dr = tr · v.
Subproblem 2: Total
Determine stopping distance db
Assume brakes applied constantly throughout stopping, producing a constant deceleration.
Brake force is F = ma, applied over a breaking distance db.
This energy absorbs the kinetic energy of the car,½ mv.
Solving
m·a·db = ½ mv2,
we expect db = C · v2.
Therefore,
5.2.4 Evaluation.
● Conclusion:
○ Plots observed stopping distance versus model.
○ Model seems reasonable (through 70 mph).
○ Residual plot shows additional behavior unmodeled
5.2.4.2 How good is the model?
To check how good is the model we can ask the below questions and try to answer them:
___________________________________________________________________________
5.4 Conclusion : Vehicular Stopping Distance Model
___________________________________________________________________________
Chapter Overview:
6.0 Objective
6.1 Probability
6.2 Expected Value
6.3 Examples:
6.3.1 Rolling the Dice,
6.3.2 Life Insurance,
6.3.3 Roulette etc
6.4 Decision Trees ,
6.5 Classification problems using Baye’s theorem
6.6 Exercise
___________________________________________________________________________
6.0 Objective
_________________________________________________________________________
● Probability theory is a mathematical modeling of the phenomenon of chance or
randomness.
● For example, if a coin is tossed in a random manner, it can land heads or tails, but we
do not know which of these will occur in a single toss.
● However stable long-run behavior of random phenomena forms the basis of
probability theory.
● A probabilistic mathematical model of random phenomena is defined by assigning
“probabilities” to all the possible outcomes of an experiment.
● The reliability of our mathematical model for a given experiment depends upon the
closeness of the assigned probabilities to the actual limiting relative frequencies.
● In this section we state the axioms, derive a few consequences, and introduce the
notion of expected value.
___________________________________________________________________________
6.1 Probability
_________________________________________________________________________
● Using a mathematical theory of probability, we may be able to calculate the likelihood
of some event.
● Many fields in computer science such as machine learning, cryptography,
computational linguistics, computer vision, robotics, and of course algorithms, rely a
lot on probability theory.
● In1933, Kolmogorov provided a precise axiomatic approach to probability theory
which made it into a rigorous branch of mathematics with even more applications.
● Probability can be conceptualized as finding the chance of occurrence of an event.
Mathematically, it is the study of random processes and their outcomes.
● The first basic assumption of probability theory is that even if the outcome of an
experiment is not known in advance, the set of all possible outcomes of an experiment
is known.
● This set is called the sample space or probability space.
❏ Random Experiment: An experiment in which all possible outcomes are known and
the exact output cannot be predicted in advance is called a random experiment.
Tossing a fair coin is an example of random experiment.
❏ Sample Space: When we perform an experiment, then the set S of all possible
outcomes is called the sample space. If we toss a coin, the sample space S = {H, T}
❏ Event: Any subset of a sample space is called an event. After tossing a coin, getting
Head on the top is an event.
❏ Probability means the chance of occurrence of a particular event. The best we can
say is how likely they are to happen, using the idea of probability.
_________________________________________________________________________
Conditional Probability:
● The conditional probability of an event B is the probability that the event will occur
given an event A has already occurred. This is written as P(B|A).
● If event A and B are mutually exclusive, then the conditional probability of event B
after the event A will be the probability of event B that is P(B).
Example 1:
In a country 50% of all teenagers know English and 30% of all teenagers know English and
Marathi. What is the probability that a teenager knows English given that the teenager owns a
Marathi?
Solution:
Let us assume A is the event of teenagers knowing only a Marathi and B is the event of
teenagers knowing only a English.
So,
P(A) = 50/100
= 0.5 and
P(A ∩ B) = 30/100
= 0.3
from the given problem.
Hence, the probability that a teenager knows English given that the teenager knows a Marathi
is 60%.
___________________________________________________________________________
Example 2:
In a class, 50% of all students play cricket and 25% of all students play cricket and
volleyball. What is the probability that a student plays volleyball given that the student plays
cricket?
Solution
Let us assume A is the event of students playing only cricket and B is the event of students
playing only volleyball.
So,
P(A) = 50/100
=0.5
and
P(A ∩ B) = 25/100
=0.25
from the given problem.
P(B|A) = P(A ∩ B) / P(A)
=0.25/0.5
=0.5
Hence, the probability that a student plays volleyball given that the student plays cricket is
50%.
___________________________________________________________________________
OR
When two events cannot occur at the same time, they are considered mutually exclusive.
Example: Consider the example of finding the probability of selecting a black card or a 6
from a deck of 52 cards.
Solution:
= 28/52
= 7/13.
__________________________________________________________________________
Independent Event
When multiple events occur, if the outcome of one event DOES NOT affect the outcome of
the other events, they are called independent events.
Say, a die is rolled twice. The outcome of the first roll doesn’t affect the second outcome.
These two are independent events.
Example 1: Assume a coin is tossed twice. What is the probability of getting two consecutive
tails ?
Solution:
Here’s the verification of the above answer with the help of sample space.
When a coin is tossed twice, the sample space is {(H,H), (H,T), (T,H), (T,T)}.
Our desired event is (T,T) whose occurrence is only once out of four possible outcomes and
hence, our answer is 1/4.
Example 2: Consider another example where a pack contains 4 blue, 2 red and 3 black pens.
If a pen is drawn at random from the pack, replaced and the process repeated 2 more times,
What is the probability of drawing 2 blue pens and 1 black pen?
Solution
Probability of drawing 2 blue pens and 1 black pen = 4/9 * 4/9 * 3/9
= 48/729
= 16/243
_________________________________________________________________________
Dependent Events
When two events occur, if the outcome of one event affects the outcome of the other, they are
called dependent events.
Consider the aforementioned example of drawing a pen from a pack, with a slight difference.
Example 1: A pack contains 4 blue, 2 red and 3 black pens. If 2 pens are drawn at random
from the pack, NOT replaced and then another pen is drawn. What is the probability of
drawing 2 blue pens and 1 black pen?
Solution:
= 1/14
________________________________________________________________________
Example 2: What is the probability of drawing a king and a queen consecutively from a deck
of 52 cards, without replacement.
Solution:
Now, the probability of drawing a king and queen consecutively is = 1/13 * 4/51
= 4/663
___________________________________________________________________________
6.2 Expected Value
_________________________________________________________________________
Consider an experiment that has only two possible events. The expected value of the
experiment is,
Throwing a Dice:
When a dice is thrown, six possible outcomes can be on the top: 1, 2, 3, 4, 5, 6.
Solution:
The probability of any one of the numbers is 1/6
The probability of getting even numbers is 3/6=1/3
The probability of getting odd numbers is 3/6=1/3
Solution:
a. Expected value = (0.0002)(199,700) + (0.9998)(−300) = − $260.00
Fire No Fire
The expected value over many years is −$260 per year.
b. The expected value for the insurance company is the same, except the perspective is
switched.
Instead of − $260 per year, it is +$260 per year.
Of this, the company must pay a large percent for salaries and overhead.
c. The insurance company can expect to gross $30,000,000 in premiums on 100,000 such
policies.
With a probability of 0.0002 for fire, the company can expect to pay on about 20 fi res.
This leaves a gross profit of $26,000,000.
SIMPLE EXAMPLE:
Let’s say that we want to calculate the probability of two Blacks in three spins. Or to put it
differently “how often will we see exactly two Black numbers in three spins”. Note that
this equation calculates the exact probabilities of a specific event. Not the probabilities of 2
or more Blacks, but exactly 2 Blacks.
Solution:
n = 3 (total spins)
P(b) = 0.5 (the probability of Black in each spin – we ignore the zero for simplicity)
Therefore, the probability in 3 spins to have exactly 2 Black numbers is 0,375 or 37,5% or
a little more than 1/3.
All these numbers are just different expressions of the same thing ,the expectation of the
event happening.
___________________________________________________________________________
6.4 Decision Trees
_________________________________________________________________________
● Decision tree is a hierarchical tree structure that is used to classify classes based on a
series of questions (or rules) about the attributes of the class.
● The attributes of the classes can be any type of variables from binary, nominal,
ordinal, and quantitative values, while the classes must be qualitative (categorical or
binary, or ordinal).
● In short, given a data of attributes together with its classes, a decision tree produces a
sequence of rules (or series of questions) that can be used to recognize the class.
● When we include a decision in a tree diagram we use a rectangular node, called a
decision node to represent the decision.
● The diagram is then called a decision tree.
● There are no probabilities at a decision node but we evaluate the expected monetary
values of the options.
● In a decision tree the first node is always a decision node.
● If there is another decision node then we evaluate the options there and choose the
best one, and the expected value of this option becomes the expected value of the
branch leading to the decision node.
1. Pick the best attribute/feature. The best attribute is one which best splits or separates
the data.
2. Ask the relevant question.
3. Follow the answer path.
4. Go to step 1 until you arrive at the answer.
The best split is one which separates two different labels into two sets.
___________________________________________________________________________
Example1:
Your company is considering developing one of two cell phones. Your development and
market research teams provide you with the following projections.
Cell phone A:
Cost of development: $2,500,000
Projected sales: 50% chance of net sales of $5,000,000
30% chance of net sales of $3,000,000
20% chance of net sales of $1,500,000
Cell phone B:
Cost of development: $1,500,000
Projected sales: 30% chance of net sales of $4,000,000
60% chance of net sales of $2,000,000
10% chance of net sales of $500,000
Which model should your company develop? Explain.
Solution:
A decision tree can help organize your thinking.
Although cell phone A has twice the risk of losing $1 million, it has the greater expected
value. So, using expected value as a decision guideline, your company should develop cell
phone A.
___________________________________________________________________________
Example 2:
Teams A and B are to play each other repeatedly until one wins two games in a row or a total
of three games. One way in which this tournament can be played is for A to win the first
game, B to win the second, and A to win the third and fourth games. Denote this by writing
A–B–A–A.
a. How many ways can the tournament be played?
b. Assuming that all the ways of playing the tournament are equally likely, what is the
probability that five games are needed to determine the tournament winner?
Solution:
a. The possible ways for the tournament to be played are represented by the distinct paths
from “root” (the start) to “leaf” (a terminal point) in the tree shown sideways in the given
figure.
The label on each branching point indicates the winner of the game.
The notations in parentheses indicate the winner of the tournament.
The fact that there are ten paths from the root of the tree to its leaves shows that there are ten
possible ways for the tournament to be played. They are (moving from the top down): A–A,
A–B–A–A, A–B–A–B–A, A–B–A–B–B, A–B–B, B–A–A,B–A–B–A–A, B–A–B–A–B, B–
A–B–B, and B–B. In five cases A wins, and in the other five B wins. The least number of
games that must be played to determine a winner is two, and the most that will need to be
played is five.
b. Since all the possible ways of playing the tournament listed in part (a) are assumed to be
equally likely, and the listing shows that five games are needed in four different cases (A–B–
A–B–A, A–B–A–B–B, B–A–B–A–B, and B–A–B–A–A),
the probability that five games are needed is 4/10 = 2/5 = 40%.
___________________________________________________________________________
7.5 Classification problems using Baye’s theorem
_________________________________________________________________________
Theorem: If A and B are two mutually exclusive events, where P(A) is the probability of A
and P(B) is the probability of B, P(A | B) is the probability of A given that B is true.
Problem
Consider a three box container.
The first box container contains 2 red flowers and 3 blue flowers;
the second box container has 3 red flowers and 2 blue flowers; and
the third box container has 4 red flowers and 1 blue flower.
There is equal probability of each box container to be selected. If one flower is drawn at
random, what is the probability that it is a red flower?
Solution:
Let Ai be the event that ith box container is selected.
Here, i = 1,2,3.
Since probability for choosing a box container is equal, P(Ai) = 1/3
The probability that a red flower is chosen among the five flower of the first box container:
P(B|A1) = 2/5
The probability that a red flower is chosen among the five flower of the second box
container:
P(B|A2) = ⅗
The probability that a red flower is chosen among the five flower of the third box container:
P(B|A3) = ⅘
___________________________________________________________________________
6.6 Exercise:
___________________________________________________________________________
Solve the following:
7.0Overview
In this chapter, we will introduce the idea of recurrence relations (difference equation).
We will study some of the famous recurrence relations like Fibonacci Sequence, Tower of Hanoi,
Lines in plane. We will study homogenous and non-homogeneous difference equations with
their solutions. Then we will study Divide and Conquer algorithms.
7.1Introduction
In this chapter, we are going to study the differenceequations and their applications
with solution. To understand the difference equation, we consider some basic terms.
The recurrence relations are also called as Difference Equations.
• Sequence:
The sequence is a function from set of natural numbers to real numbers defined as
𝑓: ℕ → ℝ with 𝑓(𝑛) = 𝑎𝑛 , where 𝑛 ∈ ℕ and 𝑎𝑛 ∈ ℝ and is denoted by < 𝑎𝑛 >
E.g., Let𝑓: ℕ → ℝdefined as 𝑓(𝑛) = 2𝑛be a sequence < 𝑎𝑛 >is defined as 𝑎𝑛 =
2𝑛 , 𝑛 = ℕ and 𝑎𝑛 ∈ ℝ . We get the sequence as < 𝑎𝑛 > = {2, 4, 6, 8, … . },
where 𝑎1 = 2, 𝑎2 = 4, 𝑎3 = 6 … and so on.
According to the literature, the world will come to an end when all the discs
will be moved to the tower Y. If we want to move all discs od tower X (source)
to tower Y (destination) then how many minimum steps (moves) do we need?
We can answer this question with an algorithm. We need to construct the
algorithm.
We first try to solve this problem with less discs. Let we have 2 discs only.
Now we consider the 3 towers X(source), Y (destination) and Z(auxiliary).
Now we have got the idea, how to solve this puzzle. Let’s try to get the
algorithm to solve Tower of Hanoi for more than 2 discs.
We consider the stack of discs into 2 parts. The largest disc (n th disc) is the
one part and other (n-1) disc are the other part.
We have to move all the discs from tower X(source) to the tower Y
(destination).
We can use the above steps to move the discs from tower X to tower Y. Now
we apply the above steps as
a. Move (n-1) discs (second part) from tower X to tower Z.
b. Move nth (largest) disc from tower X to tower Y
c. Move all (n-1) discs from tower Z to tower Y.
This algorithm we can apply recursively to all n discs and move all discs to
destination tower Y.
If we use proper recursion then we are able to solve the puzzle with n discs in
minimum 2n-1 steps.
As we know for 2 discs, we have solved this puzzle in 22-1=3 steps. Hence we
can use the induction to solve the problem with n disks.
Here we have the recurrence relation as
𝐻𝑛 = 2𝐻𝑛−1 + 1 for 𝑛 ≥ 2 and 𝐻1 = 1.
Example 1:Find a recurrence relation and initial conditions for the number of
bit strings of the length 𝑛 that do not have two consecutive zeroes(0’s). How
many such bit strings are there of length 5?
Solution: Let 𝑎𝑛 denote the number of bit strings of length n that do not have
consecutive 0’s. We have to find the recursive relation for the sequence <
𝑎𝑛 >.
Now by the sum rule, the number of bit strings of length 𝑛 that do not have
two consecutive zeroes equal to the number of such bit strings ending with ‘0’
(zero) and the numbers of such bit strings ending with’1’.
Consider that 𝑛 ≥ 3 so that the bit string has at least 3 bits.
Consider the initial conditions 𝑎1 = 2. Since if we consider the but strings of
length 1 then we have either 0 or 1 as both the strings do not have
consecutive zeroes.
Now we consider 𝑛 = 2 i.e., the bit strings with length 2. We have the bit
strings of length 2 as 01, 10 and 11 i.e., we get 𝑎2 = 3.
Now we try to generalise the result as below.
The bit strings of length 𝑛 ending with 1 that do not have consecutive 0 are
precisely the bit strings of length (𝑛 − 1) with no two consecutive zeroes with
1 added at the end and we have such 𝑎𝑛−1 strings.
Now the bit strings of length 𝑛 ending with ‘0’ that do not have consecutive 0’s
must have 1 at their (𝑛 − 1)𝑡ℎ place (bit), otherwise these will end with 00.
Hence, we have the number of such bit strings of length 𝑛 ending with 0 that
have no consecutive ‘0’ are the bit strings of length (𝑛 − 2) and we add 10 at
the last place. There are such𝑎𝑛−2 strings. Hence, we have total number of bit
strings of length 𝑛 with no two consecutive zeroes is 𝑎𝑛
∴ 𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−2 for n≥3 -------(1)
Now we want to find the nos. of bit strings with length 5.
We have 𝑎1 = 2, 𝑎2 = 3,
∴ 𝑎3 = 𝑎2 + 𝑎1from equation (1)
∴ 𝑎3 = 3 + 2 = 5
Also ∴ 𝑎4 = 𝑎3 + 𝑎2 = 5 + 3 = 8
and ∴ 𝑎5 = 𝑎4 + 𝑎3 = 8 + 5 = 13
∴ we have such 13 bit-strings of length 5.
Ex.2 Find the first 6 terms of the sequence of recurrence relation
𝑎𝑛 = 6𝑎𝑛−1 where 𝑎0 = 2.
(Hint: Here we have to find the terms up to 𝑎5 .)
Solution: We have the recurrence relation as
𝑎𝑛 = 6𝑎𝑛−1 and 𝑎0 = 2.
Consider the first 6 terms of the sequence as,
For n=1, ∴ 𝑎1 = 6𝑎0 = 6(2) = 12
For n=2, ∴ 𝑎2 = 6𝑎1 = 6(12) = 72
For n=3, ∴ 𝑎3 = 6𝑎2 = 6(72) = 432
For n=4, ∴ 𝑎4 = 6𝑎3 = 6(432) = 2592
For n=5, ∴ 𝑎5 = 6𝑎4 = 6(2592) = 15552.
Ex.3 Find the first 5 terms of the sequence of recurrence relation
𝑎𝑛 = 𝑎𝑛−1 + 3𝑎𝑛−2 with 𝑎1 = 1, 𝑎2 = 2.
Solution: We have the recurrence relation as
𝑎𝑛 = 𝑎𝑛−1 + 3𝑎𝑛−2 for n ≥ 2
Consider the first 6 terms of the sequence as,
For n=2 ∴ 𝑎2 = 𝑎1 + 3𝑎0 = 2 + 3(1) = 5
For n=3 ∴ 𝑎3 = 𝑎2 + 3𝑎1 = 5 + 3(2) = 11
For n=4 ∴ 𝑎4 = 𝑎3 + 3𝑎2 = 11 + 3(5) = 26
For n=5 ∴ 𝑎5 = 𝑎4 + 3𝑎3 = 26 + 3(11) = 59.
Ex.4 Find the 𝑎5 term of the sequence of recurrence relation
𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−3 with 𝑎0 = 1, 𝑎1 = 2 and 𝑎2 = 0.
Solution: We have the recurrence relation as
𝑎𝑛 = 𝑎𝑛−1 + 𝑎𝑛−3
with 𝑎0 = 1, 𝑎1 = 2 and 𝑎2 = 0.
Now consider
𝑎3 = 𝑎2 + 𝑎0 = 0 + 1 = 1
𝑎4 = 𝑎3 + 𝑎1 = 1 + 2 = 3
𝑎5 = 𝑎4 + 𝑎2 = 3 + 0 = 3
∴ 𝑎5 = 3
Ex.6 Find the terms up to 𝑎5 for the recursive relation 𝑎𝑛 = 𝑎𝑛−1 − 𝑎𝑛−2 with
the initial conditions 𝑎0 = 2 and 𝑎1 = −1
Solution.: We have the recurrence relation as 𝑎𝑛 = 𝑎𝑛−1 − 𝑎𝑛−2 with the initial
conditions 𝑎0 = 2 and 𝑎1 = −1
Now we have
𝑎2 = 𝑎1 − 𝑎0 = −1 − 2 = −3
∴ 𝑎3 = 𝑎2 − 𝑎1 = −3 − (−1) = −3 + 1 = −2
∴ 𝑎4 = 𝑎3 − 𝑎2 = −2 − (−3) = −2 + 3 = 1
∴ 𝑎5 = 𝑎4 − 𝑎3 = 1 − (−2) = 1 + 2 = 3
∴ 𝑎5 = 3
Now we consider 𝑛 = 2. Now if we draw 2 lines in a plane then we see that the
plane is divided into 4 regions. Hence here we get 𝑎2 = 4.
Here we need to understand that every time we draw a line it does not double the
number of regions. When we draw a third line, we see that 𝑎3 = 7
No matter how we draw the line, it can split at the 3 old regions.
Now we try to generalise the relation as recurrence relation. The 𝑛𝑡ℎ line (for 𝑛 >
0), increases the number of regions by 𝑘 if and only if it splits 𝑘 of the old
regions. It splits 𝑘 old regions if and only if it intersects the previous lines in
𝑘 − 1 different places. Two lines can intersect at the most at one point.
Therefore, the new line can intersect the 𝑛 − 1 lines in at the most 𝑛 − 1
different points, and we must have 𝑘 ≤ 𝑛.
Hence, we can have a recurrence relation as 𝑎𝑛 ≤ 𝑎𝑛−1 + 𝑛 for 𝑛 > 0
Here we have inequality, now we will try to convert it to equality using induction.
Now we draw the 𝑛𝑡ℎ line in such a way that it’s not parallel to any of the
others hence it intersects them all, and that it doesn’t go through any of the
existing intersection points (hence, it intersects all of the lines).
The recurrence is given as 𝑎0 = 1, 𝑎𝑛 = 𝑎𝑛−1 + 𝑛 for 𝑛 > 0
We have the values 𝑎0 = 1, 𝑎1 = 2 and 𝑎2 = 4 satisfy the above relation.
Now we simplify the above relation 𝑎𝑛 = 𝑎𝑛−1 + 𝑛 and 𝑎𝑛−1 = 𝑎𝑛−2 + (𝑛 − 1)
∴ 𝑎𝑛 = [𝑎𝑛−2 + (𝑛 − 1)] + 𝑛
= 𝑎𝑛−2 + (𝑛 − 1) + 𝑛 ∵ 𝑎𝑛−2 = 𝑎𝑛−3 + (𝑛 − 2)
= [𝑎𝑛−3 + (𝑛 − 2)] + (𝑛 − 1) + 𝑛
= 𝑎𝑛−3 + (𝑛 − 2) + (𝑛 − 1) + 𝑛 ∵ 𝑎𝑛−3 = 𝑎𝑛−4 + (𝑛 − 3)
∴ 𝑎𝑛 = 𝑎𝑛−4 + (𝑛 − 3) + (𝑛 − 2) + (𝑛 − 1) + 𝑛
.
.
.
𝑎𝑛 = 𝑎0 + 1 + 2 + 3 + ⋯ + (𝑛 − 3) + (𝑛 − 2) + (𝑛 − 1) + 𝑛
Ex.3: Solve the following recurrence relation 𝑎𝑛+1 = 3𝑎𝑛 for 𝑛 ≥ 0 and 𝑎0 = 7.
Solution: Let 𝑎𝑛+1 = 3𝑎𝑛 for 𝑛 ≥ 0 be the linear homogenous recurrence relation
with 𝑎0 = 7.
Hence by the theorem, the solution is given as
𝑎𝑛 = 𝑘𝑑𝑛 for 𝑛 ≥ 0
Here 𝑑 = 3 and 𝑘 = 7
We get
𝑎𝑛 = 7. 3𝑛 for 𝑛 ≥ 0
Ex.4: Find the unique solution to the recurrence relation 𝑎𝑛+1 − 1.5𝑎𝑛 = 0 for 𝑛 ≥
0 with 𝑎0 = 2.
Solution: Let 𝑎𝑛+1 − 1.5𝑎𝑛 = 0 for 𝑛 ≥ 0 be the linear homogenous recurrence
relation with 𝑎0 = 2.
Hence by the theorem, the unique solution is given as
𝑎𝑛 = 𝑘𝑑𝑛 for 𝑛 ≥ 0
Here 𝑑 = 1.5 and 𝑘 = 2
We get
𝑎𝑛 = 2(1.5)𝑛 for 𝑛 ≥ 0
Ex.2: Find the solution for Fibonacci numbers 𝐹𝑛 = 𝐹𝑛−1 + 𝐹𝑛−2 with 𝐹0 = 0 and
𝐹1 = 1
Solution: Consider the linear homogenous recurrence relation 𝐹𝑛 = 𝐹𝑛−1 + 𝐹𝑛−2
with 𝐹0 = 0 and 𝐹1 = 1.
We have the characteristic equation as
𝑚2 − 𝑚 − 1 = 0 [Replace ′𝐹𝑛 ′ by 𝑚2 , ′𝐹𝑛−1 ′ by 𝑚 and ′𝐹𝑛−2 ′ by 𝑚0 = 1.]
1±√5
Solving above quadratic equation, we get 𝑚 = 2
1+√5 1−√5
Let 𝛼 = and 𝛽 =
2 2
Since the roots of the characteristic equation are real and distinct, the general
1+√5 1−√5
solution is given as 𝐹𝑛 = 𝐶1 𝛼 𝑛 + 𝐶2 𝛽 𝑛 where 𝛼 = and 𝛽 = and 𝐶1
2 2
and 𝐶2 be the constants to be determined.
We have 𝐹0 = 0 and 𝐹1 = 1
For 𝑛 = 0, 𝐹0 = 0 = 𝐶1 + 𝐶2 and
1+√5 1−√5
For 𝑛 = 1, 𝐹1 = 1 = 𝐶1 ( ) + 𝐶2 ( )
2 2
1 1
Solving above linear equations, we get 𝐶1 = and 𝐶2 = − .
√5 √5
∴ The general solution for Fibonacci sequence is given as
𝑛 𝑛
1 1+√5 1 1−√5
𝐹𝑛 = ( ) − ( ) for 𝑛 ≥ 0
√5 2 √5 2
∴ 𝜃 = tan−1(√15)
Since the roots are complex roots, we have the general solution as
𝑎𝑛 = 𝑟 𝑛 [𝛼 cos(𝑛𝜃) + 𝛽 sin(𝑛𝜃)] for 𝑛 ≥ 0
Here 𝑟 = 2
∴ 𝑎𝑛 = 2𝑛 [𝛼 cos(𝑛𝜃) + 𝛽 sin(𝑛𝜃)] for 𝑛 ≥ 0
Where 𝜃 = tan−1(√15) and 𝛼 and 𝛽 are constants.
To find the value of 𝛼 and 𝛽, we consider the initial values of 𝑎0 and 𝑎1
For 𝑛 = 0, 𝑎0 = 0 = 𝛼 cos(0) + 𝛽 sin(0) = 𝛼
∴𝛼=0
For 𝑛 = 1, 𝑎1 = 1 = 2𝛼 cos 𝜃 + 2𝛽 sin 𝜃
Since 𝛼 = 0
∴ 1 = 2𝛽 sin 𝜃
2 tan(𝜃/2)
We know that sin 𝜃 = 1+𝑡𝑎𝑛2(𝜃/2)
2
Using above formula and solving we get 𝛽 =
√15
Hence the general solution is given as
2
𝑎𝑛 = 2𝑛 . sin(𝑛𝜃) for 𝑛 ≥ 0
√15
2𝑛+1
∴ 𝑎𝑛 = sin 𝑛𝜃 for 𝑛 ≥ 0
√15
And 𝜃 = tan−1 (√15)
Ex.1: Solve the recurrence relation 2𝑎𝑛+3 = 𝑎𝑛+2 + 2𝑎𝑛+1 − 𝑎𝑛 for 𝑛 ≥ 0 with
𝑎0 = 0, 𝑎1 = 1 and 𝑎2 = 2
Solution: Let 2𝑎𝑛+3 = 𝑎𝑛+2 + 2𝑎𝑛+1 − 𝑎𝑛 be the recurrence relation with
𝑎0 = 0, 𝑎1 = 1 and 𝑎2 = 2
This is the linear homogenous recurrence relation. Consider the characteristic
equation of above recurrence relation.
∴ 2𝑚3 − 𝑚2 − 2𝑚 + 1 = 0
∴ 2𝑚3 − 2𝑚 − 𝑚2 + 1 = 0
∴ 2𝑚(𝑚2 − 1) − (𝑚2 − 1) = 0
∴ (𝑚2 − 1)(2𝑚 − 1) = 0
∴ (𝑚 − 1)(𝑚 + 1)(2𝑚 − 1) = 0
1
∴ 𝑚 = 1, −1 and 2
1
∴ The roots of characteristic equation are −1, 2 , 1. All roots are distinct, hence the
general solution is given as
𝑎𝑛 = 𝛼1 (−1)𝑛 + 𝛼2 (1/2)𝑛 + 𝛼3 (1)𝑛 for 𝑛 ≥ 0
Where 𝛼1 , 𝛼2 and 𝛼3 are the constants to be determined.
To determine the values of 𝛼1 , 𝛼2 and 𝛼3 we consider the given initial values
𝑎0 = 0, 𝑎1 = 1 and 𝑎2 = 2
For 𝑛 = 0, ∴ 𝑎0 = 𝛼1 + 𝛼2 + 𝛼3 = 0
𝛼
For 𝑛 = 1, ∴ 𝑎1 = 1 = −𝛼1 + 22 + 𝛼3
∴ −2𝛼1 + 𝛼2 + 2𝛼3 = 2
And
𝛼
For 𝑛 = 2, ∴ 𝑎2 = 2 = 𝛼1 + 42 + 𝛼3
∴ 4𝛼1 + 𝛼2 + 4𝛼3 = 8
Solving above linear equations, we get
1 8 5
𝛼1 = 6 , 𝛼2 = − 3 and 𝛼3 = 2
Hence the solution is given as
1 8 1 𝑛 5
𝑎𝑛 = 6 (−1)𝑛 − 3 (2) + 2 for 𝑛 ≥ 0
Ex.2: Solve the recurrence relation 𝑎𝑛 = −3𝑎𝑛−1 − 3𝑎𝑛−2 − 𝑎𝑛−3 for 𝑛 ≥ 3 with
𝑎0 = 1, 𝑎1 = −2 and 𝑎2 = −1
Solution: Let 𝑎𝑛 = −3𝑎𝑛−1 − 3𝑎𝑛−2 − 𝑎𝑛−3 for 𝑛 ≥ 3 be the linear homogenous
recurrence relation with 𝑎0 = 1, 𝑎1 = −2 and 𝑎2 = −1
Consider the characteristic equation of above recurrence relation, we have
𝑚3 + 3𝑚2 + 3𝑚 + 1 = 0
(𝑚 + 1)3 = 0
∴ 𝑚 = −1, −1, −1
i.e., the root −1 is repeated 3 times. Hence the general solution is given as
𝑎𝑛 = 𝛼1 𝑚𝑛 + 𝛼2 . 𝑛. 𝑚𝑛 + 𝛼3 . 𝑛2 𝑚𝑛 for 𝑛 ≥ 0
Where 𝛼1 , 𝛼2 and 𝛼3 are the constants to be determined and 𝑚 = −1.
We have
𝑎𝑛 = 𝛼1 (−1)𝑛 + 𝛼2 . 𝑛. (−1)𝑛 + 𝛼3 . 𝑛2 (−1)𝑛 for 𝑛 ≥ 0
We have the initial values as 𝑎0 = 1, 𝑎1 = −2 and 𝑎2 = −1
For 𝑛 = 0, 𝑎0 = 1 = 𝛼1 , ∴ 𝛼1 = 1
For 𝑛 = 1, 𝑎1 = −𝛼1 − 𝛼2 − 𝛼3 = −2, ∴ 𝛼1 + 𝛼2 + 𝛼3 = 2
For 𝑛 = 2, 𝑎2 = −1 = 𝛼1 + 2𝛼2 + 4𝛼3
Solving above linear equations, we get 𝛼1 = 1, 𝛼2 = 3 and 𝛼3 = −2
Hence the general solution is given as
𝑎𝑛 = (1 + 3𝑛 − 2𝑛2 )(−1)𝑛 for 𝑛 ≥ 0
𝑓(𝑛) (𝑃)
𝑎𝑛 𝑃𝑎𝑟𝑡𝑖𝑐𝑢𝑙𝑎𝑟 𝑆𝑜𝑙𝑢𝑡𝑖𝑜𝑛
𝐶, 𝑎 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡 𝐴, 𝑎 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡
𝑛 𝐴1 𝑛 + 𝐴0
𝑛2 𝐴2 𝑛2 + 𝐴1 𝑛 + 𝐴0
𝑛𝑡 𝐴𝑡 𝑛𝑡 + 𝐴𝑡−1 𝑛𝑡−1 + ⋯ + 𝐴1 𝑛 + 𝐴0
𝑟𝑛, 𝑟 ∈ ℝ 𝐴𝑟 𝑛
sin(𝑛𝜃) / cos(𝑛𝜃) 𝐴 cos(𝑛𝜃) + 𝐵 sin(𝑛𝜃)
𝑛𝑡 𝑟 𝑛 𝑟 (𝐴𝑡 𝑛 + 𝐴𝑡−1 𝑛𝑡−1 + ⋯ + 𝐴1 𝑛 + 𝐴0 )
𝑛 𝑡
Ex. 1: Find divide and conquer recurrence relation for binary search.
Solution: Let 𝑓(𝑛) denote the number of operations required to solve the problem of
size ′𝑛′. If we consider the binary search then we divide the list into two
𝑛
parts. Hence it becomes of size 2 for the next division i.e., the problem of
𝑛
size ′𝑛′ reduces now to the problem of size . Now 2 comparisons are
2
required to move further. Now we have the problem of size ′𝑛′ can be solved
𝑛
with 𝑓(𝑛) operations which is same as solving the problem of 2 size with
𝑛
𝑓 (2)operations and 2 comparisons.
Hence the ‘Divide and Conquer recurrence relation’ is given as
𝑛
𝑓(𝑛) = 𝑓 ( ) + 2
2
Where 𝑛 is even.
Ex. 2: Find divide and conquer recurrence relation for the problem to find maxima
and minima in a sequence.
Solution: Let 𝑓(𝑛) be the total number of operations required to find the maxima
and minima of the sequence with ′𝑛′ elements.
𝑛
We know that the problem of size 𝑛 can be reduced to two problems of size 2.
Hence, we to use two comparisons, one for maxima and one for minima.
𝑛 𝑛
Let 𝑓 ( 2) be the number of operations required to solve the problem of size 2 where
𝑛 is even.
Hence the ‘Divide and Conquer recurrence relation’ is given as
𝑛
𝑓(𝑛) = 2. 𝑓 ( ) + 2
2
Where 𝑛 is even.
7.9 Bibliography:
1. Discrete and Combinatorial Mathematics: An Applied Introduction by Ralph
Grimaldi, 5th Ed., Adison Wesley, 1999.
2. Discrete Mathematics and its Applications by Kenneth Rosen, 4th Ed.,
McGraw Hill, 1998.
3. Hand book of Discrete Mathematics and its Applications by Kenneth Rosen,
Editor in Chief, CRC Press, 2000.
4. Concrete Mathematics by Ronald L. Graham, 2nd Ed., Adison Wesley, 1994.
5. Elements of Discrete Mathematics by C. L. Liu, 2nd Ed., McGraw Hill, 1985.
6. Modelling with Differential and Difference Equations, Glenn Fulford, CUP,
1997.
7. An introduction to Difference Equations by Saber Elaydi, 3rd Ed., Springer,
2005.
8.10Unit End Exercises
Q. 1. Find the𝒂𝟓 term of following recurrence relations (Difference Equations)
1. 𝒂𝒏+𝟐 = 𝒂𝒏+𝟏 − 𝟐𝒂𝒏 with 𝒂𝟎 = 𝟏 and 𝒂𝟏 = 𝟏. (Ans: 𝒂𝟓 = 𝟏𝟕)
2. 𝒂𝒏+𝟐 = 𝒂𝒏+𝟏 + 𝟑𝒂𝒏 with 𝒂𝟎 = 𝟏 and 𝒂𝟏 = 𝟏. (Ans: 𝒂𝟓 = 𝟓𝟑)
3. 𝒂𝒏+𝟏 = 𝒂𝒏 + 𝒂𝒏−𝟏 with 𝒂𝟎 = 𝟏 and 𝒂𝟏 = 𝟏. (Ans: 𝒂𝟓 = 𝟏𝟕)
Unit Structure
8.0 Objectives
8.1 Introduction
8.2 Number of Possible solutions
8.3Time Changing Environment
8.4 Problem-specific Constraints
8.5 Multi-objective Problems
8.6 Modeling the Problem
8.7 Real-World Example
8.8 Bibliography
8.0 OBJECTIVES
After going through this unit, you will be able to:
• Describe complexity of business problem
• State the characteristics of any complex business problem statement
• Illustrate the number of possible solutions for a given problem
• Understand the concept of stable solution in time-changing environment
• Classify hard-constraints and soft-constraints
• Discuss the dominated and non-dominated solutions
• Model an MOP
• Illustrate the method for approaching and resolving a real-world problem
8.1 INTRODUCTION
The public sector in our contemporary network society faces complex societal challenges.
Attempts to deal with these challenges require the involvement and collaboration of various
parties: governments, businesses, knowledge institutions, societal groups and citizens.
The following examples of cases tracking Governance and Management in the Public
Sector have in commonality that they involve difficult issues. These require in-depth
knowledge of the nature of the issues and possible solutions.
1) Public infrastructural works: Complex decision-making processes which are
involved in realizing, operating and maintaining public infrastructural works.
One can think of railways, roads, airports, water projects, waste incinerators,
power plants, and wind turbine parks. Such infrastructural works can confront
governments with a wide variety of stakeholders (private firms, citizens groups,
other public stakeholders, environmental interest groups etc.). The realization of
public infrastructure requires integral planning in complex networks of
stakeholders, which may result in lengthy processes of negotiation and
consultation.
2) Seamless transportation:The demand for seamless transportation requires
integral planning of infrastructure investments and innovative ways of
coordinating the operation of transportation services.
4) Integrated health care: Organizing health care and social services for elderly
people requires close cooperation between various health care, welfare, social
and housing organizations.Moreover, providing tailor-made services in (health)
care requires interdisciplinary collaboration in teams of professions.
Furthermore, many stakeholders are involved in these complex issues. Therefore, it may be
difficult to deal with these challenges and a chaotic process may ensue, including
unexpected and unwanted outcomes. Moreover, whilst handling these issues conflicts could
occur, which cannot easily be resolved.
The complex nature of these challenges is caused by the lack of information or knowledge,
or due to technological difficulties. In addition, the presence of various stakeholders, with
diverging or even conflicting interests and perceptions, can result in a complex issue for
which it may be difficult to find a solution. In addition, another feature of such issues is that
they cut across the traditional jurisdiction of organizations. Moreover, it can be unclear
which government layer (local, regional, national), is responsible for these issues.
Furthermore, they can blur the traditional boundaries between public, private and societal
domains.
Governments, businesses and civil society are often unable to tackle these issues
themselves because they lack the resources or problem-solving capacities. In these cases,
traditional methods of dealing with problems, policymaking and public service delivery, no
longer suffice. Therefore, these complex challenges require a shift from a more traditional
top-down way of problem-solving to a more horizontal collaborative way of governing and
managing.
The statement “complex business problems are difficult to solve” is so apparent that it
doesn’t require any justification.
Most complex business problems share the following characteristics:
▪ The number of possible solutions is so huge that it almost rules out a complete
search for the best possible answer.
▪ The problem exists in time-changing environment. This means that decisions
made in the past, found however optimal, might be actually far from optimality in
present situations.
▪ The problem is severelyconstrained. The final solution for most of the problems
have to satisfy various conditions imposed by organizational policies. Quite
frequently finding even a single acceptable solution – the one satisfying all the
constrains – is quite difficult.
▪ There exist multiple objectives of conflicting interest.
Let us discuss all the above primary characteristics in turn.
However, this way of solving real-world problems demands due attention to details, in the
sense that here we are obtaining solution to the developed modelof the problem.
Depending on the accuracy with which the model had been worked out, solution may turn
out to be meaningful or vague or meaningless.
The process of constructing mathematical models, is called mathematical modeling. The
various stages involved in mathematical modeling are
1) Formulation: Having picked a real-world problem, it is expressed in equivalent
mathematical form.
2) Solution:The formulated problem is then solved using appropriate mathematical tools
and techniques.
3) Interpretation: The solution, thus obtained is interpreted in-terms of real-world
problem.
4) Validation:validation refers tothe extent to which the solution is applicable in context
of real-world situation.
One may recall, as to how these aspects of mathematical modeling, are carried out, has
been discussed while solving linear programming problems.
When we are solving a real-life problem, formulation can require a lot of time.
1) Formulation involves the following three steps:
(i) Stating the problem: Often the real-world problem is stated ambiguously.
To overcome this, we may need to redefine it many times.
(ii) Identifying the relevant factors: Deicide which quantities and relationships
are important for our problem and which are unimportant and can be
discarded.
(iii) Mathematical Description: Now, suppose we are clear about what the
problem is and what aspects of it are more relevant than the others. Then we
have to find a relationship between the aspects involved in the form of an
equation, a graph or any other suitable mathematical description. If it is an
equation, then every important aspect should be represented by a variable in
our mathematical equation.
2) Finding the solution: Just formulating the problem mathematically does not yield
the solution. The mathematical equivalent of the problem is to be solved using
various techniques from different branches of mathematics.
3) Interpreting the solution: The solution is value of some mathematical expression
or values of the decision variables in the model. We have to interpret these values
in context to real-world problem and understand the significance of these values.
4) Validating the solution:After getting the solution and interpreting it, weneed to
check whether the solution as it is, can be implemented practically. If so, then the
mathematical model is acceptable. If the solution is not feasible, we go back and
reformulatethe model.
Formulation Interpreting
Finding the Validating the
of the the
Solution Solution
specified Solution
problem
Once a real-life problem is solved thus, then scaled-up models can be constructed. These
scaled-up models may provide either exact solutions or approximate.
Limitations of Modeling:
Sometimes such mathematical modeling turns out to be of very limited usefulness. Many a
times we have to be satisfied even with approximate solutions. For example, while
modelling the weather phenomena, the differential equations involved are so complex to
solve that we may use numerical methods to find an approximate solution and accept it.
We may ask to what extent can the model be improved. Often, to improve it, we may have
to consider more factors which may not be apparent initially. While doing this, we
introduce more variables in mathematical formulation. All this may result in a very
complicated model which may be quite difficult to use and solve.
Theoretically as well as practically, it is desirable that a model of the real-world problem
must be simple to use and solve. A good model must have following two characteristics:
(1) Ease of use (2) Accuracy, how closely it matches with real problem.
So is mathematical modeling a universal solution to all our problems? The answer is
emphatic NO. Let’s see the reason for it. Often, the objective function (profit function,
cost function, production function etc.) in many models turn out to be discontinuous and
the discontinuities pose severe difficulties for usual techniques to find optimal solutions.
Thus, the solutions we often get by applying traditional techniques (based on concept of
gradient) on these functions turn out to be of poor quality. Even though in some cases, we
may get exact solution which is practically very difficult to implement. Thus, even
though our model might be perfect, it becomes useless to take decisions. In such cases, the
further course of action taken is to try to simplify the model in order that traditional
optimization methods can be used to produce superior solutions or leaving the model
unchanged and applying non-traditional approach to obtain near optimum solution. Simply
put, the first course of action essentially used approximate model of a real-world problem
and thereafter find the precise solution, whereas second course of action carries out with
precise model of real-world problem and obtains approximate solution.
Even though first course of action appears to be best, but it is not so! Essentially this
precise solution is in context of simplified model and not of the actual real-world problem!
Second course of action is superior. To understand why it is so, we need to look at it from
this point of view. The approximate model of first approach ends up hiding the inherent
irregularities of a real-world problem. Thereby making provision for traditional methods
to give us precise solutions, which is not at all optimal as much information is lost by
hiding the said irregularities. However, the second approach of developing precise model
subjected to non-traditional methods for solving the problem is quite faithful to reality
even though it yields an approximate solution which can very well serve the purpose of
optimal solutions from all practical considerations.
8.8 BIBLIOGRAPHY
• Adaptive Business Intelligence,F 1stEdition by Zbigniew Michalewicz, Martin
Schmidt,Matthew Michalewicz, ConstantinChiriac, Springer Publication
UNIT 7: Chapter 9
MULTIPLE ATTRIBUTE DECISION MAKING AND MULTIPLE
CRITERIA DECISION MAKING
Unit Structure
9.0 Objective
9.1 Introduction
9.2 Difference between MADM and MCDM
9.3 Multiple Attribute Decision Making(MADM)
9.3.1 Analytic Hierarchy Process (AHP)
9.3.2Weighted Sum Model (WSM)
9.3.3Simple Additive Weighing(SAW)
9.0 OBJECTIVES
9.1 INTRODUCTION
In the decision making problem there are attribute and criteria. The decision is to be
taken when there are many attribute or many criteria. There are quantitative and qualitative
problems. Considering all these factors the decision is to be taken.
There are two types of decision making problems viz Multiple Attribute Decision
Making and Multiple Criteria Decision Making. Some methods to solve these these problems
are studied in this unit.
9.2DIFFERENCE BETWEEN MADMAND MCDM
In this type of problems, there are multipleattributes. We want to take decision. There are
many methods of decision making in this case. These methods are discussed below.
Phases in AHP:
1. Decompose a problem into hierarchy.
• Find criteria
2. Collect I/p data by pair-wise comparisons of criteria at each level of the
hierarchy/alternatives.
3. Estimate relative importance (weights) of criteria & alternatives & check consistency
in pair-wise comparisons.
4. Aggregate the relative weights of criteria & alternatives to obtain a global ranking of
each alternative with regards to the goal.
Example 7.1:The board of directors have to choose a leader for a company whose founder is
about to retire. There are three competing candidates Mr. Adwik, Mr. Vedant, Miss.Smahi
and four competing criteria, Experience, Education, Charisma, and Age. Use AHP to choose
the most suitable candidate.
The comparison matrix forpair wise criteria is given below.
Divide every element by column sum and then take row average.
Experience Mr. Adwik Mr. Vedant Miss. Smahi Row average weight
or eigen value
Mr. Adwik 0.19 0.184 0.286 0.22
Mr. Vedant 0.762 0.735 0.643 0.713
Miss. Smahi 0.048 0.082 0.071 0.067
Similarly the row average weights for education, cherishma and age are
Education Mr. Adwik Mr. Vedant Miss. Smahi Row average weight
or eigen value
Mr. Adwik 1.158 0.273 0.149 0.193
Mr. Vedant 0.053 0.091 0.106 0.083
Miss. Smahi 0.79 0.636 0.745 0.724
Cherisma Mr. Adwik Mr. Vedant Miss. Smahi Row average weight
or eigen value
Mr. Adwik 0.763 0.8 0.643 0.735
Mr. Vedant 0.153 0.16 0.286 0.2
Miss. Smahi 0.085 0.04 0.071 0.065
Age Mr. Adwik Mr. Vedant Miss. Smahi Row average weight
or eigen value
Mr. Adwik 0.238 0.231 0.333 0.267
Mr. Vedant 0.714 0.693 0.6 0.669
Miss. Smahi 0.048 0.077 0.067 0.064
Example 7.2:Suppose that an MCDM problem involves four criteria, which are expressed in
the same unit, and three alternatives. The relative weights of the four criteria were determined
to be: w1=0.20, w2=0.15, w3=0.40 and w4=0.25. The corresponding aij values are assumed to
be as follows:
25 20 15 30
A 10 30 20 30
30 10 25 10
Find the best alternative using the weighted sum method (WSM).
Given
Weights 0.20 0.15 0.40 0.25
C1 C2 C3 C4
A1 25 20 15 30
A2 10 30 20 30
A3 30 10 25 10
According to WSM the best alternative (in maximization case) is indicated by the following
relationship:
N
A*WSM= max qij w j for j=1,2,3, ---, N
i
j =1
Example 7.3: Use SAW method to suggest the best alternatives? Where C1, C2, C3, C5, C6are
beneficiary criteria and C4 isnon beneficiary criteria.
wj
a
m
A
P k = kj ,for k,L=1,2,3,….m
ai
AL j =1 j
• If the ratio P(Ak/AL) is greater than or equal to value 1, then it indicates alternative Ak is
more desirable than alternative AL .
• WPM is often times called “dimensionless analysis” because its mathematical structure
eliminates any units of measure.
Example 7.4:Suppose that an MCDM problem involves four criteria, which are expressed in the
same unit, and three alternatives. The relative weights of the four criteria were determined
to be: w1=0.20, w2=0.15, w3=0.40 and w4=0.25. The corresponding aij values are assumed
to be as follows:
25 20 15 30
A 10 30 20 30
30 10 30 10
Find the best alternative using the weighted sum method (WPM).
A 25
0.20 0.15 0.40 0.25
20 15 30
P 1 = = 1.007 >1
A 2 10 30 20 30
Similarly;
A 25
0.20 0.15 0.40 0.25
20 15 30
P 1 = = 1.067 >1
A 3 30 10 30 10
A 10
0.20 0.15 0.40 0.25
30 20 30
P 2 = = 1.059>1
A 3 30 10 30 10
The ranking of these alternatives follow: A1>A2>A3.
Therefore, A1 is best alternative.
OR
P(A1)=20.63, P(A2)=20.48, P(A3)=19.33.
Therefore A1 is the best alternative as value is more than any other option.
C1 C2 C3 C4
A1 25 20 15 30
A2 10 30 20 30
A3 30 10 30 10
x
i =1
ij
x11 x11 25
R 11 = = = = 0.277
3
x11 + x12 + x13 + x14 25 + 20 + 15 + 30
x
i =1
1j
x12 x12 20
R 12 = = = = 0.222
3
x11 + x12 + x13 + x14 25 + 20 + 15 + 30
x
i =1
1j
x13 x13 15
R 13 = = = = 0.167
3
x11 + x12 + x13 + x14 25 + 20 + 15 + 30
x
i =1
1j
x14 x14 30
R 14 = = = = 0.333
3
x11 + x12 + x13 + x14 25 + 20 + 15 + 30
x
i =1
1j
x 21 x 21 10
R 21 = = = = 0.111
3
x 21 + x 22 + x 23 + x 24 10 + 30 + 20 + 30
x
i =1
2j
x 22 x 22 30
R 22 = = = = 0.333
3
x 21 + x 22 + x 23 + x 24 10 + 30 + 20 + 30
x
i =1
2j
x 23 x 23 20
R 23 = = = = 0.222
3
x 21 + x 22 + x 23 + x 24 10 + 30 + 20 + 30
x
i =1
2j
x 24 x 24 30
R 24 = = = = 0.333
3
x 21 + x 22 + x 23 + x 24 10 + 30 + 20 + 30
x
i =1
2j
x 31 x 31 30
R 31 = = = = 0.375
3
x 31 + x 32 + x 33 + x 34 30 + 10 + 30 + 10
x
i =1
3j
x 32 x 32 10
R 32 = = = = 0.125
3
x 31 + x 32 + x 33 + x 34 30 + 10 + 30 + 10
x
i =1
3j
x 33 x 33 30
R 33 = = = = 0.375
3
x 31 + x 32 + x 33 + x 34 30 + 10 + 30 + 10
x
i =1
3j
x 34 x 34 10
R 34 = = = = 0.125
3
x 31 + x 32 + x 33 + x 34 30 + 10 + 30 + 10
x
i =1
3j
C1 C2 C3 C4
A1 0.277 0.222 0.167 0.333
A2 0.111 0.333 0.222 0.333
A2 0.375 0.125 0.375 0.125
STEP 2: The amount of decision information associated with each attribute can be measured
by entropy value ejisas follows:-
e j = −k Rij ln (Rij )
N
i =1
1
Where k = is a constant that guarantees 0 e j 1
ln( N )
1
Here k = = 0.91
ln( 3)
3
e1 = −0.91 Ri1 ln (Ri1 )
i =1
STEP 1: Identify Best and Worst value from the above constraints and determine objective
and identify evaluation attributes.
Find Ei = w j mij
j
Ei − E min Ri − R min
Pi =
E max − E min + (1 − ) R max − R min
1) Find the best alternative using Simple Additive Weighing (SAW) method.
Alternatives Attributes
C1 C2 C3 C4 C5 C6
A1 2.0 1500 20000 5.5 avg very high
A2 2.5 2700 18000 6.5 low avg
A3 1.8 2000 21000 4.5 high high
A4 2.2 1800 20000 5.0 avg avg
Given attribute C4 is non beneficiary and all other attributes are beneficiary.
2) Use SAW method to suggest the best alternatives? Where C1 and C3 are beneficiary
criteria and C2 and C4 are non beneficiary criteria.
Weights 0.2 0.3 0.4 0.1
C1 C2 C3 C4
A1 20 30 20 12
A2 10 30 25 30
A3 30 5 15 10
A4 20 10 20 10
3) Use WPM and WSM methods to solve the following decision matrix.
C1 C2 C3 C4
Alts. 0.20 0.15 0.40 0.25
A1 25 20 15 30
A2 10 30 20 30
A3 30 10 25 10