Linear Algebra Matrix Transformation Visualizer Back
Linear Algebra Visualizer

Linear Algebra Matrix Transformation Visualizer

Use sliders to control a 2×2 matrix and watch the 2D grid transform in real time. Animate rotation, scaling, shear, and projection. See eigenvectors — the directions that survive the transformation unchanged.

Preset Transformations
Matrix Entries A = [[a,b],[c,d]]
a (top-left)1.00
b (top-right)0.00
c (bottom-left)0.00
d (bottom-right)1.00
Determinant det(A)
Trace tr(A)
Eigenvalue λ₁
Eigenvalue λ₂
Identity

Theory

$\det(A) = ad - bc$ (area scale factor)

Eigenvalues: $\lambda = \dfrac{(a+d) \pm \sqrt{(a-d)^2+4bc}}{2}$

$A\mathbf{v}= \lambda\mathbf{v}$ — eigenequation

Blue: original grid / Red: transformed grid / Yellow arrows: eigenvectors

What is a Matrix Transformation?

🧑‍🎓
What exactly is a 2x2 matrix *doing* to the space in this simulator? I see the grid moving, but what's the math behind it?
🎓
Basically, it's a set of instructions for moving every point in the plane. A point $(x, y)$ gets sent to a new location $(x', y')$ where $x' = a x + b y$ and $y' = c x + d y$. Try setting $a=1, b=0, c=0, d=2$ in the controls. You'll see the grid stretch vertically because the new $y'$ is twice the original $y$.
🧑‍🎓
Wait, really? So the determinant being the "area scale factor" means if I make a shape on the grid, its area after the transform is just multiplied by that number?
🎓
Exactly! For instance, if you set $a=2, d=2$ and $b=c=0$, the determinant is 4. A unit square becomes a 2x2 square with area 4. Now, try moving the 'b' slider to 1.5. See how the grid shears? The area of the transformed unit square (the parallelogram) is still given by $|ad - bc|$.
🧑‍🎓
That makes sense. But what about eigenvectors? They're the lines that don't rotate, right? How do I see them in the simulator?
🎓
Right! They're the "stable directions." Check the "Show Eigenvectors" box. Now, set a matrix like $a=3, b=1, c=1, d=2$. You'll see two colored lines. Points on those red/blue lines get stretched along the same line by their eigenvalue ($\lambda$). Try animating the rotation—you'll see most vectors tumble around, but any vector lying exactly on an eigenvector just grows/shrinks in place.

Physical Model & Key Equations

The core action of a 2x2 matrix $A$ is a linear transformation of any input vector $\mathbf{v}= [x, y]^T$ to an output vector $\mathbf{v}'$. This is governed by matrix-vector multiplication.

$$ \mathbf{v}' = A\mathbf{v}= \begin{bmatrix}a & b \\ c & d \end{bmatrix}\begin{bmatrix}x \\ y \end{bmatrix}= \begin{bmatrix}ax + by \\ cx + dy \end{bmatrix}$$

Here, $a, b, c, d$ are the four parameters you control in the simulator. They completely define how the entire 2D plane is stretched, rotated, and sheared.

A special case occurs for eigenvectors. These are non-zero vectors $\mathbf{v}$ that, when transformed, only get scaled by a factor $\lambda$ (the eigenvalue) and do not change their direction. This is captured by the eigenequation.

$$ A\mathbf{v}= \lambda \mathbf{v} $$

Solving this equation yields the eigenvalues $\lambda$, which tell you the scaling factor along the eigenvector direction. A positive $\lambda > 1$ means stretching, $0 < \lambda < 1$ means shrinking, and a negative $\lambda$ means the vector is also flipped to point the opposite way along the same line.

Real-World Applications

Computer Graphics & Animation: Every rotation, scaling, or skew effect in 2D image editing software or game engines is performed using matrix transformations. For instance, rotating a sprite character is done by applying a rotation matrix to all its vertices.

Principal Component Analysis (PCA) in Data Science: PCA finds the "eigenvectors" of a dataset's covariance matrix. These eigenvectors, called principal components, are the directions of maximum variance in the data and are used for dimensionality reduction and feature extraction.

Stress Analysis in Engineering: In continuum mechanics, the stress state at a point is represented by a tensor (a generalized matrix). Finding its eigenvectors reveals the principal stress directions—the planes where shear stress is zero and only normal stress acts, which is critical for failure prediction.

Quantum Mechanics: Observables like a particle's spin or momentum are represented by Hermitian matrices. The possible measurement outcomes are the eigenvalues of these matrices, and the state collapses into the corresponding eigenvector upon measurement.

Common Misconceptions and Points to Note

When you start playing with this visualizer, there are a few common pitfalls to watch out for. First, keep in mind that "when you modify the matrix entries, the transformation always occurs centered on the origin." For example, when you move the rotation slider, the entire grid rotates around the origin, right? In practice, if you want to rotate around a specific point, these basic transformations aren't enough—you'll need knowledge of parallel translation (affine transformations). Next, don't assume eigenvectors are always orthogonal. While eigenvectors of rotation or symmetric matrices are orthogonal, for a general matrix like a=1, b=1, c=0, d=2, the red and blue arrows (eigenvectors) only intersect at an angle. This is a real example of a deformation where the "principal axes" are not orthogonal. Finally, pay attention to the behavior as the determinant (det) approaches zero. When the value of ad-bc becomes zero, the area scaling factor becomes zero, meaning the 2D plane gets flattened into a 1D line or point (it "degenerates"). For instance, setting a=1, b=2, c=2, d=4 makes the determinant zero, and you can confirm that all points are pushed onto the line y=2x. This state indicates situations like systems of equations becoming unsolvable or loss of controllability, which you absolutely want to avoid in practical work.

Related Engineering Fields

This simple 2×2 transformation is actually the "core" of much larger engineering problems. For example, robotic arm control. How minute changes in joint angles translate to changes in the position and orientation of the end effector is represented by something called the "Jacobian matrix." It's precisely the linear relationship between input (joint angle change) and output (position change) that you're observing with this tool. Another is the strain rate tensor in fluid dynamics. Looking at a small region of fluid, the deformation due to flow can be decomposed into "rotation," "extension/contraction," and "shear." When you set c and b to the same value in this tool to create a shear deformation, you're visualizing the fluid's "simple shear flow." Finally, composite materials. In anisotropic materials like fiber-reinforced plastics, stiffness varies drastically depending on the direction of force. Understanding this directional dependence starts with grasping the material's principal axes (the eigenvector directions) and their corresponding stiffness (analogous to eigenvalues). This visualizer is an excellent entry point for understanding such a "world where properties change with direction."

For Further Learning

Once you're comfortable with this tool, it's recommended to broaden your horizons. First, Step 1: Increase the dimensions. After building intuition in 2D, consider 3D transformations via 3×3 matrices. The number of rotation axes increases and shear patterns become more complex, but the core concepts remain identical: eigenvectors are "axes whose direction doesn't change under transformation," and the determinant is the "volume scaling factor." The element stiffness matrices used in Finite Element Method (FEM) for CAE are essentially extensions of this. Step 2: Confirm the relationship with systems of equations. The transformation $A\mathbf{x}$ (multiplying matrix $A$ by vector $\mathbf{x}$) and solving the system of equations $A\mathbf{x}=\mathbf{b}$ are two sides of the same coin. You saw the deformation collapse when the determinant was zero in the visualizer, right? That corresponds to the situation where the solution to $A\mathbf{x}=\mathbf{b}$ is not uniquely determined. Step 3: Step into the world of numerical computation. Matrices handled in practical CAE can have dimensions in the tens of thousands to millions. Calculating all eigenvalues for such large matrices is impossible, so "iterative methods" that find a few of the largest/smallest ones are used. Having physically experienced "what eigenvalues and eigenvectors are" in 2D, you'll be able to understand "what these methods are trying to find" more deeply than others.