Reflected chain with geometric downward jumps (source code)

= Reflected chain with geometric downward jumps
{title2=$X_{n+1}=\max(0,X_n+1-D_n)$}

Let independent $D_n$ have $\mathbb P(D_n=k)=pq^k$, $k\geq0$, $q=1-p$. The displayed chain has transition probabilities $P_{ij}=pq^{i-j+1}$ for $1\leq j\leq i+1$ and $P_{i0}=q^{i+1}$. Its <probability> of hitting zero from $i\geq1$ is one when $p\leq1/2$ and $(q/p)^{i+1}$ when $p>1/2$. The first-step boundary equation at $i=1$ is essential for the extra exponent. The chain is <positive recurrent> for $p<1/2$, with stationary probabilities $(1-p/q)(p/q)^j$, <null recurrent> at $p=1/2$, and transient for $p>1/2$.