Probably recurrent function

46 Views Asked by At

Let there be a recurrent function, $f(n) = f(n-1)+f(n-2)+p_1f(n-1)+p_2f(n-2)$, where $p_1, p_2$ accept $0$ or $1$ with a probability of $\frac{1}{2}$. What is the mathematical expectation of the function value f(n)?
P.S. $f(0) = f(1) = 1 $

1

There are 1 best solutions below

0
On BEST ANSWER

First, factor out each term:

$f(n) = (1+p_1) f(n-1) + (1+p_2) f(n-2)$

Now you need to solve for each combination of these terms $(p_1,p_2)$ so 4 cases.

Now you solve the general equation by calculating the characteristic equation $x^2 = (1+p_1)x + (1+p_2)$.

By calling $\delta = \sqrt{(1+p_1)^2+ 4(1+p_2)}$, the general expression becomes: $u(n) = 2^{-n} (K_1 ((1+p_1) - \delta)^n) + K_2((1+p_1)+\delta)^n)) $ with $K_1$ and $K_2$ two constants.

Now by using $f(0) = f(1) = 1$ you can get: $K_1 + K_2 = 1$ and $\frac{1}{2} (K_1 ((1+p_1) - \delta)+K_2((1+p_1)+\delta)) = 1$. Meaning you can get all the values of $u(n)$ and thus the values of the expected value for all combination of $p_1$ and $p_2$