Matrix Power Calculator
Run the Matrix Power Calculator Fullscreen
Edit the MicroSim with the p5.js editor
About This MicroSim
This calculator demonstrates one of the most practical applications of diagonalization: efficiently computing high powers of a matrix. Instead of multiplying A by itself k times, we use the decomposition A = PDP⁻¹ to compute A^k = PD^kP⁻¹.
Key Features:
- Editable matrix: Click cells to enter custom values
- Power slider: Compute A^k for k from 1 to 20
- Diagonalization display: See P, D, and P⁻¹ matrices
- Step-by-step: Watch how D^k is trivially computed
- Defective detection: Shows when diagonalization fails
How to Use
- Click matrix cells to enter custom values
- Adjust the power slider to compute different powers
- Toggle "Show Steps" to see the diagonalization process
- Use preset buttons for quick examples:
- Random: Generate a random matrix
- Diagonalizable: A simple diagonalizable example
- Defective: A matrix that cannot be diagonalized
Why Diagonalization is Efficient
Direct Method: To compute A^20, you need 19 matrix multiplications.
Diagonalization Method: 1. Compute P, D, P⁻¹ once (3 operations) 2. Compute D^20 = diag(λ₁^20, λ₂^20) (trivial - just raise scalars to powers) 3. Compute PD^20P⁻¹ (2 matrix multiplications)
For large k, diagonalization is dramatically faster!
Mathematical Formula
For a diagonalizable matrix A = PDP⁻¹:
A^k = PD^kP⁻¹
where D^k = diag(λ₁^k, λ₂^k, ..., λₙ^k)
This works because: - A² = (PDP⁻¹)(PDP⁻¹) = PD(P⁻¹P)DP⁻¹ = PD²P⁻¹ - By induction: A^k = PD^kP⁻¹
Embedding
1 | |
Lesson Plan
Learning Objectives
Students will be able to:
- Compute matrix powers using diagonalization
- Explain why D^k is easy to compute (diagonal matrices)
- Identify when diagonalization cannot be used (defective matrices)
Suggested Activities
- Manual verification: For A = [[2, 1], [0, 3]], verify that PD²P⁻¹ = A²
- Efficiency comparison: Count operations for A^10 using both methods
- Large powers: Use the calculator for A^20 and notice how eigenvalues dominate
Assessment Questions
- Why is D^k so easy to compute?
- If A has eigenvalues 0.5 and 2, what happens to A^k as k → ∞?
- Can you use this method for complex eigenvalues?