2

Im using the minimax algorithm for a very simple game and when counting the tree nodes found the recurrence $T(n)=T(n-1)+T(n-2)+1$, with $0$ and $1$ as initial values.

I tried generating functions: $G(x)=\sum_{n=0}^\infty T(n)x^n$ and then

\begin{align*} G(x) &= 0+1+\sum_{n=2}^\infty (T(n-1)+T(n-2)+1)x^n \\ &= 1+xG(x)+x^2G(x)+x^n \\ &= \frac{1+\sum x^n}{1-x-x^2} \end{align*} and now I dont know whath to do. Any help please?

2 Answers2

1

You should have the generating function

$$ G(x) = {\frac {x}{{x}^{3}-2\,x+1}}. $$

science
  • 2,978
  • 12
  • 12
1

Your generating function isn’t quite right. Since $T(n)=T(n-1)+T(n-2)+1-[n=0]$, where $[n=0]$ an Iverson bracket and we assume that $T(n)=0$ for all $n\le 0$, we have

$$\begin{align*} G(x)&=\sum_{n\ge 0}T(n-1)x^n+\sum_{n\ge 0}T(n-2)x^n+\sum_{n\ge 0}x^n-1\\ &=xG(x)+x^2G(x)+\frac1{1-x}-1\\ &=xG(x)+x^2G(x)+\frac{x}{1-x} \end{align*}$$

and

$$G(x)=\frac{x}{(1-x)(1-x-x^2)}\;.$$

Decompose this into partial fractions. If $\varphi=\frac12(1+\sqrt5)$ and $\widehat\varphi=\frac12(1-\sqrt5)$, you’ll find that $1-x-x^2=(1-\varphi x)(1-\widehat\varphi x)$, so your partial fraction decomposition will have the form

$$G(x)=\frac{A}{1-x}+\frac{B}{1-\varphi x}+\frac{C}{1-\widehat\varphi x}\;.\tag{1}$$

Each of the terms on the right-hand side of $(1)$ expands into a power series via

$$\frac1{1-ax}=\sum_{n\ge 0}a^nx^n\;,$$

and you can then combine the summations to get $T(n)$, the coefficient of $x^n$ in $G(x)$.

Brian M. Scott
  • 631,399