The Eigenvalue Method
For a constant-coefficient system we can guess solutions just as for single equations, except that the exponential now carries a direction:
Substituting gives , i.e. . So the guess works exactly when is an eigenvalue of and a corresponding eigenvector (Eigenvalues and Eigenvectors).
The method
- Find the eigenvalues: roots of .
- For each eigenvalue, find an eigenvector: a nonzero solution of .
- If has linearly independent eigenvectors (always true when the eigenvalues are distinct), the general solution is
Example
. The characteristic polynomial is , so or .
- : gives .
- : gives .
import sympy as sp
A = sp.Matrix([[1, 1], [4, 1]])
for lam, mult, vecs in A.eigenvects():
print(f"lambda = {lam} (multiplicity {mult}), eigenvector {list(vecs[0])}")lambda = -1 (multiplicity 1), eigenvector [-1/2, 1]
lambda = 3 (multiplicity 1), eigenvector [1/2, 1]
SymPy may scale eigenvectors differently; any nonzero multiple is fine.
Numerically: diagonalization
If with eigenvectors as the columns of , then in the coordinates the system decouples: . That gives a compact formula and an algorithm:
import numpy as np
from scipy.integrate import solve_ivp
A = np.array([[1.0, 1.0], [4.0, 1.0]])
x0 = np.array([3.0, 2.0])
lam, V = np.linalg.eig(A)
x_eig = lambda t: V @ (np.exp(lam * t) * np.linalg.solve(V, x0))
sol = solve_ivp(lambda t, x: A @ x, (0, 1), x0, rtol=1e-11, atol=1e-12)
print("eigenvalues:", lam)
print("eigen formula x(1):", np.round(x_eig(1.0), 6))
print("solve_ivp x(1):", np.round(sol.y[:, -1], 6))eigenvalues: [ 3. -1.]
eigen formula x(1): [40.538953 79.606389]
solve_ivp x(1): [40.538953 79.606389]
A three-dimensional example: cascading tanks
Three tanks drain into each other: , , . The matrix is lower triangular, so its eigenvalues are the diagonal entries , all negative: everything eventually drains away, and the slowest mode () dominates the long run.
import numpy as np
A = np.array([[-2.0, 0, 0], [2.0, -1.0, 0], [0, 1.0, -0.5]])
lam, V = np.linalg.eig(A)
x0 = np.array([10.0, 0, 0])
c = np.linalg.solve(V, x0)
for t in (1.0, 3.0, 10.0):
print(f"t = {t:4}: x =", np.round(V @ (c * np.exp(lam * t)), 4))t = 1.0: x = [1.3534 4.6509 3.2634]
t = 3.0: x = [0.0248 0.9462 3.9917]
t = 10.0: x = [0. 0.0009 0.1779]
In software
- Modal analysis in mechanical engineering and the normal modes of molecules are eigenvalue problems of this kind (Coupled Oscillators and Normal Modes).
- Continuous-time Markov chains (queueing models, reliability of server clusters) evolve by ; the eigenvalue 0 gives the steady state and the next eigenvalue the mixing rate.
Exercises
Exercise 1: Eigenvalues and solution
Solve .
Answer
.
Solution
A diagonal matrix has the standard basis vectors as eigenvectors; the system is already decoupled.
Exercise 2: A full example
Solve .
Answer
.
Solution
. For : , . For : , .
Exercise 3: Match an initial condition (code)
For the system of Exercise 2, find , for .
Answer
, .
Solution
.
import numpy as np
print(np.linalg.solve([[1.0, 2.0], [1.0, 1.0]], [1.0, 0.0]))[-1. 1.]
Test yourself
solves exactly when…
If all eigenvalues of are real and negative (and is diagonalizable), all solutions…
- grow
- tend to
- oscillate
- are constant
In eigenvector coordinates , the system becomes…
- (decoupled)
- nonlinear