Tutorials › Stochastic Processes › Computing Stationary Probabilities from Return Cycles

Stationary Distributions · Tutorial 198 of 994

Computing Stationary Probabilities from Return Cycles

Learn to turn expected visits in a return cycle into a stationary distribution, and check the cycle length and probabilities directly.

Intermediate 11 min read

What You'll Learn

  • Define a return cycle and its expected occupation count for each state.
  • Derive the balance equations for expected visits from the Markov property.
  • Compute the mean return time by summing expected cycle occupation counts.
  • Normalize cycle counts to obtain stationary probabilities.
  • Verify the resulting distribution and distinguish stationarity from convergence.

From a Return Cycle to Stationary Probabilities

A stationary distribution describes the long-run balance of a Markov chain, but it can also be calculated from the chain’s repeated returns to one chosen state. Start at that state, record the visits made before the next return, and average those counts. Their normalized values give the stationary probabilities. This approach is especially useful when the cycle visits can be found more directly than by solving the stationary equations all at once.

Let \((X_n)_{n\ge0}\) be a Markov chain on a finite state space \(S\), defined on a probability space \((\Omega,\mathcal{F},\mathbb{P})\), with transition matrix \(P=(p_{ij})\). The matrix is row-stochastic: \(p_{ij}\ge0\) and \(\sum_{j\in S}p_{ij}=1\) for every \(i\). Use the natural filtration \(\mathcal{F}_n=\sigma(X_0,\ldots,X_n)\). Fix a state \(r\), start the chain at \(r\), and define its first return time by \(T_r^+=\inf\{n\ge1:X_n=r\}\). The cycle consists of the states \(X_0,\ldots,X_{T_r^+-1}\): the return state at time \(T_r^+\) begins the next cycle and is not counted in this one.

Definition: The occupation count of state \(j\) during the cycle from \(r\) to its first return is \(C_j=\sum_{n=0}^{T_r^+-1}\mathbf{1}_{\{X_n=j\}}\). Its expected cycle occupation is \(a_j=\mathbb{E}_r[C_j]\). In particular, \(a_r=1\), because the cycle starts at \(r\) and does not include its return endpoint. If \(\mathbb{E}_r[T_r^+]<\infty\), then \(\sum_{j\in S}a_j=\mathbb{E}_r[T_r^+]\).

For a finite irreducible chain, the return time to every state has finite expectation; this is the positive-recurrence result established earlier in the course. Irreducibility means every state can be reached from every other state with positive probability in some number of steps. The cycle calculation below uses this finite-mean condition. A stationary distribution is a row vector \(\pi\) with nonnegative entries summing to one and satisfying \(\pi P=\pi\). For a finite irreducible chain, that distribution is unique, and the return-cycle construction gives it.

Theorem (Return-cycle occupation formula): For a finite irreducible Markov chain, fix any state \(r\), let \(a_j=\mathbb{E}_r[C_j]\), and let \(L=\mathbb{E}_r[T_r^+]\). Then \(L=\sum_{j\in S}a_j\), and the unique stationary distribution is \(\pi_j=a_j/L\). The expected occupation counts also satisfy \(a_j=\sum_{i\in S}a_i p_{ij}\) for every \(j\in S\).

Proof. The return time has finite expectation by positive recurrence, so the expected occupation counts are finite. For a fixed state \(j\), shift each cycle’s count forward by one time step. Pathwise, the shifted count differs from the original count by \(\mathbf{1}_{\{X_{T_r^+}=j\}}-\mathbf{1}_{\{X_0=j\}}\). Both \(X_{T_r^+}\) and \(X_0\) equal \(r\), so this difference is zero for every \(j\). Therefore, the expected number of visits to \(j\) at times \(1,\ldots,T_r^+\) equals \(a_j\).

To compute the shifted expectation another way, for each \(n\ge0\), the event \(\{n<T_r^+,X_n=i\}\) is in \(\mathcal{F}_n\). On that event the Markov property gives conditional probability \(p_{ij}\) that \(X_{n+1}=j\). Summing these conditional expectations over \(n\) and \(i\) gives the expected shifted count \(\sum_i a_i p_{ij}\). The sums involve nonnegative indicators, so their expectations may be summed, and the total is finite. Equating the shifted and original expected counts yields \(a_j=\sum_i a_i p_{ij}\). Also, on every path, \(\sum_j C_j=T_r^+\), since exactly one state is visited at each time \(0,\ldots,T_r^+-1\). Taking expectations gives \(L=\sum_j a_j\). Thus \(a/L\) is a probability row vector, and the count equations imply \((a/L)P=a/L\). It is stationary, so uniqueness for a finite irreducible chain identifies it as the unique stationary distribution. \(\square\)

The equations \(a_r=1\) and \(a_j=\sum_i a_i p_{ij}\) are a practical way to calculate cycle occupations. They are balance equations for expected counts, with the count at the chosen return state fixed by the cycle definition. Once the counts are found, sum them to get the expected return time, then divide every count by that same total.

Worked Example: A Three-State Cycle

Let \(S=\{0,1,2\}\), and use state \(0\) as the return state. The transition matrix, with states in the order \(0,1,2\), is

$$ P= \begin{bmatrix} 0&\tfrac12&\tfrac12\\ \tfrac13&\tfrac13&\tfrac13\\ 1&0&0 \end{bmatrix}. $$

Each row sums to one: \(0+\tfrac12+\tfrac12=1\), \(\tfrac13+\tfrac13+\tfrac13=1\), and \(1+0+0=1\). The chain is irreducible: from \(0\) it can reach \(1\) or \(2\), from \(1\) it can reach every state, and from \(2\) it moves to \(0\), from which \(1\) and \(2\) are accessible. Set \(a_0=1\). The equations for the other occupation counts are

$$ a_1=\tfrac12 a_0+\tfrac13 a_1,\qquad a_2=\tfrac12 a_0+\tfrac13 a_1. $$

Substitute \(a_0=1\). From the first equation, \(\tfrac23 a_1=\tfrac12\), so \(a_1=\tfrac34\). Then \(a_2=\tfrac12+\tfrac13(\tfrac34)=\tfrac12+\tfrac14=\tfrac34\). The expected return time is the sum of the expected occupation counts:

$$ L=1+\tfrac34+\tfrac34=\tfrac52. $$

Normalizing gives \(\pi=(\tfrac{1}{5/2},\tfrac{3/4}{5/2},\tfrac{3/4}{5/2})=(\tfrac25,\tfrac3{10},\tfrac3{10})\). The entries sum to \(\tfrac25+\tfrac3{10}+\tfrac3{10}=1\). To check stationarity, the three coordinates of \(\pi P\) are \(\tfrac3{10}\cdot\tfrac13+\tfrac3{10}\cdot1=\tfrac25\), \(\tfrac25\cdot\tfrac12+\tfrac3{10}\cdot\tfrac13=\tfrac3{10}\), and \(\tfrac25\cdot\tfrac12+\tfrac3{10}\cdot\tfrac13=\tfrac3{10}\). Thus \(\pi P=\pi\), and \(1/\pi_0=\tfrac52=L\), as expected from the reciprocal mean return-time formula.

Worked Example: A Cycle with a Self-Loop

Consider \(S=\{1,2,3\}\), returning to state \(1\), with transition matrix

$$ P= \begin{bmatrix} \tfrac12&\tfrac12&0\\ \tfrac14&0&\tfrac34\\ \tfrac12&\tfrac12&0 \end{bmatrix}. $$

The row sums are \(\tfrac12+\tfrac12+0=1\), \(\tfrac14+0+\tfrac34=1\), and \(\tfrac12+\tfrac12+0=1\). The chain is irreducible: state \(1\) reaches \(2\), state \(2\) reaches \(1\) and \(3\), and state \(3\) reaches \(1\) and then \(2\). Set \(a_1=1\). The equations for states \(2\) and \(3\) are

$$ a_2=\tfrac12a_1+\tfrac12a_3,\qquad a_3=\tfrac34a_2. $$

Substitute the second equation into the first: \(a_2=\tfrac12+\tfrac12(\tfrac34a_2)=\tfrac12+\tfrac38a_2\). Hence \(\tfrac58a_2=\tfrac12\), so \(a_2=\tfrac45\), and \(a_3=\tfrac34(\tfrac45)=\tfrac35\). Therefore the mean return time to \(1\) is \(L=1+\tfrac45+\tfrac35=\tfrac{12}5\). Normalizing gives \(\pi=(\tfrac5{12},\tfrac13,\tfrac14)\), whose entries sum to \(\tfrac5{12}+\tfrac4{12}+\tfrac3{12}=1\).

Check each coordinate of \(\pi P\). The first is \(\tfrac5{12}\cdot\tfrac12+\tfrac13\cdot\tfrac14+\tfrac14\cdot\tfrac12=\tfrac5{24}+\tfrac2{24}+\tfrac3{24}=\tfrac5{12}\). The second is \(\tfrac5{12}\cdot\tfrac12+\tfrac14\cdot\tfrac12=\tfrac5{24}+\tfrac3{24}=\tfrac13\). The third is \(\tfrac13\cdot\tfrac34=\tfrac14\). Thus \(\pi P=\pi\), and \(1/\pi_1=\tfrac{12}5=L\). The self-loop at state \(1\) is included in the return cycle: a cycle can have length one, in which case it visits only its starting state.

Worked Example: A Four-State Cycle with Branching

Let \(S=\{0,1,2,3\}\), with return state \(0\), and transition matrix

$$ P= \begin{bmatrix} 0&\tfrac13&\tfrac23&0\\ \tfrac12&0&0&\tfrac12\\ \tfrac14&0&0&\tfrac34\\ \tfrac12&\tfrac12&0&0 \end{bmatrix}. $$

The row sums are \(0+\tfrac13+\tfrac23+0=1\), \(\tfrac12+0+0+\tfrac12=1\), \(\tfrac14+0+0+\tfrac34=1\), and \(\tfrac12+\tfrac12+0+0=1\). The chain is irreducible: from \(0\) it reaches \(1\) and \(2\); states \(1\) and \(2\) reach \(3\) or \(0\); and \(3\) reaches \(0\) and \(1\). Put \(a_0=1\). The equations for states \(1,2,3\) are

$$ a_1=\tfrac13+\tfrac12a_3,\qquad a_2=\tfrac23,\qquad a_3=\tfrac12a_1+\tfrac34a_2. $$

Using \(a_2=\tfrac23\), the third equation becomes \(a_3=\tfrac12a_1+\tfrac12\). Substitute this into the first: \(a_1=\tfrac13+\tfrac12(\tfrac12a_1+\tfrac12)=\tfrac7{12}+\tfrac14a_1\). Thus \(\tfrac34a_1=\tfrac7{12}\), giving \(a_1=\tfrac79\). Then \(a_3=\tfrac12(\tfrac79)+\tfrac12=\tfrac7{18}+\tfrac9{18}=\tfrac89\). The mean return time is \(L=1+\tfrac79+\tfrac23+\tfrac89=\tfrac{30}{9}=\tfrac{10}3\). Normalization gives \(\pi=(\tfrac3{10},\tfrac7{30},\tfrac15,\tfrac4{15})\); the entries sum to \(\tfrac9{30}+\tfrac7{30}+\tfrac6{30}+\tfrac8{30}=1\).

For the stationarity check, the coordinates of \(\pi P\) are \(\tfrac7{30}\cdot\tfrac12+\tfrac15\cdot\tfrac14+\tfrac4{15}\cdot\tfrac12=\tfrac7{60}+\tfrac3{60}+\tfrac8{60}=\tfrac3{10}\); \(\tfrac3{10}\cdot\tfrac13+\tfrac4{15}\cdot\tfrac12=\tfrac1{10}+\tfrac2{15}=\tfrac7{30}\); \(\tfrac3{10}\cdot\tfrac23=\tfrac15\); and \(\tfrac7{30}\cdot\tfrac12+\tfrac15\cdot\tfrac34=\tfrac7{60}+\tfrac9{60}=\tfrac4{15}\). Hence \(\pi P=\pi\), and \(1/\pi_0=\tfrac{10}3=L\).

What the Cycle Calculation Does—and Does Not—Say

The return-cycle method yields a stationary distribution, not necessarily a limiting distribution for \(\mu P^n\). Stationarity means that if the initial distribution is \(\pi\), it remains \(\pi\) after one or more steps. Convergence from other initial distributions requires additional conditions; in particular, periodicity can prevent convergence even for a finite irreducible chain. No aperiodicity condition is needed for the cycle occupation formula itself.

The choice of return state affects the bookkeeping but not the final stationary distribution. Each choice produces its own cycle and expected counts, and normalizing those counts gives the same unique stationary law. The mean cycle length is also a useful check: the counts must sum to \(\mathbb{E}_r[T_r^+]\), and the reciprocal mean return-time formula gives \(\pi_r=1/\mathbb{E}_r[T_r^+]\).

Common mistake: counting the return endpoint twice. In the first example, the correct cycle counts are \((1,\tfrac34,\tfrac34)\), with total \(\tfrac52\). If the endpoint \(X_{T_0^+}=0\) is added to that cycle, the incorrect counts become \((2,\tfrac34,\tfrac34)\), with total \(\tfrac72\). Normalizing them gives the wrong vector \((\tfrac47,\tfrac3{14},\tfrac3{14})\). It is not stationary: its coordinate for state \(1\) after multiplying by \(P\) would be \(\tfrac47\cdot\tfrac12+\tfrac3{14}\cdot\tfrac13=\tfrac5{14}\), not \(\tfrac3{14}\). Excluding the return endpoint gives counts \((1,\tfrac34,\tfrac34)\), and normalizing by their sum gives the verified stationary vector \((\tfrac25,\tfrac3{10},\tfrac3{10})\).

Check Your Understanding

In each question, distinguish the count within one cycle from its normalized stationary probability.

  1. Why is the expected occupation count \(a_r\) equal to \(1\) when the cycle starts at \(r\)?
  2. For the three-state chain in the first example, compute the expected return time to state \(1\) from the cycle counts, then find \(\pi_1\).
  3. Explain why the shifted visit count over times \(1,\ldots,T_r^+\) equals the original count over times \(0,\ldots,T_r^+-1\).
  4. For the four-state example, verify the balance equation for expected visits to state \(3\) using the computed counts.
  5. Does the return-cycle formula require the chain to be aperiodic? What does it establish about the normalized cycle counts?