James Ashton MathsFREE MATHEMATICS. OPEN TO EVERYONE.
HomeIB DiplomaA levelAbout

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.

AHL 4.19HL onlyPaper 1Paper 2Paper 3GDC allowed≈ 50 min to work through
Before you start: matrix multiplication (Matrices), eigenvectors and steady states (Eigenvalues & eigenvectors) and transition matrices for graphs (Graph theory).

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 T, where Tij is the probability of moving from state j to state iAHL 4.19
  • Use an initial state matrix and 𝐬n=Tn𝐬0AHL 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.

The big idea

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 T 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

0.70.30.40.6SR

Sunny (S) and rainy (R) days

In the diagram, an arrow from S to R 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 j holds the probabilities of leaving state j: T=(0.70.40.30.6), with columns and rows in the order S,R.

Markov chain formulas Not in booklet: learn it
𝐬n=Tn𝐬0T𝐬=𝐬  for the steady state 𝐬

𝐬0 is the initial state matrix: probabilities (adding to 1) or numbers of people (adding to the total).

Worked example 1Paper 1
Today is sunny. Find the probability that it is sunny in 3 days’ time.
𝐬0=(10)
𝐬3=T3𝐬0=(0.5830.417)
Enter T on the GDC and compute T³.
P(sunny)=0.583

2.2 Steady state

A Markov chain is regular if some power of T has all entries positive (every state can reach every state). A regular chain has a unique steady state 𝐬, and Tn𝐬0→𝐬 for any start. Find it by working out Tn for large n (all columns become 𝐬), or exactly by solving T𝐬=𝐬 with the entries adding to 1. This 𝐬 is the eigenvector of T for eigenvalue 1.

Worked example 2Paper 1
Find the exact long-run proportion of sunny days.
(0.70.40.30.6)(xy)=(xy)⇒0.7x+0.4y=x
0.3x=0.4y and x+y=1
x=47, y=37
In the long run, 47≈57% of days are sunny.
Worked example 3 (faded)Paper 1
A transition matrix has first column (0.55a). Find a.
Columns add to 1, so a= 0.45  ← you work this out

2.3 Three or more states

0.80.70.60.10.20.10.10.10.3ABC

Monthly switching between supermarkets A, B and C

Worked example 4Paper 2
In a town, 300 households use supermarket A, 500 use B and 200 use C. Find the numbers after 2 months and in the long run.
T=(0.80.20.10.10.70.30.10.10.6)
Columns: from A, from B, from C.
T2(300500200)=(396404200)
Steady state (0.450.350.20): in the long run 450, 350 and 200 households.
From T50, or the eigenvector for λ = 1 scaled to add to 1.

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 (0110), never settles: Tn keeps switching between two matrices.

Worked example 5Paper 1
A light bulb is working (W) or failed (F). Each month a working bulb fails with probability 0.3, and a failed bulb is never replaced. Explain why the chain is not regular, and find the probability that a working bulb has failed after 10 months.
T=(0.700.31): F is absorbing, so the top-right entry of Tn is always 0. Not regular.
T10(10)=(0.02820.972)
P(failed)=0.972
On your TI-Nspire Calculator tricks →

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 λ=1 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: 𝐬n=Tn𝐬0, not 𝐬0Tn.
  • Forgetting that the steady state must add to 1 (or to the total number).
  • Using Tn 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 T𝐬=𝐬 with the sum condition; otherwise a high power of T 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.

FluencyP1
Write down the transition matrix for: from X, 0.9 stay, 0.1 move to Y; from Y, 0.5 stay, 0.5 move to X.
(0.90.50.10.5)
FluencyP2
Find the steady state for the previous matrix.
0.1x=0.5y, x+y=1: (56,16)
FluencyP3
For the weather chain, find the probability of rain in 2 days if today is rainy.
T2(01): 0.48
FluencyP4
Is (0.510.50) regular? Explain.
Yes: T2=(0.750.50.250.5) has all entries positive.
Problem solvingP5
Show that the steady state of (1−aba1−b) is 1a+b(ba).
(1−a)x+by=x⇒ax=by; with x+y=1, x=ba+b.
Problem solvingP6
For the supermarkets, after how many months does A first have more than 440 households?
Tn𝐬0: 438.3 after 5 months, 443.0 after 6. So 6 months.

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.

Question 1Paper 1[6 marks]

Each day Nia either goes to the gym (G) or stays at home (H). 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 T, 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)
(0.750.40.250.6)A2
A1 for one correct column.
(b)
T2(10)(M1)
0.6625A1
(c)
0.25x=0.4y, x+y=1(M1)
813A1
Question 2Paper 2[10 marks]

A city bike scheme has three docking stations, P, Q and R. Each day the bikes move between stations as shown in the transition diagram.0.60.70.60.30.20.10.30.10.1PQRAt the start of Monday there are 120 bikes at P, 80 at Q and 100 at R.

  • (a)Write down the transition matrix T, with columns and rows in the order P,Q,R.[2]
  • (b)Find the number of bikes at each station at the start of Tuesday.[2]
  • (c)Find the number of bikes at Q after 7 days, to the nearest whole number.[2]
  • (d)Find the long-term number of bikes at each station.[3]
  • (e)Station R has 80 docks. Comment on whether this is enough in the long run.[1]
(a)
(0.60.20.30.30.70.10.10.10.6)A2
(b)
T(12080100)(M1)
P 118, Q 102, R 80A1
(c)
T7𝐬0(M1)
129A1
(d)
Tn for large n, or eigenvector for λ=1(M1)
steady state (0.3670.4330.2)(A1)
P 110, Q 130, R 60A1
(e)
yes: in the long run about 60 bikes are at R, fewer than 80 docksR1
Question 3Paper 1[5 marks]

A machine part is either working (W) or failed (F). Each week a working part fails with probability 0.3. A failed part is never repaired. The transition matrix, with columns in the order W,F, is T=(0.700.31).

  • (a)Explain what the entry 1 in T 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 (F is absorbing)R1
(b)
T10(10)(M1)
0.972A1
(c)
every power of T has a 0 in the top-right entry (a failed part can never become working)R1
(d)
(01): it will certainly failA1

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.

PaperQuestionFocusDifficulty
May 2021 · TZ1 · Paper 2Q5Sunny and not sunny days: powers and the steady state★★☆
Nov 2025 · Paper 1Q16Bus, bicycle or taxi: a three-state transition diagram★★☆
May 2024 · TZ1 · Paper 1Q17Customers switching between two coffee shops★★☆
May 2025 · TZ3 · Paper 1Q15General two-state chain: the eigenvector for eigenvalue 1★★★
May 2025 · TZ1 · Paper 3Q1Markov chains modelling customers in a commercial setting★★★
Spotted a mistake on this page?Tell me and I'll fix it. The button opens an email with this page already named, or write to jamesashtonmaths@gmail.com.
Report a mistake