Linear ODE General Solution
Statement
Let be a real matrix. The linear ODE system
has a unique global solution given by the matrix exponential:
For a diagonal matrix the solution decouples:
Mathlib contains Matrix.exp and Matrix.exp_diagonal which state , capturing exactly this decoupling.
Visualization
Scalar case , : solution .
| 0 | 1.000 | 3.000 |
| 0.5 | 2.718 | 8.155 |
| 1 | 7.389 | 22.167 |
| 2 | 54.598 | 163.794 |
2-D diagonal example , :
| 0 | 1.000 | 1.000 |
| 1 | 2.718 | 0.135 |
| 2 | 7.389 | 0.018 |
The first component grows, the second decays — the eigenvalues control the long-term behavior.
Proof Sketch
- Existence. Define . Then because the power series can be differentiated term-by-term, giving .
- Initial condition. , so .
- Uniqueness. By the Picard–Lindelöf TheoremPicard–Lindelöf TheoremA Lipschitz right-hand side guarantees a unique local solution to any ODE initial value problem.Read more →, the Lipschitz map (with constant ) guarantees a unique solution.
- Diagonal decoupling. When , each power , so .
Connections
The matrix exponential is the bridge between the Cayley–Hamilton TheoremCayley–Hamilton TheoremEvery square matrix satisfies its own characteristic polynomialRead more → (which constrains to the characteristic polynomial) and the Spectral TheoremSpectral TheoremEvery real symmetric matrix is orthogonally diagonalizableRead more → (which diagonalizes symmetric , making explicit). The scalar case relies on the Fundamental Theorem of CalculusFundamental Theorem of CalculusIntegration and differentiation are inverse operationsRead more → to differentiate power series term-by-term.
Lean4 Proof
import Mathlib.Analysis.Normed.Algebra.MatrixExponential
/-!
Mathlib's `Matrix.exp_diagonal` states:
exp (diagonal v) = diagonal (exp v)
This is exactly the claim that for A = diag(λ), e^A = diag(e^λ).
We instantiate it for a concrete 2×2 diagonal matrix.
-/
open Matrix in
/-- For a diagonal matrix, the matrix exponential diagonalises:
exp(diag(λ)) = diag(exp(λ)).
This is `Matrix.exp_diagonal` in Mathlib. -/
theorem matrix_exp_diagonal_two
(λ₁ λ₂ : ℝ) :
NormedSpace.exp (diagonal (![λ₁, λ₂]))
= diagonal (![NormedSpace.exp λ₁, NormedSpace.exp λ₂]) := by
rw [exp_diagonal]
congr 1
funext i
fin_cases i <;> simp
/-- Scalar ODE y' = c*y has solution y(t) = y₀ * exp(c*t).
Verified by checking the derivative. -/
theorem scalar_linear_ode_solution (c y₀ : ℝ) :
let y : ℝ → ℝ := fun t => y₀ * Real.exp (c * t)
∀ t : ℝ, HasDerivAt y (c * y t) t := by
intro y t
have h := (Real.hasDerivAt_exp (c * t)).const_mul y₀
have hc := hasDerivAt_id t |>.const_mul c
convert h.comp t hc using 1
simp [mul_comm]Referenced by
- Integrating Factor MethodDifferential Equations
- Variation of ParametersDifferential Equations