Unit 12, lesson 79

Multi-Step Markov Probabilities

How n-step transition probabilities of a Markov chain add path products, why they are entries of a matrix power, how the Chapman-Kolmogorov relation splits a path, and how ending in a state differs from visiting it.

  • Video 79
  • Markov Chains

A machine switches between modes A and B from one hourly inspection to the next, with known one-step probabilities. What is the chance that it is in mode A three inspections from now, and what is the chance that it is in mode B at least once along the way? Each answer collects many possible paths. This lesson shows how to multiply along a path and add over disjoint paths, how matrix powers and row vectors organize that work, and why the probability of ending in a state differs from the probability of visiting it.

Key terms

The n-step transition probability

Definition Let PP be the transition matrix of a time-homogeneous Markov chain X0,X1,X2,…X_0, X_1, X_2, \dots on a finite or countable state space SS. For n≥0n \ge 0 and states i,ji, j, the nn-step transition probability pij(n)p_{ij}^{(n)} is the probability that the chain, started in state ii, is in state jj after nn steps. For any initial distribution and every m≥0m \ge 0 with P(Xm=i)>0P(X_m = i) > 0,

P(Xm+n=j∣Xm=i)=pij(n).\begin{aligned} &P(X_{m+n} = j \mid X_m = i) \\[0.4em] &\quad = p_{ij}^{(n)}. \end{aligned}

For n=0n = 0 it is 11 when j=ij = i and 00 otherwise, and for n=1n = 1 it is PijP_{ij}. For n≥2n \ge 2 it is the sum, over every list of intermediate states, of the product of the one-step probabilities along the path. For two steps,

pij(2)=∑k∈SPikPkj.p_{ij}^{(2)} = \sum_{k \in S} P_{ik} P_{kj}.

By the Markov property and time homogeneity, each path probability is a product of conditional one-step probabilities, and the paths add because different lists of intermediate states are disjoint events.

In plain words To go from ii to jj in nn steps, the chain passes through some sequence of intermediate states. Multiply along each possible route, then add over the routes.

Example Use the constructed two-mode machine with states in the order A, B and

P=(0.80.20.30.7).P = \begin{pmatrix} 0.8 & 0.2 \\ 0.3 & 0.7 \end{pmatrix}.

Starting from A, two steps end in A by the route A, A, A with probability 0.8⋅0.8=0.640.8 \cdot 0.8 = 0.64 or by the route A, B, A with probability 0.2⋅0.3=0.060.2 \cdot 0.3 = 0.06, so pAA(2)=0.70p_{AA}^{(2)} = 0.70. The four two-step probabilities, each written as a sum over the middle state, are

StartEnd in AEnd in B
A0.64+0.06=0.700.64 + 0.06 = 0.700.16+0.14=0.300.16 + 0.14 = 0.30
B0.24+0.21=0.450.24 + 0.21 = 0.450.06+0.49=0.550.06 + 0.49 = 0.55

Each row adds to 11, since after two steps the chain is in exactly one state.

Matrix power

Definition For n≥1n \ge 1 the matrix power PnP^n is the matrix product PP⋯PP P \cdots P with nn factors, and P0=IP^0 = I is the identity matrix. For a time-homogeneous chain on a finite state space,

pij(n)=(Pn)ijp_{ij}^{(n)} = (P^n)_{ij}

for all states i,ji, j and all n≥0n \ge 0, so PnP^n is the nn-step transition matrix. Every PnP^n is again row-stochastic. A power of a matrix means repeated matrix multiplication, not the matrix of powers of the entries. If the rule changes over time, with a matrix PkP_k for the step from time k−1k - 1 to time kk, the nn-step matrix from time 00 is the product P1P2⋯PnP_1 P_2 \cdots P_n in time order, and in general no single power describes it.

In plain words An entry of a matrix product adds products of a row entry and a column entry. For PP times PP, that sum runs over the intermediate state, which is exactly the path calculation. So multiplying PP by itself performs every two-step path sum at once.

Example For the two-mode machine,

P2=(0.700.300.450.55),P^2 = \begin{pmatrix} 0.70 & 0.30 \\ 0.45 & 0.55 \end{pmatrix},

which is the table of the previous card. Squaring each entry of PP instead gives the rows (0.64,0.04)(0.64, 0.04) and (0.09,0.49)(0.09, 0.49), with row sums 0.680.68 and 0.580.58. The A to A entry 0.640.64 of that matrix counts only the route A, A, A and misses the route through B. One more multiplication gives

P3=(0.650.350.5250.475).P^3 = \begin{pmatrix} 0.65 & 0.35 \\ 0.525 & 0.475 \end{pmatrix}.

Row vector of state probabilities

Definition The row vector πn\pi_n lists the probabilities P(Xn=i)P(X_n = i) for i∈Si \in S, in the order of the rows of PP, so π0\pi_0 is the initial distribution. For a time-homogeneous chain with transition matrix PP and every n≥0n \ge 0,

πn+1=πnP,πn=π0Pn.\begin{gathered} \pi_{n+1} = \pi_n P, \\[0.4em] \pi_n = \pi_0 P^n. \end{gathered}

The distribution stands on the left of the matrix, and the order of the factors matters. Under the column convention every matrix and vector is transposed, and the two conventions must not be mixed. Each πn\pi_n has nonnegative entries that add to 11. That check often exposes a slip such as a transposed matrix, but passing it does not prove that every entry is right.

In plain words The row vector is the chain’s distribution at one time. Multiplying by PP moves it forward one step, and multiplying by PnP^n moves it forward nn steps at once. The two routes agree because matrix multiplication is associative, so (π0P)P=π0(PP)(\pi_0 P)P = \pi_0 (PP).

Example From π0=(0.4,0.6)\pi_0 = (0.4, 0.6), one step gives π1=(0.5,0.5)\pi_1 = (0.5, 0.5). A second step gives the A coordinate 0.5⋅0.8+0.5⋅0.3=0.550.5 \cdot 0.8 + 0.5 \cdot 0.3 = 0.55 and the B coordinate 0.5⋅0.2+0.5⋅0.7=0.450.5 \cdot 0.2 + 0.5 \cdot 0.7 = 0.45, so π2=(0.55,0.45)\pi_2 = (0.55, 0.45). Directly from P2P^2, the A coordinate of π0P2\pi_0 P^2 is

0.4⋅0.70+0.6⋅0.45=0.28+0.27=0.55,\begin{aligned} &0.4 \cdot 0.70 + 0.6 \cdot 0.45 \\[0.4em] &\quad = 0.28 + 0.27 = 0.55, \end{aligned}

the same answer. Multiplying π1\pi_1 by the transpose of PP by mistake would give (0.5,0.5)(0.5, 0.5), whose entries add to 11 although it is not π2\pi_2.

Chapman-Kolmogorov relation

Definition For a time-homogeneous Markov chain on a finite or countable state space, all m,n≥0m, n \ge 0 and all states i,ji, j,

pij(m+n)=∑k∈Spik(m) pkj(n).p_{ij}^{(m+n)} = \sum_{k \in S} p_{ik}^{(m)}\, p_{kj}^{(n)}.

In matrix form, Pm+n=PmPnP^{m+n} = P^m P^n. The index kk runs over the possible states at the intermediate time mm. The relation follows by conditioning on XmX_m, with the law of total probability and the Markov property.

In plain words Every route of m+nm + n steps is in some state at time mm. Group the routes by that state, multiply the chance of reaching it in mm steps by the chance of finishing from it in nn steps, and add over the possible middle states.

Example Starting from A, split three steps at time 22. After two steps the chain is in A with probability 0.70.7 and in B with probability 0.30.3, so

pAA(3)=pAA(2)PAA+pAB(2)PBA=0.7⋅0.8+0.3⋅0.3=0.56+0.09=0.65.\begin{aligned} p_{AA}^{(3)} &= p_{AA}^{(2)} P_{AA} + p_{AB}^{(2)} P_{BA} \\[0.4em] &= 0.7 \cdot 0.8 + 0.3 \cdot 0.3 \\[0.4em] &= 0.56 + 0.09 = 0.65. \end{aligned}

Listing the paths confirms it. The paths A, A, A, A and A, B, A, A are in A at time 22, with probabilities 0.5120.512 and 0.0480.048, which add to 0.560.56. The paths A, A, B, A and A, B, B, A are in B at time 22, with probabilities 0.0480.048 and 0.0420.042, which add to 0.090.09.

Endpoint probability

Definition An endpoint probability is the probability that the chain is in a given state at a given time, such as P(Xn=j)P(X_n = j), or P(Xn=j∣X0=i)=pij(n)P(X_n = j \mid X_0 = i) = p_{ij}^{(n)} for a chain started in ii. It is the jj coordinate of π0Pn\pi_0 P^n. It depends only on the state at time nn, so every path that ends in jj counts, whatever states it passed through.

In plain words An endpoint question asks where the chain is at the deadline, not how it got there.

Example Starting from A, the probability of being in B at step 22 is pAB(2)=0.30p_{AB}^{(2)} = 0.30, from the path A, A, B with probability 0.160.16 and the path A, B, B with probability 0.140.14. With π0=(0.4,0.6)\pi_0 = (0.4, 0.6) instead, the endpoint probability is P(X2=B)=0.45P(X_2 = B) = 0.45, so the answer depends on the initial distribution as well as on PP.

Visiting probability

Definition For a chain started in state ii, a state jj and n≥1n \ge 1, the probability of visiting jj by step nn is the conditional probability, given X0=iX_0 = i, that Xk=jX_k = j for at least one time kk with 1≤k≤n1 \le k \le n. It equals 11 minus the total probability of the paths that avoid jj at every time 1,…,n1, \dots, n. The event {Xn=j}\{X_n = j\} is contained in this event, so the visiting probability is at least the endpoint probability pij(n)p_{ij}^{(n)}, and in general it is not an entry of PnP^n. For i≠ji \ne j it equals the endpoint probability of jj after nn steps in a modified chain in which jj is absorbing, that is, in which the row of jj is replaced by staying in jj with probability 11.

In plain words A visiting question asks whether the chain was ever in jj along the way. A chain can enter jj and leave again, so having visited jj by step nn can be more likely than being in jj at step nn.

Example Starting from A, the only two-step path that avoids B stays in A twice, with probability 0.82=0.640.8^2 = 0.64. So the probability of visiting B by step 22 is 1−0.64=0.361 - 0.64 = 0.36, while the endpoint probability is 0.300.30. The difference 0.060.06 is the path A, B, A, which visits B and leaves. Making B absorbing gives the same answer,

P~=(0.80.201),P~2=(0.640.3601).\begin{gathered} \tilde{P} = \begin{pmatrix} 0.8 & 0.2 \\ 0 & 1 \end{pmatrix}, \\[0.4em] \tilde{P}^2 = \begin{pmatrix} 0.64 & 0.36 \\ 0 & 1 \end{pmatrix}. \end{gathered}

Check yourself

  1. The two-mode machine starts in B. Find the probability that it is in B after two steps, and the probability of the particular path B, A, B.
Show the answer

Two paths end in B. The path B, A, B has probability 0.3⋅0.2=0.060.3 \cdot 0.2 = 0.06, and the path B, B, B has probability 0.7⋅0.7=0.490.7 \cdot 0.7 = 0.49. They are disjoint, so

pBB(2)=0.06+0.49=0.55,p_{BB}^{(2)} = 0.06 + 0.49 = 0.55,

the B to B entry of P2P^2. The path B, A, B is one of the two routes, with probability 0.060.06.

  1. Starting in B, find the probability of visiting A at least once in the first two steps, and compare it with the probability of being in A at step 22.
Show the answer

The only two-step path that avoids A stays in B twice, with probability 0.72=0.490.7^2 = 0.49. So the visiting probability is 1−0.49=0.511 - 0.49 = 0.51. The endpoint probability is pBA(2)=0.24+0.21=0.45p_{BA}^{(2)} = 0.24 + 0.21 = 0.45. The difference 0.060.06 is the path B, A, B, which visits A but ends in B. Reporting 0.450.45 as the visiting probability would leave that path out.

  1. Starting in B, find the probability of being in A at step 33 by splitting at time 22. A classmate instead cubes the one-step entry and reports 0.33=0.0270.3^3 = 0.027. What is wrong with that?
Show the answer

After two steps from B the chain is in A with probability 0.450.45 and in B with probability 0.550.55. So

pBA(3)=0.45⋅0.8+0.55⋅0.3=0.36+0.165=0.525,\begin{aligned} &p_{BA}^{(3)} \\[0.4em] &\quad = 0.45 \cdot 0.8 + 0.55 \cdot 0.3 \\[0.4em] &\quad = 0.36 + 0.165 = 0.525, \end{aligned}

the B to A entry of P3P^3. The four paths from B that end in A at step 33 are B, A, A, A with probability 0.1920.192, B, A, B, A with 0.0180.018, B, B, A, A with 0.1680.168 and B, B, B, A with 0.1470.147, and they add to 0.5250.525. The classmate’s product uses the move from B to A three times in a row, which no path makes, since after moving to A the next step starts from A. Cubing an entry is an entrywise power, not the matrix power P3P^3.

How this lesson connects