SlideShare a Scribd company logo
MODELING WITH 
RECURRENCE RELATIONS
CONTENTS 
 COUNTING TECHNIQUES 
 MOTIVATION 
 RECURSIVE DEFINITIONS 
 RECURRENCE RELATIONS 
 MODELING WITH RECURRENCE RELATIONS 
(PROBLEMS AND SOLUTIONS)
– Product rule 
– Sum rule 
– The Inclusion-Exclusion Principle 
– The Pigeonhole Principle 
– Permutations 
– Combinations 
A1A2  A1  A2  A1A2 
Counting technique 
Number of ways = n1n2 ··· nm 
Number of ways = n1 + n2 +…+ nm 
If N objects are placed into k boxes, 
then there is at least N one k 
box 
containing at least objects. 
       
! 
  
, 1 2 1 
! 
n 
P n r n n n n r 
n r 
      
 
  
! 
n n 
    
  
, 
! ! 
C n r 
  
r r n r 
  
MOTIVATION 
The number of bacteria in a colony doubles every hour. If the colony 
begins with 5 bacteria, how many will be present in n hours? 
Solution: 
Let an : the number of bacteria at the end of n hours 
Then; 
an = 2an-1, a0=5 
Since bacteria double every hour Initial condition 
What we are doing actually? 
By using 
recursive 
definition 
We find a formula/model for an (the relationship between an and a0) 
– this is called recurrence relations between the term of sequence.
RECURSIVE DEFINITIONS 
 Recursion – a process to define an object explicitly 
 The object can be a sequence, function or set (for BCT2078 purposes) 
 The ideas – construct new elements from known elements. 
 Process – specify some initial elements in a basis step and provide a rule for constructing new 
elements from those we already have in the recursive step. 
 Mathematical Induction can be used to prove the result. 
The given 
complex 
problem 
This 
simple 
version 
can be 
solved 
This simple 
version 
can be 
solved 
Can be 
solved if 
Can be 
solved if 
Can be 
solved if 
an = 2an-1 an-1 = 2an-2, a1 = 2a0, a0=5
RECURRENCE RELATION 
A recurrence relation for the sequence {an} is an equation that expresses an in terms of one or 
more of the previous terms of the sequence, namely, a0, a1,…, an-1, for all integers n with n ≥ n0, 
where n0 is a nonnegative integer. 
A sequence is call solution of a recurrence relation if its term satisfy the recurrence relation. 
an = 2an-1 
Recurrence relation 
a0 = 5 Initial condition 
Recursive 
definition 
 A recursive algorithm provides the solution of a problem of size n in term of the solutions of one 
or more instances of the same problem in smaller size. 
 The initial condition specify the terms that precede the first term where the recurrence relation 
takes effect.
Modeling with Recurrence Relation 
 We can use recurrence relation to model a wide variety of problems 
such as 
 Finding a compound interest 
 Counting a population of rabbits 
 Determining the number of moves in the Tower of Hanoi puzzle 
 Counting bit strings
RABBITS 
A young pair of rabbits, one of each sex, is placed on an 
island. 
A pair of rabbits does not breed until they are 2 months old. 
After they are 2 months old, each pair of rabbits produces 
another pair each month. 
Assume that none of the rabbits die. 
How many rabbits are there after n months?
RABBITS 
 Let 풇풏 denote the number of pairs of rabbits after n 
months. 
 풇ퟏ = 1 { reproducing pairs = 0, young pairs = 1 } 
 풇ퟐ = 1 { reproducing pairs = 0, young pairs = 1 } 
 풇ퟑ = 2 { reproducing pairs = 1, young pairs = 1 } 
 풇ퟒ = 3 { reproducing pairs = 1, young pairs = 2 } 
 풇ퟓ = 5 { reproducing pairs = 2, young pairs = 3 } 
 풇ퟔ= 8 { reproducing pairs = 3, young pairs = 5 }
RABBITS 
The rabbit population can be modeled by a recurrence relation. 
At the end of the first month, the number of rabbits on the island is 풇ퟏ = 1. 
At the end of the second month, the number of rabbits on the island is 풇ퟐ = 1. 
The number of pairs of rabbits after n months 풇풏 is equal to the number of 
pairs of rabbits from the previous month 풇풏−ퟏ plus the number of pairs of 
newborn rabbits, which equals 풇풏−ퟐ, since each newborn pair comes from a 
pair that is at least two months old, so 
풇풏 = 풇풏−ퟏ + 풇풏−ퟐ for n >= 3.
SOLVING RABBITS PROBLEM 
The recurrence system 
Initial conditions: 풇ퟏ = 1, 풇ퟐ = 1 
Recurrence relation: 풇풏 = 풇풏−ퟏ + 풇풏−ퟐ for n >= 3. (Linear Homogeneous RR 
with const coeff.) 
For small values of n, we get 
(풇ퟏ,, 풇ퟐ , 풇ퟑ,...) = (1,1,2,3,5,8,13,...) 
Characteristic equation : 풓ퟐ- 풓 -1 =0 
Characteristic roots: 풓ퟏ= (1+√5)/2 and 풓ퟐ = (1- √5)/2
SOLVING RABBITS PROBLEM 
Therefore, 풇풏 = 푨ퟏ∗((1+√5)/2) 
풏 
+ 푨ퟐ∗((1−√5)/2) 
풏 
, 푨ퟏ and 푨ퟐ are 
constants 
푨ퟏ = √5/5 ; 푨ퟐ = −√5/5 
풏 
+ 푨ퟐ∗((1−√5)/2) 
풇풏 = 푨ퟏ∗((1+√5)/2) 
풏 
= 
ퟏ 
√ퟓ 
∗(1+√5)/2) 
풏 
- 
ퟏ 
√ퟓ 
∗(1−√5)/2) 
풏
TOWER OF HANOI 
Initially, n discs are placed on the first peg. Move the n discs one at a time 
from one peg to another such that no larger disc is ever placed on a 
smaller disc. 
Goal: Move the discs from peg 1 to peg 2.
TOWER OF HANOI 
Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi 
problem with n discs. 
1) Move the top n-1 discs from peg 1 to peg 3 using Hn-1 moves.
TOWER OF HANOI 
Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi 
problem with n discs. 
1) Move the top n-1 discs from peg 1 to peg 3 using Hn-1 moves. 
2) Move the largest disc from peg 1 to peg 2.
TOWER OF HANOI 
Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi problem with n 
discs. 
1) Move the top n-1 discs from peg 1 to peg 3 using Hn-1 moves. 
2) Move the largest disc from peg 1 to peg 2. 
3) Move the n-1 discs from peg 3 to peg 2 using Hn-1 moves.
TOWER OF HANOI 
Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi problem with n 
discs. 
1) Move the top n-1 discs from peg 1 to peg 3 using 퐻푛−1 moves. 
2) Move the largest disc from peg 1 to peg 2. 
3) Move the n-1 discs from peg 3 to peg 2 using 퐻푛−1 moves.
TOWER OF HANOI 
Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi 
problem with n discs. Thus the no of moves is given by 
Where: 
1 1 2 1 ; 1 n n H H H     
Hn-1 moves 
Moves the largest 
disk to peg 2 
transfer the top of 
n-1 disks to peg 2 
transfer the top of 
n-1 disks to peg 3 
+ + 
Hn-1 moves 1 move
SOLVING TOWER OF HANOI PROBLEM 
Initial condition: 퐻1 = 1 
Recurrence relation: 퐻푛 = 2퐻푛−1+1 for n >= 2. 
For small values of n, we get 
(퐻1퐻2퐻3퐻4,...) = (1,3,7,15,...) 
Therefore, we can guess that 퐻푛 = ퟐ풏 - 1
SOLVING TOWER OF HANOI PROBLEM 
How can we prove that 푯풏 = ퟐ풏-1 holds for all n>=1? 
By induction. 
Base Step: 푯ퟏ = 1 = ퟐퟏ − ퟏ, so our claim holds for n=1. 
Inductive Step: Suppose that 퐻푛 = ퟐ풏 - 1 holds for some n>=1. 
It follows that 
푯풏+ퟏ = 2퐻푛 + 1 = 2(ퟐ풏- 1 ) + 1 = ퟐ풏+ퟏ-2+1= ퟐ풏+ퟏ-1 
Therefore, the claim follows by induction on n.
CODEWORD ENUMERATION 
A computer system considers a string of decimal digits a valid 
codeword if it contains an even number of 0 digits. 
For instance, 1230407869 is valid, whereas 120987045608 is not valid. 
Let 풂풏 be the number of valid n-digit codewords.
CODEWORD ENUMERATION 
Note that 풂ퟏ = 9 
A recurrence relation can be derived for this sequence by 
considering how a valid n-digit string can be obtained from 
strings of n-1 digits. 
Two ways to form a valid string with n digits from a string with 
one fewer digit.
CODEWORD ENUMERATION 
First, a valid string of n digits can be obtained by appending a valid 
string of n − 1 digits with a digit other than 0. This appending can be 
done in nine ways. Hence, a valid string 
with n digits can be formed in this manner in 9푎푛−1 ways
CODEWORD ENUMERATION 
Second, a valid string of n digits can be obtained by appending a 0 to a string of 
length n − 1 that is not valid. The number of ways that this can be done equals 
the number of invalid (n − 1)-digit strings. Because there are ퟏퟎ풏−ퟏ strings of length 
n − 1, and 풂풏−ퟏ are valid, there are ퟏퟎ풏−ퟏ − 풂풏−ퟏ valid n-digit strings obtained by 
appending an invalid string of length n − 1 with a 0. 
Since all valid strings of length n are produced in one of these two ways, it follows 
that there are 
풂풏 = 9풂풏−ퟏ + (ퟏퟎ풏−ퟏ − 풂풏−ퟏ) 
= 8풂풏−ퟏ + ퟏퟎ풏−ퟏ 
valid strings of length n.
SOLVING CODEWORD ENUMERATION 
Initial condition: 푎1 = 1 
Recurrence relation: 푎푛 = 8푎푛−1 + 10푛−1 for n >= 2. (Non-homogeneous RR 
with const coeff.) 
=> 푎- 8푎푛−1 
푛 푛−1 = 10We need to solve 풂풂(풉) 풏 = 풏 
+ 풂(풑) 
풏 
Characteristic equation: r - 8 = 0 
Characteristic root: 푟1 = 8 
β = 10
SOLVING CODEWORD ENUMERATION 
(풉) = 푨ퟏ∗ ퟖ풏 , where 푨ퟏ is constant 
Therefore, 풂풏 
(풑) = 풓ퟎ ∗(푷ퟏ ∗ ퟏퟎ풏−ퟏ) , where 푷ퟏ is a constant 
And, 풂풏 
=> 푷(ퟏퟎ풏−ퟏ − ퟖ ∗ ퟏퟎ풏−ퟐ풏−ퟏ ퟏ) = ퟏퟎ, since 푎푛 - 8푎= 10푛−1 
푛−1 => 푷ퟏ = 5 
=> 풂(풑) 풏 
= 5∗ ퟏퟎ풏−ퟏ 
(풉) + 풂풏 
Therefore, 풂풏 = 풂풏 
(풑) = (푨ퟏ∗ ퟖ풏) + (5 ∗ ퟏퟎ풏−ퟏ) 
 => 푨ퟏ = ½ (풂ퟏ = 9)
SOLVING CODEWORD ENUMERATION 
Therefore, 
(풉) + 풂풏 
풂풏 = 풂풏 
(풑) 
= (푨ퟏ∗ ퟖ풏) + (5 ∗ ퟏퟎ풏−ퟏ) 
= (1/2 ∗ ퟖ풏) + (5 ∗ ퟏퟎ풏−ퟏ) 
= 
ퟏ 
ퟐ 
(ퟖ풏 + ퟏퟎ풏)
THAT’S ALL : THANK YOU

More Related Content

What's hot

9. chapter 8 np hard and np complete problems
9. chapter 8   np hard and np complete problems9. chapter 8   np hard and np complete problems
9. chapter 8 np hard and np complete problems
Jyotsna Suryadevara
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
Mohammad Ilyas Malik
 
Knapsack Problem
Knapsack ProblemKnapsack Problem
Knapsack Problem
Jenny Galino
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
sandeep54552
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
Sujata Pardeshi
 
Introduction to design and analysis of algorithm
Introduction to design and analysis of algorithmIntroduction to design and analysis of algorithm
Introduction to design and analysis of algorithm
DevaKumari Vijay
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithm
Mohd Arif
 
Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem
sumit gyawali
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
Ashikapokiya12345
 
Matrix chain multiplication
Matrix chain multiplicationMatrix chain multiplication
Matrix chain multiplication
Kiran K
 
Discrete mathematic
Discrete mathematicDiscrete mathematic
Discrete mathematic
Naralaswapna
 
Greedy algorithm
Greedy algorithmGreedy algorithm
N queens using backtracking
N queens using backtrackingN queens using backtracking
N queens using backtracking
srilekhagourishetty
 
Intro automata theory
Intro automata theory Intro automata theory
Intro automata theory
Rajendran
 
Graph theory
Graph theoryGraph theory
Graph theory
AparnaKumari31
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
Mukesh Tekwani
 
recurrence relations
 recurrence relations recurrence relations
recurrence relations
Anurag Cheela
 
2. forward chaining and backward chaining
2. forward chaining and backward chaining2. forward chaining and backward chaining
2. forward chaining and backward chaining
monircse2
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
Dr Shashikant Athawale
 
I. Alpha-Beta Pruning in ai
I. Alpha-Beta Pruning in aiI. Alpha-Beta Pruning in ai
I. Alpha-Beta Pruning in ai
vikas dhakane
 

What's hot (20)

9. chapter 8 np hard and np complete problems
9. chapter 8   np hard and np complete problems9. chapter 8   np hard and np complete problems
9. chapter 8 np hard and np complete problems
 
Context free grammar
Context free grammar Context free grammar
Context free grammar
 
Knapsack Problem
Knapsack ProblemKnapsack Problem
Knapsack Problem
 
Greedy algorithms
Greedy algorithmsGreedy algorithms
Greedy algorithms
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
 
Introduction to design and analysis of algorithm
Introduction to design and analysis of algorithmIntroduction to design and analysis of algorithm
Introduction to design and analysis of algorithm
 
Dinive conquer algorithm
Dinive conquer algorithmDinive conquer algorithm
Dinive conquer algorithm
 
Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem Presentation of daa on approximation algorithm and vertex cover problem
Presentation of daa on approximation algorithm and vertex cover problem
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
 
Matrix chain multiplication
Matrix chain multiplicationMatrix chain multiplication
Matrix chain multiplication
 
Discrete mathematic
Discrete mathematicDiscrete mathematic
Discrete mathematic
 
Greedy algorithm
Greedy algorithmGreedy algorithm
Greedy algorithm
 
N queens using backtracking
N queens using backtrackingN queens using backtracking
N queens using backtracking
 
Intro automata theory
Intro automata theory Intro automata theory
Intro automata theory
 
Graph theory
Graph theoryGraph theory
Graph theory
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
recurrence relations
 recurrence relations recurrence relations
recurrence relations
 
2. forward chaining and backward chaining
2. forward chaining and backward chaining2. forward chaining and backward chaining
2. forward chaining and backward chaining
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
I. Alpha-Beta Pruning in ai
I. Alpha-Beta Pruning in aiI. Alpha-Beta Pruning in ai
I. Alpha-Beta Pruning in ai
 

Viewers also liked

Newton Raphson Method
Newton Raphson MethodNewton Raphson Method
Newton Raphson Method
Devanshu Taneja
 
SORTTING IN LINEAR TIME - Radix Sort
SORTTING IN LINEAR TIME - Radix SortSORTTING IN LINEAR TIME - Radix Sort
SORTTING IN LINEAR TIME - Radix Sort
Devanshu Taneja
 
Lecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrencesLecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrences
jayavignesh86
 
итоги выпуска 11 в 2014
итоги выпуска 11 в 2014итоги выпуска 11 в 2014
итоги выпуска 11 в 2014
violetta1971
 
Evidence based Advocacy-Do's and Donts from Ilm Ideas on Slide Share
Evidence based Advocacy-Do's and Donts from Ilm Ideas on Slide ShareEvidence based Advocacy-Do's and Donts from Ilm Ideas on Slide Share
Evidence based Advocacy-Do's and Donts from Ilm Ideas on Slide Share
ilmideas
 
Residence renovation @ Irinjalakuda
Residence renovation @ IrinjalakudaResidence renovation @ Irinjalakuda
Residence renovation @ Irinjalakuda
Joseph Joseph Chalissery
 
Dos papa sslideshare
Dos papa sslideshareDos papa sslideshare
Dos papa sslideshare
CREENCIALAICA GP
 
Effective Advocacy: Best Practices from Ilm Ideas on Slide Share
Effective Advocacy: Best Practices from Ilm Ideas on Slide ShareEffective Advocacy: Best Practices from Ilm Ideas on Slide Share
Effective Advocacy: Best Practices from Ilm Ideas on Slide Share
ilmideas
 
Kursintroduktion tia123
Kursintroduktion tia123Kursintroduktion tia123
Kursintroduktion tia123KristinaSWo
 
Easy metric
Easy metricEasy metric
Easy metric
ssealey
 
はなみの上山日記
はなみの上山日記はなみの上山日記
はなみの上山日記Koei Miyakita
 
Final draft
Final draftFinal draft
Final draft
Mohamed Khalifa
 
Regulations in IoT - Innovation Stifle or Urgent Need
Regulations in IoT - Innovation Stifle or Urgent NeedRegulations in IoT - Innovation Stifle or Urgent Need
Regulations in IoT - Innovation Stifle or Urgent Need
Rajesh Chitharanjan
 
Lewis & Taylor Custom Dress Shirt Overview
Lewis & Taylor Custom Dress Shirt OverviewLewis & Taylor Custom Dress Shirt Overview
Lewis & Taylor Custom Dress Shirt Overview
LewisTaylorShirts
 
Issues with SignWriting in Unicode 8
Issues with SignWriting in Unicode 8Issues with SignWriting in Unicode 8
Issues with SignWriting in Unicode 8
Stephen Slevinski
 
Earths interior
Earths interiorEarths interior
Earths interior
ssealey
 
Ethics, Do's & Don’ts, Rumors, Twitter
Ethics, Do's & Don’ts, Rumors, TwitterEthics, Do's & Don’ts, Rumors, Twitter
Ethics, Do's & Don’ts, Rumors, Twitter
maureenalley
 
1st Web Cross Channel Seminar - Fra teori til praksis
1st Web Cross Channel Seminar - Fra teori til praksis1st Web Cross Channel Seminar - Fra teori til praksis
1st Web Cross Channel Seminar - Fra teori til praksis
1st Web
 
Interior Design @ Shobha Topaz
Interior Design @ Shobha TopazInterior Design @ Shobha Topaz
Interior Design @ Shobha Topaz
Joseph Joseph Chalissery
 
How to Develop and Implement Effective Research Tools from Ilm Ideas on Slide...
How to Develop and Implement Effective Research Tools from Ilm Ideas on Slide...How to Develop and Implement Effective Research Tools from Ilm Ideas on Slide...
How to Develop and Implement Effective Research Tools from Ilm Ideas on Slide...
ilmideas
 

Viewers also liked (20)

Newton Raphson Method
Newton Raphson MethodNewton Raphson Method
Newton Raphson Method
 
SORTTING IN LINEAR TIME - Radix Sort
SORTTING IN LINEAR TIME - Radix SortSORTTING IN LINEAR TIME - Radix Sort
SORTTING IN LINEAR TIME - Radix Sort
 
Lecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrencesLecture 5 6_7 - divide and conquer and method of solving recurrences
Lecture 5 6_7 - divide and conquer and method of solving recurrences
 
итоги выпуска 11 в 2014
итоги выпуска 11 в 2014итоги выпуска 11 в 2014
итоги выпуска 11 в 2014
 
Evidence based Advocacy-Do's and Donts from Ilm Ideas on Slide Share
Evidence based Advocacy-Do's and Donts from Ilm Ideas on Slide ShareEvidence based Advocacy-Do's and Donts from Ilm Ideas on Slide Share
Evidence based Advocacy-Do's and Donts from Ilm Ideas on Slide Share
 
Residence renovation @ Irinjalakuda
Residence renovation @ IrinjalakudaResidence renovation @ Irinjalakuda
Residence renovation @ Irinjalakuda
 
Dos papa sslideshare
Dos papa sslideshareDos papa sslideshare
Dos papa sslideshare
 
Effective Advocacy: Best Practices from Ilm Ideas on Slide Share
Effective Advocacy: Best Practices from Ilm Ideas on Slide ShareEffective Advocacy: Best Practices from Ilm Ideas on Slide Share
Effective Advocacy: Best Practices from Ilm Ideas on Slide Share
 
Kursintroduktion tia123
Kursintroduktion tia123Kursintroduktion tia123
Kursintroduktion tia123
 
Easy metric
Easy metricEasy metric
Easy metric
 
はなみの上山日記
はなみの上山日記はなみの上山日記
はなみの上山日記
 
Final draft
Final draftFinal draft
Final draft
 
Regulations in IoT - Innovation Stifle or Urgent Need
Regulations in IoT - Innovation Stifle or Urgent NeedRegulations in IoT - Innovation Stifle or Urgent Need
Regulations in IoT - Innovation Stifle or Urgent Need
 
Lewis & Taylor Custom Dress Shirt Overview
Lewis & Taylor Custom Dress Shirt OverviewLewis & Taylor Custom Dress Shirt Overview
Lewis & Taylor Custom Dress Shirt Overview
 
Issues with SignWriting in Unicode 8
Issues with SignWriting in Unicode 8Issues with SignWriting in Unicode 8
Issues with SignWriting in Unicode 8
 
Earths interior
Earths interiorEarths interior
Earths interior
 
Ethics, Do's & Don’ts, Rumors, Twitter
Ethics, Do's & Don’ts, Rumors, TwitterEthics, Do's & Don’ts, Rumors, Twitter
Ethics, Do's & Don’ts, Rumors, Twitter
 
1st Web Cross Channel Seminar - Fra teori til praksis
1st Web Cross Channel Seminar - Fra teori til praksis1st Web Cross Channel Seminar - Fra teori til praksis
1st Web Cross Channel Seminar - Fra teori til praksis
 
Interior Design @ Shobha Topaz
Interior Design @ Shobha TopazInterior Design @ Shobha Topaz
Interior Design @ Shobha Topaz
 
How to Develop and Implement Effective Research Tools from Ilm Ideas on Slide...
How to Develop and Implement Effective Research Tools from Ilm Ideas on Slide...How to Develop and Implement Effective Research Tools from Ilm Ideas on Slide...
How to Develop and Implement Effective Research Tools from Ilm Ideas on Slide...
 

Similar to Modeling with Recurrence Relations

Ch-3 lecture.pdf
Ch-3 lecture.pdfCh-3 lecture.pdf
Ch-3 lecture.pdf
TamiratDejene1
 
sequence and series.docx
sequence and series.docxsequence and series.docx
sequence and series.docx
Getachew Mulaw
 
Applied Algorithms and Structures week999
Applied Algorithms and Structures week999Applied Algorithms and Structures week999
Applied Algorithms and Structures week999
fashiontrendzz20
 
10-Sequences and summation.pptx
10-Sequences and summation.pptx10-Sequences and summation.pptx
10-Sequences and summation.pptx
jaffarbikat
 
Binomial Theorem, Recursion ,Tower of Honai, relations
Binomial Theorem, Recursion ,Tower of Honai, relationsBinomial Theorem, Recursion ,Tower of Honai, relations
Binomial Theorem, Recursion ,Tower of Honai, relations
Aqeel Rafique
 
Analysis sequences and bounded sequences
Analysis sequences and bounded sequencesAnalysis sequences and bounded sequences
Analysis sequences and bounded sequences
SANDEEP VISHANG DAGAR
 
Recurrence_Theory.pptx studdents nees free
Recurrence_Theory.pptx studdents nees freeRecurrence_Theory.pptx studdents nees free
Recurrence_Theory.pptx studdents nees free
White44420
 
Factorials as sums
Factorials as sumsFactorials as sums
Factorials as sums
Roberto Anglani
 
1624 sequence
1624 sequence1624 sequence
1624 sequence
Dr Fereidoun Dejahang
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEM
Alpana Ingale
 
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
Aladdinew
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
Vikas Sharma
 
L16
L16L16
Infinite series-Calculus and Analytical Geometry
Infinite series-Calculus and Analytical GeometryInfinite series-Calculus and Analytical Geometry
Infinite series-Calculus and Analytical Geometry
Rabin BK
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms Ii
Sri Prasanna
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
RajKumar382958
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
RajKumar382958
 
Chap2
Chap2Chap2
Daa chapter 2
Daa chapter 2Daa chapter 2
Daa chapter 2
B.Kirron Reddi
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2
S.Shayan Daneshvar
 

Similar to Modeling with Recurrence Relations (20)

Ch-3 lecture.pdf
Ch-3 lecture.pdfCh-3 lecture.pdf
Ch-3 lecture.pdf
 
sequence and series.docx
sequence and series.docxsequence and series.docx
sequence and series.docx
 
Applied Algorithms and Structures week999
Applied Algorithms and Structures week999Applied Algorithms and Structures week999
Applied Algorithms and Structures week999
 
10-Sequences and summation.pptx
10-Sequences and summation.pptx10-Sequences and summation.pptx
10-Sequences and summation.pptx
 
Binomial Theorem, Recursion ,Tower of Honai, relations
Binomial Theorem, Recursion ,Tower of Honai, relationsBinomial Theorem, Recursion ,Tower of Honai, relations
Binomial Theorem, Recursion ,Tower of Honai, relations
 
Analysis sequences and bounded sequences
Analysis sequences and bounded sequencesAnalysis sequences and bounded sequences
Analysis sequences and bounded sequences
 
Recurrence_Theory.pptx studdents nees free
Recurrence_Theory.pptx studdents nees freeRecurrence_Theory.pptx studdents nees free
Recurrence_Theory.pptx studdents nees free
 
Factorials as sums
Factorials as sumsFactorials as sums
Factorials as sums
 
1624 sequence
1624 sequence1624 sequence
1624 sequence
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEM
 
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
Solutions Manual for An Introduction To Abstract Algebra With Notes To The Fu...
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
L16
L16L16
L16
 
Infinite series-Calculus and Analytical Geometry
Infinite series-Calculus and Analytical GeometryInfinite series-Calculus and Analytical Geometry
Infinite series-Calculus and Analytical Geometry
 
Analysis Of Algorithms Ii
Analysis Of Algorithms IiAnalysis Of Algorithms Ii
Analysis Of Algorithms Ii
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Chap2
Chap2Chap2
Chap2
 
Daa chapter 2
Daa chapter 2Daa chapter 2
Daa chapter 2
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2
 

Recently uploaded

132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
PuktoonEngr
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 

Recently uploaded (20)

132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 

Modeling with Recurrence Relations

  • 2. CONTENTS  COUNTING TECHNIQUES  MOTIVATION  RECURSIVE DEFINITIONS  RECURRENCE RELATIONS  MODELING WITH RECURRENCE RELATIONS (PROBLEMS AND SOLUTIONS)
  • 3. – Product rule – Sum rule – The Inclusion-Exclusion Principle – The Pigeonhole Principle – Permutations – Combinations A1A2  A1  A2  A1A2 Counting technique Number of ways = n1n2 ··· nm Number of ways = n1 + n2 +…+ nm If N objects are placed into k boxes, then there is at least N one k box containing at least objects.        !   , 1 2 1 ! n P n r n n n n r n r          ! n n       , ! ! C n r   r r n r   
  • 4. MOTIVATION The number of bacteria in a colony doubles every hour. If the colony begins with 5 bacteria, how many will be present in n hours? Solution: Let an : the number of bacteria at the end of n hours Then; an = 2an-1, a0=5 Since bacteria double every hour Initial condition What we are doing actually? By using recursive definition We find a formula/model for an (the relationship between an and a0) – this is called recurrence relations between the term of sequence.
  • 5. RECURSIVE DEFINITIONS  Recursion – a process to define an object explicitly  The object can be a sequence, function or set (for BCT2078 purposes)  The ideas – construct new elements from known elements.  Process – specify some initial elements in a basis step and provide a rule for constructing new elements from those we already have in the recursive step.  Mathematical Induction can be used to prove the result. The given complex problem This simple version can be solved This simple version can be solved Can be solved if Can be solved if Can be solved if an = 2an-1 an-1 = 2an-2, a1 = 2a0, a0=5
  • 6. RECURRENCE RELATION A recurrence relation for the sequence {an} is an equation that expresses an in terms of one or more of the previous terms of the sequence, namely, a0, a1,…, an-1, for all integers n with n ≥ n0, where n0 is a nonnegative integer. A sequence is call solution of a recurrence relation if its term satisfy the recurrence relation. an = 2an-1 Recurrence relation a0 = 5 Initial condition Recursive definition  A recursive algorithm provides the solution of a problem of size n in term of the solutions of one or more instances of the same problem in smaller size.  The initial condition specify the terms that precede the first term where the recurrence relation takes effect.
  • 7. Modeling with Recurrence Relation  We can use recurrence relation to model a wide variety of problems such as  Finding a compound interest  Counting a population of rabbits  Determining the number of moves in the Tower of Hanoi puzzle  Counting bit strings
  • 8. RABBITS A young pair of rabbits, one of each sex, is placed on an island. A pair of rabbits does not breed until they are 2 months old. After they are 2 months old, each pair of rabbits produces another pair each month. Assume that none of the rabbits die. How many rabbits are there after n months?
  • 9. RABBITS  Let 풇풏 denote the number of pairs of rabbits after n months.  풇ퟏ = 1 { reproducing pairs = 0, young pairs = 1 }  풇ퟐ = 1 { reproducing pairs = 0, young pairs = 1 }  풇ퟑ = 2 { reproducing pairs = 1, young pairs = 1 }  풇ퟒ = 3 { reproducing pairs = 1, young pairs = 2 }  풇ퟓ = 5 { reproducing pairs = 2, young pairs = 3 }  풇ퟔ= 8 { reproducing pairs = 3, young pairs = 5 }
  • 10. RABBITS The rabbit population can be modeled by a recurrence relation. At the end of the first month, the number of rabbits on the island is 풇ퟏ = 1. At the end of the second month, the number of rabbits on the island is 풇ퟐ = 1. The number of pairs of rabbits after n months 풇풏 is equal to the number of pairs of rabbits from the previous month 풇풏−ퟏ plus the number of pairs of newborn rabbits, which equals 풇풏−ퟐ, since each newborn pair comes from a pair that is at least two months old, so 풇풏 = 풇풏−ퟏ + 풇풏−ퟐ for n >= 3.
  • 11. SOLVING RABBITS PROBLEM The recurrence system Initial conditions: 풇ퟏ = 1, 풇ퟐ = 1 Recurrence relation: 풇풏 = 풇풏−ퟏ + 풇풏−ퟐ for n >= 3. (Linear Homogeneous RR with const coeff.) For small values of n, we get (풇ퟏ,, 풇ퟐ , 풇ퟑ,...) = (1,1,2,3,5,8,13,...) Characteristic equation : 풓ퟐ- 풓 -1 =0 Characteristic roots: 풓ퟏ= (1+√5)/2 and 풓ퟐ = (1- √5)/2
  • 12. SOLVING RABBITS PROBLEM Therefore, 풇풏 = 푨ퟏ∗((1+√5)/2) 풏 + 푨ퟐ∗((1−√5)/2) 풏 , 푨ퟏ and 푨ퟐ are constants 푨ퟏ = √5/5 ; 푨ퟐ = −√5/5 풏 + 푨ퟐ∗((1−√5)/2) 풇풏 = 푨ퟏ∗((1+√5)/2) 풏 = ퟏ √ퟓ ∗(1+√5)/2) 풏 - ퟏ √ퟓ ∗(1−√5)/2) 풏
  • 13. TOWER OF HANOI Initially, n discs are placed on the first peg. Move the n discs one at a time from one peg to another such that no larger disc is ever placed on a smaller disc. Goal: Move the discs from peg 1 to peg 2.
  • 14. TOWER OF HANOI Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi problem with n discs. 1) Move the top n-1 discs from peg 1 to peg 3 using Hn-1 moves.
  • 15. TOWER OF HANOI Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi problem with n discs. 1) Move the top n-1 discs from peg 1 to peg 3 using Hn-1 moves. 2) Move the largest disc from peg 1 to peg 2.
  • 16. TOWER OF HANOI Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi problem with n discs. 1) Move the top n-1 discs from peg 1 to peg 3 using Hn-1 moves. 2) Move the largest disc from peg 1 to peg 2. 3) Move the n-1 discs from peg 3 to peg 2 using Hn-1 moves.
  • 17. TOWER OF HANOI Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi problem with n discs. 1) Move the top n-1 discs from peg 1 to peg 3 using 퐻푛−1 moves. 2) Move the largest disc from peg 1 to peg 2. 3) Move the n-1 discs from peg 3 to peg 2 using 퐻푛−1 moves.
  • 18. TOWER OF HANOI Let 퐻푛 denote the number of moves needed to solve the tower of Hanoi problem with n discs. Thus the no of moves is given by Where: 1 1 2 1 ; 1 n n H H H     Hn-1 moves Moves the largest disk to peg 2 transfer the top of n-1 disks to peg 2 transfer the top of n-1 disks to peg 3 + + Hn-1 moves 1 move
  • 19. SOLVING TOWER OF HANOI PROBLEM Initial condition: 퐻1 = 1 Recurrence relation: 퐻푛 = 2퐻푛−1+1 for n >= 2. For small values of n, we get (퐻1퐻2퐻3퐻4,...) = (1,3,7,15,...) Therefore, we can guess that 퐻푛 = ퟐ풏 - 1
  • 20. SOLVING TOWER OF HANOI PROBLEM How can we prove that 푯풏 = ퟐ풏-1 holds for all n>=1? By induction. Base Step: 푯ퟏ = 1 = ퟐퟏ − ퟏ, so our claim holds for n=1. Inductive Step: Suppose that 퐻푛 = ퟐ풏 - 1 holds for some n>=1. It follows that 푯풏+ퟏ = 2퐻푛 + 1 = 2(ퟐ풏- 1 ) + 1 = ퟐ풏+ퟏ-2+1= ퟐ풏+ퟏ-1 Therefore, the claim follows by induction on n.
  • 21. CODEWORD ENUMERATION A computer system considers a string of decimal digits a valid codeword if it contains an even number of 0 digits. For instance, 1230407869 is valid, whereas 120987045608 is not valid. Let 풂풏 be the number of valid n-digit codewords.
  • 22. CODEWORD ENUMERATION Note that 풂ퟏ = 9 A recurrence relation can be derived for this sequence by considering how a valid n-digit string can be obtained from strings of n-1 digits. Two ways to form a valid string with n digits from a string with one fewer digit.
  • 23. CODEWORD ENUMERATION First, a valid string of n digits can be obtained by appending a valid string of n − 1 digits with a digit other than 0. This appending can be done in nine ways. Hence, a valid string with n digits can be formed in this manner in 9푎푛−1 ways
  • 24. CODEWORD ENUMERATION Second, a valid string of n digits can be obtained by appending a 0 to a string of length n − 1 that is not valid. The number of ways that this can be done equals the number of invalid (n − 1)-digit strings. Because there are ퟏퟎ풏−ퟏ strings of length n − 1, and 풂풏−ퟏ are valid, there are ퟏퟎ풏−ퟏ − 풂풏−ퟏ valid n-digit strings obtained by appending an invalid string of length n − 1 with a 0. Since all valid strings of length n are produced in one of these two ways, it follows that there are 풂풏 = 9풂풏−ퟏ + (ퟏퟎ풏−ퟏ − 풂풏−ퟏ) = 8풂풏−ퟏ + ퟏퟎ풏−ퟏ valid strings of length n.
  • 25. SOLVING CODEWORD ENUMERATION Initial condition: 푎1 = 1 Recurrence relation: 푎푛 = 8푎푛−1 + 10푛−1 for n >= 2. (Non-homogeneous RR with const coeff.) => 푎- 8푎푛−1 푛 푛−1 = 10We need to solve 풂풂(풉) 풏 = 풏 + 풂(풑) 풏 Characteristic equation: r - 8 = 0 Characteristic root: 푟1 = 8 β = 10
  • 26. SOLVING CODEWORD ENUMERATION (풉) = 푨ퟏ∗ ퟖ풏 , where 푨ퟏ is constant Therefore, 풂풏 (풑) = 풓ퟎ ∗(푷ퟏ ∗ ퟏퟎ풏−ퟏ) , where 푷ퟏ is a constant And, 풂풏 => 푷(ퟏퟎ풏−ퟏ − ퟖ ∗ ퟏퟎ풏−ퟐ풏−ퟏ ퟏ) = ퟏퟎ, since 푎푛 - 8푎= 10푛−1 푛−1 => 푷ퟏ = 5 => 풂(풑) 풏 = 5∗ ퟏퟎ풏−ퟏ (풉) + 풂풏 Therefore, 풂풏 = 풂풏 (풑) = (푨ퟏ∗ ퟖ풏) + (5 ∗ ퟏퟎ풏−ퟏ)  => 푨ퟏ = ½ (풂ퟏ = 9)
  • 27. SOLVING CODEWORD ENUMERATION Therefore, (풉) + 풂풏 풂풏 = 풂풏 (풑) = (푨ퟏ∗ ퟖ풏) + (5 ∗ ퟏퟎ풏−ퟏ) = (1/2 ∗ ퟖ풏) + (5 ∗ ퟏퟎ풏−ퟏ) = ퟏ ퟐ (ퟖ풏 + ퟏퟎ풏)
  • 28. THAT’S ALL : THANK YOU