Two-lane Markov chain with a deterministic restart (source code)

= Two-lane Markov chain with a deterministic restart
{title2=$q_c=(\sqrt5-1)/2$}

Take states $0,n,n'$ for $n\geq1$, with $0\to1'$ deterministic and transitions $n\to n-1$ with probability $q$, $n\to(n+1)'$ with probability $p=1-q$, $n'\to n$ with probability $q$, and $n'\to(n+1)'$ with probability $p$. The <Markov chain> is transient for $q<q_c$, null recurrent for $q=q_c$, and positive recurrent for $q>q_c$. To see the <Markov chain> recurrence threshold, eliminate the primed-state <hitting probabilities> to obtain $p(1+q)a_{n+1}-(1+pq)a_n+qa_{n-1}=0$, with characteristic roots $1$ and $q/(1-q^2)$. Boundedness forces return with probability one when the second root is at least one. When it is below one, the minimal nonnegative solution gives return probability $q^2/p<1$ from $0$. In the positive recurrent case, put $t=(1-q^2)/q$ and $D=q^2+q-1$. The <stationary distribution> is $\pi_0=D/[q(q+2)]$, $\pi_n=(\pi_0/q)t^{n-1}$ and $\pi_{n'}=\pi_0t^{n-1}$. It follows from balance across each level cut and sums to one; at criticality the invariant weights cannot be normalized.