02 — Matrices as Transformations

Matrices as
Transformations

Stop thinking of a matrix as a grid of numbers to multiply. Start seeing it as a function that reshapes space — stretching, rotating, shearing, projecting. Every matrix is a geometric action. Once you see this, you can never unsee it.

On this page
01 — The hook 02 — Columns as images of basis vectors 03 — Matrix-vector product 04 — Transformation playground 05 — Composing transformations 06 — The zoo of transformations 07 — What makes a transformation linear EE / EM connections

A matrix is a function, not a table

Forget rows and columns for a moment. A matrix A is a machine: you feed it a vector x, it spits out a new vector Ax. The output lives in a (possibly different) space, pointing in a (possibly different) direction, with a (possibly different) length.

That machine has a specific geometric action — it stretches space, rotates it, shears it, or collapses it. The entries of the matrix encode exactly how space gets deformed. To understand a matrix, you understand what it does to the coordinate grid.

The Central Idea
A matrix A represents a linear transformation T: ℝⁿ → ℝᵐ. Feeding it a vector gives you the transformed vector. Understanding A means understanding the geometric action — what happens to every arrow in space when you apply the transformation.

The columns tell you everything

Here's the most important fact about matrix-vector multiplication: the columns of A are where the basis vectors land after the transformation.

Recall that any vector x = x₁ê₁ + x₂ê₂. Now apply A to both sides:

Step 1 — write x as a linear combination of basis vectors: x = x₁ê₁ + x₂ê₂

Step 2 — apply A. Because A is linear, it distributes: Ax = A(x₁ê₁ + x₂ê₂) = x₁(Aê₁) + x₂(Aê₂)

Step 3 — but Aê₁ is just the FIRST COLUMN of A, and Aê₂ is the SECOND: Ax = x₁ · col₁(A) + x₂ · col₂(A)

Conclusion: Ax is a linear combination of A's columns, weighted by the entries of x.

This is the geometric reading of matrix multiplication: to transform x, you go to where ê₁ landed, scale it by x₁, go to where ê₂ landed, scale it by x₂, then add them up. The whole transformation is determined by where the basis vectors go.

Column 1 = image of ê₁

After transformation, the unit vector along x becomes the first column of A. It may stretch, shrink, or rotate.

Column 2 = image of ê₂

After transformation, the unit vector along y becomes the second column of A. Together, they define the entire transformation.

Matrix-vector multiplication, derived

Let's go slow and build the mechanics from what we know, no memorization needed.

Given a 2×2 matrix A and vector x: A = [[a, b], [c, d]]    x = [x₁, x₂]ᵀ

Step 1 — Ax is a linear combination of columns, weighted by x: Ax = x₁·[a, c]ᵀ + x₂·[b, d]ᵀ

Step 2 — Add component by component: Ax = [ax₁ + bx₂, cx₁ + dx₂]ᵀ

Step 3 — Equivalently (dot product of each ROW with x): (Ax)₁ = [a, b] · x = ax₁ + bx₂    ← row 1 dot x
(Ax)₂ = [c, d] · x = cx₁ + dx₂    ← row 2 dot x

Both views — column combination and row dot products — give the same answer. The column view is geometric (where do basis vectors go?). The row view is computational (project x onto each output direction). Both are useful. Master both.

The (i,j) Entry Rule
For a general matrix product C = AB, the entry C_ij = (row i of A) · (column j of B). It's a dot product. This is why matrix multiplication is the way it is — each entry encodes how much one row direction aligns with one column direction.
Interactive — Grid Transformation edit the matrix columns — watch the grid deform
Presets:
1.00
0.00
0.00
1.00
det(A) — area scale
1.000
col₁ = image of ê₁
[1.00, 0.00]
col₂ = image of ê₂
[0.00, 1.00]
orientation
preserved
Interactive — Transform a Single Vector adjust the matrix and the input vector
1.50
0.50
-0.50
1.20
1.0
1.0
input x
output Ax
‖x‖
‖Ax‖

Chaining transformations = matrix multiplication

Apply transformation B first, then transformation A. The combined effect is a single matrix AB. This is exactly what matrix multiplication computes — the composition of two linear maps.

Apply B first, then A: y = A(Bx) = (AB)x

The (i,j) entry of AB — derived from the column rule: (AB)ᵢⱼ = (row i of A) · (col j of B) = Σₖ Aᵢₖ Bₖⱼ

Why? Each column of AB is A applied to a column of B: col_j(AB) = A · col_j(B)
⚠️ Critical — Order Matters

AB ≠ BA in general. "Rotate then shear" is not the same as "shear then rotate." Matrix multiplication is not commutative. This is one of the most important things to internalize — transformations applied in different orders produce different results. Try it geometrically: rotate a square 90°, then shear it. Now reverse the order. Different result.

Interactive — Transformation Composition (AB vs BA) see why order matters
45°
0.70
A = rotation matrix
B = shear matrix
AB (rotate then shear)
BA (shear then rotate)

Important transformations and their matrices

Every transformation has a matrix. Here are the ones you'll encounter constantly — derive them by asking "where does ê₁ go? where does ê₂ go?" and writing those as columns.

Scaling by sx in x, sy in y: A = [[sx, 0], [0, sy]]    det = sxsy

Rotation by angle θ (CCW): A = [[cos θ, −sin θ], [sin θ, cos θ]]    det = 1

Horizontal shear by k: A = [[1, k], [0, 1]]    det = 1

Reflection across x-axis: A = [[1, 0], [0, −1]]    det = −1

Projection onto x-axis: A = [[1, 0], [0, 0]]    det = 0    ← collapses dimension

Notice how the determinant tells you everything about area change: det = 2 means areas double. det = −1 means orientation flips. det = 0 means the transformation collapses space to a lower dimension — this is a critical geometric warning you'll see again in null spaces.

Interactive — Transformation Zoo watch the unit square transform
Type:
1.50
0.50
matrix A
det(A)
area: before → after
what it does

What makes a transformation linear?

Not every function T: ℝⁿ → ℝᵐ is linear. Linear transformations obey exactly two rules:

Rule 1 — Additivity (T respects vector addition): T(u + v) = T(u) + T(v)

Rule 2 — Homogeneity (T respects scalar scaling): T(cv) = cT(v)

Combined into one condition (linearity): T(cu + dv) = cT(u) + dT(v)
💡 Insight — Grid Lines as the Test

Look at the transformation in the visualizations above. If the coordinate grid lines stay straight, evenly spaced, and the origin stays put — the transformation is linear and has a matrix. If any grid line curves, or the origin moves, it's not a linear transformation. This is the geometric litmus test.

⚡ EE — Impedance and Linear Systems

A circuit with n nodes can be described by Ax = b, where A is the conductance matrix (a linear transformation), x is the node voltage vector, and b is the current injection vector. Solving the circuit is inverting the transformation. Understanding A geometrically tells you about the structure of the circuit — singular A means the circuit has no unique solution.

⚡ EE — Rotation Matrices in Coordinate Frames

Coordinate frame changes are rotation matrices. When you transform a field from global to local coordinates (or vice versa), you're applying a rotation matrix. In EM, converting between Cartesian and spherical/cylindrical coordinates involves exactly these transformations. The matrix's columns tell you where each axis of one frame points in the other.

⚡ EE — State-Space Representation

A dynamical system ẋ = Ax is a matrix telling your state vector which direction to flow. The matrix A defines the geometry of the flow — its eigenvectors (Page 6) point along the natural axes of the dynamics, and its eigenvalues tell you how fast things grow or decay along each axis.

💡 Geometric Insight — Invertibility

An invertible matrix is a transformation you can undo. If det(A) ≠ 0, the transformation doesn't collapse any dimension — every output vector came from exactly one input vector. If det(A) = 0, the transformation squashes space to a lower dimension and information is lost: multiple inputs map to the same output. You cannot undo it.

The transformation picture you now have