Read · 1 min

Learning recurrence relations- Part 1\color{Blue}{\textbf{Learning recurrence relations- Part 1}}

Recurrence relation is about reducing a problem to smaller problem, by finding the dependence of the nthn^{th} term (generally denoted as ana_n ,the answer for a specific value nn given in a question) on previous terms. This gives as a recursive formula for a thing we're looking for.

Question\textbf{Question}- Find the number of ways in which a man can climb a staircase of 1010 steps, if he climbs only 11 or 22 steps at once.

Solution\textbf{Solution}- Let ana_n be the number of ways in which nn step-staircase can be climbed. Then, we see that the man can come to the nthn^{th} step by either taking one step from (n−1)th(n-1)^{th} step, or by taking 2 steps from (n−2)th(n-2)^{th} step.

And number of ways of climbing the (n−1)(n-1) and (n−2)(n-2) steps is actually an−1a_{n-1} and an−2a_{n-2}.

Thus we conclude an=an−1+an−2a_n=a_{n-1}+a_{n-2}

It's easy to see that 1 step can be climbed in 11 way, and 2-step can be climbed in 22 ways (1+1 or directly 2) , giving a1=1,a2=2a_1=1, a_2=2.

Thus the number of ways of climbing 3-step will be a3=a1+a2=3a_3=a_1+a_2=3 for 4-step will be a4=a3+a2=5a_4=a_3+a_2=5 and so on... Thus the sequence will be 1,2,3,5,8,13,21,34,55,89,...1,2,3,5,8,13,21,34,55,89,... And here speciically, the 10th10^{th} term is 8989, so our asked answer will be a10=89a_{10}=\boxed{89}

Thus, generalising a problem makes it easy at times !

Look for the coming parts of this, I'll be posting notes about Recurrence relations...

Interactive · 1 question

Problem 1: If there are nn steps to reach success and each time you may climb up 1 or 2 steps, how many different ways are there for you to reach success?

Let f(n)f(n) denote the number of ways for nn steps. Note that f(n)=f(n−1)+f(n−2)f(n) = f(n-1) + f(n-2) and f(0)=1,f(1)=1.f(0) = 1, f(1) = 1. Working our way up, we can determine f(n)f(n) for all positive integers n.n.

Problem 2: A pair of rabbits starts to breed after they are 2 months old and produces another pair each month. Suppose a pair of newly born rabbits is placed on a desolate island. How many pairs of rabbits will be there after nn months, assuming no rabbits ever die?

Let's make a table!

Month & Existing pairs & Newborn pairs & Total pairs

  • 1 & 1 & 0 & 1
  • 2 & 1 & 0 & 1
  • 3 & 1 & 1 & 2
  • 4 & 2 & 1 & 3
  • 5 & 3 & 2 & 5
  • 6 & 5 & 3 & 8

Starting from the 3rd month, the total pairs is the number of pairs in the last month f(n−1)f(n-1) plus the newborn pairs f(n−2),f(n-2), since every pair two months ago gives birth to a newborn pair.

Therefore we again have f(1)=1,f(2)=1,f(1) =1, f(2) = 1, and f(n)=f(n−1)+f(n−2).f(n)=f(n-1)+f(n-2).

Both of the above problems were examples of the Fibonacci Sequence F,F, which is defined as F1=F2=1,F_1=F_2=1, and Fn=Fn−1+Fn−2.F_n=F_{n-1}+F_{n-2}.

For example, F3=F2+F1=2,F_3=F_2+F_1=2, F4=F3+F2=3F_4=F_3+F_2=3 F5=5,F_5=5, and so on.

What is the value of F8?F_8?

Type a concept, like “slope” or “photosynthesis”.

↑ ↓ to choose · Enter to openSearch explanations and problems