solving generating function with non-constant coefficient

96 Views Asked by At

I have the following problem which I solve with generating function. But the answer is not making sense. It would be very kind if someone can point out the mistake I made.

The problem: frog jumps on lilly pad numbered 0 to 10. If it reaches 0 it dies. If it reaches 10 it lives. When the frog is on pad $N$, $0<N<10$, it will jump to pad $N-1$ with probability $\frac{N}{10}$ and to pad $N+1$ with probability $1-\frac{N}{10}$. Each jump is independent of the previous jumps.

Solution: First write recurrence relation: $P_n = \frac {n} {10}P_{n - 1} + \frac {10 - n} {10}P_{n + 1}$ with boundary condition $P_0 = 0$, $P_{10} = 1$

Define: $A(x) = \Sigma_{n=0}^{n=\infty} P_n x^n$

Multiply recurrence equation above with $x^n$ and sum from zero to infinity. Which will result in the following (while writing the terms down I have used the fact that $P_0=0$):

$10 \Sigma_{n=0}^{n=\infty} P_n x^n = 10 A(x)$

$ \Sigma_{n=0}^{n=\infty} n P_{n - 1} x^n = x\frac {d(xA(x))}{dx}$

$ 10 \Sigma_{n=0}^{n=\infty} P_{n + 1} x^n = 10\frac {A(x)}{x}$

$ \Sigma_{n=0}^{n=\infty} n P_{n - 1} x^n = x\frac {d (A(x)/x)}{dx}$

Thus we get a following equation in terms of generating function:

$\frac{1}{A} \frac{d A}{dx} = \frac{11}{x} + \frac{1}{1-x} - \frac{11}{1+x}$

which solves to: $A(x) = \frac{x^{11}}{(1-x)(1+x)^{11}}$

The coefficient of $x$ should have given me the desired $P_1$ answer which I am looking for, but something is wrong with my reasoning which is not giving me correct answer. Can someone point out what. The computations are correct, I have checked several time the error most probably is in some logical step.

Note I am not looking for a different method to solve the recurrence relation and get the answer. I am trying to figure out why the generating function method is not working.

1

There are 1 best solutions below

0
On

The crucial thing here is to precisely consider the boundary conditions of this recurrence relation. Here I derive as a starter a differential equation for the generating function $A(x)$. As it is not more difficult to perform the calculation with $N$ instead of the special case $N=10$ we consider the general case.

Given the recurrence relation \begin{align*} \color{blue}{P_n}&\color{blue}{=\frac{n}{N}P_{n-1}+\left(1-\frac{n}{N}\right)P_{n+1}\qquad 1\leq n\leq N-1}\tag{1}\\ \color{blue}{P_0}&\color{blue}{=0, P_N=1, P_q=0\qquad\qquad\qquad q>N}\tag{2} \end{align*}

we use a generating function approach respecting (1) and (2) \begin{align*} \color{blue}{A(x)}&=\sum_{n=0}^{\infty}P_nx^n\color{blue}{=\sum_{n=1}^{N-1}P_nx^n+x^N}\tag{3}\\ \frac{d}{dx}A(x)&=\sum_{n=1}^{N-1}nP_nx^{n-1}+Nx^{N-1}\tag{4} \end{align*}

We obtain from (1) and (3) \begin{align*} \sum_{n=1}^{N-1}P_nx^n &=\sum_{n=1}^{N-1}\frac{n}{N}P_{n-1}x^n+\sum_{n=1}^{N-1}\left(1-\frac{n}{N}\right)P_{n+1}x^n\\ &=\sum_{n=0}^{N-2}\frac{n+1}{N}P_nx^{n+1}+\sum_{n=2}^N\left(1-\frac{n-1}{N}\right)P_nx^{n-1}\tag{5}\\ &=\left(\frac{x^2}{N}\sum_{n=1}^{N-2}nP_nx^{n-1}+\frac{x}{N}\sum_{n=1}^{N-2}P_nx^n\right)\\ &\qquad+\left(\left(1+\frac{1}{N}\right)\frac{1}{x}\sum_{n=2}^{N}P_nx^n-\frac{1}{N}\sum_{n=2}^NnP_nx^{n-1}\right)\tag{6} \end{align*} Comment:

  • In (5) we shift the indices of the right-hand sums to get a factor $P_n$.

  • In (6) we split both sums to separate summands with factor $n$ and do some rearrangements to be able to substitute $A(x)$ and the derivative of $A(x)$ in the next steps.

We use (3) and (4) and get from (6) \begin{align*} A(x)-x^N&=\frac{x^2}{N}\left(\frac{d}{dx}A(x)-(N-1)P_{N-1}x^{N-2}-Nx^{N-1}\right)\\ &\qquad+\frac{x^n}{N}\left(A(x)-P_{N-1}x^{N-1}-x^N\right)\\ &\qquad+\left(1+\frac{1}{N}\right)\frac{1}{x}\left(A(x)-P_1(x)\right)\\ &\qquad-\frac{1}{N}\left(\frac{d}{dx}A(x)-P_1\right)\tag{7} \end{align*}

Collecting in (7) like terms and doing a bit simplifications we finally get \begin{align*} \color{blue}{A(x)}&\color{blue}{\left(1-\frac{1}{N}x-\left(1+\frac{1}{N}\right)\frac{1}{x}\right)}\\ &\color{blue}{=\frac{1}{N}\left(x^2-1\right)\frac{d}{dx}A(x)-\left(1+\frac{1}{N}\right)x^{N+1}}\\ &\qquad\color{blue}{+\left(1-P_{N-1}\right)x^N-P_1}\tag{8} \end{align*}

We have for snall $N=1,2,3,4,5$ the following coefficients of $A_N(x)=0+\sum_{n=1}^{N-1}P_nx^n+x^N$:

\begin{align*} \begin{array}{crrrrrr} N/n&0&1&2&3&4&5\\ \hline\\ 1&0&1\\ \\ 2&0&\frac{1}{2}&1\\\\ 3&0&\frac{2}{5}&\frac{3}{5}&1\\\\ 4&0&\frac{3}{8}&\frac{4}{8}&\frac{5}{8}&1\\\\ 5&0&\frac{12}{32}&\frac{15}{32}&\frac{17}{32}&\frac{20}{32}&1 \end{array} \end{align*}

I've checked (8) for $N=1,2,3$ with the table entries above. There are some nice relationsships, for instance $P_n+P_{N-n}=1$ and it might be interesting to

  • find an explicit formula for $P_1$ (and so also for $P_{N-1}$).

  • find a closed formula for $A(x)$ in terms of known functions.