IB Maths Help logoIB Maths Help

Matrix powers (transition / Markov chains)

Find the state of a Markov chain after n steps, and its long-term state, with the exact key presses for the TI-84 Plus CE, Casio fx-CG50, Casio fx-CG100 and TI-Nspire CX, plus what to write in the exam.

Used inAI HL

To find the state after n steps, store the transition matrix and the starting state as matrices, then enter the matrix raised to the power n and multiplied by the starting state. For the long-term state, use a large power such as 50: the answer stops changing, and that settled answer is the steady state. This guide is for AI HL.

Example

Each week, 70% of the customers of shop P stay with P and 30% move to shop Q. Each week, 40% of the customers of Q move to P and 60% stay with Q. At the start there are 200 customers of P and 100 of Q. (a) Find the number of customers of each shop after 4 weeks. (b) Find the number of customers of each shop in the long term, to the nearest whole number.

The transition matrix is T=(0.70.40.30.6)T = \begin{pmatrix}0.7 & 0.4 \\ 0.3 & 0.6\end{pmatrix} and the starting state is s0=(200100)s_0 = \begin{pmatrix}200 \\ 100\end{pmatrix}. After 4 weeks the state is T4s0T^4 s_0, which is 171.66 customers of P and 128.34 of Q. For the long term use a large power: T50s0T^{50} s_0 is 171.4285714 and 128.5714286, so about 171 customers of P and 129 of Q.

Choose your calculator

How to raise a matrix to a power on a TI-84 Plus CE

The state after n steps

Enter the transition matrix as [A], with the same layout as in the question (each column adds to 1), and the starting state as a one-column matrix [B]. For the example, [A] is 2 × 2 with rows 0.7 0.4 and 0.3 0.6, and [B] is 2 × 1 holding 200 and 100. The steps for the matrix editor are in matrix operations and solving systems.

Press 2nd mode (QUIT) to return to the home screen. Press 2nd x⁻¹ (MATRIX) and choose 1:[A] from the NAMES list. The name must be pasted from this list, because it cannot be typed. Then press ^ 4 ×, press 2nd x⁻¹ (MATRIX) again and choose 2:[B].

[A]^4*[B]

Press enter. The answer is a column holding the number in each state after 4 steps.

After 4 weeks there are 171.66171.66 customers of P and 128.34128.34 of Q.

[A]^4*[B]
[[171.66]
[128.34]]

The long-term state

Use the same entry with a large power. Press 2nd enter (ENTRY) to bring the last line back, change the 4 to 50, and press enter.

The numbers settle at 171.4285714171.4285714 and 128.5714286128.5714286, which is 171171 and 129129 to 3 significant figures.

[A]^50*[B]
[[171.4285714]
[128.5714286]]

To see the long-term proportions, enter [A]^50 on its own: every column is the same, and each column is the steady state. The power can be any whole number from 0 to 255.

Check the answer by adding the two numbers: they should still total the starting number, here 300. If they do not, the columns of the matrix probably do not add to 1.

How to raise a matrix to a power on a Casio fx-CG50

The state after n steps

Store the transition matrix in Mat A, with the same layout as in the question (each column adds to 1), and the starting state as a one-column matrix in Mat B. For the example, Mat A is 2 × 2 with rows 0.7 0.4 and 0.3 0.6, and Mat B is 2 × 1 holding 200 and 100. The steps for the matrix editor are in matrix operations and solving systems.

Press MENU and choose Run-Matrix. Press OPTN, then F2 (MAT/VCT), then F1 (Mat), then ALPHA X,θ,T (A). Press ^ 4 ▶ ×, then OPTN F2 F1 again and ALPHA log (B).

Mat A^4×Mat B

Press EXE. The answer is a column holding the number in each state after 4 steps.

After 4 weeks there are 171.66171.66 customers of P and 128.34128.34 of Q.

Mat A^4×Mat B
[[171.66]
[128.34]]

The long-term state

Enter the same calculation with a large power, Mat A^50×Mat B, and press EXE.

The numbers settle at 171.429171.429 and 128.571128.571, which is 171171 and 129129 to 3 significant figures.

Mat A^50×Mat B
[[171.429]
[128.571]]

To see the long-term proportions, enter Mat A^50 on its own: every column is the same, and each column is the steady state.

Check the answer by adding the two numbers: they should still total the starting number, here 300. If they do not, the columns of the matrix probably do not add to 1.

How to raise a matrix to a power on a Casio fx-CG100

The state after n steps

Store the transition matrix in Mat A, with the same layout as in the question (each column adds to 1), and the starting state as a one-column matrix in Mat B. For the example, Mat A is 2 × 2 with rows 0.7 0.4 and 0.3 0.6, and Mat B is 2 × 1 holding 200 and 100. The steps for the Matrix tab are in matrix operations and solving systems.

Press HOME and choose Calculate. Press CATALOG, choose Matrix and then Matrix, and pick Mat A. Then press ^ 4 ▶ × and paste Mat B in the same way.

Mat A^4×Mat B

Press EXE. The answer is a column holding the number in each state after 4 steps.

After 4 weeks there are 171.66171.66 customers of P and 128.34128.34 of Q.

Mat A^4×Mat B
[[171.66]
[128.34]]

The long-term state

Enter the same calculation with a large power, Mat A^50×Mat B, and press EXE.

The numbers settle at 171.429171.429 and 128.571128.571, which is 171171 and 129129 to 3 significant figures.

Mat A^50×Mat B
[[171.429]
[128.571]]

To see the long-term proportions, enter Mat A^50 on its own: every column is the same, and each column is the steady state.

Check the answer by adding the two numbers: they should still total the starting number, here 300. If they do not, the columns of the matrix probably do not add to 1.

How to raise a matrix to a power on a TI-Nspire CX

The state after n steps

On a Calculator page create the transition matrix with menu → Matrix & Vector → Create → Matrix, with the same layout as in the question (each column adds to 1). Store it with ctrl var (sto→) under the name tm. Do the same for the starting state, a one-column matrix, under the name sv. For the example, tm is 2 × 2 with rows 0.7 0.4 and 0.3 0.6, and sv is 2 × 1 holding 200 and 100. The steps for creating a matrix are in matrix operations and solving systems.

Type tm ^ 4 ▶ × sv, so the line reads tm^4*sv, and press enter. The answer is a column holding the number in each state after 4 steps.

After 4 weeks there are 171.66171.66 customers of P and 128.34128.34 of Q.

tm^4*sv
[[171.66]
[128.34]]

The long-term state

Enter the same calculation with a large power, tm^50*sv, and press enter.

The numbers settle at 171.429171.429 and 128.571128.571, which is 171171 and 129129 to 3 significant figures.

tm^50*sv
[[171.429]
[128.571]]

To see the long-term proportions, enter tm^50 on its own: every column is the same, and each column is the steady state.

Check the answer by adding the two numbers: they should still total the starting number, here 300. If they do not, the columns of the matrix probably do not add to 1.

Sources. Key presses follow the manufacturers' documentation: the TI-84 Plus CE eGuide, the TI-Nspire eGuide, the Casio fx-CG50 Software User's Guide (version 3.30) and the Casio fx-CG100 online manual.

What to write in the exam

  • Write the matrix method. State the transition matrix TT, the starting state s0s_0, and that you used Tns0T^n s_0. Do not write the key presses.
  • Write the answer in the context. Say what each number means, for example the number of customers of each shop, not just the matrix.
  • Give 3 significant figures unless the question says otherwise, and keep the full calculator value for later parts instead of re-typing a rounded one.
  • Show that you used a large power for a long-term answer, or use the steady-state equation Ts=sTs = s when the question asks for an exact value.
  • Check the layout of the matrix. This guide uses the layout where each column of TT adds to 1 and the state is a column, so the order is Tns0T^n s_0. If the question gives rows that add to 1, follow its layout.

An exact steady state

A large power gives a decimal. For an exact value, solve Ts=sTs = s with the entries of ss adding to 1: write it as a system of equations and use solving a system of equations. The eigenvector for eigenvalue 1 also gives the steady state: see eigenvalues and eigenvectors.

Error messages and what to do

CalculatorMessageUsual causeWhat to try
TI-84 Plus CEERR:DIMENSION MISMATCHThe matrix and the starting-state matrix cannot be multiplied: the number of columns of the first must equal the number of rows of the second.Check [A] is square and [B] is one column with the same number of rows.
Casio fx-CG50Dimension ERRORThe matrix and the starting-state matrix have sizes that cannot be multiplied, or the matrix is not square.Check Mat A is square and Mat B is one column with the same number of rows.
Casio fx-CG100Dimension ERRORThe matrix and the starting-state matrix have sizes that cannot be multiplied, or the matrix is not square.Check Mat A is square and Mat B is one column with the same number of rows.
TI-Nspire CXDimension mismatchThe matrix and the starting-state matrix have sizes that cannot be multiplied.Check the transition matrix is square and the starting state is one column with the same number of rows.

Common mistakes

  • Multiplying in the wrong order. With a column state, write the matrix power first: Tns0T^n s_0, not s0Tns_0 T^n.
  • Using the wrong layout. In this guide each column of TT adds to 1. If the rows add to 1 instead, the matrix is the transpose of the one this method needs.
  • Typing the matrix name. On the TI-84 Plus CE the name [A] must be pasted from the MATRIX NAMES list, not typed.
  • Using a power that is too small. Check the long-term answer by trying a larger power: the numbers should not change to the places you give.
  • Writing key presses as working. Write the matrix, the power and the answer. The examiner needs the method, not the keys.

Try it yourself

Real questions from the IB Maths Help question bank. Type your answer and press Mark it: the worked solution and mark scheme then appear. Use your calculator to raise the matrix to a power.

Practise with your calculator

Choose your course to see the practice sets that use this skill. You can also try practice mode or browse every GDC guide.

Quick questions

How do I find the state after n steps of a Markov chain on a calculator?

Store the transition matrix and the starting state as matrices, then enter the matrix raised to the power n and multiplied by the starting state. With a column state and columns that add to 1, the order is the matrix power first.

How do I find the steady state on a calculator?

Raise the transition matrix to a large power such as 50. Every column of the result is the steady state, and the matrix multiplied by any starting state gives the long-term numbers. For an exact value, solve the steady-state equation instead.

Why does my answer not add up to the starting total?

The columns of the transition matrix should each add to 1. If a column does not, a value was typed wrongly or the matrix has rows and columns the wrong way round.

Do I write the key presses in my exam working?

No. Write the transition matrix, the starting state and the power you used, then the answer. Examiners look for the method, not the key presses.