IB Diploma Mathematics AI · Number and algebra
Matrices (HL)
1What a matrix is
A matrix is a rectangular array of numbers. An $m \times n$ matrix has $m$ rows and $n$ columns.
- Matrices store data, such as quantities sold in different shops, or the coefficients of a system of equations.
- Two matrices can be added or subtracted only if they have the same order: add the matching entries.
- Scalar multiplication multiplies every entry by the number.
$\begin{pmatrix}1 & 2\\3 & 4\end{pmatrix} + \begin{pmatrix}5 & 0\\-1 & 2\end{pmatrix} = \begin{pmatrix}6 & 2\\2 & 6\end{pmatrix}$, and $3\begin{pmatrix}1 & 2\\3 & 4\end{pmatrix} = \begin{pmatrix}3 & 6\\9 & 12\end{pmatrix}$.
Check yourself
What is the order of a matrix with 2 rows and 3 columns?
Show the answer
2 × 3
Rows first, then columns.
2Multiplying matrices
To multiply $AB$, the number of columns of $A$ must equal the number of rows of $B$. An $m \times n$ matrix times an $n \times p$ matrix gives an $m \times p$ matrix.
Each entry is a row of $A$ times a column of $B$: multiply matching pairs and add.
A product
- $\begin{pmatrix}2 & 1\\0 & 3\end{pmatrix}\begin{pmatrix}4\\5\end{pmatrix}$.
- Top: $2 \times 4 + 1 \times 5 = 13$. Bottom: $0 \times 4 + 3 \times 5 = 15$.
- Result: $\begin{pmatrix}13\\15\end{pmatrix}$.
Sales and prices
- Shop sales of items X and Y: row 1 (shop A) is 10, 4; row 2 (shop B) is 6, 8. Prices: X costs 3 euros and Y costs 5 euros.
- $\begin{pmatrix}10 & 4\\6 & 8\end{pmatrix}\begin{pmatrix}3\\5\end{pmatrix} = \begin{pmatrix}50\\58\end{pmatrix}$: shop A takes 50 euros and shop B takes 58 euros.
In general $AB \ne BA$: the order matters.
Check yourself
A is 3 × 2 and B is 2 × 4. What is the order of AB?
Show the answer
3 × 4
The inner numbers match (2), and the outer numbers give the order.
3Determinant and inverse
The identity matrix $I = \begin{pmatrix}1 & 0\\0 & 1\end{pmatrix}$ acts like 1: $AI = IA = A$.
For $A = \begin{pmatrix}a & b\\c & d\end{pmatrix}$:
- The determinant is $\det A = ad - bc$.
- If $\det A \ne 0$, the inverse is $A^{-1} = \frac{1}{ad - bc}\begin{pmatrix}d & -b\\-c & a\end{pmatrix}$, and $AA^{-1} = I$.
- If $\det A = 0$, the matrix is singular and has no inverse.
An inverse
- $A = \begin{pmatrix}2 & 1\\5 & 3\end{pmatrix}$. $\det A = 6 - 5 = 1$.
- $A^{-1} = \begin{pmatrix}3 & -1\\-5 & 2\end{pmatrix}$.
- For larger matrices, use the calculator.
Check yourself
What is the determinant of the matrix with rows (4, 2) and (3, 5)?
Show the answer
14
4 × 5 − 2 × 3 = 14.
4Solving systems with matrices
A system of linear equations can be written as $AX = B$, where $A$ holds the coefficients, $X$ the unknowns and $B$ the constants. Then
$$X = A^{-1}B$$
A pair of equations
- Solve $2x + y = 5$ and $5x + 3y = 13$.
- $A = \begin{pmatrix}2 & 1\\5 & 3\end{pmatrix}$, $B = \begin{pmatrix}5\\13\end{pmatrix}$.
- $X = A^{-1}B = \begin{pmatrix}3 & -1\\-5 & 2\end{pmatrix}\begin{pmatrix}5\\13\end{pmatrix} = \begin{pmatrix}2\\1\end{pmatrix}$.
- So $x = 2$ and $y = 1$.
Multiply in the right order: $A^{-1}B$, not $BA^{-1}$. If $\det A = 0$, the system has either no solution or infinitely many.
Check yourself
In AX = B, how is X found?
Show the answer
X = A⁻¹B
Multiply both sides on the left by A⁻¹.
5Leslie matrices and population models
Matrices can model populations divided into age groups.
A two-stage population
- Juveniles $J$ and adults $A$. Each adult produces 2 juveniles per year; 40% of juveniles become adults; 70% of adults survive.
- Matrix: $\begin{pmatrix} J_{n+1} \\ A_{n+1} \end{pmatrix} = \begin{pmatrix} 0 & 2 \\ 0.4 & 0.7 \end{pmatrix}\begin{pmatrix} J_n \\ A_n \end{pmatrix}$.
- Starting with 100 juveniles and 50 adults: $J_1 = 100$, $A_1 = 40 + 35 = 75$.
Check yourself
What does each entry in a population matrix represent?
Show the answer
A rate of reproduction or survival between stages
Transition rates.
6Inverse matrices in practice
Solving with an inverse
- System: $2x + y = 7$, $x + 3y = 11$.
- Matrix form: $\begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 7 \\ 11 \end{pmatrix}$.
- Determinant: $6 - 1 = 5$. Inverse: $\frac{1}{5}\begin{pmatrix} 3 & -1 \\ -1 & 2 \end{pmatrix}$.
- Solution: $\frac{1}{5}\begin{pmatrix} 21 - 11 \\ -7 + 22 \end{pmatrix} = \begin{pmatrix} 2 \\ 3 \end{pmatrix}$.
Check yourself
When does a matrix have no inverse?
Show the answer
When its determinant is zero
Singular matrix.
7Going deeper: solving a system, transformations and a population model
Worked example (solving a system): $2x + 3y = 13$ and $5x - y = 7$.
- Write as $A\mathbf{x} = \mathbf{b}$ with $A = \begin{pmatrix} 2 & 3 \\ 5 & -1 \end{pmatrix}$ and $\mathbf{b} = \begin{pmatrix} 13 \\ 7 \end{pmatrix}$.
- $\det A = (2)(-1) - (3)(5) = -17$.
- $A^{-1} = \frac{1}{-17}\begin{pmatrix} -1 & -3 \\ -5 & 2 \end{pmatrix}$.
- $\mathbf{x} = A^{-1}\mathbf{b}$: $x = \frac{-13 - 21}{-17} = 2$ and $y = \frac{-65 + 14}{-17} = 3$.
- Check: $2(2) + 3(3) = 13$ and $5(2) - 3 = 7$.
- If $\det A = 0$ the matrix is singular, has no inverse, and the system has no unique solution.
Worked example (transformations): a matrix can represent a transformation of the plane.
- Rotation by 90° anticlockwise about the origin: $\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$. The point $(3, 1)$ maps to $(-1, 3)$.
- Enlargement with scale factor $k$: $\begin{pmatrix} k & 0 \\ 0 & k \end{pmatrix}$.
- Reflection in the $x$-axis: $\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$.
- Area scale factor $= |\det|$. The matrix $\begin{pmatrix} 3 & 1 \\ 0 & 2 \end{pmatrix}$ has determinant 6, so a shape of area 5 maps to a shape of area 30.
- For "transformation $P$ followed by transformation $Q$", the single matrix is $QP$: the first one applied is written on the right.
Worked example (a Leslie matrix): a population has juveniles and adults. Each adult produces 3 juveniles per year; 40% of juveniles survive to become adults; 50% of adults survive.
- $L = \begin{pmatrix} 0 & 3 \\ 0.4 & 0.5 \end{pmatrix}$, and the population vector is $\begin{pmatrix} \text{juveniles} \\ \text{adults} \end{pmatrix}$.
- Start with $\begin{pmatrix} 100 \\ 40 \end{pmatrix}$.
- After one year: juveniles $= 3 \times 40 = 120$; adults $= 0.4 \times 100 + 0.5 \times 40 = 60$.
- After two years: juveniles $= 3 \times 60 = 180$; adults $= 0.4 \times 120 + 0.5 \times 60 = 78$.
- After $n$ years the population is $L^n$ times the starting vector, found on a GDC.
- The long-term growth rate is the largest eigenvalue of $L$.
Rules
- Matrices multiply only if the number of columns of the first equals the number of rows of the second. A $2 \times 3$ matrix times a $3 \times 4$ matrix gives a $2 \times 4$ matrix.
- $AB \ne BA$ in general.
- $AI = IA = A$ and $AA^{-1} = I$.
- To solve $AX = B$, multiply on the left: $X = A^{-1}B$.
Common mistakes
- Multiplying corresponding entries.
- Writing $X = BA^{-1}$.
- Forgetting to divide by the determinant in the inverse.
Check yourself
What is the determinant of the matrix with rows (6, 1) and (2, 3)?
Show the answer
16
6 × 3 − 1 × 2 = 18 − 2 = 16.
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera