[Math] Recurrence relation for a strictly increasing sequence

recurrence-relations

Find a recurrence relation for the number of strictly increasing sequences of positive integers such that the first term is 1 and last term is $n$, where $n$ is a positive integer. The sequence is: $a_1$, $a_2$, $a_3$, … , $a_k$ and $a_1=1$, $a_k=n$ and $a_{j-1}$ < $a_j$ where $j=1,2,3, … , k-1$.

Here $a_{j-1}$ means the $(j-1)th$ term of the sequence.
The solution considers two cases when $a_{k-1} = n-1$ and when $a_{k-1} < n-1$.

I don't understand why two cases are considered.

Best Answer

Let $f_n(m)$ be the number of $m$-length sequences with first term $1$, last term $n$.

A sequence of length $m$ which ends at $n$ is precisely one of the following two disjoint possibilities:

  • A sequence of length $m-1$ which ends at $n-1$, with $n$ appended
  • A sequence of length $m-1$ which ends at something less than $n-1$, with $n$ appended

The first case: there are $f_{n-1}(m-1)$ options for this.

The second case: there is one option for each of the $n-1$ ending points. Therefore, there are $f_1(m-1) + f_2(m-1) + \dots + f_{n-2}(m-1)$ options.

That is, $f_n(m) = \sum_{i=1}^{n-1} f_i(m-1)$.

The initial conditions are that $f_n(n) = 1$, $f_n(m) = 0$ if $m > n$, and $f_n(1) = 0$.

To be honest, I'm not really sure why they've asked you to split it into those two cases. It's a very artificial distinction.

Related Question