impera Open Impera

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.
Example

$\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?

  • 2 × 3

  • 3 × 2

  • 6

  • 5

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.

Worked example

A product

  1. $\begin{pmatrix}2 & 1\\0 & 3\end{pmatrix}\begin{pmatrix}4\\5\end{pmatrix}$.
  2. Top: $2 \times 4 + 1 \times 5 = 13$. Bottom: $0 \times 4 + 3 \times 5 = 15$.
  3. Result: $\begin{pmatrix}13\\15\end{pmatrix}$.
Worked example

Sales and prices

  1. 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.
  2. $\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?

  • 3 × 4

  • It cannot be found

  • 2 × 2

  • 4 × 3

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.
Worked example

An inverse

  1. $A = \begin{pmatrix}2 & 1\\5 & 3\end{pmatrix}$. $\det A = 6 - 5 = 1$.
  2. $A^{-1} = \begin{pmatrix}3 & -1\\-5 & 2\end{pmatrix}$.
  3. For larger matrices, use the calculator.
Check yourself

What is the determinant of the matrix with rows (4, 2) and (3, 5)?

  • 14

  • 26

  • −14

  • 20

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

Worked example

A pair of equations

  1. Solve $2x + y = 5$ and $5x + 3y = 13$.
  2. $A = \begin{pmatrix}2 & 1\\5 & 3\end{pmatrix}$, $B = \begin{pmatrix}5\\13\end{pmatrix}$.
  3. $X = A^{-1}B = \begin{pmatrix}3 & -1\\-5 & 2\end{pmatrix}\begin{pmatrix}5\\13\end{pmatrix} = \begin{pmatrix}2\\1\end{pmatrix}$.
  4. 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?

  • X = A⁻¹B

  • X = B ÷ A

  • X = AB

  • X = BA⁻¹

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.

Worked example

A two-stage population

  1. Juveniles $J$ and adults $A$. Each adult produces 2 juveniles per year; 40% of juveniles become adults; 70% of adults survive.
  2. 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}$.
  3. 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?

  • The total population of the species in one year

  • A random number used to simulate the population

  • The number of years between two population counts

  • A rate of reproduction or survival between stages

Show the answer

A rate of reproduction or survival between stages

Transition rates.

6Inverse matrices in practice

Worked example

Solving with an inverse

  1. System: $2x + y = 7$, $x + 3y = 11$.
  2. Matrix form: $\begin{pmatrix} 2 & 1 \\ 1 & 3 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 7 \\ 11 \end{pmatrix}$.
  3. Determinant: $6 - 1 = 5$. Inverse: $\frac{1}{5}\begin{pmatrix} 3 & -1 \\ -1 & 2 \end{pmatrix}$.
  4. 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?

  • When its entries are positive

  • When it is 2 by 2

  • When it is square

  • When its determinant is zero

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$.

  1. 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}$.
  2. $\det A = (2)(-1) - (3)(5) = -17$.
  3. $A^{-1} = \frac{1}{-17}\begin{pmatrix} -1 & -3 \\ -5 & 2 \end{pmatrix}$.
  4. $\mathbf{x} = A^{-1}\mathbf{b}$: $x = \frac{-13 - 21}{-17} = 2$ and $y = \frac{-65 + 14}{-17} = 3$.
  5. Check: $2(2) + 3(3) = 13$ and $5(2) - 3 = 7$.
  6. 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.

  1. Rotation by 90° anticlockwise about the origin: $\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}$. The point $(3, 1)$ maps to $(-1, 3)$.
  2. Enlargement with scale factor $k$: $\begin{pmatrix} k & 0 \\ 0 & k \end{pmatrix}$.
  3. Reflection in the $x$-axis: $\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$.
  4. 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.
  5. 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.

  1. $L = \begin{pmatrix} 0 & 3 \\ 0.4 & 0.5 \end{pmatrix}$, and the population vector is $\begin{pmatrix} \text{juveniles} \\ \text{adults} \end{pmatrix}$.
  2. Start with $\begin{pmatrix} 100 \\ 40 \end{pmatrix}$.
  3. After one year: juveniles $= 3 \times 40 = 120$; adults $= 0.4 \times 100 + 0.5 \times 40 = 60$.
  4. After two years: juveniles $= 3 \times 60 = 180$; adults $= 0.4 \times 120 + 0.5 \times 60 = 78$.
  5. After $n$ years the population is $L^n$ times the starting vector, found on a GDC.
  6. 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)?

  • −16

  • 9

  • 16

  • 20

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