Tutorials › Stochastic Processes › Choosing a Method to Compute P to the nth Power

Chapman-Kolmogorov Equations and n-Step Transitions · Tutorial 125 of 994

Choosing a Method to Compute P to the nth Power

Learn to match the computation of an n-step transition matrix to the size of n, the structure of the chain, and the exact answer required.

Intermediate 10 min read

What You'll Learn

  • Decide when direct path enumeration is practical for an n-step probability.
  • Compute powers recursively by multiplying a transition matrix.
  • Use eigenvalues and eigenvectors to calculate large powers when the matrix is diagonalizable.
  • Check exact calculations using row sums and an independent method.
  • Recognize why diagonalization cannot be used for every transition matrix.

Three Ways to Compute an n-Step Transition Matrix

For a Markov chain, the probability of moving from state \(i\) to state \(j\) in \(n\) steps is the entry \(p_{ij}^{(n)}\) of its n-step transition matrix \(P^{(n)}=P^n\). There is no single best way to compute this power in every problem. A small \(n\) often makes a path calculation shortest; repeated multiplication gives a dependable method for moderate \(n\); and diagonalization can make a very large power manageable when the matrix has a suitable eigenstructure. The aim here is to choose among these methods, keep the arithmetic verifiable, and recognize when a method does not apply.

Throughout, \((X_n)_{n\ge0}\) is a discrete-time Markov chain on a finite state space \(S\), defined on a probability space \((\Omega,\mathcal F,\mathbb P)\). Its transition matrix \(P=(p_{ij})\) is row-stochastic, and \(p_{ij}^{(n)}=\mathbb P_i(X_n=j)\). In particular, \(P^{(0)}=I\). Chapman–Kolmogorov gives \(P^{(m+n)}=P^mP^n\); equivalently, the distribution row vector evolves by \(\mu_{n+1}=\mu_nP\). These identities let us compute the same quantities in different ways.

Method guide: Use path enumeration when the number of relevant length-\(n\) paths is small. Use recursive multiplication when \(n\) is moderate or a straightforward exact answer is wanted. Use diagonalization for large \(n\) only when \(P\) is diagonalizable and its eigenvalues and eigenvectors can be calculated reliably.

Why the Three Methods Work

A path of length \(n\) from \(i\) to \(j\) is a sequence \(i=i_0,i_1,\ldots,i_n=j\) of states. Its probability, conditional on starting at \(i\), is the product of the transition probabilities along that path. Summing over all such paths gives the n-step probability.

Proposition (Path expansion): For \(n\ge1\) and states \(i,j\), \(p_{ij}^{(n)}\) is the sum, over all intermediate states \(i_1,\ldots,i_{n-1}\in S\), of \(\prod_{r=1}^n p_{i_{r-1}i_r}\), with \(i_0=i\) and \(i_n=j\). For \(n=0\), \(p_{ij}^{(0)}=\mathbf{1}_{\{i=j\}}\).

Proof. For \(n=1\), the displayed sum has no intermediate states and consists of \(p_{ij}\), as required. Suppose the formula holds for \(n\). Chapman–Kolmogorov gives \(p_{ij}^{(n+1)}=\sum_{k\in S}p_{ik}^{(n)}p_{kj}\). Substitute the length-\(n\) path expansion for each \(p_{ik}^{(n)}\). Each term then corresponds to a length-\((n+1)\) path whose penultimate state is \(k\), and its product includes the final factor \(p_{kj}\). As \(k\) ranges over \(S\), these are exactly all length-\((n+1)\) paths, each counted once. For \(n=0\), the chain is in its starting state with probability one and in any different state with probability zero, which is the identity matrix. \(\square\)

Recursive multiplication is the same combination of intermediate states written as matrix arithmetic. Compute \(P^{(0)}=I\), then \(P^{(r+1)}=P^{(r)}P\). In each matrix product, the entry for \(i,j\) is \(\sum_k p_{ik}^{(r)}p_{kj}\), precisely the final-step conditioning in Chapman–Kolmogorov. A second route to a large power is to express a diagonalizable matrix as \(P=V D V^{-1}\), where \(D\) is diagonal.

Proposition (Power of a diagonalizable matrix): If \(P=V D V^{-1}\) for an invertible matrix \(V\) and diagonal matrix \(D\), then for every integer \(n\ge0\), \(P^n=V D^n V^{-1}\).

Proof. For \(n=0\), \(P^0=I=VIV^{-1}=VD^0V^{-1}\). For \(n\ge1\), multiply \(P=VDV^{-1}\) by itself \(n\) times. Each adjacent factor \(V^{-1}V\) equals \(I\), leaving \(V D^n V^{-1}\). This proves the formula for every nonnegative integer \(n\). \(\square\)

This identity does not say that every matrix can be diagonalized. If \(P\) has too few linearly independent eigenvectors, this route is unavailable; recursive multiplication remains valid. The following examples show how the choice affects the work.

Worked Example: Enumerating Paths for a Small Power

Let \((X_n)_{n\ge0}\) be a chain on \(S=\{1,2,3\}\), with transition matrix

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

Each row sums to \(1\): the row sums are \(\tfrac12+\tfrac12+0=1\), \(0+\tfrac12+\tfrac12=1\), and \(\tfrac12+0+\tfrac12=1\). Find \(p_{13}^{(2)}\). There is just one possible two-step path from \(1\) to \(3\) with positive probability: \(1\to2\to3\). Its probability is the product \(\tfrac12\cdot\tfrac12=\tfrac14\). The other possible intermediate states contribute zero: the path through \(1\) has final transition \(p_{13}=0\), and the path through \(3\) has first transition \(p_{13}=0\). Therefore \(p_{13}^{(2)}=\tfrac14\).

Check by multiplication: the entry in row \(1\), column \(3\) of \(P^2\) is \(\sum_{k=1}^3p_{1k}p_{k3}=\tfrac12\cdot0+\tfrac12\cdot\tfrac12+0\cdot\tfrac12=\tfrac14\), agreeing with the path calculation.

Worked Example: Recursive Multiplication for Three Steps

Use the same chain to find \(P^3\). Since \(n=3\), it is feasible to multiply two small matrices; enumeration would require checking paths for each entry. The matrix \(P\) has row sums \(1,1,1\), as checked in the preceding example. First compute \(P^2=PP\): for instance, its first row is \(\tfrac12( \tfrac12,\tfrac12,0)+\tfrac12(0,\tfrac12,\tfrac12)+0(\tfrac12,0,\tfrac12)=(\tfrac14,\tfrac12,\tfrac14)\). Multiplying each row in the same way gives

$$ P^2= \begin{bmatrix} \tfrac14&\tfrac12&\tfrac14\\ \tfrac14&\tfrac14&\tfrac12\\ \tfrac12&\tfrac14&\tfrac14 \end{bmatrix}. $$

Each row of \(P^2\) sums to \(1\): \(\tfrac14+\tfrac12+\tfrac14=1\), \(\tfrac14+\tfrac14+\tfrac12=1\), and \(\tfrac12+\tfrac14+\tfrac14=1\). Now use \(P^3=P^2P\). The first row is \(\tfrac14\) times row \(1\) of \(P\), plus \(\tfrac12\) times row \(2\), plus \(\tfrac14\) times row \(3\), giving \((\tfrac14,\tfrac38,\tfrac38)\). The second row is \(\tfrac14\) times row \(1\), plus \(\tfrac14\) times row \(2\), plus \(\tfrac12\) times row \(3\), giving \((\tfrac38,\tfrac14,\tfrac38)\). The third row is \(\tfrac12\) times row \(1\), plus \(\tfrac14\) times row \(2\), plus \(\tfrac14\) times row \(3\), giving \((\tfrac38,\tfrac38,\tfrac14)\). Thus

$$ P^3= \begin{bmatrix} \tfrac14&\tfrac38&\tfrac38\\ \tfrac38&\tfrac14&\tfrac38\\ \tfrac38&\tfrac38&\tfrac14 \end{bmatrix}. $$

Checks: The row sums are \(\tfrac14+\tfrac38+\tfrac38=1\), \(\tfrac38+\tfrac14+\tfrac38=1\), and \(\tfrac38+\tfrac38+\tfrac14=1\). Also, the earlier path calculation can be extended to \(p_{13}^{(3)}\): the paths are \(1\to1\to2\to3\), \(1\to2\to2\to3\), and \(1\to2\to3\to3\), each with probability \(\tfrac18\), giving \(\tfrac38\), the \((1,3)\) entry above.

Worked Example: Diagonalization for a Large Power

Let \((X_n)_{n\ge0}\) be a chain on \(S=\{1,2,3\}\) with

$$ P=\begin{bmatrix} \tfrac7{12}&\tfrac1{12}&\tfrac13\\ \tfrac1{12}&\tfrac7{12}&\tfrac13\\ \tfrac13&\tfrac13&\tfrac13 \end{bmatrix}. $$

Each row sums to \(1\): \(\tfrac7{12}+\tfrac1{12}+\tfrac13=\tfrac{12}{12}=1\), \(\tfrac1{12}+\tfrac7{12}+\tfrac13=\tfrac{12}{12}=1\), and \(\tfrac13+\tfrac13+\tfrac13=1\). To compute \(p_{11}^{(10)}\) without ten successive matrix multiplications, use three eigenvectors. Let \(u=(1,1,1)^\mathsf{T}\), \(v=(1,-1,0)^\mathsf{T}\), and \(w=(1,1,-2)^\mathsf{T}\). Direct multiplication gives \(Pu=u\), \(Pv=\tfrac12v\), and \(Pw=0w\). These three vectors are linearly independent: if \(a u+b v+c w=0\), the third coordinate gives \(a-2c=0\), and the first two coordinates then give \(b=0\) and \(a+c=0\), so \(a=b=c=0\). Thus they form a basis of eigenvectors and \(P\) is diagonalizable.

Write \(e_1=(1,0,0)^\mathsf{T}\). Its coordinates in this eigenvector basis are \(e_1=\tfrac13u+\tfrac12v+\tfrac16w\), as can be checked coordinatewise: the first coordinate is \(\tfrac13+\tfrac12+\tfrac16=1\), the second is \(\tfrac13-\tfrac12+\tfrac16=0\), and the third is \(\tfrac13-\tfrac13=0\). Applying \(P^{10}\) multiplies these components by \(1^{10}\), \((\tfrac12)^{10}\), and \(0^{10}\). Hence the first coordinate of \(P^{10}e_1\), which is \((P^{10})_{11}\), is

$$ \tfrac13+\tfrac12\left(\tfrac12\right)^{10} =\tfrac13+\tfrac1{2048} =\tfrac{2051}{6144}. $$

Check: The corresponding formula for every \(n\ge1\) is \((P^n)_{11}=\tfrac13+\tfrac12( \tfrac12)^n\); at \(n=1\) it gives \(\tfrac13+\tfrac14=\tfrac7{12}\), the original \((1,1)\) entry. At \(n=10\), converting to a common denominator gives \(\tfrac{2048}{6144}+\tfrac3{6144}=\tfrac{2051}{6144}\), as above.

Choosing Efficiently—and Avoiding a Common Error

For a small exponent and a single requested entry, path enumeration may avoid calculating entries that are not needed. Its cost grows with the number of possible paths, however: if every state can transition to every state, there can be \(|S|^{n-1}\) intermediate-state sequences for one entry. Recursive multiplication organizes those sums systematically and is usually clearer when several entries are required. For a very large exponent, diagonalization can replace many multiplications by raising eigenvalues to the \(n\)th power, but only if a full eigenvector basis exists and the resulting arithmetic is manageable. The result must still be checked against the probability structure.

Common mistake: adding transition probabilities along a path. In the first example, the path \(1\to2\to3\) has probability \(\tfrac12+\tfrac12=1\) if its two transition probabilities are incorrectly added. The probability of the path is instead their product, \(\tfrac12\cdot\tfrac12=\tfrac14\), because both transitions must occur. Then probabilities of distinct paths are added. For \(p_{13}^{(2)}\), the only positive-probability path contributes \(\tfrac14\), not \(1\).

Another limitation is that diagonalization is not guaranteed. For example, consider the matrix below on \(S=\{1,2,3\}\), where \((X_n)\) is again a discrete-time chain on a probability space:

$$ R=\begin{bmatrix} 1&0&0\\ \tfrac14&\tfrac12&\tfrac14\\ \tfrac12&0&\tfrac12 \end{bmatrix}. $$

Its row sums are \(1\), \(\tfrac14+\tfrac12+\tfrac14=1\), and \(\tfrac12+0+\tfrac12=1\). The characteristic polynomial is \((1-\lambda)(\tfrac12-\lambda)^2\). For eigenvalue \(\tfrac12\), the equation \((R-\tfrac12I)x=0\) forces \(x_1=0\) from the first row and \(x_3=0\) from the second row; \(x_2\) is free. Thus this eigenvalue has only one linearly independent eigenvector, despite having algebraic multiplicity two, so \(R\) is not diagonalizable. Do not force the diagonalization method in this case; recursive multiplication is still justified by Chapman–Kolmogorov.

For any computed power, row sums provide a basic check: if \(P\) is row-stochastic, then \(P^n\) is row-stochastic for every \(n\ge0\). Indeed, if a row vector \(x\) has nonnegative entries summing to one, then the \(i\)th row of \(P^{n+1}=P^nP\) is a nonnegative weighted sum of rows of \(P\), with weights from row \(i\) of \(P^n\); those weights sum to one, so the resulting row also sums to one. This check detects many arithmetic errors, though it does not by itself verify every entry.

Check Your Understanding

For each question, identify a method and verify the proposed computation using the definitions or a second calculation.

  1. For a single entry \(p_{ij}^{(2)}\), what quantities are multiplied along each path, and what quantities are summed across paths?
  2. Why is recursive multiplication a direct implementation of Chapman–Kolmogorov?
  3. What additional condition, beyond having eigenvalues, is required to use \(P=VDV^{-1}\) for computing powers?
  4. Suppose \(P\) is row-stochastic. Explain why the rows of \(P^n\) must sum to one.
  5. For the first worked example, recompute \(p_{13}^{(2)}\) by evaluating \(\sum_{k=1}^3p_{1k}p_{k3}\).