Skip to content
IB Diploma ProgrammeSL & HL

Matrix algebra

Mathematics: Applications and Interpretation SL & HL Chapter Notes

Last updated November 2026

ShareWhatsAppPost

Matrix algebra notes as a printable PDF.

Read online free. Download a watermarked copy with a free account.

Read the notes

The full Matrix algebra notes as text: skim, search, and jump between subtopics.

~16 min read

1. Matrices, order and equality

A matrix is a rectangular array of numbers arranged in rows and columns. Each number is an element.

A matrix with m rows and n columns has order m × n. Say the rows first. The element in row i and column j is written a_ij.

Two matrices are equal only when they have the same order and every pair of corresponding elements is equal. Equal matrices give one equation for each element.

A = beginpmatrixa₁₁ & a₁₂ & a₁₃ a₂₁ & a₂₂ & a₂₃endpmatrix order 2 × 3

A = B iff same order and a_ij = b_ij for every i, j

Worked example 14 marks

Let M = beginpmatrix2 & -1 & 4 0 & 5 & 3endpmatrix.

(a) State the order of M.

(b) Write down the element in row 2 and column 3 of M.

(c) Given that beginpmatrixx & 3 2 & y+1endpmatrix = beginpmatrix4 & 3 2 & 7endpmatrix, find the values of x and y.

  1. 1

    A1:(a) M has 2 rows and 3 columns, so the order is 2 × 3 [1]

  2. 2

    A1:(b) m₂₃ = 3 [1]

  3. 3

    Equal matrices: corresponding elements are equal, so x = 4 and y + 1 = 7

  4. 4

    A1A1:(c) x = 4 and y = 6 [2]

2. Adding, subtracting and multiplying by a scalar

Add or subtract matrices of the same order by adding or subtracting corresponding elements. Matrices of different order cannot be added or subtracted.

To multiply a matrix by a scalar k, multiply every element by k.

On the GDC, enter each matrix in the matrix editor, then type the expression, for example 2A - 3B.

A ± B = (a_ij ± b_ij)

kA = (k a_ij)

Worked example 13 marks

Let A = beginpmatrix3 & -2 1 & 4endpmatrix and B = beginpmatrix1 & 5 -3 & 2endpmatrix.

Calculate 2A - 3B.

  1. 1

    M1: attempt to multiply each matrix by its scalar: 2A = beginpmatrix6 & -4 2 & 8endpmatrix and 3B = beginpmatrix3 & 15 -9 & 6endpmatrix [1]

  2. 2

    A1: subtract corresponding elements: 6 - 3 = 3, -4 - 15 = -19, 2 - (-9) = 11, 8 - 6 = 2 [1]

  3. 3

    A1: 2A - 3B = beginpmatrix3 & -19 11 & 2endpmatrix [1]

3. Multiplying matrices

Two matrices can be multiplied only when the number of columns of the first equals the number of rows of the second. An m × n matrix times an n × q matrix gives an m × q matrix.

Each element of the product is a row of the first matrix multiplied term by term with a column of the second, then added. Matrix multiplication is associative and distributive, but it is non-commutative.

For example, with A = beginpmatrix1 & 2 0 & 1endpmatrix and B = beginpmatrix1 & 0 3 & 1endpmatrix, AB = beginpmatrix7 & 2 3 & 1endpmatrix but BA = beginpmatrix1 & 2 3 & 7endpmatrix.

To solve a practical problem, put the quantities in one matrix and the prices or rates in another, so that the product gives the totals.

(m × n)(n × q) gives m × q

(AB)C = A(BC)

A(B + C) = AB + AC

AB ≠ BA in general

Worked example 13 marks

A cafe sells three drinks. The matrix S shows the number of each drink sold on Monday (row 1) and on Tuesday (row 2). The column vector p gives the price of each drink in dollars.

S = beginpmatrix40 & 25 & 10 30 & 35 & 20endpmatrix and p = beginpmatrix2.5 3 4endpmatrix

Calculate the money taken on each day, using matrix multiplication.

  1. 1

    M1: attempt to find Sp: orders 2 × 3 and 3 × 1 give a 2 × 1 product, one total for each day [1]

  2. 2

    A1: Monday: 40 × 2.5 + 25 × 3 + 10 × 4 = 100 + 75 + 40 = 215 dollars [1]

  3. 3

    A1: Tuesday: 30 × 2.5 + 35 × 3 + 20 × 4 = 75 + 105 + 80 = 260 dollars, so Sp = beginpmatrix215 260endpmatrix [1]

4. Identity, zero, determinant and inverse

The identity matrix I has 1 on the leading diagonal and 0 everywhere else. It leaves a matrix unchanged. The zero matrix 0 has every element 0.

For a 2 × 2 matrix, the determinant is ad - bc. The matrix has an inverse when its determinant is not zero. To find the inverse by hand, swap a and d, change the signs of b and c, then divide by the determinant.

A matrix times its inverse is I. For an n × n matrix, use technology: enter the matrix, then evaluate its determinant and its inverse on the GDC.

AI = IA = A

A = beginpmatrixa & b c & dendpmatrix: det A = ad - bc

A⁻¹ = 1/(ad - bc)beginpmatrixd & -b -c & aendpmatrix

AA⁻¹ = A⁻¹A = I

Worked example 13 marks

Let M = beginpmatrix4 & 3 2 & 2endpmatrix.

(a) Calculate det M.

(b) Find M⁻¹.

  1. 1

    A1:(a) det M = 4 × 2 - 3 × 2 = 2 [1]

  2. 2

    M1:(b) swap the leading diagonal, change the signs of the other two elements, divide by the determinant: M⁻¹ = 1/2beginpmatrix2 & -3 -2 & 4endpmatrix [1]

  3. 3

    A1: M⁻¹ = beginpmatrix1 & -1.5 -1 & 2endpmatrix. Check: MM⁻¹ = beginpmatrix1 & 0 0 & 1endpmatrix [1]

5. Writing a system as Ax = b

A system of linear equations can be written in the form Ax = b. The matrix A holds the coefficients, the column vector x holds the unknowns, and the column vector b holds the constants.

Each row of A is one equation. Each column of A belongs to one unknown. Write the unknowns in the same order in every equation, and put 0 where an unknown is missing.

In examinations A will always be an invertible matrix, except when solving for eigenvectors.

beginaligned a₁x + b₁y + c₁z &= d₁ a₂x + b₂y + c₂z &= d₂ a₃x + b₃y + c₃z &= d₃ endaligned

beginpmatrixa₁ & b₁ & c₁ a₂ & b₂ & c₂ a₃ & b₃ & c₃endpmatrixbeginpmatrixx y zendpmatrix=beginpmatrixd₁ d₂ d₃endpmatrix

Worked example 12 marks

A school sells adult tickets at 6 dollars, student tickets at 4 dollars and child tickets at 2 dollars. It sells 100 tickets and takes 320 dollars. It sells as many adult tickets as student tickets. Let x, y and z be the numbers of adult, student and child tickets.

Write down the system of equations in the form Ax = b.

  1. 1

    Equations: x + y + z = 100, 6x + 4y + 2z = 320, x - y + 0z = 0

  2. 2

    A1: A = beginpmatrix1 & 1 & 1 6 & 4 & 2 1 & -1 & 0endpmatrix [1]

  3. 3

    A1: x = beginpmatrixx y zendpmatrix and b = beginpmatrix100 320 0endpmatrix [1]

6. Solving a system with the inverse matrix

To solve Ax = b using the inverse matrix, multiply both sides on the left by A⁻¹. Since A⁻¹A = I and Ix = x, the solution is x = A⁻¹b.

Order matters because matrix multiplication is non-commutative. Write A⁻¹ in front of b. The product bA⁻¹ does not exist for a column vector b.

For a 2 × 2 system, find the inverse by hand. For a 3 × 3 system, enter A and b on the GDC and evaluate A⁻¹b. Check the answer in an original equation.

Ax = b

A⁻¹Ax = A⁻¹b

x = A⁻¹b

Worked example 14 marks

A shop sells notebooks and pens. Two notebooks and one pen cost 7 dollars. One notebook and three pens cost 11 dollars.

Let x be the cost of a notebook and y the cost of a pen, in dollars. Use an inverse matrix to determine x and y.

  1. 1

    A1: beginpmatrix2 & 1 1 & 3endpmatrixbeginpmatrixx yendpmatrix=beginpmatrix7 11endpmatrix, so A = beginpmatrix2 & 1 1 & 3endpmatrix and b = beginpmatrix7 11endpmatrix [1]

  2. 2

    A1: det A = 2 × 3 - 1 × 1 = 5, so A⁻¹ = 1/5beginpmatrix3 & -1 -1 & 2endpmatrix [1]

  3. 3

    M1: evidence of using the inverse: x = A⁻¹b = 1/5beginpmatrix3 & -1 -1 & 2endpmatrixbeginpmatrix7 11endpmatrix= 1/5beginpmatrix10 15endpmatrix [1]

  4. 4

    A1: x = 2 and y = 3. Check: 2 × 2 + 3 = 7 and 2 + 3 × 3 = 11 [1]

7. Working backwards with the inverse

A transition matrix takes a vector one step forward: next month's vector is T times this month's. To go one step back, multiply by the inverse. If C = TP, then P = T⁻¹C.

Do not multiply by T itself. That predicts the next month, not the previous one. The markscheme gives the method mark for evidence of using the inverse of the matrix. It also credits a second route, evidence of using simultaneous equation (the markscheme's own words).

State the answer in context, as a proportion or a percentage of each kind of customer. Transition matrices link to Markov chains (AHL 4.19).

C = TP

P = T⁻¹C

Worked example 13 marks

Krauss works at a coffee shop and finds that this month, 65% of customers ordered regular coffee and 35% of customers ordered decaf coffee. This information can be displayed as the following column vector.

C = beginpmatrix0.65 0.35endpmatrix

Krauss believes that customers change their choices each month according to the following transition matrix.

T = beginpmatrix0.8 & 0.3 0.2 & 0.7endpmatrix

(a) Use Krauss' transition matrix to predict the proportion of customers who ordered regular coffee and decaf coffee in the previous month.

  1. 1

    M1: evidence of using the inverse of matrix T. det T = 0.8 × 0.7 - 0.3 × 0.2 = 0.5 [1]

  2. 2

    A1: C_last month = T⁻¹C, where T⁻¹ = beginpmatrix1.4 & -0.6 -0.4 & 1.6endpmatrix [1]

  3. 3

    Working: 1.4 × 0.65 - 0.6 × 0.35 = 0.7 and -0.4 × 0.65 + 1.6 × 0.35 = 0.3

  4. 4

    A1: beginpmatrix0.7 0.3endpmatrix or 70% ordered regular coffee and 30% ordered decaf [1]

Recap

  • A matrix has order m × n: rows first. Equal matrices have the same order and equal corresponding elements.
  • Add and subtract matrices of the same order element by element. A scalar multiplies every element.
  • The product AB needs columns of A equal to rows of B, and AB ≠ BA in general. AI = IA = A.
  • A⁻¹ = 1/(ad - bc) times the matrix with a and d swapped and b and c negated. Solve Ax = b with x = A⁻¹b.

End-of-chapter exercise

Test yourself on the whole chapter. Work through these before moving on.

  1. State the order of the matrix beginpmatrix4 & 0 & -2 1 & 7 & 5endpmatrix.1 mark
    Answer
    1. 2 × 3: two rows and three columns.

    Trap: Writing 3 × 2. The order always gives the rows first.

  2. Do not use a calculator. Let A = beginpmatrix2 & -1 4 & 3endpmatrix and B = beginpmatrix5 & 0 -2 & 1endpmatrix. Calculate A - 2B.2 marks
    Answer
    1. 2B = beginpmatrix10 & 0 -4 & 2endpmatrix.
    2. A - 2B = beginpmatrix-8 & -1 8 & 1endpmatrix, since 4 - (-4) = 8 and 3 - 2 = 1.

    Trap: A sign slip in the second row: 4 - (-4) is 8, not 0. Doubling every element of B before subtracting avoids the other common slip.

  3. Matrix P has order 3 × 2 and matrix Q has order 2 × 4. (a) State the order of PQ. (b) State whether QP exists.2 marks
    Answer
    1. (a)
    2. PQ has order 3 × 4: the inner numbers match (both 2).
    3. (b)
    4. QP does not exist: Q has 4 columns but P has 3 rows.

    Trap: Assuming QP exists because PQ does. For QP the inner numbers are 4 and 3, which do not match.

  4. Do not use a calculator. Let A = beginpmatrix1 & 2 3 & 4endpmatrix and B = beginpmatrix0 & 1 1 & 0endpmatrix. (a) Calculate AB and BA. (b) State whether AB = BA.4 marks
    Answer
    1. (a)
    2. AB = beginpmatrix2 & 1 4 & 3endpmatrix, since 1 × 0 + 2 × 1 = 2, 1 × 1 + 2 × 0 = 1, 3 × 0 + 4 × 1 = 4 and 3 × 1 + 4 × 0 = 3.
    3. BA = beginpmatrix3 & 4 1 & 2endpmatrix.
    4. (b)
    5. No. AB ≠ BA, so the product is non-commutative.

    Trap: Multiplying element by element, which gives beginpmatrix0 & 2 3 & 0endpmatrix for AB. Multiply each row by each column and add.

  5. Do not use a calculator. Find the inverse of M = beginpmatrix6 & 4 2 & 3endpmatrix.3 marks
    Answer
    1. det M = 6 × 3 - 4 × 2 = 10.
    2. Swap 6 and 3, change the signs of 4 and 2: M⁻¹ = 1/10beginpmatrix3 & -4 -2 & 6endpmatrix.
    3. M⁻¹ = beginpmatrix0.3 & -0.4 -0.2 & 0.6endpmatrix. Check: MM⁻¹ = I.

    Trap: Forgetting to divide by the determinant, or changing the signs of a and d as well. The check MM⁻¹ = I fails.

  6. The matrix N = beginpmatrix2 & 1 & 0 1 & 3 & 2 0 & 1 & 4endpmatrix. Use your GDC to find (a) det N, (b) the element in row 1 and column 3 of N⁻¹.3 marks
    Answer
    1. (a)
    2. Enter N in the matrix editor. det N = 16.
    3. (b)
    4. Evaluate N⁻¹ on the GDC. The element in row 1 and column 3 is 0.125 (or 1/8).

    Trap: Reading row 3 and column 1, which is 0.0625. Count the row first, then the column.

  7. Do not use a calculator. A bakery's sales of muffins (column 1) and cookies (column 2) on Saturday (row 1) and Sunday (row 2) are S = beginpmatrix30 & 20 25 & 40endpmatrix. A muffin costs 1.5 dollars and a cookie 0.8 dollars, so p = beginpmatrix1.5 0.8endpmatrix. (a) Calculate Sp. (b) State what each element of Sp represents.3 marks
    Answer
    1. (a)
    2. Sp = beginpmatrix30 × 1.5 + 20 × 0.8 25 × 1.5 + 40 × 0.8endpmatrix = beginpmatrix61 69.5endpmatrix.
    3. (b)
    4. Row 1 is the money taken on Saturday, 61 dollars. Row 2 is the money taken on Sunday, 69.5 dollars.

    Trap: Writing pS. A 2 × 1 matrix times a 2 × 2 matrix does not exist.

  8. Do not use a calculator. Consider the system 3x - 2y = 8 and 4x + y = 7. (a) Write the system in the form Ax = b. (b) Hence use an inverse matrix to determine x and y.4 marks
    Answer
    1. (a)
    2. beginpmatrix3 & -2 4 & 1endpmatrixbeginpmatrixx yendpmatrix = beginpmatrix8 7endpmatrix.
    3. (b)
    4. det A = 3 × 1 - (-2) × 4 = 11, so A⁻¹ = 1/11beginpmatrix1 & 2 -4 & 3endpmatrix.
    5. x = A⁻¹b = 1/11beginpmatrix22 -11endpmatrix, since 1 × 8 + 2 × 7 = 22 and -4 × 8 + 3 × 7 = -11.
    6. x = 2 and y = -1. Check: 6 + 2 = 8 and 8 - 1 = 7.

    Trap: A sign slip in the determinant: 3 - (-8) is 11, not -5. The slip makes every element of the answer wrong.

  9. Do not use a calculator. A message is coded in pairs of letters, with A = 1, B = 2, and so on to Z = 26. Each pair, as a column vector, is multiplied on the left by M = beginpmatrixa & 1 3 & 2endpmatrix. The letters G and O (7 and 15) are coded as beginpmatrix29 51endpmatrix. (a) Find the value of a. (b) Find M⁻¹. (c) Hence decode the vector beginpmatrix25 42endpmatrix.6 marks
    Answer
    1. (a)
    2. M1: Mbeginpmatrix7 15endpmatrix = beginpmatrix7a + 15 21 + 30endpmatrix, and equal matrices give 7a + 15 = 29.
    3. A1: a = 2. Check: the second element is 51, as given.
    4. (b)
    5. M1: det M = 2 × 2 - 1 × 3 = 1.
    6. A1: M⁻¹ = beginpmatrix2 & -1 -3 & 2endpmatrix.
    7. (c)
    8. M1: M⁻¹beginpmatrix25 42endpmatrix = beginpmatrix50 - 42 -75 + 84endpmatrix = beginpmatrix8 9endpmatrix.
    9. A1: the letters are H and I. Check: Mbeginpmatrix8 9endpmatrix = beginpmatrix16 + 9 24 + 18endpmatrix = beginpmatrix25 42endpmatrix.

    Trap: Decoding with M instead of M⁻¹ gives beginpmatrix92 159endpmatrix, which is not a pair of letters; the method mark needs evidence of using the inverse.

  10. A farmer mixes three feeds, X, Y and Z. The table gives the grams of protein, fat and fibre in 1 kg of each feed. The mix must contain exactly 1900 g of protein, 800 g of fat and 950 g of fibre. Let x, y and z kg be the masses of X, Y and Z in the mix. (a) Write down a system of equations in the form Ax = b. (b) Use an inverse matrix to determine x, y and z. (c) X, Y and Z cost 1.20, 0.80 and 1.50 dollars per kg. Use matrix multiplication to calculate the cost of the mix. | | X | Y | Z | | --- | --- | --- | --- | | Protein (g) | 200 | 100 | 300 | | Fat (g) | 50 | 150 | 100 | | Fibre (g) | 100 | 200 | 50 |7 marks
    Answer
    1. (a)
    2. A1: one equation for each nutrient, so each row of A is a row of the table: A = beginpmatrix200 & 100 & 300 50 & 150 & 100 100 & 200 & 50endpmatrix.
    3. A1: x = beginpmatrixx y zendpmatrix and b = beginpmatrix1900 800 950endpmatrix.
    4. (b)
    5. M1: enter A and b on the GDC and evaluate x = A⁻¹b.
    6. A1A1: x = 4, y = 2, z = 3, so 4 kg of X, 2 kg of Y and 3 kg of Z. Check protein: 800 + 200 + 900 = 1900.
    7. (c)
    8. A1: beginpmatrix1.2 & 0.8 & 1.5endpmatrixbeginpmatrix4 2 3endpmatrix = 4.8 + 1.6 + 4.5 = 10.9, so the mix costs 10.90 dollars.

    Trap: Putting each feed in a row of A (the table turned on its side) gives y ≈ -18.5, a negative mass: each row of A must be one equation.

Say this, not that

Wording that loses the mark, against the wording the mark scheme credits.

Loses the markGets the mark
AB = BA for any two matricesAB ≠ BA in general: matrix multiplication is non-commutative
x = bA⁻¹, with the inverse on the rightx = A⁻¹b, with the inverse in front of b
A⁻¹ = beginpmatrixa & b c & dendpmatrix divided by ad - bc, with nothing swapped or negatedswap a and d, change the signs of b and c, then divide by det A = ad - bc
TC = beginpmatrix0.625 0.375endpmatrix given as the previous monthevidence of using the inverse: T⁻¹C = beginpmatrix0.7 0.3endpmatrix is the previous month

Frequently asked questions

What is the order of a matrix?
A matrix with m rows and n columns has order m × n. Say the rows first. For M = beginpmatrix2 & -1 & 4 0 & 5 & 3endpmatrix the order is 2 × 3, and the element in row 2 and column 3 is 3. Two matrices are equal only when they have the same order and equal corresponding elements.
How do you add, subtract or multiply a matrix by a scalar?
Add or subtract matrices of the same order by combining corresponding elements. To multiply by a scalar k, multiply every element by k. For 2A - 3B with A = beginpmatrix3 & -2 1 & 4endpmatrix and B = beginpmatrix1 & 5 -3 & 2endpmatrix, the result is beginpmatrix3 & -19 11 & 2endpmatrix.
How do you multiply two matrices, and does the order matter?
Multiply the rows of the first matrix by the columns of the second, term by term, then add. An m × n matrix times an n × q matrix gives an m × q matrix. Matrix multiplication is non-commutative, so AB ≠ BA in general. For A = beginpmatrix1 & 2 0 & 1endpmatrix and B = beginpmatrix1 & 0 3 & 1endpmatrix, AB = beginpmatrix7 & 2 3 & 1endpmatrix but BA = beginpmatrix1 & 2 3 & 7endpmatrix.
How do you find the inverse of a 2 by 2 matrix?
Find the determinant ad - bc. The matrix has an inverse only when this is not zero. Swap a and d, change the signs of b and c, then divide by the determinant. For M = beginpmatrix4 & 3 2 & 2endpmatrix, det M = 2 and M⁻¹ = beginpmatrix1 & -1.5 -1 & 2endpmatrix. Check that MM⁻¹ = I.
How do you solve a system of equations using an inverse matrix?
Write the system as Ax = b, then multiply on the left by A⁻¹, so x = A⁻¹b. Order matters, so write A⁻¹ in front of b. For 2x + y = 7 and x + 3y = 11, det A = 5 and x = 1/5beginpmatrix3 & -1 -1 & 2endpmatrixbeginpmatrix7 11endpmatrix, giving x = 2 and y = 3.
What is a common error when writing a system of equations as a matrix equation?
Each row of A must be one equation, with each column belonging to one unknown. Putting the unknowns in a different order in each equation, or putting a feed in a row of A instead of an equation, gives the wrong system. Writing x = bA⁻¹ puts the inverse on the wrong side, since matrix multiplication is non-commutative.

Free notes are just the start.

Unlock every Workbook and Chapter at a Glance, and generate your own worksheets and predicted papers.

Explore plans

Related chapters