Solution (source code)

= Solution

Let $u_n=\mathbb P(X_n=1\mid X_0=1)$. Conditioning on $X_n$ gives
$$
u_{n+1}=(1-a)u_n+b(1-u_n)=b+(1-a-b)u_n,\qquad u_0=1.
$$
The fixed value is $b/(a+b)$. Subtracting it and iterating the scalar recurrence yields
$$
\boxed{u_n=\frac b{a+b}+\frac a{a+b}(1-a-b)^n},\qquad n\geq0.
$$
The formula includes $n=0$. If $a+b=1$, its value at $n=0$ is interpreted directly as $u_0=1$, while $u_n=b$ for all $n\geq1$. Since $|1-a-b|<1$, the limiting probability is $b/(a+b)$.