Clever Quest Lab ← Labs

Matrix Transformations

Drag the two basis arrows and watch a 2×2 matrix move the whole plane.

grey: original grid   blue: transformed grid. Drag the tip of the green arrow î or the red arrow ĵ. Keyboard: focus the plane, press I, J or V to pick an arrow, then the arrow keys; Space plays.

Matrix A

î → ĵ →

Determinant and inverse

det A = ad − bc
Area scale
Orientation

A−1 =

A−1 = (1 / det A) · d−b−ca

Presets

View

Eigenvectors

Trace a + d
Determinant
Characteristic polynomial

Test vector v

v = (,)

Composition: does the order matter?

A is the main matrix above, B is a second matrix. “B A” means: apply A first, then B. The matrix on the right acts first.

Matrix B

B A: first A, then B

B A =

    A B: first B, then A

    A B =

      Each entry of a product is a row of the left matrix times a column of the right matrix.

      How to use it

      The picture shows the plane before and after a 2×2 matrix A acts on it. The faint grey grid is the original plane and the blue grid is where it ends up. The green arrow î and the red arrow ĵ show where the basis vectors (1, 0) and (0, 1) land, and those two landing points are exactly the two columns of the matrix. Drag either arrow, or type numbers into the matrix, and everything else follows. Press Play to watch the plane move from the identity (nothing changed) to your matrix.

      Controls

      How it works

      A linear transformation keeps sums and multiples: T(u + v) = T(u) + T(v) and T(kv) = kT(v). As a result the origin stays fixed and grid lines stay straight, parallel and evenly spaced. Every vector (x, y) is x times î plus y times ĵ, so its image is x times the first column plus y times the second:

      abcd applied to (x, y) gives (ax + by, cx + dy)

      The determinant ad − bc is the signed area of the parallelogram that the unit square becomes. Every area is multiplied by its absolute value. A negative determinant means the plane has been flipped over, so the letter F turns into its mirror image. A determinant of zero squashes the plane onto a line or a point.

      The inverse matrix undoes the transformation. It exists exactly when the determinant is not zero:

      A−1 = 1 / (ad − bc) · d−b−ca

      Composition is matrix multiplication. Doing A first and then B is the single matrix BA, read from right to left. Order usually matters: rotating and then shearing is not the same as shearing and then rotating, so BA and AB differ.

      An eigenvector is a non-zero vector that stays on its own line through the origin: Av = λv. The eigenvalue λ is the stretch factor along that line, and a negative λ reverses the direction. The eigenvalues solve λ² − (a + d)λ + (ad − bc) = 0. When this equation has no real solution, as for a rotation, no direction is preserved.

      Rotation by θ: cos θ−sin θsin θcos θ

      These ideas are everyday tools. Computer graphics rotates, scales and shears every point of an image or model with matrices. Robotics uses rotation matrices to convert between the coordinate frame of each joint and that of the workspace. In data analysis, principal component analysis looks for the eigenvectors of a covariance matrix.

      Things to try

      Frequently asked questions

      Why are the columns of a matrix the images of the basis vectors?

      Multiplying A by (1, 0) keeps only the first column, and multiplying by (0, 1) keeps only the second. So the columns are literally where î and ĵ go.

      What does a negative determinant mean?

      The orientation is reversed: a counter-clockwise loop becomes clockwise, like looking in a mirror. Areas are still scaled by the absolute value.

      Why is there no inverse when the determinant is zero?

      Many different points land on the same point, so the information about where they came from is lost and cannot be recovered.

      Can a 2×2 matrix shift the whole plane sideways?

      No. A linear map always leaves the origin in place. Graphics software handles shifts by adding a third coordinate and using 3×3 matrices.

      Why does a 180° rotation shrink to a point half-way through the animation?

      The animation blends each matrix entry in a straight line from the identity to A. Half-way between the identity and a half-turn is the zero matrix. The start and the end are still exact.

      More free games and simulators