linear algebra calculators

Linear Transformation Matrix Calculator

Apply 2D linear transformations — rotation, scaling, reflection, and shearing — to any input vector. Ideal for computer graphics, robotics, and linear algebra coursework.

About this calculator

A 2D linear transformation maps a vector (x, y) to a new vector (x′, y′) via matrix multiplication. For a rotation by angle θ: x′ = cos(θ)·x − sin(θ)·y and y′ = sin(θ)·x + cos(θ)·y. For uniform scaling: x′ = sₓ·x, y′ = s_y·y. Reflection across the y-axis gives x′ = −x, y′ = y. A horizontal shear produces x′ = x + k·y, y′ = y. Each transformation is represented by a 2×2 matrix T, so the output vector is T·[x, y]ᵀ. Compositions of transformations correspond to matrix multiplication: applying T₁ then T₂ equals (T₂·T₁)·v. This calculator computes the x-component of the transformed output directly from the formula.

How to use

Rotate vector (1, 0) by 90°. The formula gives x′ = cos(90°)·1 − sin(90°)·0 = 0·1 − 1·0 = 0. For the y-component: y′ = sin(90°)·1 + cos(90°)·0 = 1·1 + 0·0 = 1. So (1, 0) maps to (0, 1), confirming a 90° counterclockwise rotation. Try scaling: set transformation to 'scaling', scaleX = 3, inputX = 4 → x′ = 3·4 = 12.

Frequently asked questions

What is the matrix representation of a 2D rotation transformation?

A 2D rotation by angle θ counterclockwise about the origin is represented by the matrix R = [[cos θ, −sin θ], [sin θ, cos θ]]. Multiplying this matrix by a column vector [x, y]ᵀ gives the rotated coordinates. This matrix is orthogonal, meaning its inverse equals its transpose and it preserves lengths and angles. Rotation matrices are fundamental in computer graphics, robotics kinematics, and physics simulations.

How do you combine multiple linear transformations into a single matrix?

You can compose two transformations T₁ and T₂ by multiplying their matrices: the combined matrix is M = T₂·T₁, applied left-to-right means T₁ first, then T₂. For example, to rotate then scale, compute M = S·R where S is the scaling matrix and R is the rotation matrix. Matrix multiplication is associative but not commutative, so the order matters — rotating then scaling generally gives a different result than scaling then rotating.

What is the difference between a linear transformation and an affine transformation?

A linear transformation preserves the origin, meaning T(0) = 0, and satisfies T(au + bv) = aT(u) + bT(v). Rotations, scalings, reflections, and shears are all linear. An affine transformation adds a translation component, so T(v) = Av + t, which does not preserve the origin. Affine transformations are represented using homogeneous coordinates with 3×3 matrices in 2D, allowing translations to be expressed as matrix multiplication alongside linear operations.