Web Simulation 

 

 

 

 

Eigenvalues and Eigenvectors - Interactive Tutorial 

Eigenvalues and Eigenvectors are fundamental concepts in linear algebra with far-reaching applications in physics, engineering, machine learning, and data science. This interactive tutorial provides a geometric understanding of these concepts through visualization.

🎯 The Core Insight

Eigenvectors are special vectors that don't get "knocked off" their span during a linear transformation. They only get stretched or compressed (scaled) by a factor called the eigenvalue.

🎮 Simulation Features

  • Interactive Vector: Move your mouse to control the input vector and see real-time transformation
  • Eigenvector Detection: Vectors turn GOLD when aligned with eigenvector directions
  • Area Visualization: See how the matrix transforms a unit square (determinant = area scale factor)
  • Complex Eigenvalue Animation: Visualize rotation/spiral behavior with trajectory animation
  • 13 Preset Matrices: Including scaling, shear, rotation, reflection, projection, and spiral matrices

1. Introduction: What Are Eigenvalues and Eigenvectors?

1.1 The Definition

Given a square matrix A, a non-zero vector v is called an eigenvector if:

A · v = λ · v

Where:

  • A is an n×n matrix (linear transformation)
  • v is the eigenvector (non-zero)
  • λ (lambda) is the eigenvalue (scalar)

1.2 Geometric Interpretation

When you apply a linear transformation to most vectors, they change both direction and magnitude. But eigenvectors are special:

Vector Type

After Transformation

Visual Effect

Generic Vector

Direction AND magnitude change

Rotates and stretches unpredictably

Eigenvector

Only magnitude changes (by factor λ)

Stays on the same line (span)

Transformation of a generic vector:
→ v
⟶ A ⟶
↗ Av (different direction)
Transformation of an eigenvector:
→ v
⟶ A ⟶
→→ λv (same direction, scaled)

2. Finding Eigenvalues and Eigenvectors

2.1 The Characteristic Equation

To find eigenvalues, we solve the characteristic equation:

det(A - λI) = 0

For a 2×2 matrix:

A = | a  b |
    | c  d |

Characteristic equation:
det | a-λ   b  | = 0
    |  c   d-λ |

(a-λ)(d-λ) - bc = 0

λ² - (a+d)λ + (ad-bc) = 0

λ² - trace(A)·λ + det(A) = 0

2.2 Solving for Eigenvalues

Using the quadratic formula:

λ = (trace ± √(trace² - 4·det)) / 2

Where: trace = a + d and det = ad - bc

2.3 The Discriminant

The discriminant Δ = trace² - 4·det determines the nature of eigenvalues:

Discriminant (Δ)

Eigenvalue Type

Geometric Meaning

Δ > 0

Two distinct real eigenvalues

Two independent eigenvector directions

Δ = 0

One repeated real eigenvalue

One eigenvector direction (or shear)

Δ < 0

Complex conjugate eigenvalues

Rotation! No real eigenvectors

3. Geometric Visualization

3.1 How Linear Transformations Warp Space

A 2×2 matrix transforms the entire 2D plane. In the visualization below:

  • Dark gray grid: Original coordinate space (background)
  • Blue grid lines: Transformed coordinate system
  • Green shaded square: Input unit square (area = 1)
  • Red shaded parallelogram: Transformed unit square (area = |det(A)|)
  • Yellow dashed lines: Eigenvector directions (if real eigenvalues exist)

3.2 The "Aha!" Moment

Try this in the simulation: Move your mouse around the canvas. The cyan vector is your input, and the red vector is the output after transformation.

When you align the input vector with an eigenvector direction, the output vector will point in the exact same direction (or opposite if λ < 0). The vectors turn GOLD to celebrate!

3.3 The Determinant and Area

The determinant of a matrix has a beautiful geometric meaning:

  • |det(A)| = the factor by which areas are scaled
  • det(A) > 0: Orientation is preserved
  • det(A) < 0: Orientation is flipped (reflected)
  • det(A) = 0: The transformation is singular (collapses space to a line or point)

In the simulation, the Input Area (green square) is always 1. The Output Area (red parallelogram) equals |det(A)|. Watch how different matrices stretch, compress, or flip the unit square!

3.4 Complex Eigenvalues: Rotation and Spirals

When eigenvalues are complex, there are no real eigenvector directions - every vector gets rotated!

Complex eigenvalues come in conjugate pairs: λ = r·e±iθ

  • r = magnitude = scaling factor per iteration
  • θ = angle = rotation per iteration

The simulation shows a spiral trajectory when you click "▶ Spiral" - this visualizes repeated application of the matrix: v, Av, A²v, A³v, ...

Complex Eigenvalue

r Value

Trajectory Behavior

λ = r·e±iθ, r < 1

|λ| < 1

Spiral Inward → converges to origin

λ = e±iθ, r = 1

|λ| = 1

Pure Rotation → circular orbit

λ = r·e±iθ, r > 1

|λ| > 1

Spiral Outward → diverges to infinity

4. Common Matrix Types and Their Eigenvectors

The simulation includes 13 preset matrices demonstrating different transformation types:

4.1 Scaling Matrix (Preset: "Scale")

A = | 2  0 |    λ₁ = 2, v₁ = (1, 0)  ← x-axis
    | 0  3 |    λ₂ = 3, v₂ = (0, 1)  ← y-axis

Every axis-aligned vector is an eigenvector! Scales x by 2, y by 3. det = 6 (area multiplied by 6).

4.2 Shear Matrix (Preset: "Shear")

A = | 1  1 |    λ₁ = λ₂ = 1 (repeated)
    | 0  1 |    Only one eigenvector direction: (1, 0)

Only horizontal vectors stay on their span. det = 1 (area preserved!). This is called an "area-preserving shear".

4.3 Rotation Matrices (Presets: "Rotate 45°", "Rotate 90°")

A = | cos(θ)  -sin(θ) |    λ = cos(θ) ± i·sin(θ)
    | sin(θ)   cos(θ) |    COMPLEX eigenvalues!

No real eigenvectors! Every vector gets rotated - none stay on their span. det = 1 (rotation preserves area). Try the "▶ Spiral" button to see a circular orbit!

4.4 Reflection Matrices (Presets: "Reflect (x-axis)", "Reflect (y=x)")

Reflect x-axis:         Reflect y=x:
A = | 1   0 |           A = | 0  1 |
    | 0  -1 |               | 1  0 |
    
λ = +1, -1              λ = +1, -1

Reflections always have det = -1 (area preserved but orientation flipped). Notice the "(flipped)" indicator in the simulation!

4.5 Projection Matrix (Preset: "Project (onto y=x)")

A = | 0.5  0.5 |    λ₁ = 1 (onto the line y=x)
    | 0.5  0.5 |    λ₂ = 0 (perpendicular direction)

Projection onto the line y=x. det = 0 (singular!) - the entire plane collapses to a line. The red parallelogram becomes a line segment with zero area.

4.6 Symmetric Matrix (Preset: "Symmetric")

A = | 2  1 |    Symmetric matrices (A = Aᵀ) always have:
    | 1  2 |    - REAL eigenvalues (λ = 3, 1)
                - ORTHOGONAL eigenvectors

Notice the eigenvector directions are perpendicular! This is a fundamental property of symmetric matrices.

4.7 Spiral Matrices (Presets: "Spiral In/Out Fast/Slow")

These matrices combine rotation + scaling and demonstrate complex eigenvalues:

Preset

|λ|

Rotation

Behavior

Spiral In (Fast)

0.8

45°/iteration

Quickly spirals to origin

Spiral In (Slow)

0.95

15°/iteration

Slowly spirals to origin

Spiral Out (Fast)

1.15

45°/iteration

Quickly spirals outward

Spiral Out (Slow)

1.05

15°/iteration

Slowly spirals outward

Try it: Select a spiral preset, drag the purple "START" marker to set your initial point, then click "▶ Spiral" to watch the trajectory!

[
]
abcd
Trace (a+d): 4.0
Det (ad-bc): 3.0
Discriminant: 4.0
λ₁: 3.0
λ₂: 1.0
Input Area: 1.00
Output Area: 1.00
Move mouse to explore eigenvectors
Input Vector x
Output Vector Ax
Eigenvector Directions
Input Unit Square
Output (Transformed)
Linear Transformation Visualizer (Move mouse to explore)
Align the blue vector with a dashed line to find an eigenvector!
n=0

5. Applications of Eigenvalues and Eigenvectors

5.1 Principal Component Analysis (PCA)

In machine learning, PCA uses eigenvectors of the covariance matrix to find the directions of maximum variance in data:

  • Eigenvector with largest eigenvalue = direction of most variance
  • Used for dimensionality reduction
  • The eigenvalue magnitude indicates how much variance is captured

5.2 Stability Analysis

In dynamical systems dx/dt = Ax, eigenvalues determine stability:

Eigenvalue Property

System Behavior

All |λ| < 1 (discrete) or Re(λ) < 0 (continuous)

Stable - converges to origin

Any |λ| > 1 or Re(λ) > 0

Unstable - diverges

Complex eigenvalues

Oscillating - spirals

5.3 Google PageRank

The PageRank algorithm finds the dominant eigenvector of the web link matrix:

  • Web pages = states in a Markov chain
  • Links = transition probabilities
  • PageRank scores = eigenvector with λ = 1

5.4 Quantum Mechanics

In quantum physics, observable quantities are eigenvalues of Hermitian operators:

  • Energy levels = eigenvalues of Hamiltonian
  • Quantum states = eigenvectors
  • Measurement collapses system to an eigenstate

5.5 Vibration Analysis

Natural frequencies of mechanical systems are determined by eigenvalues:

  • Eigenvalues = squared natural frequencies (ω²)
  • Eigenvectors = mode shapes (how the system vibrates)
  • Critical for avoiding resonance in bridges, buildings

6. Important Properties

6.1 Key Theorems

  • Sum of eigenvalues = trace(A)
  • Product of eigenvalues = det(A)
  • If A is symmetric (A = Aᵀ), eigenvalues are always real
  • If A is symmetric, eigenvectors are orthogonal
  • Eigenvalues of A⁻¹ are 1/λ (same eigenvectors)
  • Eigenvalues of Aⁿ are λⁿ (same eigenvectors)

6.2 Diagonalization

If matrix A has n linearly independent eigenvectors, it can be diagonalized:

A = PDP⁻¹

Where P = matrix of eigenvectors (columns), D = diagonal matrix of eigenvalues

This makes computing powers of A easy: Aⁿ = PDⁿP⁻¹

6.3 When Are Eigenvectors Orthogonal?

⚠️ Common Misconception

Eigenvectors are NOT always perpendicular! They are only guaranteed to be orthogonal for symmetric matrices.

Symmetric Matrices: The Spectral Theorem

A matrix is symmetric if A = Aᵀ (i.e., a[i][j] = a[j][i]). For symmetric matrices:

  • Eigenvalues are always real (never complex)
  • Eigenvectors are always orthogonal (perpendicular, 90° apart)

This is guaranteed by the Spectral Theorem - one of the most important results in linear algebra!

Try it: Select the "Symmetric" preset in the simulation. Notice the two dashed eigenvector lines are exactly perpendicular!

General Matrices: No Orthogonality Guarantee

For non-symmetric matrices, eigenvectors can be at any angle:

Example: A = | 2  1 |    (upper triangular, NOT symmetric)
             | 0  3 |

λ₁ = 2 → v₁ = (1, 0)     ← horizontal
λ₂ = 3 → v₂ = (1, 1)     ← 45° diagonal

Angle between eigenvectors: 45° (NOT orthogonal!)

Summary: Eigenvector Orthogonality

Matrix Type

Eigenvectors Orthogonal?

Example in Simulation

Symmetric (A = Aᵀ)

✅ Always

"Symmetric" preset

Diagonal

✅ Yes (along axes)

"Scale (Diagonal)" preset

Rotation/Reflection

Complex λ or orthogonal

"Rotate 45°", "Reflect" presets

General matrix

❌ Not necessarily

Try: a=2, b=1, c=0, d=3

Shear

Only 1 eigenvector direction

"Shear" preset

🔬 Experiment: Enter the matrix a=2, b=1, c=0, d=3 in the simulation. You'll see the gold and orange eigenvector lines are at 45° - clearly NOT perpendicular! Then switch to "Symmetric" preset and see them become exactly 90° apart.

7. Using the Simulation

7.1 Simulation Controls

Control

Description

Matrix Inputs (a, b, c, d)

Directly edit the 2×2 matrix values

Preset Dropdown

Select from 13 predefined matrices (changes to "Custom" when you edit values)

Mouse Movement

Control the input vector position to explore transformations

Show Grid

Toggle the background coordinate grid

Show Transformed Grid

Toggle the blue transformed coordinate lines

Show Eigen Lines

Toggle the yellow dashed eigenvector direction lines

Show Trajectory

Toggle visibility of spiral trajectory animation

Purple "START" Marker

Drag to set initial point for spiral animation (only visible for complex eigenvalues)

▶ Spiral Button

Start trajectory animation (only visible for complex eigenvalues)

↺ Reset Button

Clear trajectory and reset animation

7.2 Visual Elements

● Cyan Vector

Input vector (mouse position)

● Red Vector

Output vector (Ax)

● Gold Vectors

Eigenvector found!

■ Green Square

Input unit square (area = 1)

▰ Red Parallelogram

Output area (|det(A)|)

● Purple Marker

Draggable start point for spiral

8. Exercises to Try

8.1 Find the Eigenvectors

Use the simulation to find eigenvector directions for these matrices:

Matrix 1:
| 3  1 |
| 1  3 |

Hint: λ = 4 and 2

Check: det = 8, area = 8×

Matrix 2:
| 0  1 |
| 1  0 |

Hint: This is a reflection!

Check: det = -1 (flipped)

Matrix 3:
| 2  0 |
| 0  2 |

What's special about this? (Every direction is an eigenvector!)

8.2 Predict Before You Check

  1. Calculate eigenvalues by hand using the quadratic formula
  2. Predict where the eigenvector directions should be
  3. Predict the output area (det = λ₁ × λ₂)
  4. Verify using the simulation

8.3 Explore Edge Cases

  • Singular matrix (det = 0): Try the "Project (onto y=x)" preset. Notice the red parallelogram collapses to a line!
  • Pure rotation (det = 1, complex λ): Try "Rotate 45°" or "Rotate 90°". The spiral is a perfect circle.
  • Negative determinant: Try "Reflect (x-axis)". Notice the "(flipped)" label!
  • Repeated eigenvalue: Try the "Shear" preset (λ₁ = λ₂ = 1).

8.4 Spiral Challenge

  1. Select "Spiral In (Fast)" preset
  2. Drag the purple marker to position (2, 2)
  3. Click "▶ Spiral" and count how many iterations until it nearly reaches origin
  4. Now try "Spiral In (Slow)" - how many more iterations does it take?
  5. Try "Spiral Out" presets - the trajectory diverges! Can you predict when it will go off-screen?

9. Mathematical Summary

For a 2×2 Matrix A = [a b; c d]

Quantity

Formula

Geometric Meaning

Trace

τ = a + d

Sum of eigenvalues (λ₁ + λ₂)

Determinant

det = ad - bc

Area scale factor (λ₁ × λ₂)

Discriminant

D = τ² - 4·det

Real vs complex eigenvalues

Eigenvalues

λ = (τ ± √D) / 2

Scaling factors along eigenvector directions

Eigenvector for λ

v = (λ - d, c) or (b, λ - a)

Directions that don't rotate

Eigenvalue Classification

  • D > 0: Two distinct real eigenvalues → Two eigenvector directions
  • D = 0: One repeated eigenvalue → May have 1 or 2 eigenvector directions
  • D < 0: Complex conjugate eigenvalues → Rotation (no real eigenvectors)

Determinant and Area Transformation

Determinant

Area Change

Orientation

det > 0

Area multiplied by det

Preserved (same handedness)

det < 0

Area multiplied by |det|

Flipped (reflected)

det = 0

Area becomes 0

Singular (collapses to line/point)

Complex Eigenvalues: λ = r·e±iθ

  • r = |λ| = √det (when det > 0)
  • θ = arctan(Im(λ)/Re(λ)) = rotation angle per iteration
  • Trajectory: Anv traces a spiral with radius scaling as rn

Limitations

  • 2×2 matrices only: the visualizer is limited to two dimensions so eigenvectors can be drawn in the plane. Real applications (PCA, vibration modes) use much larger matrices.
  • Real, diagonalizable focus: repeated (defective) eigenvalues and non-diagonalizable matrices are not handled specially; complex eigenvalues are shown via spiral animation rather than a full complex eigenbasis.
  • Geometric, not numerical: eigenvalues come from the closed-form 2×2 characteristic equation, not an iterative solver — it does not teach numerical methods (QR algorithm, power iteration).
  • Display scaling: vectors and the unit square are drawn in screen units; very large eigenvalues are clamped for visibility.