Matrices are compact tables of numbers that describe systems of equations, geometric transformations, networks and data sets. Most coursework boils down to a handful of operations: multiplying two matrices, finding a determinant, inverting a matrix and working out its rank. Each has a clear procedure, but the arithmetic is long, and one sign error anywhere ruins the answer.
This guide explains what each operation means, walks through 2×2 and 3×3 examples step by step, and shows quick checks you can use to confirm your work. It ends with how to get exact answers, with fractions rather than rounded decimals, from a calculator.
Matrix basics
A matrix with m rows and n columns is called an m×n matrix. The entry in row i, column j is written aᵢⱼ.
- Addition and subtraction work entry by entry and need matrices of the same size.
- Scalar multiplication multiplies every entry by the same number.
- Transpose (Aᵀ) turns rows into columns, so a 2×3 matrix becomes 3×2.
These are straightforward. Multiplication is where the rules become less obvious.
Multiplying matrices
To multiply A (m×n) by B (n×p), the number of columns of A must equal the number of rows of B. The result is m×p. Each entry is a row of A "dotted" with a column of B: multiply matching entries and add.
[1 2 3] [1 0] [1·1 + 2·0 + 3·2 1·0 + 2·1 + 3·1] [ 7 5]
[4 5 6] × [0 1] = [4·1 + 5·0 + 6·2 4·0 + 5·1 + 6·1] = [16 11]
[2 1]
A 2×3 matrix times a 3×2 matrix gives a 2×2 result.
Order matters
Matrix multiplication is generally not commutative. With
P = [1 2] R = [0 1]
[3 4] [1 0]
P × R = [[2, 1], [4, 3]] (the columns of P swapped), while R × P = [[3, 4], [1, 2]] (the rows swapped). Always check which order a problem asks for.
The determinant
The determinant is a single number calculated from a square matrix. It tells you two important things:
- Whether the matrix can be inverted. If det(A) = 0, the matrix is singular and has no inverse. The corresponding system of equations has either no solution or infinitely many.
- How the matrix scales area or volume. A 2×2 matrix with determinant 3 triples the area of any shape it transforms; a negative determinant also flips orientation.
2×2 determinant
det [a b] = ad − bc
[c d]
For [[4, 7], [2, 6]]: 4 × 6 − 7 × 2 = 24 − 14 = 10.
3×3 determinant by cofactor expansion
Expand along the first row, alternating signs (+ − +), and multiply each entry by the 2×2 determinant left when you delete its row and column:
A = [2 1 0]
[1 3 1]
[0 1 4]
det(A) = 2 × det[3 1; 1 4] − 1 × det[1 1; 0 4] + 0 × det[1 3; 0 1]
= 2 × (12 − 1) − 1 × (4 − 0) + 0
= 22 − 4
= 18
Tip: expand along the row or column with the most zeros. Here the 0 in the first row saved one sub-determinant.
For larger matrices, cofactor expansion becomes slow. The practical method is row reduction: use row operations to reach a triangular form, then multiply the diagonal. Swapping two rows flips the sign of the determinant, and multiplying a row by k multiplies the determinant by k, so keep track of both.
The inverse
The inverse A⁻¹ is the matrix that undoes A: A × A⁻¹ = I, the identity matrix (1s on the diagonal, 0s elsewhere). Only square matrices with a non-zero determinant have one.
2×2 inverse formula
Swap a and d, change the signs of b and c, and divide by the determinant:
[a b]⁻¹ = 1 [ d −b]
[c d] ───── [−c a]
ad−bc
For [[4, 7], [2, 6]] with determinant 10:
(1/10) × [ 6 −7] = [ 3/5 −7/10]
[−2 4] [−1/5 2/5 ]
3×3 inverse by row reduction
Write A next to the identity, [A | I], and use row operations to turn the left side into I. The right side then becomes A⁻¹. For the 3×3 matrix above, the result is:
A⁻¹ = (1/18) × [11 −4 1]
[−4 8 −2]
[ 1 −2 5]
Notice the 1/18 factor: it is 1 over the determinant, which is why a zero determinant makes inversion impossible.
Check your answer: multiply A by your A⁻¹. If you do not get the identity matrix exactly, there is an error somewhere. This check takes a minute and catches almost every slip.
Rank and reduced row echelon form
Row-reducing a matrix as far as it will go gives its reduced row echelon form (RREF): each non-zero row starts with a 1 (a pivot), each pivot is the only non-zero entry in its column, and zero rows sit at the bottom.
The rank is the number of non-zero rows in the RREF, which equals the number of independent rows (or columns). Take
[1 2 3]
[2 4 6]
[1 0 1]
The second row is exactly twice the first, so it adds no new information. The RREF is [[1, 0, 1], [0, 1, 1], [0, 0, 0]], the rank is 2, and the determinant is 0. A square matrix has an inverse exactly when its rank equals its size.
Using the matrix calculator
The Matrix Calculator handles matrices up to 5×5.
- Set the size of matrix A with the Rows and Cols menus and type the entries. Entries can be integers, decimals or fractions such as 3/4; empty cells count as 0.
- Choose an Operation: A + B, A − B, A × B, B × A, k × A (scalar), Determinant det(A), Inverse A⁻¹, Transpose Aᵀ, Rank of A, or Row echelon form (RREF).
- For operations that need a second matrix, fill in B. Swap A ↔ B exchanges them, Random fills in practice values, and Clear resets both.
- Read the result. Use Show entries as to switch between Fractions and Decimals.
- Open the steps to see the row operations or cofactor working, and use the copy button to paste the result into a spreadsheet as tab-separated text.
All arithmetic is exact, so an inverse such as 11/18 stays as a fraction rather than becoming 0.6111. That matters when you want to check your hand working or feed the result into another step.
Other ways to do matrix calculations
- Spreadsheets: Excel, LibreOffice and Google Sheets provide
MMULTfor multiplication,MDETERMfor determinants,MINVERSEfor inverses andTRANSPOSE. They work in floating point, so an inverse that should contain 1/3 shows 0.333333, and a determinant that should be 0 may show a tiny number like 1E-16. - Programming: NumPy in Python (
numpy.linalg.det,numpy.linalg.inv) is the standard choice for large matrices; SymPy gives exact fractions. - Graphing calculators have matrix menus that are handy in exams, though entering a 4×4 matrix on a small keypad is slow.
To solve a system of equations directly rather than invert a matrix, the Linear Equation Solver is the more convenient tool, and the Fraction Calculator helps with the fraction arithmetic in hand working.
Common mistakes
- Multiplying entry by entry. That is not matrix multiplication (it is called the Hadamard product and is rarely what a problem wants).
- Ignoring the size rule. A 2×3 matrix cannot be multiplied by another 2×3 matrix.
- Forgetting the alternating signs in cofactor expansion. The middle term of a 3×3 expansion along the first row is subtracted.
- Dividing by the determinant too early in hand calculations, creating messy fractions. Keep the 1/det factor outside until the end.
- Assuming (AB)⁻¹ = A⁻¹B⁻¹. The correct rule reverses the order: (AB)⁻¹ = B⁻¹A⁻¹.
Frequently asked questions
What does it mean if the determinant is zero?
The matrix is singular: it has no inverse, its rows are linearly dependent, and a system of equations built on it has either no solution or infinitely many.
Can a non-square matrix have a determinant or inverse?
No. Determinants and ordinary inverses are only defined for square matrices. Non-square matrices do have a rank and a transpose.
Why is AB not equal to BA?
Each entry of AB combines rows of A with columns of B, and swapping the order combines different rows and columns. In some cases, such as multiplying by the identity, the results happen to match, but not in general.
How do I check that my inverse is correct?
Multiply the original matrix by your inverse. The result must be the identity matrix exactly; any other entry means there is an arithmetic error.
What is the difference between row echelon form and reduced row echelon form?
Row echelon form only needs zeros below each pivot. Reduced row echelon form also needs each pivot to be 1 and zeros above it, which makes the form unique for a given matrix.