Linear Algebra • Vector Transformation Calculator

2D Vector Transformer

Multiply 2D vectors by arbitrary 2×2 transformation matrices in real time. Visualize the mapped vector on an interactive Cartesian plane, observe how unit basis vectors deform into a parallelogram, inspect step-by-step row-by-column arithmetic, and export code directly to Python, JavaScript, CSS, and GLSL.

Reviewed by Sanjay Samanta & Academic Review Board Last updated: September 2026 Linear Map & Invariants Verified
2D Vector Transformation Calculator Linear Map: T(v) = A · v Invertible • det(A) = 3
Presets:
Transformation Matrix A (2×2) Columns = Basis Vectors
[
]
Determinant 3.0000
Trace (a + d) 4.0000
Input Vector v = [x, y]⊤ Drag handle on canvas or type
[
]
Quick:
Step-by-Step Matrix-Vector Multiplication
Row 1 • Column v (New X-coordinate): x'
x' = (2 × 1.5) + (1 × 1.0) = 3 + 1 = 4.0000
Row 2 • Column v (New Y-coordinate): y'
y' = (1 × 1.5) + (2 × 1.0) = 1.5 + 2 = 3.5000
Original |v| 1.8028
Transformed |v'| 5.3151
Length Ratio ×2.948
Developer Code Exports
import numpy as np
A = np.array([[2, 1], [1, 2]])
v = np.array([1.5, 1.0])
v_prime = A @ v  # [4.0, 3.5]
Interactive Cartesian Plane
Input v Output v' i'=(a,c) j'=(b,d)
+X +Y -X -Y i' j' v v'
Final Transformed Vector Result v' = A · v
Cartesian Coordinates:
[ 4.0000, 3.5000 ]⊤
Polar Coordinates (r, θ):
r = 5.3151, θ = 41.19°
Direct Answer & Overview
Verified Educational Guide

How to Transform a 2D Vector with a Matrix

To transform a 2D vector v = (x, y) using a 2×2 matrix A, multiply each row of the matrix by the coordinate vector (dot product). The new vector v' = (x', y') is given by x' = a·x + b·y and y' = c·x + d·y. Geometrically, the matrix scales, rotates, shears, or reflects the vector across the Cartesian plane, while its determinant det(A) = ad - bc dictates how surface area expands or shrinks.

2D Vector Transformation Formula Row-by-Column Dot Product Multiplication
Standard Equation
ƒ(x)
Q.E.D.
(x′y′)=(abcd)(xy)=(ax+bycx+dy)\begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} ax + by \\ cx + dy \end{pmatrix}
Step 1 • Matrix Input
Matrix A = [[a, b], [c, d]]

Columns define where basis vectors (1, 0) and (0, 1) land

Step 2 • Row Multiplication
x' = ax + by, y' = cx + dy

Row 1 gives new X; Row 2 gives new Y

Step 3 • Transformed Vector
Output v' = (x', y')

New position on Cartesian coordinate plane

Geometric Insight: The columns of matrix A represent the final coordinates of unit vectors (1, 0) and (0, 1).
Fundamental Rule
Input Parameters
Required
1
2×2 Matrix Entries [a, b; c, d] (determines rotation, scale, shear, or reflection)
2
2D Vector Coordinates (x, y)
Expected Outputs
Calculated
Transformed Vector v' = (x', y') with exact numerical coordinates
Step-by-Step Dot Product arithmetic for both x' and y'
Determinant det(A) = ad - bc (geometric area scaling factor)
Vector Magnitudes |v| and |v'| with length ratio stretch factor
Ready-to-use Code Exports (Python NumPy, JavaScript Canvas, CSS, GLSL)
Worked Numerical Example
Instant Verification
Transform vector v = (1.5, 1.0) using matrix A = [[2, 1], [1, 2]].
→ x' = (2)(1.5) + (1)(1.0) = 3 + 1 = 4.0 y' = (1)(1.5) + (2)(1.0) = 1.5 + 2 = 3.5
Transformed Vector v' = (4.0, 3.5)
Mathematical Foundations

What is a 2D Vector Transformation?

In linear algebra, a linear transformation (or linear mapping) is a function T: ℝ² → ℝ² that maps every 2D vector to another 2D vector while preserving two foundational properties:

1. Additivity
T(u + v) = T(u) + T(v)

Transforming the sum of two vectors yields the exact same result as transforming each vector individually and adding their outputs together.

2. Homogeneity (Scalar Scaling)
T(c · v) = c · T(v)

Scaling a vector by any scalar constant c before transforming produces the same output as scaling the transformed vector by c afterward.

Because of these two linearity rules, grid lines remain parallel and evenly spaced, and the origin (0, 0) remains fixed at the center. Every 2D linear transformation can be represented by a unique 2×2 matrix.

Step-by-Step Calculation

The Row-by-Column Dot Product Rule

To calculate the coordinates of the transformed vector v' = [x', y']ᵀ from matrix A and vector v = [x, y]ᵀ, multiply each row of matrix A by the column vector:

Computing the New X-Coordinate (x'):

Take the first row of matrix A — [a, b] — and compute its dot product with vector [x, y]:

x' = (a × x) + (b × y)
Computing the New Y-Coordinate (y'):

Take the second row of matrix A — [c, d] — and compute its dot product with vector [x, y]:

y' = (c × x) + (d × y)
💡
Memory Trick: Think of the calculation as "Run across the row, dive down the column". Multiply corresponding terms and add them together.
Visual Intuition

The Basis Vector Secret: Columns Are Transformed Unit Vectors

The most intuitive way to understand 2D matrices (popularized by 3Blue1Brown's Essence of Linear Algebra) is to realize that every 2×2 matrix is completely described by where it sends the two standard unit basis vectors i = (1, 0) and j = (0, 1):

Column 1 = Where i Lands
A · [1, 0]ᵀ = [a, c]ᵀ

The first column [a, c] tells you exactly where the standard horizontal unit vector (1, 0) ends up after the transformation.

Column 2 = Where j Lands
A · [0, 1]ᵀ = [b, d]ᵀ

The second column [b, d] tells you exactly where the standard vertical unit vector (0, 1) ends up after the transformation.

Because any vector v = (x, y) can be written as v = x·i + y·j, its transformation is simply:

T(v) = x · T(i) + y · T(j) = x · [a, c]ᵀ + y · [b, d]ᵀ = [ax + by, cx + dy]ᵀ
Geometric Invariants

What Does the Determinant det(A) = ad - bc Mean?

The determinant is not just an arbitrary algebraic formula; it has an exact geometric interpretation: it is the area scaling factor of the transformation.

Determinant Value Area Effect Spatial Orientation Invertibility
det(A) > 0 Scales area by factor of |det A| Preserved (No reflection) Invertible
det(A) = 1 Area is exactly preserved (Equiareal) Preserved Invertible
det(A) < 0 Scales area by factor of |det A| Reversed (Spatial flip / Reflection) Invertible
det(A) = 0 Area collapses completely to zero Collapsed to a line or point Singular (Not Invertible)
Transformation Catalog

Common 2D Transformation Matrices Reference

The table below lists the standard 2×2 matrix representations for elementary geometric transformations in ℝ²:

Operation Matrix A = [[a, b], [c, d]] Transformed Coordinates [x', y'] Determinant
Identity (No change) [[1, 0], [0, 1]] [x, y] 1
Rotation by angle θ [[cos θ, -sin θ], [sin θ, cos θ]] [x·cosθ - y·sinθ, x·sinθ + y·cosθ] 1
Differential Scaling (sx, sy) [[sx, 0], [0, sy]] [sx · x, sy · y] sx · sy
Horizontal Shear (factor k) [[1, k], [0, 1]] [x + k·y, y] 1
Vertical Shear (factor k) [[1, 0], [k, 1]] [x, k·x + y] 1
Reflection across Y-Axis [[-1, 0], [0, 1]] [-x, y] -1
Orthogonal Projection onto X [[1, 0], [0, 0]] [x, 0] 0
Real-World Engineering

Where 2D Vector Transformations Are Used in Industry

1. Game Physics & Collision Detection

2D game engines (such as Unity 2D, Godot, Box2D) transform hitbox vertices and velocity vectors between local sprite coordinate spaces and global world spaces millions of times per second.

2. Computer Vision & Image Processing

OpenCV and machine learning preprocessing pipelines use 2×2 transformation matrices to apply data augmentation (random rotations, shears, zooms) to train robust convolutional neural networks.

3. Robotics & Inverse Kinematics

Robotic arms rely on matrix transformations at each joint to compute end-effector positions in planar workspace trajectories using forward and inverse kinematics.

4. Web Graphics & CSS Hardware Acceleration

Modern browsers compile CSS transform: matrix(...) and SVG transformation attributes directly into GPU vertex shaders for silky 60fps animations.

Frequently Asked Questions

How do you multiply a 2×2 matrix by a 2D vector?
Matrix-vector multiplication computes each component of the output vector via the dot product of a matrix row with the coordinate vector. For matrix A = [[a, b], [c, d]] and vector v = [x, y]ᵀ, the new x-coordinate is x' = a·x + b·y (the dot product of Row 1 and v), and the new y-coordinate is y' = c·x + d·y (the dot product of Row 2 and v).
What do the columns of a 2×2 transformation matrix represent?
The columns of a 2×2 transformation matrix represent the exact coordinates where the standard unit basis vectors land after transformation. The first column [a, c]ᵀ is where the x-basis vector i = (1, 0) transforms to: A · [1, 0]ᵀ = [a, c]ᵀ. The second column [b, d]ᵀ is where the y-basis vector j = (0, 1) transforms to: A · [0, 1]ᵀ = [b, d]ᵀ. Any other vector is simply a linear combination of these two transformed basis vectors.
What is the geometric meaning of the matrix determinant det(A)?
The determinant det(A) = ad - bc measures the factor by which the transformation scales areas on the 2D plane. If det(A) = 3, any 2D region or polygon has its surface area tripled. If det(A) = 1, the transformation preserves area (equiareal). If det(A) is negative, the orientation of space has been reversed (a reflection has occurred). If det(A) = 0, the matrix collapses 2D space onto a 1D line or a single point, meaning the transformation is singular and non-invertible.
Can a 2×2 matrix perform 2D translation (moving an object)?
No. A 2×2 matrix represents a strictly linear transformation, and every linear transformation must map the origin (0, 0) to itself (A · 0 = 0). Translation shifts the origin (T(0) ≠ 0) and is an affine transformation. To combine translation with rotation, scaling, and shearing into a single matrix multiplication, computer graphics uses 3×3 homogeneous matrices with vectors represented as [x, y, 1]ᵀ.
How do you invert a 2D vector transformation to recover the original vector?
To reverse the transformation and find original coordinates v from transformed coordinates v', multiply v' by the inverse matrix A⁻¹: v = A⁻¹ · v'. For matrix A = [[a, b], [c, d]], the inverse exists if det(A) = ad - bc ≠ 0 and is given by A⁻¹ = (1 / det(A)) · [[d, -b], [-c, a]]. If det(A) = 0, the transformation is singular and cannot be inverted.
How does vector length (magnitude) change during a linear transformation?
In general, a linear transformation stretches or compresses vectors by different factors depending on their orientation. The original vector magnitude is |v| = √(x² + y²), and the transformed magnitude is |v'| = √(x'² + y'²). Only orthogonal transformations (pure rotations and reflections, where Aᵀ · A = I) preserve vector lengths identically for all vectors (|v'| = |v|).
What are eigenvectors and eigenvalues in a 2D vector transformation?
An eigenvector is a non-zero vector whose direction does not change when multiplied by matrix A—it only scales along its original line: A · v = λ · v. The scalar factor λ is the eigenvalue. For example, in a pure scaling matrix with factors sx and sy, the coordinate axes are the eigenvectors with eigenvalues λ₁ = sx and λ₂ = sy.