Solving the recurrence relation $a_n=p(1-a_{n-1})+(1-p)a_{n-1}$?

130 Views Asked by At

I am attempting to solve a recurrence relation which stems from calculating the probability that there are an even number of heads after $n$ tosses of a biased coin with $P(\text{heads})=p$. I managed to obtain

$$a_n=p(1-a_{n-1})+(1-p)a_{n-1}.$$

I attempted to solve it using the generic method of “converting subscript to exponent” which I found in this MSE post. This gives me the polynomial

$$a^n=p+(1-2p)a^{n-1}.$$

I am now stuck with this equation. I’ve considered using the factor theorem, but to no avail so far. Could someone help me with this part? Thank you!

1

There are 1 best solutions below

0
On

$$q = 1 - 2p$$ $$a_n = p + q a_{n-1}$$ $$a_n = p + pq + pq^2 + \dots q^n a_0 $$ $$a_n = p \left( \frac{q^n - 1}{q-1} + q^n a_0 \right) $$