# Solve using generating functions the following recurrence

$F_0 = F_1 = 0$
$F_2 = 1$
$F_n = F_{n-1} + F_{n-2} + F_{n-3} , n \ge 3$
Hint: You will have to write the recurrence in relation to the Fibonacci sequence.
I seem to be stuck in this method since I am at a point where $G(z) = \frac{z}{1-z-z^2-z^3}$ and I do not know how to proceed

• You have to give the value of $F_2$ ? In the case it is 1, the generating function is $G(z) = \frac{z^2}{1-z-z^2-z^3}$ with numerator $z^2$ instead of $z$. – Jean Marie Jan 23 '17 at 10:22
• @JeanMarie yes I had forgotten that. Thanks. I am not sure though how it would be $z^2$ – K Soe Jan 23 '17 at 10:26

## 2 Answers

The sequence \begin{align*} \left(F_n\right)_{n\geq 0}=(0,0,1,1,2,4,7,13,24,44,81,\ldots) \end{align*} has the corresponding generating function \begin{align*} G(z)=z^2+z^3+2z^4+4z^5+7z^6+\cdots \end{align*}

Since the series expansion of $G(z)$ at $z=0$ starts with $z^2$ and the geometric series $\frac{1}{1-y}=1+y+y^2+\cdots$ starts with the constant term $1$ we use $z^2$ in the numerator of OPs generating function

\begin{align*} G(z)&=\frac{z^2}{1-\left(z+z^2+z^3\right)}\tag{1} \end{align*}

In the following it is convenient to use the coefficient of operator $[z^n]$ to denote the coefficient of $z^n$ in a series.

We apply the geometric series expansion of (1) and obtain for $n\geq 2$ \begin{align*} [z^n]G(z)&=[z^n]z^2\sum_{k=0}^\infty \left(z+z^2+z^3\right)^k\\ &=[z^{n-2}]\sum_{k=0}^\infty z^k\left(1+z+z^2\right)^k\tag{2}\\ &=\sum_{k=0}^{n-2}[z^{n-2-k}]\left(1+z+z^2\right)^k\tag{3}\\ &=\sum_{k=0}^{n-2}[z^{n-2-k}]\sum_{l=0}^k\binom{k}{l}z^l\left(1+z\right)^l\tag{4}\\ &=\sum_{k=0}^{n-2}\sum_{l=0}^{n-2-k}[z^{n-2-k-l}]\binom{k}{l}\sum_{j=0}^l\binom{l}{j}z^j\\ &=\sum_{k=0}^{n-2}\sum_{l=0}^{n-2-k}\binom{k}{l}\binom{l}{n-2-k-l}\tag{5}\\ &=\sum_{k=0}^{n-2}\sum_{l=0}^{n-2-k}\binom{k}{n-2-k-l}\binom{t-2-k-l}{l}\tag{6}\\ &=\sum_{k=0}^{n-2}\sum_{l=0}^{k}\binom{n-2-k}{k-l}\binom{k-l}{l}\tag{7}\\ \end{align*}

Comment:

• In (2) we use the rule $[z^p]z^qA(z)=[z^{p-q}]A(z)$.

• In (3) we use the linearity of the coefficient of operator and use the rule from (2) again. Since the powers of $z$ are non-negative we restrict the upper limit of the left-most sum with $n-2$.

• In (4) we apply the binomial theorem and continue here and in the next line similarly as before.

• In (5) we select the coefficient of $z^{n-2-k-l}$. Next we transform the double sum to simplify the representation somewhat.

• In (6) we change the summation order of the inner sum by replacing the index $l$ with $n-2-k-l$.

• In (7) we change the summation order of the outer sum by replacing the index $k$ with $n-2-k$.

We conclude, the coefficients $F_n$ are \begin{align*} &F_0=F_1=0\\ &F_2=1\\ &F_n=\sum_{k=0}^{n-2}\sum_{l=0}^{k}\binom{n-2-k}{k-l}\binom{k-l}{l}\qquad\qquad n\geq 3 \end{align*}

Note: The coefficients $F_n$ are called Tribonacci numbers and are archived as OEIS/A000073.

Partial answer due to a problem in partial fraction decomposition.

Adding the four relationships:

$$\begin{cases} \ \ \ \ \ G(z)&=&F_0&+&F_1z&+&F_2z^2&+&F_3z^3&+&F_4z^4&-&F_5z^5-...\\-z \ G(z)&=&&-&F_0z&-&F_1z^2&-&F_2z^3&-&F_3z^4&-&F_4z^5-...\\-z^2G(z)&=&&&&-&F_0z^2&-&F_1z^3&-&F_2z^4&-&F_3z^5-...\\-z^3G(z)&=&&&&&&-&F_0z^3&-&F_1z^4&-&F_2z^5-...\end{cases}$$

all terms with power $\geq 3$ cancel, and the result is:

$$G(z)(1-z-z^2-z^3)=F_2z^2=z^2.$$

The generating function is thus

$$G(z) = \frac{z^2}{1-z-z^2-z^3} = z^2 + z^3 + 2 z^4 + 4z^5 +...$$

The classical method here relies on the decomposition of $G(z)$ into partial fractions.

But the problem is that this decomposition is awful because the roots of the denominator are very complicated (one is real, the other two complex conjugate).

Could you check that you have the right relationship (and the right initial values) ?

• Yes that is the relation and I have the same problem with decomposition – K Soe Jan 23 '17 at 10:48
• On which grounds have I been downvoted, as I have explained to the OP where was one error : $z$ instead of $z^2$ in the numerator of $G(z)$... and I couldn't do it in a comment... ? – Jean Marie Jan 23 '17 at 20:41