Markov chains
In a Markov chain, what happens next depends only on where you are now. Weather from day to day, customers switching between shops, bikes moving between docking stations: a transition matrix holds the probabilities, its powers predict the future, and its steady state describes the long run.
1What you need to know
Tick these off as you go. By the end of the page you should be able to do all of them without notes.
- Draw and read transition diagramsAHL 4.19
- Write a transition matrix , where is the probability of moving from state to state AHL 4.19
- Use an initial state matrix and AHL 4.19
- Know what a regular Markov chain isAHL 4.19
- Find the steady state by repeated multiplication or by solving equationsAHL 4.19
- Know that the steady state is the eigenvector for the eigenvalue 1AHL 4.19
2Notes & worked examples
Each idea is followed by a worked example. Try the question yourself first, then reveal the solution one step at a time.
Each column of the transition matrix is a "from" state and lists where you go next, so each column adds to 1. Multiplying the current state vector by moves everyone one step. For a regular chain, doing this again and again settles down to the same long-run proportions, whatever the starting point.
2.1 Transition diagrams and matrices
Sunny (S) and rainy (R) days
In the diagram, an arrow from to labelled 0.3 means "if today is sunny, tomorrow is rainy with probability 0.3". The arrows leaving each state add to 1. In the transition matrix, column holds the probabilities of leaving state : , with columns and rows in the order .
is the initial state matrix: probabilities (adding to 1) or numbers of people (adding to the total).
2.2 Steady state
A Markov chain is regular if some power of has all entries positive (every state can reach every state). A regular chain has a unique steady state , and for any start. Find it by working out for large (all columns become ), or exactly by solving with the entries adding to 1. This is the eigenvector of for eigenvalue 1.
2.3 Three or more states
Monthly switching between supermarkets A, B and C
2.4 When there is no single steady state
Not every chain is regular. An absorbing state is one you never leave (a 1 on the diagonal): everyone eventually ends up there, so the long run depends on that state, not on mixing. A chain that alternates, such as , never settles: keeps switching between two matrices.
On the TI-Nspire, store the transition matrix as t and the initial state as a column, for example s:=[[300][500][200]]. Then t^2·s gives the state after 2 steps. For the steady state, try t^50 and t^51: if they agree, every column is the steady state. Alternatively, eigVc(t) gives eigenvectors; divide the one for by the sum of its entries. If the question asks for exact values, solve the equations by hand or with solve.
3Explore it
A two-state chain starting in state A. Set the probabilities of staying in A and of staying in B, and the number of steps n. The bars show the probabilities of being in A and B after n steps; the readout shows the steady state they approach.
4Common mistakes & exam tips
Common mistakes
- Writing the "from" states as rows. In the IB convention, columns are "from" and add to 1.
- Multiplying in the wrong order: , not .
- Forgetting that the steady state must add to 1 (or to the total number).
- Using for "on day 3" when the start is day 1: that is 2 steps, not 3.
- Assuming every chain has a steady state that does not depend on the start.
Exam tips
- Label the rows and columns of your matrix with the states.
- Check that every column adds to 1 before you calculate anything.
- "Exact" steady state: solve with the sum condition; otherwise a high power of is fine.
- Give long-run answers in context: "in the long run about 45% of households use A".
5Practice
Fluency questions build the basics. Problem-solving questions make you think about which method to use.
6Exam-style questions
Original questions in the style of the IB Maths AI HL exam, with full markschemes. Your GDC is allowed throughout: use it, but write down what you entered and what it gave you. Give yourself about 1 minute per mark.
Each day Nia either goes to the gym () or stays at home (). If she goes to the gym one day, the probability that she goes the next day is 0.75. If she stays at home one day, the probability that she goes to the gym the next day is 0.4.
- (a)Write down the transition matrix , with columns representing the current day.[2]
- (b)Nia goes to the gym on Monday. Find the probability that she goes to the gym on Wednesday.[2]
- (c)Find, as an exact fraction, the long-term proportion of days on which Nia goes to the gym.[2]
| (a) | |
| A2 | |
| A1 for one correct column. | |
| (b) | |
| (M1) | |
| A1 | |
| (c) | |
| , | (M1) |
| A1 | |
A city bike scheme has three docking stations, , and . Each day the bikes move between stations as shown in the transition diagram.At the start of Monday there are 120 bikes at , 80 at and 100 at .
- (a)Write down the transition matrix , with columns and rows in the order .[2]
- (b)Find the number of bikes at each station at the start of Tuesday.[2]
- (c)Find the number of bikes at after 7 days, to the nearest whole number.[2]
- (d)Find the long-term number of bikes at each station.[3]
- (e)Station has 80 docks. Comment on whether this is enough in the long run.[1]
| (a) | |
| A2 | |
| (b) | |
| (M1) | |
| 118, 102, 80 | A1 |
| (c) | |
| (M1) | |
| A1 | |
| (d) | |
| for large , or eigenvector for | (M1) |
| steady state | (A1) |
| 110, 130, 60 | A1 |
| (e) | |
| yes: in the long run about 60 bikes are at , fewer than 80 docks | R1 |
A machine part is either working () or failed (). Each week a working part fails with probability 0.3. A failed part is never repaired. The transition matrix, with columns in the order , is .
- (a)Explain what the entry 1 in represents.[1]
- (b)A part is working at the start. Find the probability that it has failed after 10 weeks.[2]
- (c)Explain why this Markov chain is not regular.[1]
- (d)Write down the long-term state of the part.[1]
| (a) | |
| a failed part stays failed ( is absorbing) | R1 |
| (b) | |
| (M1) | |
| A1 | |
| (c) | |
| every power of has a 0 in the top-right entry (a failed part can never become working) | R1 |
| (d) | |
| : it will certainly fail | A1 |
7Check yourself
Six quick questions, marked instantly. Aim for 6/6 before moving on. Fractions like 3/2 are accepted.
8Past-paper practice
Once you are scoring well above, try these real IB Maths AI HL questions on this topic. Your school or teacher will have the papers.
| Paper | Question | Focus | Difficulty |
|---|---|---|---|
| May 2021 · TZ1 · Paper 2 | Q5 | Sunny and not sunny days: powers and the steady state | ★★☆ |
| Nov 2025 · Paper 1 | Q16 | Bus, bicycle or taxi: a three-state transition diagram | ★★☆ |
| May 2024 · TZ1 · Paper 1 | Q17 | Customers switching between two coffee shops | ★★☆ |
| May 2025 · TZ3 · Paper 1 | Q15 | General two-state chain: the eigenvector for eigenvalue 1 | ★★★ |
| May 2025 · TZ1 · Paper 3 | Q1 | Markov chains modelling customers in a commercial setting | ★★★ |
