Linear transformations explained

Matrices are often taught as tables of numbers with strange rules for multiplying them. Seen as transformations of the plane, the rules become natural: a matrix is where the basis vectors go, its determinant is how areas change, its eigenvectors are the directions it leaves alone, and multiplying matrices is doing one transformation after another. This page explains each idea for 2×2 matrices, where everything can be drawn.

The plane transformed by the matrix [2 1; 1 2]: the faint original grid, the blue transformed grid, î and ĵ in green and red spanning a shaded parallelogram of area 3, a letter F stretched along the diagonal, the two dashed eigenvector lines with λ = 3 and λ = 1, and a vector v with its image Av
The plane transformed by the matrix [2 1; 1 2]: the faint original grid, the blue transformed grid, î and ĵ in green and red spanning a shaded parallelogram of area 3, a letter F stretched along the diagonal, the two dashed eigenvector lines with λ = 3 and λ = 1, and a vector v with its image Av

What makes a transformation linear

A transformation T of the plane is linear when T(u + v) = T(u) + T(v) and T(kv) = kT(v) for all vectors u, v and numbers k. Geometrically, the origin stays fixed, straight lines stay straight, and parallel, evenly spaced grid lines stay parallel and evenly spaced. Rotations about the origin, reflections in lines through it, stretches, shears and projections onto a line are all linear; a translation is not, because it moves the origin, and neither is anything that bends lines.

A matrix is where the basis vectors go

Every vector is a combination of î = (1, 0) and ĵ = (0, 1): (x, y) = x·î + y·ĵ. Linearity then gives T(x, y) = x·T(î) + y·T(ĵ), so T is completely decided by two vectors. Writing T(î) = (a, c) and T(ĵ) = (b, d) as the columns of a matrix gives A = [a b; c d], and the rule for multiplying a matrix by a vector, A(x, y) = (ax + by, cx + dy), is just this combination. A rotation by θ has the columns (cos θ, sin θ) and (−sin θ, cos θ); the shear [1 1; 0 1] keeps î and slides ĵ to (1, 1).

The determinant as a signed area

The unit square spanned by î and ĵ lands on the parallelogram spanned by the two columns. Its area is |ad − bc|, and because all the squares of the grid change alike, every area in the plane is multiplied by the same factor. Keeping the sign gives the determinant det A = ad − bc: positive when î still turns counter-clockwise towards ĵ, negative when the transformation flips the plane over like a reflection, which is why a letter F comes out mirrored. The determinant of a product is the product of the determinants, since the area factors multiply.

Singular matrices and inverses

When det A = 0 the two columns lie on one line and the whole plane collapses onto it (or onto the origin). Many points then share an image, so nothing can undo the map: the matrix is singular and has no inverse. When det A ≠ 0 the inverse is A⁻¹ = (1/(ad − bc))·[d −b; −c a]; it maps every point back, so A⁻¹A = AA⁻¹ = I. Solving the equations ax + by = p, cx + dy = q asks which point A sends to (p, q), and there is exactly one answer precisely when det A ≠ 0.

Eigenvectors and eigenvalues

An eigenvector of A is a non-zero vector that A only stretches, Av = λv, by its eigenvalue λ; the whole line through it is mapped onto itself. Since A − λI must then squash some direction to zero, det(A − λI) = 0, the characteristic equation λ² − (a + d)λ + (ad − bc) = 0. The sum of the eigenvalues is the trace a + d and their product is the determinant. Symmetric matrices always have real eigenvalues and perpendicular eigenvectors; a shear has the double eigenvalue 1 but only one line of eigenvectors; and a projection has the eigenvalues 1 (along its line) and 0 (the direction it destroys).

Complex eigenvalues: rotation and scaling

When the discriminant (a + d)² − 4(ad − bc) is negative, the eigenvalues are a conjugate pair α ± βi and no real direction stays put. Writing α + βi = r(cos φ + i sin φ), with r = √det A, the matrix is a rotation by φ combined with a scaling by r, seen in a suitable, possibly skewed, basis. Applying it again and again makes a point spiral: outwards if r > 1, inwards if r < 1 and round a closed ellipse if r = 1. The matrix [1 −1; 1 1] is exactly √2 times a rotation by 45°, and its eigenvalues are 1 ± i, which links 2×2 matrices to the multiplication of complex numbers.

Composition: one transformation after another

Applying A and then B sends v to B(Av), and the single matrix that does both is the product BA, whose columns are B applied to the columns of A. Because the second transformation is written on the left, products are read from right to left. Order matters: a quarter turn followed by a shear is a different map from the shear followed by the turn, so BA and AB generally differ. Matrix multiplication is associative, (CB)A = C(BA), because doing three transformations in turn does not depend on how you group them.

Polar and singular value decompositions, and how the app works

Every matrix factors into rotations and stretches. The polar decomposition A = RS writes it as a symmetric stretch S followed by a rotation R; the app's rotation-aware animation turns R gradually while S grows from the identity, so a rotation matrix turns instead of shrinking through the middle as on the straight path (1 − t)I + tA. The singular value decomposition A = UΣVᵀ is a rotation Vᵀ, a stretch along the axes by the singular values σ₁ ≥ σ₂ ≥ 0 and a rotation U, so the unit circle becomes an ellipse with the semi-axes σ₁ and σ₂. In the app every quantity comes from closed formulas for 2×2 matrices in double precision: the eigenvalues from the characteristic polynomial, the SVD from the half-sums and half-differences of the entries.

Frequently asked questions

Why do matrices multiply in such a strange way?

Because the product is defined to be the composition. The first column of BA must be where î ends up after A and then B, which is B applied to the first column of A, and the same holds for the second column. Writing that out entry by entry gives the row-times-column rule; it is not an arbitrary convention but the only rule that makes BA mean A followed by B.

Is a translation a linear transformation?

No: a translation moves the origin, and a linear map must send 0 to 0. Translations are affine. Computer graphics handles them by adding a third coordinate (homogeneous coordinates), so that a translation of the plane becomes a 3×3 matrix acting linearly on (x, y, 1).

What is the difference between the trace and the determinant?

Both stay the same under a change of basis, so they describe the transformation rather than the coordinates. The determinant ad − bc is the area factor and the product of the eigenvalues; the trace a + d is the sum of the eigenvalues. Together they decide the eigenvalues completely, through λ² − tr·λ + det = 0, and so whether a 2×2 matrix stretches along two lines, shears or rotates.

How is this different from the Matrix Calculator?

This app is about geometry: it draws what a single 2×2 matrix, or a product of two, does to the plane and animates it. The Matrix Calculator works with numbers: matrices up to 6 × 6 in exact fractions, with determinants, inverses, row reduction, eigenvalues and linear systems step by step. Use the calculator for exact answers and this app to see why they are what they are.

Ready to try it?

Open PictorX in your browser — no install, no credit card required to start.

Open the linear transformations app