Matrices and linear transformations

Represent vector transformations and linear systems. Theory, formulas, worked examples and interactive graphs.

What it is

A matrix is a compact way of writing a linear transformation: a rule T that takes a vector v and produces another vector T(v), satisfying T(v + w) = T(v) + T(w) and T(cv) = cT(v). When that rule acts on finite-dimensional vectors, it can always be written as a matrix-vector product, Av, where the columns of A are the images of the vectors of the original basis.

Multiplying two matrices, AB, represents applying transformation B first and then transformation A to the result. Order matters: in general AB is not equal to BA, since composing transformations is not commutative except in special cases.

Why it appears in physics

It appears because almost any linear relation between multi-component physical quantities is naturally represented as a matrix acting on a vector: a rotation in space, a change of basis between reference frames, the relation between currents and voltages in a circuit network, or the evolution of a quantum state vector under an operator.

It also appears when describing systems of linear equations, where all the information of the system is condensed into a coefficient matrix, and when modeling discrete dynamical systems, where the state at the next instant is obtained by multiplying the current state by a transition matrix.

Visual or geometric idea

The visual idea is this: a matrix distorts space uniformly. Imagine a square grid; after applying the matrix, the grid turns into a lattice of parallelograms, but straight lines remain straight and the origin stays fixed. The columns of the matrix are exactly the images of the standard basis vectors, so seeing where those few vectors land is enough to understand the whole transformation.

If the transformation preserves angles and lengths, it is a rotation or a reflection; if it stretches more in one direction than another, it describes an anisotropic deformation, typical of mechanical stresses or oscillation modes.

Minimal symbolic language

Symbolically, T(v) = Av, where A is an m×n matrix if T maps from an n-dimensional space to an m-dimensional one. The product (Av)_i = Σ_j A_ij v_j sums, for each row i, the product of each row entry by the corresponding component of v.

Composing transformations translates into a matrix product: if T1 is represented by A and T2 by B, then T2(T1(v)) is represented by BA, not by AB. The identity matrix I leaves any vector unchanged, and the inverse matrix A^-1, when it exists, undoes the transformation of A.

What the result means

The result means the transformed vector: its new components, expressed in the same basis or in a different one if the matrix represents a change of coordinates. Each component of the resulting vector is a specific linear combination of the original components, weighted by the coefficients of a matrix row.

If the matrix represents a physical quantity with units (a stiffness matrix, a conductance matrix, or an inertia matrix), the result inherits combined units, and it is worth checking that they make dimensional sense for the output vector.

When not to use it

Do not use a matrix when the relation between the quantities is not linear: if doubling an input does not exactly double the corresponding output, the relation cannot be represented by Av without approximation. Also do not confuse the size of a matrix with its invertibility: a square matrix may fail to have an inverse if its determinant is zero.

Do not swap the order of a composition AB for BA either, unless you have explicitly checked that both matrices commute; in general they represent different physical processes.

Operational summary

Write the transformation as Av, identify the columns of A as the images of the basis vectors, apply the matrix-vector product respecting rows and columns, and if several transformations are involved, multiply the matrices in the reverse order to how they are applied. Interpret the resulting vector in the physical context of the problem.

Procedure

Before calculating

Identify the input space and the output space of the transformation: how many components the original vector has and how many the result should have. This fixes the size of the matrix, m rows by n columns.

Decide whether you need to build the matrix from a physical description (for example, a rotation by a given angle) or whether you already have it and only need to apply it to a specific vector.

Step 1: identify the mathematical object

Recognize whether the problem asks you to apply a transformation (matrix-vector product), compose several transformations (matrix product), or invert a transformation (inverse matrix). Each operation has a different rule and a different order.

If you are building the matrix from scratch, identify the images of the basis vectors: each column of the matrix is the image of one basis vector under the transformation.

Step 2: choose the operation

To apply the transformation to a vector, use the product Av row by row. To compose transformation T2 after T1, multiply the matrices in the order BA, with B representing the transformation applied second.

To undo a transformation, find the inverse matrix A^-1 and check it by verifying that A A^-1 = I.

Step 3: preserve units and signs

Respect the order of rows and columns in every sum: (Av)_i sums over the column index j, not over the row index. A frequent error is accidentally transposing the matrix while multiplying.

If the matrix carries physical units, check that the final product has units consistent with the expected output quantity.

Step 4: calculate

Calculate each component of the resulting vector separately, summing the row-by-column products. If several matrices must be multiplied, decide the correct order before operating, and multiply from right to left when applying the transformation to a specific vector.

When possible, check the result in a simple limiting case, such as applying the transformation to the zero vector or to a basis vector.

Step 5: interpret the result

Describe the resulting vector in the physical language of the problem: new position, new state, new combination of currents or voltages. If the matrix represented a change of coordinates, clarify in which reference frame the result is expressed.

Also check whether the transformation preserves any relevant property, such as vector length or the angle between two vectors, which would indicate a rotation or an isometry.

Self-check checklist

Check that the size of the matrix is compatible with the input vector, that the product was calculated row by column and not the other way around, that the composition order of several matrices is correct, and that you can describe in words what the resulting vector represents physically.

Guided example

Physical situation

A position vector (x, y) in the plane must be rotated 90 degrees counterclockwise to describe the turning of a part in a mechanism. The task is to find the new position of the point (3, 1) after the rotation.

Mathematical translation

A rotation by angle θ is represented by the matrix R = [[cos θ, −sin θ], [sin θ, cos θ]]. For θ = 90°, cos θ = 0 and sin θ = 1, so R = [[0, −1], [1, 0]]. The new vector is obtained by multiplying R by the original vector.

Step-by-step calculation

Applying R to the vector (3, 1): the first component is 0·3 + (−1)·1 = −1, and the second component is 1·3 + 0·1 = 3. The transformed vector is (−1, 3).

Reading the result

The point (3, 1) becomes (−1, 3) after the 90-degree rotation. One can check that the length is preserved: both vectors have length square root of 10, confirming that R is a pure rotation with no scaling.

Common error avoided

This avoids multiplying the vector by the matrix in the wrong order (vector times matrix instead of matrix times vector), which is generally not defined the same way or gives a different result. It also avoids confusing sin θ with −sin θ when building the matrix, an error that reverses the sense of rotation.

Inverse example

Given result

A linear transformation sends the basis vector (1, 0) to (2, 0) and the basis vector (0, 1) to (0, 3).

What physical question it can answer

That information is enough to reconstruct the full matrix of the transformation without further data: its columns are exactly those images, so A = [[2, 0], [0, 3]]. Physically, this matrix represents an independent scaling along each axis, typical of an anisotropic deformation or a stress ellipse with principal axes aligned with the coordinate axes.

Common errors

Error 1: reversing the order of matrix-vector multiplication

It seems reasonable to multiply the vector by the matrix in any order. It fails because the product Av and the product vA (if it were defined) do not represent the same operation or the same result. Detect it by checking dimensions: Av requires the number of columns of A to match the number of components of v. Correct it by always writing the matrix on the left of the vector when applying a transformation. Mini-example: for a 2×3 matrix and a 3-component vector, only Av is defined, not vA.

Error 2: assuming AB equals BA

It seems reasonable because order does not matter when multiplying numbers. It fails because matrix multiplication represents composing transformations, and rotating first and then scaling is generally not the same as the reverse order. Detect it by comparing both products in a simple numerical example. Correct it by fixing the order in which transformations are applied before multiplying the matrices. Mini-example: rotating and then stretching an object does not give the same shape as stretching and then rotating.

Error 3: forgetting that not every square matrix has an inverse

It seems reasonable to look for the inverse of any square matrix. It fails if the determinant of the matrix is zero, in which case the transformation collapses some direction and cannot be undone. Detect it by calculating the determinant before searching for the inverse. Correct it by verifying that the determinant is nonzero, or by recognizing that the transformation loses information in that case. Mini-example: a matrix that projects space onto a line cannot be inverted, because many different vectors produce the same image.

Error 4: mixing up rows and columns when building the matrix

It seems reasonable to write coefficients in any arrangement as long as they are all present. It fails because each column must represent the image of a specific basis vector, and accidentally transposing the matrix completely changes the represented transformation. Detect it by checking the image of the first basis vector against the first column of the built matrix. Correct it by explicitly verifying each column against the physical definition of the transformation. Mini-example: if the x axis is scaled by 2 and the y axis by 3, the correct matrix is diag(2, 3), not its inverted transpose.

Error 5: treating a nonlinear transformation as if it were linear

It seems reasonable to write any relation between vectors as a matrix. It fails if the relation includes quadratic terms, products between components, or nonlinear angular dependencies, which cannot be represented by an exact product Av. Detect it by checking whether doubling the input exactly doubles the output. Correct it by linearizing only within a small neighborhood, if the problem allows it, and explicitly stating that approximation. Mini-example: the relation between angle and position for a large pendulum is not linear, although it is approximated as such for small angles.

Quick detection rule

If the order of a matrix multiplication is changed without physical justification, if an inverse is sought without checking the determinant, or if a quadratic relation is treated as linear without stating the approximation, the error is probably in the algebraic setup, not in the final arithmetic.

Physical applications

1. Rotations and reference changes

It appears when describing the turning of a body or the change between two coordinate systems. The transformed vector is calculated by multiplying the rotation matrix by the original vector. The result gives the new position or orientation while preserving lengths and angles. The dangerous error is confusing the sense of rotation or the composition order of several successive rotations. As a final control, the learner must explain which geometric property is preserved and which one changes after the transformation.

2. Electric circuits

It appears when relating currents and voltages in a network through an impedance or conductance matrix. The unknown current or voltage vector is calculated by solving a system written in matrix form. The result predicts the full electrical behavior of the network. The dangerous error is building the matrix without respecting the actual topology of the circuit. As a final control, the learner must explain what each row and column of the matrix represents in terms of nodes or loops.

3. Coupled oscillations

It appears when writing the equation of motion of several connected masses as a single matrix system. The evolution of the position vector is calculated by applying the coupling matrix. The result describes how motion is transmitted between the masses. The dangerous error is treating each mass in isolation while ignoring the off-diagonal terms of the matrix. As a final control, the learner must explain which matrix entry connects each pair of masses.

4. Quantum mechanics

It appears because physical operators act on state vectors through matrix multiplication in a finite basis. The new state is calculated by applying the operator's matrix to the state vector. The result predicts the evolution or the measurement of a quantum system. The dangerous error is applying operators in the wrong order when combining several that do not commute. As a final control, the learner must explain why the order of applying two operators can change the physical result.

5. Graphics and geometric transformations

It appears when scaling, rotating, or projecting shapes in design applications, geometrical optics, or physical simulation. The image of each point is calculated by applying the corresponding transformation matrix. The result predicts the final shape of an object after several combined operations. The dangerous error is applying the transformations in an order different from what the physical or geometric problem requires. As a final control, the learner must explain how the result would change if the order of two successive transformations were reversed.

Practice

Level 1: recognition

Identify, for a transformation described in words (a rotation, a scaling, a projection), how many rows and columns its matrix should have and what each column represents.

Exercise: describe in words the matrix that reflects a vector about the x axis, and predict what its columns would be before writing it down.

Level 2: direct application

Apply a simple matrix to a specific vector and check the result by calculating component by component.

Exercise: apply a 90-degree rotation matrix to three different vectors and verify that the length of each one is preserved.

Level 3: choosing the tool

Decide whether the problem asks you to apply a transformation, compose several, or invert one, and choose the corresponding matrix product.

Exercise: set up the matrix resulting from rotating 45 degrees and then scaling by a factor of 2, and explain in which order the matrices must be multiplied.

Level 4: physical interpretation

Interpret the result of applying a matrix to a physical state vector: position, current, or a simplified quantum state.

Exercise: given a coupling matrix between two masses, describe in words what happens to the position of each mass after a small time interval.

Level 5: intentional error

Analyze a calculation where the vector was multiplied by the matrix in the wrong order, or where a matrix was inverted without checking that its determinant is nonzero. Detect the error, correct it, and explain what physical consequence it would have had.

Exercise: invent a plausible error when building a rotation matrix, write why it seems reasonable, correct it, and state which incorrect vector it would have produced.