A machine runs in one of two modes, A or B, and is inspected once an hour. If it is in mode A at this inspection, how likely is mode A at the next one, and would it help to know its mode at every earlier inspection? A Markov chain is a model in which the earlier modes add nothing once the current mode is known, although the next mode may still depend strongly on the current one. This lesson defines states and the Markov property, collects the one-step probabilities in a transition matrix, and shows how a starting distribution moves forward one step at a time.
Key terms
State
Definition A discrete-time random process describes a system at the steps , and the random variable is its state at step . The state space is the set of possible states, which in this course is finite or countable. Choosing the states is part of building the model. A Markov chain, defined in the next card, is a sensible model only when the state at step records everything about the history up to step that affects the probabilities of the next state.
In plain words A state is the label the model gives the system at one step, such as a mode, a location or a category. The labels have to be detailed enough that two histories ending in the same state predict the next step in the same way.
Example The machine in the opening has state space , and means that it runs in mode B at step . For a case where coarse labels fail, consider a constructed machine that is either ready or busy at each step. A ready machine starts a job at the next step with probability , whatever happened before. Every job lasts exactly two steps, after which the machine is ready again. A machine that is busy now and was ready one step earlier is busy at the next step with probability , while one that has been busy for two steps is ready at the next step with probability . So the two labels ready and busy do not say enough. Splitting busy into “first step of a job” and “second step of a job” gives three states whose next-step probabilities depend on the current state alone.
Markov chain
Definition A sequence of random variables with values in a finite or countable state space is a Markov chain if it has the Markov property. Take any , any states and , and any event that fixes the earlier states, where when . Whenever ,
The positivity condition makes both conditional probabilities well defined.
In plain words Once the current state is known, the earlier states add nothing to the prediction of the next state. This is not independence. The next state can depend strongly on the current one, and through the current one on the past. The property only says that the past matters for the next step through the current state alone.
Example In a constructed model, the two-mode machine moves from A to A with probability and from A to B with probability , and from B to A with probability and from B to B with probability , whatever its earlier modes were. This is a Markov chain. If the machine is in A now, the chance of A next is whether it was in A or in B one step earlier. Yet consecutive modes are dependent whenever both modes have positive probability at the earlier step. If and , then
while . The ready and busy machine of the previous card is not a Markov chain with its two coarse states, but it is one with the three refined states.
Time-homogeneous chain
Definition A Markov chain is time-homogeneous if its one-step transition probabilities do not depend on the step number. That is, there are numbers with
for every and all states with . The Markov property and time homogeneity are separate assumptions. A chain can have the Markov property while its transition probabilities change from one step to the next.
In plain words The same rule moves the chain at every step. Which part of the rule applies depends on the current state, but not on the clock.
Example The two-mode machine, which moves with the same probabilities , , and at every inspection, is time-homogeneous. A machine that stays in A with probability at daytime inspections but with probability at nighttime inspections, with no other dependence on the past, is still a Markov chain but is not time-homogeneous. The length of a step belongs to the rule as well. Probabilities for one-hour steps cannot be used as if each step were a day.
Transition matrix
Definition For a time-homogeneous chain on a finite state space whose states are listed in a fixed order, the transition matrix is with . This course uses the row-stochastic convention, so row belongs to the current state and column to the next state . Every entry is nonnegative, and for each state the row sums to ,
because from state the chain moves to exactly one state. The columns need not sum to . Some books use the transposed, column-stochastic convention. Either one works on its own, but mixing them in one calculation can give wrong answers.
In plain words Read row as the answer to the question “if the chain is in now, where does it go next?” A diagonal entry is the chance of staying in the same state for one step, and an off-diagonal entry is the chance of switching.
Example For the two-mode machine, with the states in the order A, B,
| Current state | Next A | Next B | Row sum |
|---|---|---|---|
| A | 0.8 | 0.2 | 1 |
| B | 0.3 | 0.7 | 1 |
The rows sum to , while the columns sum to and . The entry is not a timetable of four steps in A followed by a switch. A run in A of any length is possible, and at each step the run continues with probability . The row for B stays part of the model even if the machine starts in A for certain, because B can be reached later.
Initial distribution
Definition The initial distribution of a chain is the law of its starting state, written as the row vector whose entries are the probabilities for , in the same order as the rows of . Its entries are nonnegative and add to , and the transition matrix does not determine it. Together, and determine the probability of every path. By the multiplication rule for conditional probabilities, the Markov property and time homogeneity,
In plain words The matrix says how the chain moves, and the initial distribution says where it starts. A path probability multiplies the chance of the starting state by the chance of each move along the path. These factors are conditional probabilities, so the product is not a claim that the states are independent.
Example If the machine starts in A for certain, then and the path A, B, A has probability . If instead , the same path has probability . With the matrix alone, the probability of mode A at step is not determined. A start in A with probability , where , gives , which can be any number from to .
One-step update
Definition Let be the row vector of the probabilities for . For a time-homogeneous chain with transition matrix ,
Coordinate by coordinate, this is the law of total probability over the current state,
The new vector again has nonnegative entries that add to , because each row of sums to .
In plain words To find the chance of each next state, send the probability of every current state along its arrows and add what arrives at each state. The update averages the rows of , with the current probabilities as weights.
Example From , the A coordinate of is , and the B coordinate is , so
Starting in A for certain, two updates give and . The A coordinate of is , which adds the paths A, A, A and A, B, A. Repeating the update times amounts to multiplying by the matrix power , and splitting a run of steps at an intermediate time gives the Chapman-Kolmogorov relation. Both are developed in Multi-Step Markov Probabilities.
Check yourself
- The two-mode machine starts in B for certain. Find the distribution of and the probability of the path B, A, B.
Show the answer
The initial distribution is , so is the B row of , which is . The path B, A, B multiplies the chance of moving from B to A by the chance of moving from A to B, so its probability is . The second factor comes from the A row, because the chain is in A at step , and by the Markov property the earlier state B does not change it.
- With the same start in B, find the probability that the machine is in A at step . A classmate says that by the Markov property the state at step does not depend on the starting state, so the answer must equal the value found for a start in A. Explain the mistake.
Show the answer
Two disjoint paths end in A. The path B, A, A has probability , and the path B, B, A has probability , so
This differs from , so the starting state does matter. The Markov property says that earlier states add nothing once the current state is known. Here the state at step is not given, and the start influences step through it.
- Someone writes the machine’s rule as the matrix
and multiplies the row vector by it. What do they get, and which check exposes the mistake?
Show the answer
The product is , whose entries add to , so it is not a probability distribution. The rows of sum to and , so is not row-stochastic. It is the transpose of , with the current state in the columns, and using it with a row vector mixes the two conventions. The correct update is .