Free access until 31 December 2026 · Physics and Maths questions and notes, updated continuously · Build a test

ExaminerPrep › IB Maths AI › Notes

IB Maths AI · Topic 1 · 1.6 · HL only

Matrices and matrix algebra

This note covers matrices: their size, how to add and multiply them, the identity, determinant and inverse, and how to use an inverse to solve systems of linear equations. Matrices organise tables of data and let one calculation handle many quantities at once.

Key ideas

A matrix is a rectangular array of numbers in rows and columns. Its order is \(m\times n\), meaning \(m\) rows and \(n\) columns. A matrix with one column is a column vector. A square matrix has equal numbers of rows and columns. The entry in row \(i\) and column \(j\) is written \(a_{ij}\).

Addition and scalar multiplication. Matrices are added or subtracted entry by entry, and only if they have the same order. A scalar multiple \(kA\) multiplies every entry by \(k\).

Matrix multiplication. The product \(AB\) exists only if the number of columns of \(A\) equals the number of rows of \(B\). If \(A\) is \(m\times n\) and \(B\) is \(n\times p\), then \(AB\) is \(m\times p\). Each entry of \(AB\) is found by taking a row of \(A\) and a column of \(B\), multiplying matching entries and adding them. Multiplication has these properties:

  • It is not commutative. In general \(AB\ne BA\), and one of them may not even exist.
  • It is associative, \((AB)C=A(BC)\), and distributive, \(A(B+C)=AB+AC\).
  • The identity matrix \(I\) has 1s on the main diagonal and 0s elsewhere, and \(AI=IA=A\).

Powers. For a square matrix, \(A^{2}=AA\), \(A^{3}=AAA\), and so on. Your GDC can compute \(A^{n}\) directly.

Determinant. For \(A=\begin{pmatrix}a&b\\c&d\end{pmatrix}\), the determinant is \(\det A=ad-bc\). If \(\det A=0\) the matrix is singular and has no inverse.

Inverse. If \(\det A\ne0\), the inverse is the matrix \(A^{-1}\) with \(AA^{-1}=A^{-1}A=I\). For a 2×2 matrix,

\[ A^{-1}=\frac{1}{ad-bc}\begin{pmatrix}d&-b\\-c&a\end{pmatrix} \]

For 3×3 matrices, use the GDC to find the determinant and inverse. The inverse of a product reverses the order: \((AB)^{-1}=B^{-1}A^{-1}\).

Solving systems. A system such as \(ax+by=p\), \(cx+dy=q\) can be written \(AX=B\) with \(A=\begin{pmatrix}a&b\\c&d\end{pmatrix}\), \(X=\begin{pmatrix}x\\y\end{pmatrix}\) and \(B=\begin{pmatrix}p\\q\end{pmatrix}\). If \(A\) is invertible, multiply both sides on the left by \(A^{-1}\) to get \(X=A^{-1}B\). The same method works for three equations in three unknowns, using the GDC to enter \(A\) and \(B\) and compute \(A^{-1}B\). When \(\det A=0\), the system has either no solution or infinitely many.

Matrices in context. A matrix can store a table, such as the quantities of each part used by two workshops. Multiplying that matrix by a column of prices gives the cost for each workshop. Check that the order of the matrices lines up with the meaning of the rows and columns.

Using the GDC. Enter each matrix in the matrix editor, giving its order first. You can then compute sums, products, powers, determinants and inverses with the matrix menu. Name your matrices clearly, for example \([A]\) and \([B]\), and write down the result you read from the screen. For a 3×3 system, enter the coefficient matrix and the column of constants, and calculate \([A]^{-1}[B]\) in that order. If the calculator reports an error, check whether the determinant is zero.

Checking a solution. Substitute your values back into the original equations. For a matrix product, check that the answer has the order you predicted. A product of a \(2\times2\) and a \(2\times1\) matrix must be \(2\times1\). If it is not, the multiplication was set up wrongly.

Definitions and formulae

Term or formulaMeaning / when to use
Order \(m\times n\)\(m\) rows and \(n\) columns. Always rows first.
\((AB)_{ij}=\sum_{k}a_{ik}b_{kj}\)The entry in row \(i\), column \(j\) of a product.
\(AI=IA=A\)The identity matrix leaves a matrix unchanged.
\(\det\begin{pmatrix}a&b\\c&d\end{pmatrix}=ad-bc\)Determinant of a 2×2 matrix. Zero means no inverse.
\(A^{-1}=\dfrac{1}{\det A}\begin{pmatrix}d&-b\\-c&a\end{pmatrix}\)Inverse of a 2×2 matrix.
\(AX=B\Rightarrow X=A^{-1}B\)Solving a system of linear equations.
\((AB)^{-1}=B^{-1}A^{-1}\)Inverse of a product, with the order reversed.

Worked examples

Example 1 Let \(A=\begin{pmatrix}2&1\\3&4\end{pmatrix}\) and \(B=\begin{pmatrix}1&0\\2&5\end{pmatrix}\). Find \(AB\) and \(BA\).

\(AB\): row 1 of \(A\) with column 1 of \(B\) gives \(2\times1+1\times2=4\). Row 1 with column 2 gives \(2\times0+1\times5=5\).

Row 2 with column 1 gives \(3\times1+4\times2=11\). Row 2 with column 2 gives \(3\times0+4\times5=20\).

So \(AB=\begin{pmatrix}4&5\\11&20\end{pmatrix}\).

\(BA\): \(1\times2+0\times3=2\), \(1\times1+0\times4=1\), \(2\times2+5\times3=19\), \(2\times1+5\times4=22\).

Answer: \(AB=\begin{pmatrix}4&5\\11&20\end{pmatrix}\) and \(BA=\begin{pmatrix}2&1\\19&22\end{pmatrix}\), so \(AB\ne BA\).

Example 2 A cafe charges £7 for 2 coffees and 1 cake, and £18 for 3 coffees and 4 cakes. Use matrices to find the price of a coffee and of a cake.

Let \(x\) be the price of a coffee and \(y\) the price of a cake. Then \(2x+y=7\) and \(3x+4y=18\).

Write \(\begin{pmatrix}2&1\\3&4\end{pmatrix}\begin{pmatrix}x\\y\end{pmatrix}=\begin{pmatrix}7\\18\end{pmatrix}\).

\(\det A=2\times4-1\times3=5\), which is not zero, so \(A^{-1}\) exists: \(A^{-1}=\dfrac{1}{5}\begin{pmatrix}4&-1\\-3&2\end{pmatrix}\).

\(X=A^{-1}B=\dfrac{1}{5}\begin{pmatrix}4\times7-18\\-3\times7+2\times18\end{pmatrix}=\dfrac{1}{5}\begin{pmatrix}10\\15\end{pmatrix}=\begin{pmatrix}2\\3\end{pmatrix}\).

Check: \(2\times2+3=7\) and \(3\times2+4\times3=18\).

Answer: a coffee costs £2 and a cake costs £3.

Example 3 Two workshops use three parts. Workshop 1 uses 12, 8 and 5 of parts P, Q and R. Workshop 2 uses 10, 6 and 9. The parts cost £4.50, £2.25 and £3.00 each. Find the total cost of parts for each workshop.

Quantities matrix (2×3): \(Q=\begin{pmatrix}12&8&5\\10&6&9\end{pmatrix}\). Price vector (3×1): \(p=\begin{pmatrix}4.50\\2.25\\3.00\end{pmatrix}\).

The product \(Qp\) exists because \(Q\) has 3 columns and \(p\) has 3 rows, and it is 2×1.

Row 1: \(12\times4.50+8\times2.25+5\times3.00=54+18+15=87\).

Row 2: \(10\times4.50+6\times2.25+9\times3.00=45+13.5+27=85.5\).

Answer: \(Qp=\begin{pmatrix}87\\85.50\end{pmatrix}\), so the costs are £87.00 and £85.50.

Common errors

  • Common error: assuming \(AB=BA\), or multiplying entry by entry instead of row by column.
  • Common error: forgetting to divide by the determinant when finding an inverse, or swapping the wrong entries. The leading diagonal entries swap places, and the other two change sign.
  • Common error: writing \(X=BA^{-1}\) instead of \(X=A^{-1}B\). Multiply on the left, since the order matters.
  • Common error: trying to add matrices of different orders or multiply matrices whose inner dimensions do not match.
  • Common error: trying to find the inverse when the determinant is zero.

Exam tip: write the order of each matrix (for example \(2\times3\) times \(3\times1\)) before multiplying. It confirms the product exists and tells you the size of the answer.

Check yourself

  1. Find the inverse of \(\begin{pmatrix}3&2\\5&4\end{pmatrix}\).
    Answer\(\det=12-10=2\). \(A^{-1}=\dfrac12\begin{pmatrix}4&-2\\-5&3\end{pmatrix}=\begin{pmatrix}2&-1\\-2.5&1.5\end{pmatrix}\).
  2. Find \(M^{2}\) for \(M=\begin{pmatrix}1&1\\0&1\end{pmatrix}\).
    Answer\(M^{2}=\begin{pmatrix}1\times1+1\times0&1\times1+1\times1\\0&1\end{pmatrix}=\begin{pmatrix}1&2\\0&1\end{pmatrix}\).
  3. For which value of \(k\) is \(\begin{pmatrix}k&6\\2&3\end{pmatrix}\) singular?
    Answer\(\det=3k-12=0\), so \(k=4\).
  4. If \(A\) is \(2\times3\) and \(B\) is \(3\times4\), what is the order of \(AB\)? Does \(BA\) exist?
    Answer\(AB\) is \(2\times4\). \(BA\) does not exist, because \(B\) has 4 columns but \(A\) has only 2 rows.