Skip to main content
© 2026 ePowerAI — instrumented learning, no login required.
CoursesContact
ePOWERAI
CoursesContact
Week 11: Differential Equations
Linear Algebra
01Start Here: Python and the Math the Labs Use
02Week 1: Vectors and Linear Combinations
03Week 2: Linear Transformations and Matrices
04Week 3: Elimination and LU Factorization
05Week 4: Determinants
06Week 5: Vector Spaces, Independence, and Basis
07Week 6: The Four Fundamental Subspaces
08Week 7: Orthogonality and Projections
09Week 8: Least Squares and QR
10Week 9: Eigenvalues and Eigenvectors
11Week 10: Diagonalization and Markov Matrices
12Week 11: Differential Equations
13Week 12: Symmetric and Positive Definite Matrices
14Week 13: The SVD and Complex Matrices
15Week 14: The Fourier Matrix, FFT, and PCA
Week 11· Linear Algebra9 min read

Week 11: Differential Equations

Learning Outcomes
  • Set up a first-order linear system dudt=Au\frac{du}{dt} = Audtdu​=Au
  • Solve the system using the eigenvalues and eigenvectors of AAA
  • Determine stability of the system from the sign of the eigenvalues
  • Connect the exponential solution formula to diagonalization
Prerequisites

Background knowledge assumed:

  • Diagonalization and matrix powers

Recommended: Review Week 10: Diagonalization and Markov Matrices before starting.

Systems of Differential Equations#

A single scalar equation dudt=au\frac{du}{dt} = a udtdu​=au has the familiar solution u(t)=c eatu(t) = c\,e^{a t}u(t)=ceat. The constant aaa is a growth rate: negative means decay to 000, positive means explosive growth. Many models couple several unknowns at once — concentrations of chemicals, positions of masses on springs, currents in a circuit, or components of a robot state. Those systems are still first-order and linear, but the right-hand side is a matrix times a vector:

dudt=Au.\frac{du}{dt} = A u.dtdu​=Au.

Here u(t)∈Rnu(t) \in \mathbb{R}^nu(t)∈Rn is the state at time ttt, and AAA is a fixed n×nn \times nn×n matrix of constant coefficients. Component-wise this is nnn equations

duidt=∑j=1naij uj,\frac{du_i}{dt} = \sum_{j=1}^{n} a_{ij}\, u_j,dtdui​​=j=1∑n​aij​uj​,

so each rate depends on every component when AAA is dense. The equations are coupled: you cannot solve for u1u_1u1​ without knowing u2u_2u2​, and vice versa.

Why eigenvalues enter. Week 10 diagonalized AAA as A=SΛS−1A = S\Lambda S^{-1}A=SΛS−1 whenever AAA has nnn independent eigenvectors. Change variables to the eigen-coordinates v=S−1uv = S^{-1}uv=S−1u (so u=Svu = Svu=Sv). Differentiating and substituting:

dudt=Au⟹Sdvdt=ASv=SΛv⟹dvdt=Λv.\frac{du}{dt} = A u \quad\Longrightarrow\quad S\frac{dv}{dt} = A S v = S\Lambda v \quad\Longrightarrow\quad \frac{dv}{dt} = \Lambda v.dtdu​=Au⟹Sdtdv​=ASv=SΛv⟹dtdv​=Λv.

Because Λ\LambdaΛ is diagonal, the system for vvv decouples into nnn independent scalar ODEs:

dvidt=λivi⇒vi(t)=ci eλit.\frac{dv_i}{dt} = \lambda_i v_i \qquad\Rightarrow\qquad v_i(t) = c_i\, e^{\lambda_i t}.dtdvi​​=λi​vi​⇒vi​(t)=ci​eλi​t.

Each eigen-direction evolves on its own, at rate λi\lambda_iλi​. Transforming back with u=Svu = Svu=Sv reassembles the solution in the original coordinates — the whole strategy of this week: diagonalize, solve nnn scalar problems, change back.

Initial condition. The system is first-order, so one vector u(0)=u0u(0) = u_0u(0)=u0​ pins down the solution completely. In eigen-coordinates that means v(0)=S−1u0=cv(0) = S^{-1}u_0 = cv(0)=S−1u0​=c, the vector of coefficients cic_ici​.


The Solution Formula#

Suppose AAA is diagonalizable with eigenvalues λ1,…,λn\lambda_1,\ldots,\lambda_nλ1​,…,λn​ and corresponding independent eigenvectors x1,…,xnx_1,\ldots,x_nx1​,…,xn​ (columns of SSS). The general solution of dudt=Au\frac{du}{dt} = Audtdu​=Au is

u(t)=c1eλ1t x1+c2eλ2t x2+⋯+cneλnt xn.u(t) = c_1 e^{\lambda_1 t}\, x_1 + c_2 e^{\lambda_2 t}\, x_2 + \cdots + c_n e^{\lambda_n t}\, x_n.u(t)=c1​eλ1​tx1​+c2​eλ2​tx2​+⋯+cn​eλn​txn​.

Each term is one eigen-direction evolving at its own rate λi\lambda_iλi​; the constants c1,…,cnc_1,\ldots,c_nc1​,…,cn​ are fixed by the initial condition:

u(0)=c1x1+⋯+cnxn=u0.u(0) = c_1 x_1 + \cdots + c_n x_n = u_0.u(0)=c1​x1​+⋯+cn​xn​=u0​.

In matrix form that is Sc=u0S c = u_0Sc=u0​, so c=S−1u0c = S^{-1}u_0c=S−1u0​ — solve one linear system once, then the solution is known for every ttt.

Matrix exponential view. The same formula can be written compactly as u(t)=eAt u0u(t) = e^{At}\, u_0u(t)=eAtu0​. When A=SΛS−1A = S\Lambda S^{-1}A=SΛS−1,

eAt=SeΛtS−1,eΛt=diag⁡(eλ1t,…,eλnt).e^{At} = S e^{\Lambda t} S^{-1}, \qquad e^{\Lambda t} = \operatorname{diag}\bigl(e^{\lambda_1 t},\ldots,e^{\lambda_n t}\bigr).eAt=SeΛtS−1,eΛt=diag(eλ1​t,…,eλn​t).

Expanding SeΛtS−1u0S e^{\Lambda t} S^{-1} u_0SeΛtS−1u0​ recovers the sum of cieλitxic_i e^{\lambda_i t} x_ici​eλi​txi​ above. You do not need the matrix-exponential series for this course — the eigen-sum is the practical formula — but it explains why diagonalization is the natural tool for continuous-time dynamics just as it was for discrete powers AkA^kAk in Week 10.

Complex eigenvalues. If a real matrix AAA has a complex conjugate pair α±iω\alpha \pm i\omegaα±iω, the corresponding complex exponential e(α±iω)t=eαt(cos⁡ωt±isin⁡ωt)e^{(\alpha\pm i\omega)t} = e^{\alpha t}(\cos\omega t \pm i\sin\omega t)e(α±iω)t=eαt(cosωt±isinωt) combines into real solutions that oscillate at frequency ω\omegaω while growing or decaying with envelope eαte^{\alpha t}eαt. The real part α\alphaα still governs stability; the imaginary part sets the oscillation rate.


Stability#

Long-run behavior of every solution is read from the eigenvalues of AAA. Write each eigenvalue as λ=α+iω\lambda = \alpha + i\omegaλ=α+iω with real part α=Re⁡(λ)\alpha = \operatorname{Re}(\lambda)α=Re(λ). Then ∣eλt∣=eαt|e^{\lambda t}| = e^{\alpha t}∣eλt∣=eαt, so:

Eigenvalues of AAALong-run behavior of u(t)u(t)u(t)Classification
Every Re⁡(λ)<0\operatorname{Re}(\lambda) < 0Re(λ)<0All terms eλtxe^{\lambda t}xeλtx decay to 000Stable (asymptotically stable origin)
Some Re⁡(λ)>0\operatorname{Re}(\lambda) > 0Re(λ)>0At least one term grows without boundUnstable
Some Re⁡(λ)=0\operatorname{Re}(\lambda) = 0Re(λ)=0, none positiveOscillation or constants (no decay, no growth from those modes)Marginally stable / neutrally stable (with care)

The course rule is a sign check: stable if every eigenvalue has negative real part — every solution decays to 000; unstable if any eigenvalue has positive real part, because that single growing mode dominates for large ttt even when the others decay. On the borderline, purely imaginary eigenvalues (Re⁡(λ)=0\operatorname{Re}(\lambda) = 0Re(λ)=0, Im⁡(λ)≠0\operatorname{Im}(\lambda) \neq 0Im(λ)=0) produce sustained oscillation eiωte^{i\omega t}eiωt — neither decay nor growth — and a pure zero eigenvalue leaves the component along its eigenvector constant.

Preview of Week 12. When AAA is symmetric (real), every eigenvalue is real, so there is no oscillatory pair. Stability then reduces to “are all eigenvalues negative?” Symmetric matrices with nonpositive eigenvalues are a clean special case of the table above; Week 12 develops the spectral theory that makes those eigenvalues especially well-behaved.


Example: A Two-Component System#

Work a full 2×22 \times 22×2 example end to end. Let

A=(−311−3),u(0)=(10).A = \begin{pmatrix} -3 & 1 \\ 1 & -3 \end{pmatrix}, \qquad u(0) = \begin{pmatrix} 1 \\ 0 \end{pmatrix}.A=(−31​1−3​),u(0)=(10​).

Step 1 — eigenvalues. Trace tr⁡(A)=−6\operatorname{tr}(A) = -6tr(A)=−6 and det⁡(A)=9−1=8\det(A) = 9 - 1 = 8det(A)=9−1=8, so

det⁡(A−λI)=λ2+6λ+8=0⇒(λ+2)(λ+4)=0.\det(A - \lambda I) = \lambda^2 + 6\lambda + 8 = 0 \quad\Rightarrow\quad (\lambda+2)(\lambda+4) = 0.det(A−λI)=λ2+6λ+8=0⇒(λ+2)(λ+4)=0.

Eigenvalues: λ1=−2\lambda_1 = -2λ1​=−2, λ2=−4\lambda_2 = -4λ2​=−4. Both are real and negative, so the origin is stable — every solution will decay to 000.

Step 2 — eigenvectors. For λ1=−2\lambda_1 = -2λ1​=−2:

A+2I=(−111−1)⇒x1=(11).A + 2I = \begin{pmatrix} -1 & 1 \\ 1 & -1 \end{pmatrix} \quad\Rightarrow\quad x_1 = \begin{pmatrix} 1 \\ 1 \end{pmatrix}.A+2I=(−11​1−1​)⇒x1​=(11​).

For λ2=−4\lambda_2 = -4λ2​=−4:

A+4I=(1111)⇒x2=(1−1).A + 4I = \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \quad\Rightarrow\quad x_2 = \begin{pmatrix} 1 \\ -1 \end{pmatrix}.A+4I=(11​11​)⇒x2​=(1−1​).

So

S=(111−1),S−1=12(111−1).S = \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad S^{-1} = \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}.S=(11​1−1​),S−1=21​(11​1−1​).

Step 3 — coefficients from u(0)u(0)u(0).

c=S−1u0=12(111−1)(10)=12(11)=(1/21/2).c = S^{-1}u_0 = \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\begin{pmatrix} 1 \\ 0 \end{pmatrix} = \frac{1}{2}\begin{pmatrix} 1 \\ 1 \end{pmatrix} = \begin{pmatrix} 1/2 \\ 1/2 \end{pmatrix}.c=S−1u0​=21​(11​1−1​)(10​)=21​(11​)=(1/21/2​).

Step 4 — solution formula.

u(t)=12 e−2t(11)+12 e−4t(1−1)=(12e−2t+12e−4t12e−2t−12e−4t).u(t) = \frac{1}{2}\, e^{-2t}\begin{pmatrix} 1 \\ 1 \end{pmatrix} + \frac{1}{2}\, e^{-4t}\begin{pmatrix} 1 \\ -1 \end{pmatrix} = \begin{pmatrix} \frac{1}{2}e^{-2t} + \frac{1}{2}e^{-4t} \\ \frac{1}{2}e^{-2t} - \frac{1}{2}e^{-4t} \end{pmatrix}.u(t)=21​e−2t(11​)+21​e−4t(1−1​)=(21​e−2t+21​e−4t21​e−2t−21​e−4t​).

Check u(0)=(1,0)⊤u(0) = (1,0)^\topu(0)=(1,0)⊤: both components match. As t→∞t \to \inftyt→∞, both exponentials vanish, so u(t)→0u(t) \to 0u(t)→0, confirming stability from the signs of λ\lambdaλ.

Contrast — an unstable matrix. Replace AAA by −A-A−A:

B=(3−1−13)B = \begin{pmatrix} 3 & -1 \\ -1 & 3 \end{pmatrix}B=(3−1​−13​)

has eigenvalues +2+2+2 and +4+4+4. The same algebra with e+2te^{+2t}e+2t and e+4te^{+4t}e+4t produces solutions that grow without bound — unstable. The eigenvectors stay the same; only the signs of the rates flip.

Contrast — pure oscillation. The rotation generator

C=(0−110)C = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix}C=(01​−10​)

has eigenvalues ±i\pm i±i. Since C2=−IC^2 = -IC2=−I, the exponential series collapses to a rotation,

eCt=(cos⁡t−sin⁡tsin⁡tcos⁡t),e^{Ct} = \begin{pmatrix} \cos t & -\sin t \\ \sin t & \cos t \end{pmatrix},eCt=(costsint​−sintcost​),

so u(t)=eCtu0u(t) = e^{Ct}u_0u(t)=eCtu0​ circles the origin at constant radius — sustained oscillation, neither decay nor growth. Purely imaginary eigenvalues sit on the stability boundary. Linear state-space models of this exact form, x˙=Ax+Bu\dot{x} = Ax + Bux˙=Ax+Bu, are the backbone of Robot Learning Week 2: Dynamics and State Estimation.


Knowledge check#

Exercise · Multiple choice

A system du/dt = Au has eigenvalues -1 and -3. What is its long-run behavior?

Every solution decays to 0 (stable)
Every solution grows without bound (unstable)
Solutions oscillate forever
Solutions stay constant
Question 1 of 4

The general solution of du/dt = Au is u(t) = a sum of terms c_i e^{λ_i t} times the corresponding ___ of A.


Browser lab: stable vs unstable systems#

Simulate a stable and an unstable system side by side.

python · runs in browser
import numpy as np
import matplotlib.pyplot as plt

A_stable = np.array([[-1., 0.], [0., -3.]])
A_unstable = np.array([[1., 0.], [0., 2.]])

def simulate(A, u0, t):
    eigvals, eigvecs = np.linalg.eig(A)
    c = np.linalg.solve(eigvecs, u0)
    U = np.zeros((len(t), 2))
    for i, ti in enumerate(t):
        U[i] = (eigvecs @ (c * np.exp(eigvals * ti))).real
    return U

t = np.linspace(0, 3, 100)
u0 = np.array([1.0, 1.0])

U_stable = simulate(A_stable, u0, t)
U_unstable = simulate(A_unstable, u0, t)

fig, axes = plt.subplots(1, 2, figsize=(10, 4))
axes[0].plot(t, U_stable)
axes[0].set_title("Stable: eigenvalues -1, -3")
axes[1].plot(t, U_unstable)
axes[1].set_title("Unstable: eigenvalues 1, 2")
plt.tight_layout()
plt.show()

print("Notice: the left panel decays toward zero while the right explodes — negative vs positive eigenvalues.")

The left panel decays to zero (negative eigenvalues). The right panel explodes (positive eigenvalues). The lab uses the eigen-sum formula from this lesson: solve Sc=u0S c = u_0Sc=u0​, then plot S(c⊙eλt)S(c \odot e^{\lambda t})S(c⊙eλt) at each ttt.


Done when#

You can set up dudt=Au\frac{du}{dt}=Audtdu​=Au, solve it as u(t)=∑icieλitviu(t)=\sum_i c_i e^{\lambda_i t}v_iu(t)=∑i​ci​eλi​tvi​ with c=S−1u0c = S^{-1}u_0c=S−1u0​, and classify stability from the sign of the eigenvalues' real parts. Check it against the browser lab: the left panel decays to zero (eigenvalues −1,−3-1, -3−1,−3) and the right panel grows without bound (eigenvalues 1,21, 21,2), and you can state which sign drives each behavior.


Going Deeper#

Extension Prompts
  • Try solving the 3×33 \times 33×3 case where AAA has a complex conjugate pair of eigenvalues. The real solution picks up both an exponential envelope eαte^{\alpha t}eαt and oscillatory cos⁡ωt\cos\omega tcosωt, sin⁡ωt\sin\omega tsinωt terms.
  • What happens when eigenvalues repeat (the defective case)? The matrix can no longer be diagonalized, and solutions involve polynomial terms teλtt e^{\lambda t}teλt.

Further Reading#

  • Strang, G. Introduction to Linear Algebra, 6th ed., Chapter 5 — differential equations and the matrix exponential.
  • Trefethen, L.N. and Bau, D. Numerical Linear Algebra, SIAM, Chapters 14–15 — matrix exponentials and stability of linear systems.
← Previous
Week 10: Diagonalization and Markov Matrices
Next →
Week 12: Symmetric and Positive Definite Matrices
On this page
  • Systems of Differential Equations
  • The Solution Formula
  • Stability
  • Example: A Two-Component System
  • Knowledge check
  • Browser lab: stable vs unstable systems
  • Done when
  • Going Deeper
  • Further Reading