Use symbolic linear algebraLesson 35 of 48 · 8 min
Use a different coordinate basis
Verify diagonalisation before using it to compute a matrix power.
Maths refresher: Changing coordinates
A basis gives a set of independent coordinate directions. A change of basis describes the same transformation using different coordinates.
The middle factors cancel in repeated multiplication. The formula requires an invertible P and a valid decomposition.
A diagonalisation writes , where D is diagonal and the columns of P form an eigenvector basis. In those coordinates, repeated applications reduce to powers of diagonal entries.
- Eigenvector coordinates
- Scale coordinates
- Original coordinates
Not every square matrix is diagonalizable. Repeated eigenvalues do not by themselves decide the question; the number of independent eigenvectors matters. Check the reconstruction before using a diagonalisation to infer anything else.
The example reconstructs a small symmetric matrix and compares its fifth power with the diagonal-basis calculation. A second matrix demonstrates that diagonalisation is a property to establish rather than an operation guaranteed for every input. This exact example focuses on meaning, not a claim of numerical speed.
Can you use a diagonal-power formula without first establishing a valid eigenvector basis?
Write a prediction (optional)
Exact symbolic investigation
Select Run Python with the code unchanged.
Your saved draft is open. To use the published code, select Restore example in Tools. Use Recover draft to bring back your code.
Tools
About Python
Python and the course packages can load while you read. Each run starts with fresh user variables; imported modules stay loaded. Stop replaces the worker. Runtime details ↗
Ctrl+Enter or ⌘+Enter runs Python.
Execution error
Technical error details
Your result
Python text output
Compare with the worked example
Executed from the published Python during the site build. Your own run appears above. Build environment ↗
Worked text output
Basis matrix P: Matrix([[-1, 1], [1, 1]]) Diagonal matrix D: Matrix([[1, 0], [0, 3]]) Reconstruction residual: Matrix([[0, 0], [0, 0]]) Power residual: Matrix([[0, 0], [0, 0]]) Is J diagonalizable?: False J eigenspace basis: [(1, 2, [Matrix([ [1], [0]])])]
Read the starter result
The two zero residual matrices verify reconstruction and the power calculation. In J eigenspace basis, the one eigenvalue has multiplicity two but only one independent eigenvector.
Edit and compare
Replace power = 5 with power = 10. Select Run Python and read Power residual. Then read J eigenspace basis. Does J provide enough independent eigenvectors for a two-dimensional basis?
Scope. Exact diagonalisation can be unsuitable or unstable for numerical work; specialised numerical methods may be preferable.
Try a fresh case
A repeated eigenvalue appears. What is needed before claiming diagonalizability?
Need a hint?
Hint 1
P must be invertible.
Hint 2
Count independent eigenvectors, not just repeated root labels.