
Every time a phone rotates a photo, a game engine moves a character across the screen, or a company totals sales for dozens of products at once, a matrix is doing the work. In this chapter you will learn to compute with matrices, measure them with determinants, undo them with inverses, and use all of it to solve systems of equations quickly and reliably.
1. What is a matrix?
A matrix is a rectangular array of numbers called entries, arranged in rows (horizontal) and columns (vertical). A matrix with \(m\) rows and \(n\) columns has size \(m \times n\). The entry in row \(i\) and column \(j\) is written \(a_{ij}\).
For example, \(M = \begin{bmatrix}4&-2&0\\7&1&9\end{bmatrix}\) is a \(2 \times 3\) matrix, and \(a_{23} = 9\). A matrix with the same number of rows and columns is square. The identity matrix \(I = \begin{bmatrix}1&0\\0&1\end{bmatrix}\) is the square matrix with \(1\) on the main diagonal and \(0\) elsewhere; it acts like the number \(1\) in multiplication.
2. Adding, subtracting, and scaling
You can add or subtract two matrices only when they have the same size: just combine entries in the same position. To multiply a matrix by a number (a scalar), multiply every entry.
Let \(A = \begin{bmatrix}2&-1\\3&4\end{bmatrix}\) and \(B = \begin{bmatrix}1&5\\0&-2\end{bmatrix}\). Find \(A + B\) and \(2A - B\).
\(A + B = \begin{bmatrix}3&4\\3&2\end{bmatrix}\).
\(2A = \begin{bmatrix}4&-2\\6&8\end{bmatrix}\), so \(2A - B = \begin{bmatrix}3&-7\\6&10\end{bmatrix}\).
3. Matrix multiplication
If \(A\) is \(m \times n\) and \(B\) is \(n \times p\), then \(AB\) is the \(m \times p\) matrix whose entry in row \(i\), column \(j\) is the sum of the products of row \(i\) of \(A\) with column \(j\) of \(B\). The number of columns of \(A\) must equal the number of rows of \(B\).
A cafe sells small, medium, and large coffees. Saturday sales were \(40, 55, 25\) and Sunday sales were \(35, 60, 30\). The prices are \(\$2.00\), \(\$2.75\), and \(\$3.50\). Then
\[ \begin{bmatrix}40&55&25\\35&60&30\end{bmatrix}\begin{bmatrix}2.00\\2.75\\3.50\end{bmatrix} = \begin{bmatrix}318.75\\340.00\end{bmatrix} \]
because \(40(2) + 55(2.75) + 25(3.5) = 80 + 151.25 + 87.5 = 318.75\), and \(35(2) + 60(2.75) + 30(3.5) = 70 + 165 + 105 = 340\). The cafe earned \(\$318.75\) on Saturday and \(\$340.00\) on Sunday.
Matrix multiplication is not commutative. With the matrices of Example 1, \(AB = \begin{bmatrix}2&12\\3&7\end{bmatrix}\) but \(BA = \begin{bmatrix}17&19\\-6&-8\end{bmatrix}\). It is, however, associative: \((AB)C = A(BC)\), and it distributes: \(A(B + C) = AB + AC\).
4. Determinants
For \(A = \begin{bmatrix}a&b\\c&d\end{bmatrix}\), the determinant is \(\det A = ad - bc\).
For a \(3 \times 3\) matrix, expand along the first row using smaller determinants (cofactors) with alternating signs \(+, -, +\):
\[ \det \begin{bmatrix}a&b&c\\d&e&f\\g&h&i\end{bmatrix} = a(ei - fh) - b(di - fg) + c(dh - eg). \]
Find \(\det A\) for \(A = \begin{bmatrix}2&-1\\3&4\end{bmatrix}\), then \(\det N\) for \(N = \begin{bmatrix}2&0&1\\1&3&-1\\0&4&5\end{bmatrix}\).
\(\det A = 2(4) - (-1)(3) = 8 + 3 = 11\).
\(\det N = 2\big(3\cdot 5 - (-1)\cdot 4\big) - 0 + 1\big(1\cdot 4 - 3\cdot 0\big) = 2(19) + 4 = 42\).
The determinant has a geometric meaning: for the vectors \(u = (a, c)\) and \(v = (b, d)\), the parallelogram they span has area \(|ad - bc|\). Also, \(\det(AB) = \det A \cdot \det B\), and a square matrix is invertible exactly when its determinant is not zero.
5. Inverse matrices
The inverse of a square matrix \(A\) is the matrix \(A^{-1}\) with \(AA^{-1} = A^{-1}A = I\). It exists only if \(\det A \neq 0\).
If \(A = \begin{bmatrix}a&b\\c&d\end{bmatrix}\) and \(\det A = ad - bc \neq 0\), then \[ A^{-1} = \dfrac{1}{ad - bc} \begin{bmatrix}d&-b\\-c&a\end{bmatrix}. \]
For \(A = \begin{bmatrix}2&-1\\3&4\end{bmatrix}\), we found \(\det A = 11\). Swap the diagonal entries, negate the others, and divide by \(11\):
\(A^{-1} = \dfrac{1}{11}\begin{bmatrix}4&1\\-3&2\end{bmatrix}\). Check: \(A \cdot \begin{bmatrix}4&1\\-3&2\end{bmatrix} = \begin{bmatrix}11&0\\0&11\end{bmatrix}\), so \(AA^{-1} = I\).
6. Solving systems with matrices
A system of linear equations can be written as one matrix equation \(AX = C\), where \(A\) holds the coefficients, \(X\) the unknowns, and \(C\) the constants. If \(A\) is invertible, multiply both sides on the left by \(A^{-1}\): \(X = A^{-1}C\).
Solve \(2x - y = 7\) and \(3x + 4y = 5\).
In matrix form, \(\begin{bmatrix}2&-1\\3&4\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix} = \begin{bmatrix}7\\5\end{bmatrix}\). Using \(A^{-1}\) from Example 4:
\(\begin{bmatrix}x\\y\end{bmatrix} = \dfrac{1}{11}\begin{bmatrix}4&1\\-3&2\end{bmatrix}\begin{bmatrix}7\\5\end{bmatrix} = \dfrac{1}{11}\begin{bmatrix}33\\-11\end{bmatrix} = \begin{bmatrix}3\\-1\end{bmatrix}\).
The solution is \((3, -1)\): the two lines in the figure cross at exactly that point.
Solving \(AX = C\) means undoing the action of \(A\) to recover the unknowns. The determinant tells you what to expect from a system of two equations in two unknowns:
| If \(\det A\) is… | The two lines… | Number of solutions |
|---|---|---|
| not zero | cross at one point | exactly one |
| zero | are parallel and different | none |
| zero | are the same line | infinitely many |
7. Gaussian elimination
Finding an inverse is wonderful for small systems, but it becomes heavy for larger ones. Elimination is the workhorse that computers actually use, because it works for any number of equations and also reveals when a system has no solution or infinitely many.
Gaussian elimination solves a system by simplifying its augmented matrix with three legal row operations: swap two rows, multiply a row by a nonzero number, or add a multiple of one row to another row. The goal is a staircase (row echelon) form that you finish by back-substitution.
- Write the augmented matrix.
- Use the first row to create zeros below the first leading entry.
- Repeat with the next row and the next column.
- Back-substitute from the bottom row upward.
Solve \(x + y + z = 4\), \(2x - y + z = 8\), \(x + 3y - 2z = -7\).
\(\begin{bmatrix}1&1&1\\2&-1&1\\1&3&-2\end{bmatrix}\) with constants \(4, 8, -7\). Do \(R_2 \to R_2 - 2R_1\) and \(R_3 \to R_3 - R_1\): the rows become \((0, -3, -1 \mid 0)\) and \((0, 2, -3 \mid -11)\).
Now \(R_3 \to 3R_3 + 2R_2\) gives \((0, 0, -11 \mid -33)\), so \(z = 3\). Then \(-3y - 3 = 0\) gives \(y = -1\), and \(x = 4 - (-1) - 3 = 2\).
The solution is \((2, -1, 3)\).
8. Cramer’s Rule
For \(ax + by = e\) and \(cx + dy = f\) with \(D = ad - bc \neq 0\): \[ x = \dfrac{D_x}{D} = \dfrac{ed - bf}{ad - bc}, \qquad y = \dfrac{D_y}{D} = \dfrac{af - ec}{ad - bc}. \] \(D_x\) is \(D\) with the first column replaced by the constants; \(D_y\) is \(D\) with the second column replaced.
Solve \(3x + 2y = 16\) and \(5x - 4y = 12\).
\(D = 3(-4) - 2(5) = -22\). \(D_x = 16(-4) - 2(12) = -88\). \(D_y = 3(12) - 16(5) = -44\).
So \(x = \dfrac{-88}{-22} = 4\) and \(y = \dfrac{-44}{-22} = 2\).
On my planet we say: “Cramer is fast for two unknowns, slow for four.” For larger systems, Gaussian elimination needs far fewer calculations.
9. Transformation matrices
A \(2 \times 2\) matrix transforms the plane: the point \((x, y)\) is sent to \(A\begin{bmatrix}x\\y\end{bmatrix}\). The columns of \(A\) are the images of the points \((1, 0)\) and \((0, 1)\). Here are the most common ones:
| Transformation | Matrix | Image of \((x, y)\) |
|---|---|---|
| Reflection in the x-axis | \(\begin{bmatrix}1&0\\0&-1\end{bmatrix}\) | \((x, -y)\) |
| Reflection in the y-axis | \(\begin{bmatrix}-1&0\\0&1\end{bmatrix}\) | \((-x, y)\) |
| Rotation of 90° counterclockwise | \(\begin{bmatrix}0&-1\\1&0\end{bmatrix}\) | \((-y, x)\) |
| Scaling by factor \(k\) | \(\begin{bmatrix}k&0\\0&k\end{bmatrix}\) | \((kx, ky)\) |
| Horizontal shear | \(\begin{bmatrix}1&s\\0&1\end{bmatrix}\) | \((x + sy, y)\) |
Rotate triangle \(A(1, 0)\), \(B(3, 0)\), \(C(1, 2)\) by \(90^\circ\) counterclockwise about the origin.
Multiply each vertex by \(\begin{bmatrix}0&-1\\1&0\end{bmatrix}\): \((x, y) \to (-y, x)\), so \(A' = (0, 1)\), \(B' = (0, 3)\), \(C' = (-2, 1)\). Since the determinant is \(1\), the area stays \(2\).
A transformation with matrix \(A\) multiplies every area by \(|\det A|\). To apply transformation \(P\) first and then \(Q\), multiply \(QP\): the matrix written closest to the point acts first.
Key takeaways
- Matrices of the same size add entry by entry; a scalar multiplies every entry.
- \(AB\) exists only when the columns of \(A\) match the rows of \(B\), and in general \(AB \neq BA\).
- \(\det \begin{bmatrix}a&b\\c&d\end{bmatrix} = ad - bc\); a square matrix has an inverse exactly when its determinant is not zero.
- For \(AX = C\) with \(A\) invertible, \(X = A^{-1}C\).
- Gaussian elimination uses three row operations to reach echelon form, then back-substitution.
- Cramer’s Rule gives \(x = D_x / D\) and \(y = D_y / D\) when \(D \neq 0\).
- A transformation matrix scales areas by \(|\det A|\); the order of composition matters.
Test yourself: quick challenge for Grade 12
Speed drill for Grade 12: how many in 60 seconds?
🚀 Keep exploring with Zyro
✏️ Math practiceMatrices and Systems of Equations: math practice, Grade 12
📝 Math testsMatrices and Systems of Equations: math test, Grade 12
🎯 Math quizzesMatrices and Systems of Equations: math quiz, Grade 12
✏️ Math practiceSequences, Series, and Induction: math practice, Grade 12
✏️ Math practiceLimits, Probability, and Statistics: math practice, Grade 12
📝 Math testsSequences, Series, and Induction: math test, Grade 12

