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)
b (top-right)
c (bottom-left)
d (bottom-right)
Identity
Results
Determinant det(A)
Trace tr(A)
Eigenvalue λ₁
Eigenvalue λ₂
Mat

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

Theory & Key Formulas

$\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

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 \gt 1$ means stretching, $0 \lt \lambda \lt 1$ means shrinking, and a negative $\lambda$ means the vector is also flipped to point the opposite way along the same line.

Frequently Asked Questions

Initially, the matrix is the identity matrix (a=1, d=1, b=0, c=0), so applying the transformation does not change the original grid. If you change the values of a or d from 1 using the slider, or set b or c to non-zero values, scaling, rotation, and shearing will be visualized in real time.
The eigenvectors (arrows) displayed on the screen do not change direction when the matrix is applied; only their length is multiplied by the eigenvalue. By observing that these arrows only stretch or shrink without rotating when you change the matrix with the slider, you can intuitively understand this concept.
Yes. The change in grid area corresponds to the absolute value of the determinant. When you change a and d with the slider, the area expands or shrinks. Additionally, you can visually confirm that as the determinant approaches zero, the grid collapses and the inverse matrix no longer exists.
A rotation matrix requires the relationships a=cosθ, b=-sinθ, c=sinθ, d=cosθ. Since the sliders operate each component independently, you need to manually set these numerical values to reproduce an accurate rotation. If you want to change the angle θ, please calculate cos and sin using a calculator and input them.

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.

How to Use

  1. Input your 2x2 matrix coefficients into fields saNum (top-left), sbNum (top-right), scNum (bottom-left), and sdNum (bottom-right) to define matrix A
  2. Adjust the sliders sa, sb, sc, sd to animate transformations in real-time and observe how the unit square and basis vectors rotate, scale, or shear
  3. Monitor the output statistics: determinant det(A) indicates area scaling factor, trace tr(A) equals sum of eigenvalues, and λ₁, λ₂ show principal stretch directions and magnitudes

Worked Example

For a 90-degree counterclockwise rotation matrix: saNum=0, sbNum=-1, scNum=1, sdNum=0. The visualizer shows the unit square rotated with det(A)=1 (area preserved), tr(A)=0, and eigenvalues λ₁=i, λ₂=-i (complex pair indicating pure rotation). For a shear transformation with saNum=1, sbNum=0.5, scNum=0, sdNum=1: det(A)=1, and eigenvectors align along principal strain directions typical in finite element stress analysis.

Practical Notes

  1. When det(A)=0, the matrix is singular and collapses your geometry to a line or point—common when modeling degenerate finite element meshes
  2. Real eigenvalues indicate stretching axes; complex eigenvalues reveal rotational dominance useful for vibration mode analysis
  3. Use this to verify coordinate transformation matrices before applying to CAD geometry or FEA boundary conditions in structural mechanics workflows