**Recurrence Relation**: A recurrence relation is a formula or rule by which each term of a sequence can be determined using one or more of the earlier terms.

**Problem 1: **For each of the following sequences find a recurrence pattern.

a. $1,10,100,\dots $

b. $1,3,6,10,\dots $

c. $1,2,6,24,120,\dots $

d. $1,1,2,3,5,8,13,\dots$

e. $0,1,9,44, 265, \dots $

**Solution: **

a. $$a_n=10\cdot a_{n-1}$$

b. $$a_n=a_{n-1}+n$$

c. $$a_n=n\cdot a_{n-1}$$

d. This is the *Fibonacci sequence*. We have $$F_0=1,F_1=1, F_2=2,\dots F_n=F_{n-1}+F_{n-2}$$

e. This is the *derangement number*. We have $$ D_n= n \cdot D_{n-1}+(-1)^n.$$ We also have $$D_n=(n-1)(D_{n-1}+D_{n-2})$$

**The Stamp problem:**

Suppose we have $1,2,5$ stamps. The problem is to find the number of ways these can be arranged in a row so that they can add up to a given value $n.$**Solution:** Let $a_n$ be the number of ways the stamp can add up to $n.$

Then we have three cases considering the value of the last stamp. **Case 1:** If the last stamp is $1$. Then the total value of the remaining stamps must be $n-1.$ Therefore the number of ways in which these remaining stamps can be selected is $a_{n-1}.$

**Case 2:** If the last stamp is $2$. Then the total value of the remaining stamps must be $n-2.$ Therefore the number of ways in which these remaining stamps can be selected is $a_{n-2}.$

**Case 3:** If the last stamp is $5$. Then the total value of the remaining stamps must be $n-5.$ Therefore the number of ways in which these remaining stamps can be selected is $a_{n-5}.$

So $$ \boxed{a_n=a_{n-1}+a_{n-2}+a_{n-5}}$$

**Word with no two consecutive As :**

Find the number of $n$ letter of letter words using letters from the set $\{A,B\}$ in which no two consecutive $A$ can appear.**Solution:** Let $w_n=$ the number of $n$ letter word satisfying the given condition

$a_n=$ the number of $n$ letter word ending with $A$

$b_n=$ the number of $n$ letter word ending with $B$

So $w_n=a_n+b_n.$

But note that if the last letter of a word is $A$ then the second last letter of the word is $B.$ So $a_n=b_{n-1}.$

And $$b_n= b_{n-1}+a_{n-1}\implies b_n=w_{n-1}\implies a_n=w_{n-2}$$

So $$\boxed{ w_n= w_{n-1}+w_{n-2}}.$$

**Subsets with no two consecutive digits: **

Find the number of subsets of the set of digits $\{0,1,2,\dots, n\}$ such that the subset contains now two consecutive digits.**Solution: ** Let $X_n$ denote the subset with highest element $n.$

Here are some examples

$$X_0=1;\{0\}$$

$$X_1=1; \{1\}$$

$$X_2=2; \{2\}, \{0,2\}$$

$$X_3=3;\{3\}, \{0,3\}, \{1,3\}$$

$$X_4=5; \{4\}, \{0,4\}, \{1,4\},\{2,4\}, \{0,2,4\} $$

Note that $$\boxed{X_n= 1+ X_1+\dots+X_{n-2}}$$

where $1$ is for the single set $\{n\}$ and rest are because $n$ is added to the subset.

**Classical Stairs:**

There is a $n$ stair staircase, one can climb $1$ or $2$ stairs ($1$ or $2$ steps) at a time, in how many ways he can climb the entire staircase?

**Solution: **Let $a_n$ denote the number of ways he can climb the $n$ stairs. Then we get two cases considering the last step.**Case 1:** If the last step was $1$ stair then he was at $n-1$ staircase. There are $a_{n-1}$ ways to reach the $n-1$th staircase**Case 2:** If the last step was $2$ stair, then we previously at $n-2$ th staircase. There are $a_{n-2}$ ways to reach the $n-2$th staircase.

So $$\boxed{a_n=a_{n-1}+a_{n-2}}$$

**Tower of Hanoi: **

Given a stack of $n$ disks arranged from largest on the bottom to smallest on top placed on a rod, together with two empty rods, the tower of Hanoi puzzle asks for the minimum number of moves required to move the stack from one rod to another, where moves are allowed only if they place smaller disks on top of larger disks. **Solution: **The minimum number of moves is $\boxed{2^n-1}.$

**Proof:** Let the discs be $[1,2,3,\dots, n]$ with $[1]<[2]<\dots<[n].$ Denote $A_n$ as the number of moves requires to move discs $[1,2,3,\dots, n].$

Also let's name the rods as $A, B, C.$

**Claim:** We need at least require $2\cdot A_{n-1}+1$ moves.**Proof: **Now, consider the step when we keep disk $[n]$ from some rod $X$ to rod $C.$ This will require us $1$ move. Also during this move, the $[n-1]$ discs must be in rod other than $X$ and $C.$ ( arranging the $[n-1]$ discs would have taken us at least $A_{n-1}$) And then to bring the $n-1$ disks back to rod $C$ would have taken us at least another $A_{n-1}$ moves.

So we know that the required move is $\ge 2\cdot A_{n-1}+1.$**Claim:** $2\cdot A_{n-1}+1$ works**Proof:** We shift the $[1,2,\dots , n-1]$ disc from $A$ to $B$ which will be done in $A_{n-1}$ moves, shift $[n]$ from $A$ to $C$ in one move and then shift $[1,2,\dots , n-1]$ disc from $B$ to $C$ in $A_{n-1}$ moves.

So $$ A_n= 2\cdot A_{n-1}+1.$$

Another way of proving the bound was just strong induction.

We have $A_1= 1, A_2=3, A_3=7, \dots$ and by induction we get $\boxed{A_n=2^n-1}.$

Okay, now we should know how to "solve" linear recurrence relations..

**Open and closed Brackets: **

How many ways are there to arrange $n$ open brackets ”[” and $n$ closed brackets ”]” such that when read left to right, the number of closed brackets is less than or equal to the number of open brackets?**Solution:** The answer is the Catalan number.

Let $C_n$ denote the number of ways.

Let us consider the sequence of closed and open brackets as $a_1,a_2,\dots a_{2n}$ where $a_i $ is either $[, ]$

Let $f(j)$ denote the number of [ which are there in the sequence from $a_1,\dots ,a_i$ and $g(j)$ denote the number of ] which are there in the sequence from $a_1,\dots ,a_i.$

Now we consider cases. At first, we have $f(1)>g(1)$ but at the end of the sequence, we have $f(2n)=g(2n).$ So there would be an index $k$ where $f(k)=g(k).$ Note that in this index our first open bracket will complete.

So we have the sequence of the form $$ [A]B$$

Now, both $A$ and $B$ also have to balance and can max contain $n-1$ pairs inside.

So $$C_n=\boxed{C_0\cdot C_{n-1}+C_1\cdot C_{n-2}+C_3\cdot C_{n-4}+\dots + C_{n-1}\cdot C_0}$$

Also, we have $$\boxed{C_n= \frac{1}{n+1}\binom{2n}{n}}$$

**Dominoe tiling:**

How many ways are there to fill in a $ 2 \times n$ grid with $1 \times 2$ or $ 2\times 1$ dominos?**Solution: **Now we consider the last $2 x 1$ cell. We consider in what ways we can tile. Denote $T_n$ as the number of ways to tile. We consider cases.

So we get $$ \boxed{T_n=T_{n-1}+T_{n-2}}$$

**Linear Recurrence:** A *linear recurrence*

Wait what about other non-linear recurrence relations? It's hopeless to solve them :)

Also, a recurrence relation is

**homogeneous**if it doesn’t contain any constant terms. Else, not homogeneous.

So a **linear homogeneous recurrence** is $$c_0a_n+c_1a_{n-1}+\dots +c_ra_{n-r}=0$$

The **characteristic equation ** of the recurrence is $$c_0x^r+c_1x^{r-1}+\dots +c_r=0$$

If $\alpha_1,\dots \alpha_r$ are the **distinct roots** then $$ a_n= A_1(\alpha_1)^n+A_2(\alpha_2)^n+\dots +A_r(\alpha_r)^n$$

What about repetitions?

So for two-degree equation whose root repeat we get,

$$a_n= (A+Bn)r^n$$

**Solving Fibonacci: **

We have to solve the recurrence $$a_n-a_{n-1}-a_{n-2}=0$$

So the characteristic equation is $$ x^2-x-1=0$$

and it's roots are $$ \alpha_1=\frac{1+\sqrt{5}}{2}$$ and $$\alpha_2=\frac{1-\sqrt{5}}{2}$$

Hence $$ a_n= A\Big(\frac{1+\sqrt{5}}{2}\Big)^n+B\Big(\frac{1-\sqrt{5}}{2}\Big)^n$$

Since $$a_0=a_1=1\implies A+B=1, A\Big(\frac{1+\sqrt{5}}{2}\Big)+B\Big(\frac{1-\sqrt{5}}{2}\Big)=1$$

Solving gives us $$A= \frac{1+\sqrt{5}}{2\sqrt{5}}, B=\frac{-1+\sqrt{5}}{2\sqrt{5}}$$

So $$a_n= \frac{1}{\sqrt{5}}\Big[ \Big(\frac{1+\sqrt{5}}{2}\Big)^{n+1}-\Big(\frac{1-\sqrt{5}}{2}\Big)^{n+1}\Big]$$

**Another example:**

Find solution to the recurrence relation $$ a_n=3a_{n-1}+4a_{n-2}$$ with $a_0=2, a_1=3.$**Solution: **We have $x^2-3x-4=0\implies (x-4)(x+1)=0$

So $$a_n=A\cdot 4^n+B\cdot (-1)^n$$

So $$a_0=2\implies A+B=2$$

$$a_1=3\implies 4a-B=3$$

$$\implies A=1,B=1$$

Hence $$a_n= 4^n+(-1)^n$$

**Olympiad Problems:**

Problem [India postal 2006]: Consider the set $A = \{1, 2, 3, ..., 2008\}$. We say that a set is of type $r, r \in \{0, 1, 2\}$, if that set is a nonempty subset of $A$ and the sum of its elements gives the remainder $r$ when divided by $3$. Denote by $X_r, r \in \{0, 1, 2\}$ the class of sets of type $r$. Determine which of the classes $X_r, r \in \{0, 1, 2\}$, is the largest.**Proof:** Consider set $B=\{1,2,\dots , 3k\}, k>1.$

**Claim 1:**$X_0$ is the largest for set $B.$

We can say by symmetry, $|X_1|=|X_2|.$ And we can show this by induction on $k.$

For base case take $k=2,$ we get $|X_1|=|X_2|=2$ and $|X_3|=3.$ So $X_3 $ is largest. Now if we add $\{4,5,6\}, $ we will get previous set using only

$E=\{1,2,3\}$ , sets using only $F=\{4,1,2,3\}$ , sets using only $G=\{5,1,2,3\}$ ,sets using only $H=\{6,1,2,3\}$, sets using only $I=\{4,5,1,2,3\}$, sets using only $J=\{4,6,1,2,3\}$, sets using only $K=\{5,6,1,2,3\}$, sets using only $L=\{4,5,6,1,2,3\}.$

For now sets $F,G,H,I,J,K,L$ will use at least two elements from there sets with $F$ must having $4$, $G$ having $5$, and so on.

Now initially we has $X_1=2,X_2=2, X_3=3$ . Now if we see sets, $\{4\},\{5\},\{6\},\{4,5\},\{4,6\}, \{5,6\}.$ Now $X_1=3,X_2=3,X_3=5.$

Now set $E's$ all non-empty subset has been counted. Now consider set $F.$ Since $F's $ subsets will must have $4,$ it's same as having $E's$ subsets, but everything shifting to $1\mod 3,$ hence it will have $X_1=3,X_2=2,X_3=2.$

Similarly, Since $G's $ subsets will have $5,$ it's same as having $E's$ subsets, but everything shifting to $2\mod 3,$ hence it will have $X_1=2,X_2=3,X_3=2.$

And so on.. adding we get $X_1=20,X_2=20,X_3=23.$ For set $\{1,2,3,4,5,6\}.$

Now for $\{1,2,3,4,5,6,7,8,9\}, $ we will have $X_3$ and infact by this method, we get $|X_3| - |X_1|=2\cdot 3+1=7.$

For $\{1,2,3,4,5,6,7,8,9,10,11,12\}, $ we will have $X_3$ and we get $|X_3| - |X_1|=2\cdot 7+1.$

So this forming recurrence stuff. Clearly, $K$ grows more, and the difference between $X_3$ and $X_1$ grows very much too.

Now consider $C=\{1,2,\cdots,3k,3k+1\},$ It's just the set $B$ but we added ${3k+1}. $ So there are $3$ types of subsets,

Subset's of $B$, $\{3k+1\}, D=$Subsets must containing $3k+1.$

**Claim2:** $X_1$ is the largest for $C.$

Now if for $B,$ we have by our claim, $X_1=X_2=a$ and $X_3=b$ and $b>>a.$

Again, note that $D's$ subets are just $ B's$ subsets, but everything shifted with $1\mod 3.$

So $D's$ contribution to $X_1=b,X_2=a,X_3=a$ and the single set $\{3k+1\} $ contributes $1$ to $X_{1}.$

So for set $C,$ we get $X_1=a+b+1,X_2=a+a,X_3=a+b.$ Hence we get $X_1$ to be the largest.

Note that $2008=2007+1= 3l+1,$ so by our Claim2, we get $X_1$ to be the largest. And we are done!

**Problem[ Modified INMO from Gramoly handout]:** For any natural number $n,$ consider a $1 \times n$ rectangular board made up of n unit squares. This is covered by $3$ types of tiles : $1 \times 1$ red tile, $1 \times 1$ green tile and $1 ×\times 2$ domino. Let $T_n$ denote the number of ways of covering $1 \times n$ rectangular board by these $3$ types of tiles. Find a recursion for $T_n$

**Proof: **Clearly, $$T_n=2\cdot T_{n-1}+ T_{n-2}.$$

Solving, we $$x^2-2x+1=0 \implies a_n= A(1+\sqrt{2})^n+B(1-\sqrt{2})^n$$

Then $$a_1=2, a_2 =3\implies A+B=2, A-B=\frac{3}{\sqrt{2}}$$

**Problem [2018 USAJMO]:** For each positive integer $n$, find the number of $n$-digit positive integers that satisfy both of the following conditions:

no two consecutive digits are equal, and the last digit is a prime.**Proof**: Note that the unit digit can be filled up in $4$ ways and then we can fill up the rest $n-1$ digits in $9^{n-1}$ ways ( allowing $0$ to be in the first digit). Now, note that the no. of numbers has $0$ in the first place is $a_{n-1}.$

Hence $$4\cdot 9^{n-1}=a_n+a_{n-1}\implies a_n+a_{n-1}= \frac{ a_n+a_{n-1}}{9}$$

$$\implies 8a_{n-1}+9a_{n-2}=a_n$$ And $a_1=4, a_2=32$

Solving we get $$x^2-8x-9=0\implies \alpha_1= -1, \alpha_2=9 \implies a_n= A(-1)^n+B(9)^n$$

$$ \implies A=\frac{-2}{5}, B=\frac{2}{5}$$

So $$\boxed{a_n=\frac{2}{5}\left(9^n-(-1)^{n}\right)}$$

**Problem[ 2020 C1]:** Let $n$ be a positive integer. Find the number of permutations $a_1$, $a_2$, $\dots a_n$ of the sequence $1$, $2$, $\dots$ , $n$ satisfying

$$a_1 \le 2a_2\le 3a_3 \le \dots \le na_n$$

Proof: Let $F_0=1,F_1=1,F_2=2, F_n=F_{n-1}+F_{n-2}.$ We claim that the number of permutation is $F_n.$

We use strong induction. For $n=1$ it is true. For $n=2$ we get $(1,2)$ and $(2,1).$**Claim:** $k+1$ is $a_k$ or $a_{k+1}$ in a valid permutation**Proof:** If not then let $k+1$ be $a_y.$ Then let $y$ be $a_i.$ Also $i\cdot y\le (k+1) y$ for any $i.$

So $i \le y.$ Hence by PHP, there is a number $x<y$ which is $a_j$ and $j>y.$ But then we must have $j\cdot x\ge (k+1) y$ which is false. A contradiction.

So $k+1$ is $a_k$ or $a_{k+1}.$

**Case 1: **If $k+1$ is $a_{k+1}$ then by induction, we have $F_k$ valid permutaion.**Case 2: **If $k+1$ is $a_{k}$ then $a_{k+1}$ must be $k,$ then by induction, we have $F_{k-1}$ valid permuations.

So $$\boxed{F_{k+1}=F_k+F_{k-1}}.$$

Hope you enjoyed this blog post!

Sunaina Pati

## Comments

## Post a Comment