Linear Algebra · From Zero to Confident

The Complete
Guide to Matrices

Everything you need to understand, compute with, and apply matrices — from first principles through eigenvalues, with worked examples throughout.

Chapters: 10 Topics: 25+ Examples: 15+ Quiz: 8 questions
Chapter 01

What Is a Matrix?

A matrix is a rectangular array of numbers arranged in rows and columns. Think of it as a spreadsheet of values that carry mathematical meaning — a compact way to represent data, transformations, and systems of equations.

A matrix with m rows and n columns is called an m × n matrix. The numbers inside it are called elements or entries.

A =
1
2
3
4
5
6
7
8
9
← 3 × 3 matrix
(diagonal highlighted)
Key Insight Matrices are the language in which computers, physicists, economists, and engineers express transformations. When you rotate a 3D model in a game or train a neural network, matrices are doing the heavy lifting.

Real-world analogy

Imagine a cinema's seating chart: row number is your first coordinate, seat number is your second. Any seat in the theatre can be pinpointed with two numbers — exactly how an element in a matrix is pinpointed. A matrix is just a much more powerful version of that chart, capable of encoding transformations and relationships.

Chapter 02

Types of Matrices

Different configurations of rows, columns, and entries have special names and properties. Recognising the type immediately tells you what operations are possible.

NameConditionExample shape
Row MatrixExactly 1 row1 × n
Column MatrixExactly 1 columnm × 1
Square Matrixm = nn × n
Zero MatrixAll entries = 0any
Identity Matrix (I)Square; diagonal = 1, rest = 0n × n
Diagonal MatrixSquare; non-diagonal entries = 0n × n
Symmetric MatrixA = Aᵀn × n
Upper TriangularAll entries below main diagonal = 0n × n
Scalar MatrixDiagonal with equal valuesn × n

The Identity Matrix

The identity matrix I is the matrix equivalent of the number 1: multiplying any matrix by it leaves the matrix unchanged.

I₃ =
1
0
0
0
1
0
0
0
1
Chapter 03

Notation & Indexing

The element in row i and column j of matrix A is written aᵢⱼ or A[i,j]. Row index comes first, column second — always.

Element Notation
A = [aᵢⱼ] where i = 1,2,...,m and j = 1,2,...,n
aᵢⱼ is pronounced "a-sub-i-j". The subscript i gives the row, j gives the column.
Worked Example — Reading Elements

Given:

B =
3
7
-2
5
  • b₁₁ = 3 (row 1, col 1)
  • b₁₂ = 7 (row 1, col 2) — blue
  • b₂₁ = −2 (row 2, col 1) — orange
  • b₂₂ = 5 (row 2, col 2)
Common Mistake Students often reverse i and j. Remember: i = row = "I go across rows first", j = column = "jumps sideways". Row before column, always.
Chapter 04

Addition & Subtraction

Two matrices can be added or subtracted only when they have the same dimensions. The operation is applied element-by-element.

Matrix Addition
(A + B)ᵢⱼ = aᵢⱼ + bᵢⱼ
Add corresponding elements. Both matrices must be m × n.
Worked Example
1
2
3
4
+
5
6
7
8
=
6
8
10
12

Properties

PropertyStatement
CommutativeA + B = B + A
Associative(A + B) + C = A + (B + C)
Zero MatrixA + 0 = A
Additive InverseA + (−A) = 0
Chapter 05

Scalar Multiplication

Multiplying a matrix by a scalar (single number) scales every element uniformly.

Scalar Multiplication
(kA)ᵢⱼ = k · aᵢⱼ
Every element is multiplied by k. The size of the matrix stays the same.
Worked Example — 3 × A
3 ×
2
-1
0
4
=
6
-3
0
12
Tip Scalar multiplication is distributive: k(A + B) = kA + kB. Also, (k₁k₂)A = k₁(k₂A).
Chapter 06

Matrix Multiplication

This is the heart of matrix algebra. Matrix multiplication is not element-wise — it's a dot-product operation between rows and columns.

Dimension Rule To multiply A (m × n) by B (n × p), the inner dimensions must match. The result is an m × p matrix. Think: (m × n) · (n × p) = m × p.
Matrix Multiplication
(AB)ᵢⱼ = Σₖ aᵢₖ · bₖⱼ
The (i,j) element of AB equals the dot product of row i of A with column j of B.
Worked Example — 2×2 Multiplication

Compute AB:

A=
1
2
3
4
B=
5
6
7
8
  1. (AB)₁₁: Row 1 of A · Col 1 of B = (1×5) + (2×7) = 5 + 14 = 19
  2. (AB)₁₂: Row 1 of A · Col 2 of B = (1×6) + (2×8) = 6 + 16 = 22
  3. (AB)₂₁: Row 2 of A · Col 1 of B = (3×5) + (4×7) = 15 + 28 = 43
  4. (AB)₂₂: Row 2 of A · Col 2 of B = (3×6) + (4×8) = 18 + 32 = 50
AB=
19
22
43
50
Not Commutative! AB ≠ BA in general. Matrix multiplication is commutative only for special cases (e.g., a matrix and its inverse). Always preserve order.

Properties

PropertyStatementNote
Associative(AB)C = A(BC)Group how you like
DistributiveA(B+C) = AB + AC
IdentityAI = IA = AI is the identity
NOT commutativeAB ≠ BA (generally)Order matters!
Zero productAB = 0 does NOT imply A=0 or B=0Unlike scalars
Chapter 07

Transpose

The transpose of a matrix flips it across its main diagonal — rows become columns and columns become rows.

Transpose
(Aᵀ)ᵢⱼ = Aⱼᵢ
If A is m × n, then Aᵀ is n × m.
A=
1
2
3
4
5
6
→ Aᵀ =
1
4
2
5
3
6

Key Properties

PropertyFormula
Double transpose(Aᵀ)ᵀ = A
Sum(A+B)ᵀ = Aᵀ + Bᵀ
Product (reverses)(AB)ᵀ = BᵀAᵀ
Scalar(kA)ᵀ = kAᵀ
Chapter 08

Determinant

The determinant is a scalar value computed from a square matrix. It encodes critical information: whether the matrix is invertible, how it scales volumes, and the sign of orientation change.

2×2 Determinant

det(A) for 2×2
det(A) = ad − bc
For A = [[a,b],[c,d]]. Multiply diagonals, subtract.
Worked Example — 2×2 Determinant
A=
3
8
4
6

det(A) = (3 × 6) − (8 × 4) = 18 − 32 = −14

Since det(A) ≠ 0, this matrix is invertible.

3×3 Determinant (Cofactor Expansion)

Cofactor Expansion Along Row 1
det(A) = a₁₁(a₂₂a₃₃−a₂₃a₃₂) − a₁₂(a₂₁a₃₃−a₂₃a₃₁) + a₁₃(a₂₁a₃₂−a₂₂a₃₁)
Signs follow the pattern + − + − + − ...
Geometric Meaning |det(A)| gives the area of the parallelogram (2D) or volume of the parallelepiped (3D) formed by the rows (or columns) of A. A determinant of 0 means the rows are linearly dependent — the matrix "collapses" space.

Properties of Determinants

PropertyFormula
Productdet(AB) = det(A) · det(B)
Transposedet(Aᵀ) = det(A)
Inversedet(A⁻¹) = 1/det(A)
Scalardet(kA) = kⁿ · det(A)
Row swapSwapping two rows negates det
Singulardet(A) = 0 iff A is not invertible
Chapter 09

Matrix Inverse

The inverse of a square matrix A, written A⁻¹, is the matrix such that A · A⁻¹ = A⁻¹ · A = I. It exists only when det(A) ≠ 0.

Inverse of a 2×2 Matrix
A⁻¹ = (1/det(A)) · [[d, -b], [-c, a]]
Swap the diagonal elements, negate the off-diagonal, divide by det(A).
Worked Example — 2×2 Inverse
A=
2
3
1
4
  1. Compute det(A): (2×4) − (3×1) = 8 − 3 = 5
  2. Swap diagonal: [[4, 3], [1, 2]] → [[4, -3], [-1, 2]]
  3. Divide by 5:
A⁻¹=
4/5
-3/5
-1/5
2/5
= (1/5)[[4,-3],[-1,2]]

Gauss-Jordan Method (for larger matrices)

For larger matrices, form the augmented matrix [A | I] and apply row operations until the left side becomes I. The right side then becomes A⁻¹.

Application Inverses are used to solve systems of equations: if Ax = b, then x = A⁻¹b. This is the matrix equivalent of dividing both sides by A.
Chapter 10

Rank & Linear Systems

The rank of a matrix is the maximum number of linearly independent rows (or columns). It tells us the "true dimensionality" of the data in the matrix.

Rank-Nullity Theorem
rank(A) + nullity(A) = n
Where n = number of columns. Nullity is the dimension of the null space (solutions to Ax = 0).

Solving Systems with Matrices

A system of linear equations can be written as Ax = b. Row reduction (Gaussian elimination) on the augmented matrix [A | b] finds the solution:

System: 2x + y = 5, x + 3y = 10
  1. Write augmented matrix: [[2, 1, 5], [1, 3, 10]]
  2. R1 ↔ R2: [[1, 3, 10], [2, 1, 5]]
  3. R2 → R2 − 2R1: [[1, 3, 10], [0, -5, -15]]
  4. R2 → R2 / (−5): [[1, 3, 10], [0, 1, 3]]
  5. R1 → R1 − 3R2: [[1, 0, 1], [0, 1, 3]]
  6. Solution: x = 1, y = 3
Chapter 11

Eigenvalues & Eigenvectors

An eigenvector of a matrix A is a non-zero vector v that only gets scaled (not rotated) when multiplied by A. The scale factor is the eigenvalue λ.

Eigenvalue Equation
Av = λv ⟺ (A − λI)v = 0
For non-trivial solutions, det(A − λI) = 0. This is the characteristic equation.
Finding Eigenvalues — 2×2
A=
4
1
2
3
  1. Characteristic equation: det(A − λI) = 0 → det([[4−λ, 1],[2, 3−λ]]) = 0
  2. Expand: (4−λ)(3−λ) − (1)(2) = 0 → λ² − 7λ + 12 − 2 = 0 → λ² − 7λ + 10 = 0
  3. Factor: (λ − 5)(λ − 2) = 0 → λ₁ = 5, λ₂ = 2
  4. For λ₁ = 5: (A − 5I)v = 0 → v₁ = [1, 1]ᵀ
  5. For λ₂ = 2: (A − 2I)v = 0 → v₂ = [1, −2]ᵀ
Why Eigenvalues Matter Eigenvalues power: Principal Component Analysis (PCA), Google's PageRank algorithm, quantum mechanics (energy levels), structural engineering (vibration modes), image compression, and neural network training dynamics.
Interactive

Live Matrix Calculator

Enter values in both 2×2 matrices and compute common operations interactively.

Matrix Operations — Try It Now

MATRIX A
×
MATRIX B
=
RESULT
?
?
?
?
Chapter 12

Real-World Applications

Matrices are not abstract curiosities — they are the computational backbone of modern technology and science.

🤖

Machine Learning

Neural network weights are matrices. Backpropagation is matrix calculus. Every forward pass is matrix multiplication.

🎮

Computer Graphics

3D rotation, scaling, and perspective projection are all matrix transformations applied per vertex per frame.

🔬

Quantum Mechanics

Quantum states are vectors; observables are matrices (operators). Eigenvalues are measurable quantities.

📊

Data Science (PCA)

Principal Component Analysis uses eigenvectors of the covariance matrix to reduce dimensions while preserving variance.

🌐

Google PageRank

The web is modelled as a matrix. PageRank is the dominant eigenvector of the link matrix — ranking pages by importance.

🏗️

Structural Engineering

Stiffness matrices relate forces to displacements. Eigenvalues predict resonance frequencies to prevent collapse.

💹

Economics

Input-output models (Leontief) represent inter-industry dependencies as matrices to analyse economic policy impacts.

🖼️

Image Processing

A grayscale image is a matrix of pixel values. Convolution (blur, edge detection) is matrix operations applied to it.

Self-Test

Knowledge Check

Test Your Matrix Mastery

1. For matrix multiplication AB to be defined, which condition must hold?

2. What is det([[2,1],[5,3]])?

3. Which of these is always true for matrices A and B of compatible sizes?

4. If A is a 3×4 matrix and B is a 4×2 matrix, what is the size of AB?

5. A matrix A is invertible if and only if:

6. The eigenvalues of the identity matrix Iₙ are all equal to:

7. Which operation gives a matrix of dimension n × m from an m × n matrix?

8. If Av = λv for non-zero vector v, then v is called: