Finding Nth term using a generating function

374 Views Asked by At

Good day everyone

I am in need of help, I was using an online program to solve a sequence, the name of the program is WolframAlpha and using it I was able to get the actual nth term that I was looking for several times. But in order to get that nth term the program used the following generating function

$$\frac{ z(-34z ^ { 2 } +77z-41) }{ (z-1) ^ { 3 } } +25$$

Note my sequence was 25,32,36,39,41 and gave me nth term 42 which is what I actually needed. Now I need to find out how did the program get to find the nth using this generating function, I don't understand how -34z and 77z came to be.

Thank you while I wait for the answer

2

There are 2 best solutions below

0
On

I think perhaps the fastest way to answer this question is to note that \begin{align*} f(z) = \frac{z(-34z^2 + 77z - 41)}{(z-1)^3} + 25 = -9 + \frac{25}{1-z} + \frac{11}{(1-z)^2} - \frac{2}{(1-z)^3} \end{align*}

The coefficient of $z^n$ in the series expansion of $(1-z)^{-1}, (1-z)^{-2}, (1-z)^{-3}$ are respectively $1, n+1, \frac{(n+1)(n+2)}{2}$. Therefore, the coefficient of $z^n$ in $f(z)$ is \begin{align*} -9\cdot\mathbb{I}_{\{n=0\}} + 25+ 11(n+1) - 2\frac{(n+1)(n+2)}{2} \end{align*} where $\mathbb{I}$ is the indicator function.

0
On

This is a long comment. I wish I could give a definitive answer, but what WA does is unclear.

That generating function implies a polynomial $n$th term. As with most choices of a sequence's first five terms, the lowest-order polynomial expression for the $n$th term that's correct for all data is quartic. You can see this by verifying these terms' third differences are two different values, $2,\,0$. It's likely WA determined the quartic first, then obtained its generating function (which will be a polynomial divided by $(z-1)^5$), so it's conceptually simplest to get the quartic directly.

The first differences are $7,\,4,\,3,\,2$; the second are $-3,\,-1,\,1$; the third are $2,\,0$; the only fourth difference is $-2$. If fourth differences are constant and $25$ is the $0$th term, the $n$th term is $25+7n-3\binom{n}{2}+2\binom{n}{3}-2\binom{n}{4}$. This sequence has generating function $\frac{25}{1-z}+\frac{7z}{(1-z)^2}-\frac{3z^2}{(1-z)^3}+\frac{2z^3}{(1-z)^4}-\frac{2z^4}{(1-z)^5}$.

I doubt this matches what you got, because the highest power of $(1-z)^{-1}$ is different. My comment on the OP noted WA gave me a different generating function anyway (which, by the same logic, probably doesn't match the above either). Further, this $k$th-difference technique predicts the next term is $40$, not $42$ (although WA gave me $42$ as the next term as well).