Flow Lab

Syllabus / Module 1: Linear Algebra, Reloaded

Lesson 1.8

The Matrix Exponential: From Hops to Flows

From iterating x_{n+1} = A x_n to continuous growth: defining e^{At} by power series and via diagonalization, and why it solves x' = Ax.

Written byClaude Opus

🌊
Why this matters for simulation: Every explicit time-stepper approximates a matrix exponential; how well it does so is its accuracy and stability.

By the end of this lesson you can…

  • Explain how the continuous system x′ = Ax arises as the small-step limit of the discrete system xₙ₊₁ = (I + hA)xₙ.
  • Define the matrix exponential by its power series and compute it for diagonal, nilpotent and rotation-generator matrices.
  • Compute the matrix exponential by diagonalization (P e^(Dt) P⁻¹) and use it to solve x′ = Ax by hand.
  • Derive d/dt e^(At) = A e^(At) and show that x(t) = e^(At) x₀ solves the initial value problem.
  • Interpret forward Euler and RK4 as truncations of e^(hA), and predict their stability from |R(hλ)| for each eigenvalue.
  • Recognize when e^(A+B) = e^A e^B fails, and connect the failure to operator-splitting error in fluid solvers.
On this page
·
  1. From hopping to flowing
  2. The scalar case: Euler’s method meets compound interest
  3. The exponential as a power series
  4. Defining eAte^{At}eAt
  5. Why eAte^{At}eAt solves x⃗′=Ax⃗\vec x' = A\vec xx′=Ax
  6. Computing eAte^{At}eAt by diagonalization
  7. Worked example: distinct real eigenvalues
  8. Determinants and incompressibility
  9. Rotation: eθJe^{\theta J}eθJ and Euler’s formula
  10. Explore: the flow of a linear system
  11. Euler’s method is an approximation of eAte^{At}eAt
  12. Every explicit time-stepper approximates ehAe^{hA}ehA
  13. Stability: comparing R(hλ)R(h\lambda)R(hλ) with ehλe^{h\lambda}ehλ
  14. A warning: eA+B≠eAeBe^{A+B} \ne e^A e^BeA+B=eAeB
  15. Computing eAe^{A}eA yourself
  16. Practice problems
  17. Where this goes next
  18. Key Takeaways

For the last three lessons, time came in whole steps. We iterated a matrix, x⃗n+1=Ax⃗n\vec x_{n+1} = A\vec x_n, and found that eigenvalues decide everything: ∣λ∣>1|\lambda| \gt 1 means growth, ∣λ∣<1|\lambda| \lt 1 means decay, and complex λ\lambda means rotation. But a falling ball, a swinging pendulum and a swirling fluid don’t hop from frame to frame. Their state changes continuously, following a velocity rule like x⃗ ′=Ax⃗\vec x\,' = A\vec x. Your simulator then chops that continuous motion back into steps of size hh. This lesson connects the two pictures. The object that does it is the matrix exponential eAte^{At}, the continuous-time version of AnA^n. It ties together everything in this module (eigenvectors, diagonalization, complex eigenvalues, determinants), it is the master key to linear systems of ODEs, and it explains exactly what Euler, RK4 and every other time-stepper you’ve written are trying to compute.

▶ Video Part 1: from hopping to flowing, Euler's limit, and the series for e^(At)captions only
Transcript
  1. This is the last lesson of Linear Algebra, Reloaded, and the bridge into differential equations. Its hero is the matrix exponential.
  2. For the last three lessons we iterated a matrix: x n plus one equals A times x n. Time came in whole steps, and the state hopped from point to point.
  3. Now let time flow continuously. Instead of a jump rule we get a velocity rule: the rate of change of x is A times x. At every point, the matrix tells you which way to move.
  4. Jumps became a smooth curve. Our question for this lesson: what plays the role of A to the n, when time is continuous?
  5. Start with one number instead of a vector. The equation y prime equals k y says the growth rate is proportional to the size. Its solution, from calculus, is e to the k t times y naught.
  6. Now pretend you don't know that, and use Euler's method with step h. Each step adds h times the slope, so it multiplies y by one plus h k. After n steps, y is one plus h k to the n, times y naught. That is discrete dynamics again.
  7. Take k equal to one and run to t equals two. With h equal to one half, Euler lands near five. With a quarter, near six. With a tenth, six point seven. The polygons creep up toward the true curve, which ends at e squared, about seven point four.
  8. With h equal to t over n, this is exactly the compound interest limit from calculus. Compound more and more often, and one plus t over n, to the n, becomes e to the t. Euler's method, in the limit of tiny steps, computes the exponential.
  9. Calculus two gave us a second description of the exponential: its power series. One, plus x, plus x squared over two factorial, plus x cubed over three factorial, and so on. It converges for every x.
  10. The series only uses adding, scaling and multiplying, and all three make sense for square matrices. So we simply define e to the A t by the same series, with the identity matrix in place of one. It converges for every matrix.
  11. Differentiate term by term. The derivative of A t is A. The derivative of A t squared over two is A squared t. Factor out one A, and the original series comes back: the derivative of e to the A t is A times e to the A t.
  12. So x of t equals e to the A t times x naught has derivative A times x of t, and at time zero it equals x naught. That is the solution of x prime equals A x. The answer to our question: e to the A t is the continuous version of A to the n.
  13. In part two we put this matrix in motion: rotations, saddles and spirals, and what it all means for RK4 and for fluid solvers.

From hopping to flowing

Here are the two kinds of linear dynamics side by side.

DiscreteContinuous
Rulex⃗n+1=A x⃗n\vec x_{n+1} = A\,\vec x_ndx⃗dt=A x⃗\dfrac{d\vec x}{dt} = A\,\vec x
MeaningAA says where to jumpAA says which way to move, and how fast
Solutionx⃗n=Anx⃗0\vec x_n = A^n \vec x_0x⃗(t)=eAtx⃗0\vec x(t) = e^{At}\vec x_0
Eigen-modeλnv⃗\lambda^n \vec veλtv⃗e^{\lambda t}\vec v
Decays when∣λ∣<1\lvert\lambda\rvert \lt 1Re⁡λ<0\operatorname{Re}\lambda \lt 0

In the continuous rule, AA turns a position into a velocity. At every point x⃗\vec x of the plane, the arrow Ax⃗A\vec x tells a particle sitting there which way to go. Picture a whole field of arrows, a vector field, and the solution curves are the paths you’d trace by following the arrows. You’ll study general vector fields in 2.6 Vector Fields, Flow Lines & Streamlines. Here the field is linear, which is why linear algebra can solve it exactly.

The bottom two rows of the table are the real story of this lesson. Along an eigenvector v⃗\vec v with Av⃗=λv⃗A\vec v = \lambda\vec v, the discrete system multiplies by λ\lambda each step, while the continuous system grows like eλte^{\lambda t}. So “inside the unit circle” for maps becomes “in the left half-plane” for flows. To see why, start with one number instead of a vector.

The scalar case: Euler’s method meets compound interest

The equation y′=kyy' = ky says the growth rate is proportional to the size. You know its solution from calculus:

y′=ky,y(0)=y0⟹y(t)=ekt y0.y' = ky,\quad y(0) = y_0 \qquad\Longrightarrow\qquad y(t) = e^{kt}\,y_0 .

Now pretend you don’t know that, and run forward Euler with step hh. Each step adds hh times the slope:

yn+1=yn+h (k yn)=(1+hk) yn⟹yn=(1+hk)n y0.y_{n+1} = y_n + h\,(k\,y_n) = (1 + hk)\,y_n \qquad\Longrightarrow\qquad y_n = (1+hk)^n\,y_0 .

Euler’s method has turned the continuous equation into a discrete dynamical system with multiplier 1+hk1 + hk. To reach a fixed time tt, take nn steps of size h=t/nh = t/n:

yn=(1+ktn)ny0.y_n = \Big(1 + \frac{kt}{n}\Big)^n y_0 .

This is the compound interest formula: a rate kk for time tt, compounded nn times. As n→∞n \to \infty, take logarithms and use ln⁡(1+u)=u−u2/2+⋯\ln(1+u) = u - u^2/2 + \cdots:

ln⁡(1+ktn)n=n(ktn−k2t22n2+⋯)=kt−k2t22n+⋯  ⟶  kt.\ln\Big(1 + \frac{kt}{n}\Big)^n = n\Big(\frac{kt}{n} - \frac{k^2t^2}{2n^2} + \cdots\Big) = kt - \frac{k^2t^2}{2n} + \cdots \;\longrightarrow\; kt .

So (1+kt/n)n→ekt(1 + kt/n)^n \to e^{kt}. In the limit of tiny steps, Euler’s method computes the exponential. The leftover term also tells you how fast: (1+kt/n)n≈ekt(1−k2t22n)(1+kt/n)^n \approx e^{kt}\big(1 - \tfrac{k^2t^2}{2n}\big), so the relative error shrinks like 1/n1/n, i.e. like hh. That’s what “Euler is first order” means.

🐍 PythonEuler's method is compound interest
⌘/Ctrl + Enter

The last column settles down to a constant, which is the 1/n1/n law in action.

✅ Concept check

Forward Euler with step $h$ applied to the system $\vec x' = A\vec x$ produces which sequence?

The exponential as a power series

Calculus II gave you a second description of exe^x, its Taylor series about 00:

ex=∑k=0∞xkk!=1+x+x22!+x33!+x44!+⋯e^{x} = \sum_{k=0}^{\infty} \frac{x^k}{k!} = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \cdots

The ratio test shows it converges for every xx: the ratio of consecutive terms is ∣x∣/(k+1)→0|x|/(k+1) \to 0. Two properties follow directly from the series:

  • Derivative. Differentiating term by term, ddtekt=ddt∑kjtjj!=∑j≥1kjtj−1(j−1)!=k ekt\dfrac{d}{dt}e^{kt} = \dfrac{d}{dt}\displaystyle\sum \frac{k^j t^j}{j!} = \sum_{j\ge1} \frac{k^j t^{j-1}}{(j-1)!} = k\,e^{kt}.
  • Product rule. Multiplying two series and collecting terms (the binomial theorem does the bookkeeping) gives eaeb=ea+be^{a}e^{b} = e^{a+b}. Hold on to this one. It quietly uses ab=baab = ba, and it will fail for matrices.

You’ll revisit Taylor series, in several variables, in 2.4 Taylor Series in One and Several Variables.

Defining eAte^{At}

The series uses only three operations: adding, scaling by numbers, and multiplying. All three make sense for square matrices. So we define the matrix exponential by the same series, with the identity matrix II playing the role of 11:

Let’s compute a few directly from the definition.

Diagonal matrices. Powers of a diagonal matrix are diagonal, Dk=diag⁡(λ1k,λ2k)D^k = \operatorname{diag}(\lambda_1^k, \lambda_2^k), so the series runs separately down the diagonal:

D=[λ100λ2]⟹eDt=[1+λ1t+λ12t22!+⋯001+λ2t+⋯]=[eλ1t00eλ2t].D = \begin{bmatrix} \lambda_1 & 0 \\ 0 & \lambda_2 \end{bmatrix} \quad\Longrightarrow\quad e^{Dt} = \begin{bmatrix} 1 + \lambda_1 t + \frac{\lambda_1^2t^2}{2!} + \cdots & 0 \\ 0 & 1 + \lambda_2 t + \cdots \end{bmatrix} = \begin{bmatrix} e^{\lambda_1 t} & 0 \\ 0 & e^{\lambda_2 t} \end{bmatrix}.

A diagonal system x1′=λ1x1x_1' = \lambda_1 x_1, x2′=λ2x2x_2' = \lambda_2 x_2 is just two unrelated scalar equations, and eDte^{Dt} solves each one.

Nilpotent matrices. For the shear N=[0100]N = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, we have N2=0N^2 = 0, so the series stops after two terms:

eNt=I+Nt=[1t01].e^{Nt} = I + Nt = \begin{bmatrix} 1 & t \\ 0 & 1 \end{bmatrix}.

Notice the tt: no exponentials at all, just linear growth. This is the fingerprint of a matrix that can’t be diagonalized, which you met in 1.6 Change of Basis & Diagonalization.

Useful properties. Straight from the series, with AA commuting with itself:

  • eA⋅0=Ie^{A\cdot 0} = I.
  • eA(s+t)=eAseAte^{A(s+t)} = e^{As}e^{At}: flowing for time ss then time tt is the same as flowing for s+ts + t.
  • So eAte^{At} is always invertible, with (eAt)−1=e−At\big(e^{At}\big)^{-1} = e^{-At}: you can always run the flow backward.
  • If AB=BAAB = BA, then eA+B=eAeBe^{A+B} = e^A e^B. If AB≠BAAB \ne BA, this generally fails. We’ll come back to this when we talk about fluid solvers.

Why eAte^{At} solves x⃗′=Ax⃗\vec x' = A\vec x

Differentiate the series term by term, exactly as in the scalar case. The derivative of Aktkk!\dfrac{A^k t^k}{k!} is Aktk−1(k−1)!\dfrac{A^k t^{k-1}}{(k-1)!}:

ddteAt=A+A2t+A3t22!+⋯=A(I+At+A2t22!+⋯)=A eAt.\frac{d}{dt}e^{At} = A + A^2 t + \frac{A^3t^2}{2!} + \cdots = A\Big(I + At + \frac{A^2t^2}{2!} + \cdots\Big) = A\,e^{At}.

Now set x⃗(t)=eAtx⃗0\vec x(t) = e^{At}\vec x_0. Then

x⃗ ′(t)=A eAtx⃗0=A x⃗(t),x⃗(0)=Ix⃗0=x⃗0.\vec x\,'(t) = A\,e^{At}\vec x_0 = A\,\vec x(t), \qquad \vec x(0) = I\vec x_0 = \vec x_0 .

(Uniqueness takes one more line: if y⃗\vec y is any solution, then ddt(e−Aty⃗)=−Ae−Aty⃗+e−AtAy⃗=0⃗\frac{d}{dt}\big(e^{-At}\vec y\big) = -Ae^{-At}\vec y + e^{-At}A\vec y = \vec 0, since AA commutes with e−Ate^{-At}, so e−Aty⃗(t)e^{-At}\vec y(t) is constant and equal to x⃗0\vec x_0. The general theory is in 3.7 Existence & Uniqueness.)

So eAte^{At} really is the continuous version of AnA^n. It is the matrix that carries the state at time 00 to the state at time tt.

Computing eAte^{At} by diagonalization

Summing a series by hand is rarely practical. Diagonalization does the work. If A=PDP−1A = PDP^{-1}, with the eigenvectors in the columns of PP and the eigenvalues on the diagonal of DD, then the P−1PP^{-1}P pairs cancel inside powers:

Ak=(PDP−1)(PDP−1)⋯(PDP−1)=P Dk P−1.A^k = (PDP^{-1})(PDP^{-1})\cdots(PDP^{-1}) = P\,D^k\,P^{-1}.

Put that into the series and factor PP out on the left and P−1P^{-1} on the right:

eAt=∑ktk PDkP−1k!=P(∑k(Dt)kk!)P−1=P eDt P−1=P[eλ1t00eλ2t]P−1.e^{At} = \sum_k \frac{t^k\,P D^k P^{-1}}{k!} = P\Big(\sum_k \frac{(Dt)^k}{k!}\Big)P^{-1} = P\,e^{Dt}\,P^{-1} = P\begin{bmatrix} e^{\lambda_1 t} & 0 \\ 0 & e^{\lambda_2 t}\end{bmatrix}P^{-1}.

The geometric meaning is the same as for AnA^n in 1.6 Change of Basis & Diagonalization: switch to eigen-coordinates (P−1P^{-1}), let each coordinate grow independently by eλite^{\lambda_i t}, and switch back (PP). Equivalently, write x⃗0=c1v⃗1+c2v⃗2\vec x_0 = c_1\vec v_1 + c_2\vec v_2 in the eigenbasis. Then

x⃗(t)=c1eλ1t v⃗1+c2eλ2t v⃗2.\vec x(t) = c_1 e^{\lambda_1 t}\,\vec v_1 + c_2 e^{\lambda_2 t}\,\vec v_2 .

Each eigen-direction is a straight-line solution that grows or decays at its own rate. This formula is the workhorse of 7.2 Linear Systems & the Eigenvalue Method.

Worked example: distinct real eigenvalues

Compute eAte^{At} for A=[1141]A = \begin{bmatrix} 1 & 1 \\ 4 & 1 \end{bmatrix} and solve x⃗′=Ax⃗\vec x' = A\vec x with x⃗(0)=(1,0)\vec x(0) = (1, 0).

Eigenvalues. det⁡(A−λI)=(1−λ)2−4=0\det(A - \lambda I) = (1-\lambda)^2 - 4 = 0, so 1−λ=±21 - \lambda = \pm 2 and λ1=3\lambda_1 = 3, λ2=−1\lambda_2 = -1.

Eigenvectors. For λ1=3\lambda_1 = 3: A−3I=[−214−2]A - 3I = \begin{bmatrix} -2 & 1 \\ 4 & -2 \end{bmatrix}, so −2v1+v2=0-2v_1 + v_2 = 0 and v⃗1=(1,2)\vec v_1 = (1, 2). For λ2=−1\lambda_2 = -1: A+I=[2142]A + I = \begin{bmatrix} 2 & 1 \\ 4 & 2 \end{bmatrix}, so 2v1+v2=02v_1 + v_2 = 0 and v⃗2=(1,−2)\vec v_2 = (1, -2).

Assemble. With P=[112−2]P = \begin{bmatrix} 1 & 1 \\ 2 & -2 \end{bmatrix}, det⁡P=−4\det P = -4 and

P−1=1−4[−2−1−21]=[121412−14].P^{-1} = \frac{1}{-4}\begin{bmatrix} -2 & -1 \\ -2 & 1 \end{bmatrix} = \begin{bmatrix} \tfrac12 & \tfrac14 \\[2pt] \tfrac12 & -\tfrac14 \end{bmatrix}.

Then

eAt=[112−2][e3t00e−t][121412−14]=[e3t+e−t2e3t−e−t4e3t−e−te3t+e−t2].e^{At} = \begin{bmatrix} 1 & 1 \\ 2 & -2 \end{bmatrix} \begin{bmatrix} e^{3t} & 0 \\ 0 & e^{-t} \end{bmatrix} \begin{bmatrix} \tfrac12 & \tfrac14 \\[2pt] \tfrac12 & -\tfrac14 \end{bmatrix} = \begin{bmatrix} \dfrac{e^{3t} + e^{-t}}{2} & \dfrac{e^{3t} - e^{-t}}{4} \\[10pt] e^{3t} - e^{-t} & \dfrac{e^{3t} + e^{-t}}{2} \end{bmatrix}.

Check. At t=0t = 0 this is [1001]=I\begin{bmatrix} 1 & 0 \\ 0 & 1\end{bmatrix} = I. ✓ Its derivative at t=0t=0 is [(3−1)/2(3+1)/43+1(3−1)/2]=[1141]=A\begin{bmatrix} (3-1)/2 & (3+1)/4 \\ 3+1 & (3-1)/2 \end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 4 & 1\end{bmatrix} = A. ✓

Solve. x⃗(t)=eAt(1,0)\vec x(t) = e^{At}(1, 0) is the first column:

x⃗(t)=[12(e3t+e−t)e3t−e−t]=12e3t[12]+12e−t[1−2].\vec x(t) = \begin{bmatrix} \tfrac12\big(e^{3t} + e^{-t}\big) \\[2pt] e^{3t} - e^{-t} \end{bmatrix} = \tfrac12 e^{3t}\begin{bmatrix} 1 \\ 2 \end{bmatrix} + \tfrac12 e^{-t}\begin{bmatrix} 1 \\ -2\end{bmatrix}.

The second form is the eigen-mode expansion, with c1=c2=12c_1 = c_2 = \tfrac12 (which is P−1x⃗0P^{-1}\vec x_0). For large tt the e3te^{3t} mode dominates and the trajectory lines up with v⃗1=(1,2)\vec v_1 = (1, 2). This is a saddle: one eigenvalue positive, one negative.

✅ Concept check

For $A = \operatorname{diag}(2, -1)$, what is the top-left entry of $e^{At}$ at $t = \ln 3$?

Determinants and incompressibility

Take the determinant of eAt=PeDtP−1e^{At} = Pe^{Dt}P^{-1}. Since det⁡(XY)=det⁡Xdet⁡Y\det(XY) = \det X\det Y (1.4 Determinants as Volume Scaling), the PP factors cancel:

det⁡eAt=det⁡eDt=eλ1teλ2t=e(λ1+λ2)t=et tr⁡A.\det e^{At} = \det e^{Dt} = e^{\lambda_1 t}e^{\lambda_2 t} = e^{(\lambda_1 + \lambda_2)t} = e^{t\,\operatorname{tr}A}.

(This identity holds for every square matrix, diagonalizable or not.) Since the determinant is the area scaling factor, the flow changes areas by the factor et tr⁡Ae^{t\,\operatorname{tr}A}.

Rotation: eθJe^{\theta J} and Euler’s formula

Now take the rotation generator

J=[0−110],Jx⃗⊥x⃗ for every x⃗.J = \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix}, \qquad J\vec x \perp \vec x \text{ for every } \vec x .

The velocity Jx⃗J\vec x is always perpendicular to the position, so a particle can’t move toward or away from the origin. It circles forever. Let’s confirm that with the series. The powers of JJ cycle with period four, exactly like the powers of ii:

J2=−I,J3=−J,J4=I,J5=J, …J^2 = -I,\qquad J^3 = -J,\qquad J^4 = I,\qquad J^5 = J,\ \ldots

Split the series into even and odd powers:

eθJ=(1−θ22!+θ44!−⋯)I+(θ−θ33!+θ55!−⋯)J=cos⁡θ I+sin⁡θ J,e^{\theta J} = \Big(1 - \frac{\theta^2}{2!} + \frac{\theta^4}{4!} - \cdots\Big)I + \Big(\theta - \frac{\theta^3}{3!} + \frac{\theta^5}{5!} - \cdots\Big)J = \cos\theta\,I + \sin\theta\,J ,

so

eθJ=[cos⁡θ−sin⁡θsin⁡θcos⁡θ].e^{\theta J} = \begin{bmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix}.

The exponential of the rotation generator is the rotation matrix. Compare it with Euler’s formula from 1.7 Complex Eigenvalues & Rotation:

eiθ=cos⁡θ+isin⁡θ.e^{i\theta} = \cos\theta + i\sin\theta .

It’s the same computation, line for line, because JJ is the real 2×22\times 2 matrix that behaves like ii (J2=−IJ^2 = -I), and its eigenvalues are ±i\pm i. Multiplying a complex number by eiθe^{i\theta} rotates it by θ\theta. Multiplying a vector by eθJe^{\theta J} does the same thing.

More generally, A=aI+bJ=[a−bba]A = aI + bJ = \begin{bmatrix} a & -b \\ b & a \end{bmatrix} has eigenvalues a±iba \pm ib. Since aIaI commutes with everything, eAt=eatebtJe^{At} = e^{at}e^{btJ}: rotate at angular speed bb while scaling by eate^{at}. That’s a spiral, inward if a<0a \lt 0 and outward if a>0a \gt 0, exactly the spirals of lesson 1.7, now running in continuous time.

✅ Concept check

What is $e^{\pi J}$, for the rotation generator $J$?

▶ Video Part 2: Euler on a rotation, linear flows, and time-steppers as approximations of e^(hA)captions only
Transcript
  1. In part one we defined e to the A t by its power series and showed that it solves x prime equals A x. Now let's watch it move the plane.
  2. Now the same idea with a matrix. Take the rotation generator J: zero, minus one, one, zero. The velocity J x is always perpendicular to x, so the exact solution goes around a circle forever.
  3. Euler's method for x prime equals A x is x n plus one equals I plus h A, times x n. So after n steps we have I plus h A, to the n, times x naught. Watch three step sizes for one full turn.
  4. Euler spirals outward, because each Euler step rotates a little and also stretches by the square root of one plus h squared. As h shrinks the spiral tightens onto the circle. Just like the scalar case, I plus h A to the n converges to e to the A t.
  5. What is the exact answer? J squared is minus the identity, just like i squared is minus one. So the series splits into even and odd powers, which are the series for cosine and sine.
  6. e to the t J is exactly the rotation matrix by angle t. It is Euler's formula from the complex eigenvalues lesson, e to the i t equals cosine t plus i sine t, written as a two by two matrix.
  7. Here is the picture to remember. e to the A t doesn't move just one point. It moves every point of the plane at once. It is a flow, and every initial condition rides along.
  8. First a saddle. This matrix has eigenvalues one and minus one half, with eigenvectors along the two diagonals. Particles are squeezed toward one diagonal and stretched along the other.
  9. This is diagonalization at work. In the eigenvector basis the flow is just two separate exponentials: e to the t along the red line, and e to the minus t over two along the green one. So e to the A t equals P, times e to the D t, times P inverse.
  10. Next, complex eigenvalues minus zero point two plus or minus i. The imaginary part rotates, the negative real part shrinks, and the whole plane swirls down the drain like a decaying vortex.
  11. Finally a center, with purely imaginary eigenvalues. Every particle travels around an ellipse and comes back after one period. The trace is zero, so the flow preserves area, exactly like an incompressible fluid.
  12. Now the payoff for simulation. One step of size h should multiply the state by e to the h A. Forward Euler uses only the first two terms of the series: I plus h A.
  13. And here is something your simulations course may not have told you. For a linear system, one RK4 step is exactly the Taylor series of e to the h A, cut off after the fourth power. That is why RK4 is fourth order.
  14. Along each eigenvector the true solution multiplies by e to the h lambda, and the method multiplies by R of h lambda. Accuracy is how closely R matches the exponential. Stability is whether R stays at most one in size when the true solution doesn't grow. On a center, Euler's factor is always bigger than one: that's the outward spiral we saw.
  15. One warning. For numbers, e to the a plus b equals e to the a times e to the b. For matrices that fails, unless A and B commute.
  16. Fluid solvers break each time step into pieces: advect, then diffuse, then project. That is operator splitting, and it approximates e to the A plus B times h by e to the A h times e to the B h. The commutator of A and B sets the splitting error.
  17. To recap: x prime equals A x is solved by e to the A t times x naught. You can compute it from the series or by diagonalizing, and every time-stepper you know is an approximation of it.
  18. That completes our linear algebra toolkit. Next we go multivariable: partial derivatives, gradients and vector fields. And in the systems module, the matrix exponential returns as the master key to every linear system of differential equations.

Explore: the flow of a linear system

The sim moves a cloud of particles with the exact flow x⃗(t)=eAtx⃗0\vec x(t) = e^{At}\vec x_0. It uses a closed form for 2×22\times 2 matrices that’s equivalent to the series. From one seed point (the ring), it also runs forward Euler, (I+hA)nx⃗0(I + hA)^n\vec x_0, and RK4 with step hh so you can compare them with the exact path.

◆ Interactive Flow of x′ = Ax: exact e^(At) vs Euler and RK4

Loading simulation…

Try these:

  1. Rotation, h = 0.25. Euler (amber) spirals outward. The readout shows its per-step growth factor ∣1+hi∣=1+h2>1|1 + hi| = \sqrt{1 + h^2} \gt 1. RK4 (green) stays on the circle. Push hh up to 11: Euler explodes, and RK4 finally starts to visibly lose radius.
  2. Saddle. With eigenvectors on, the cloud drains in along the stable line (λ=−12\lambda = -\tfrac12) and streams out along the unstable line (λ=1\lambda = 1). The violet area blob gets stretched into a thin sliver. Its area grows like e0.5te^{0.5t}, because tr⁡A=0.5\operatorname{tr}A = 0.5 (see the readout). Now set a=d=0a = d = 0 (keeping b=c=0.75b = c = 0.75) to get a saddle with tr⁡A=0\operatorname{tr}A = 0. The blob still deforms wildly, but its area stays fixed at its starting value.
  3. Spiral sink and source. The real part of λ\lambda sets the shrink or growth rate and the imaginary part sets the rotation speed. Compare one turn of the cloud to the spirals of lesson 1.7.
  4. Shear. λ=0\lambda = 0 is repeated and there’s only one eigenvector. Particles slide along horizontal lines at speeds proportional to their height, eNt=I+Nte^{Nt} = I + Nt, with no exponentials.

Euler’s method is an approximation of eAte^{At}

The scalar computation carries over to matrices. Forward Euler for x⃗′=Ax⃗\vec x' = A\vec x gives

x⃗n+1=x⃗n+hAx⃗n=(I+hA) x⃗n⟹x⃗n=(I+hA)n x⃗0.\vec x_{n+1} = \vec x_n + hA\vec x_n = (I + hA)\,\vec x_n \qquad\Longrightarrow\qquad \vec x_n = (I + hA)^n\,\vec x_0 .

With h=t/nh = t/n, the matrix version of the compound interest limit holds:

lim⁡n→∞(I+Atn)n=eAt.\lim_{n\to\infty}\Big(I + \frac{At}{n}\Big)^n = e^{At}.

When A=PDP−1A = PDP^{-1} this follows from the scalar case: (I+hA)n=P(I+hD)nP−1(I + hA)^n = P(I + hD)^nP^{-1}, and each diagonal entry (1+hλi)n(1 + h\lambda_i)^n tends to eλite^{\lambda_i t}. It’s true for every square matrix, and the error again decays like 1/n1/n.

The rotation, concretely. For A=JA = J, factor I+hJI + hJ as a scaling times a rotation:

I+hJ=[1−hh1]=1+h2[cos⁡ϕ−sin⁡ϕsin⁡ϕcos⁡ϕ],tan⁡ϕ=h.I + hJ = \begin{bmatrix} 1 & -h \\ h & 1 \end{bmatrix} = \sqrt{1+h^2}\begin{bmatrix} \cos\phi & -\sin\phi \\ \sin\phi & \cos\phi \end{bmatrix},\qquad \tan\phi = h .

Every Euler step rotates by ϕ≈h\phi \approx h and stretches by 1+h2>1\sqrt{1+h^2} \gt 1. That’s why Euler spirals outward on a center no matter how small hh is. After nn steps the radius has grown by (1+h2)n/2(1+h^2)^{n/2}. For one full turn (nh=2πnh = 2\pi) with h=2π/63≈0.0997h = 2\pi/63 \approx 0.0997, that’s (1.00995)31.5≈1.37(1.00995)^{31.5} \approx 1.37, a 37% error in the radius after one orbit, even with 63 steps. The growth does vanish as h→0h\to 0 (it is about e2π2/ne^{2\pi^2/n}), but slowly, at first order.

✅ Concept check

Forward Euler with a fixed small step $h$ is applied to the center $\vec x' = J\vec x$. Over many steps, the distance from the origin…

Every explicit time-stepper approximates ehAe^{hA}

Here’s the big idea for simulation. For x⃗′=Ax⃗\vec x' = A\vec x, the exact solution satisfies

x⃗(t+h)=ehA x⃗(t),\vec x(t + h) = e^{hA}\,\vec x(t),

so the perfect one-step method would multiply by ehAe^{hA}. Every explicit one-step method applied to a linear system instead multiplies by some polynomial R(hA)R(hA), and the polynomial is a truncation of the exponential series:

MethodOne step for x⃗′=Ax⃗\vec x' = A\vec xStability function R(z)R(z)Order
exactehAe^{hA}ez=1+z+z22+z36+z424+⋯e^z = 1 + z + \frac{z^2}{2} + \frac{z^3}{6} + \frac{z^4}{24} + \cdotsn/a
forward EulerI+hAI + hA1+z1 + z1
Heun / midpointI+hA+(hA)22I + hA + \frac{(hA)^2}{2}1+z+z221 + z + \frac{z^2}{2}2
RK4I+hA+(hA)22+(hA)36+(hA)424I + hA + \frac{(hA)^2}{2} + \frac{(hA)^3}{6} + \frac{(hA)^4}{24}1+z+z22+z36+z4241 + z + \frac{z^2}{2} + \frac{z^3}{6} + \frac{z^4}{24}4

RK4 is the fourth-order Taylor polynomial of ehAe^{hA}. Here’s the check, using the RK4 stages you already know with f(x⃗)=Ax⃗f(\vec x) = A\vec x:

k⃗1=Ax⃗k⃗2=A(x⃗+h2k⃗1)=(A+h2A2)x⃗k⃗3=A(x⃗+h2k⃗2)=(A+h2A2+h24A3)x⃗k⃗4=A(x⃗+hk⃗3)=(A+hA2+h22A3+h34A4)x⃗.\begin{aligned} \vec k_1 &= A\vec x \\ \vec k_2 &= A\big(\vec x + \tfrac h2 \vec k_1\big) = \big(A + \tfrac h2 A^2\big)\vec x \\ \vec k_3 &= A\big(\vec x + \tfrac h2 \vec k_2\big) = \big(A + \tfrac h2 A^2 + \tfrac{h^2}{4} A^3\big)\vec x \\ \vec k_4 &= A\big(\vec x + h\vec k_3\big) = \big(A + hA^2 + \tfrac{h^2}{2}A^3 + \tfrac{h^3}{4}A^4\big)\vec x . \end{aligned}

Now collect x⃗+h6(k⃗1+2k⃗2+2k⃗3+k⃗4)\vec x + \frac h6(\vec k_1 + 2\vec k_2 + 2\vec k_3 + \vec k_4) power by power. The AA terms give h6(1+2+2+1)A=hA\frac h6(1+2+2+1)A = hA. The A2A^2 terms give h6(2⋅h2+2⋅h2+h)A2=h22A2\frac h6\big(2\cdot\frac h2 + 2\cdot\frac h2 + h\big)A^2 = \frac{h^2}{2}A^2. The A3A^3 terms give h6(2⋅h24+h22)A3=h36A3\frac h6\big(2\cdot\frac{h^2}{4} + \frac{h^2}{2}\big)A^3 = \frac{h^3}{6}A^3. The A4A^4 term gives h6⋅h34A4=h424A4\frac h6 \cdot \frac{h^3}{4}A^4 = \frac{h^4}{24}A^4. So

x⃗n+1=(I+hA+(hA)22!+(hA)33!+(hA)44!)x⃗n.\vec x_{n+1} = \Big(I + hA + \frac{(hA)^2}{2!} + \frac{(hA)^3}{3!} + \frac{(hA)^4}{4!}\Big)\vec x_n .

Those four clever stage weights, 16,13,13,16\tfrac16, \tfrac13, \tfrac13, \tfrac16, are exactly what’s needed to reproduce ehAe^{hA} through the h4h^4 term without ever forming a matrix power. The per-step error is the first missing term, about (hA)5120\frac{(hA)^5}{120}, which is O(h5)O(h^5). Over t/ht/h steps it adds up to O(h4)O(h^4). That’s why RK4 is “fourth order”. (For nonlinear ff the stages also have to match cross-derivative terms, which is the hard part of designing RK methods. See 4.3 Runge–Kutta Methods & Butcher Tableaux.)

Stability: comparing R(hλ)R(h\lambda) with ehλe^{h\lambda}

Diagonalize once more. Along an eigenvector with eigenvalue λ\lambda, the true solution multiplies by ehλe^{h\lambda} each step, and the method multiplies by R(hλ)R(h\lambda). So:

  • Accuracy is how closely R(z)R(z) matches eze^z near z=0z = 0.
  • Stability asks whether ∣R(hλ)∣≤1|R(h\lambda)| \le 1 whenever the true mode doesn’t grow (Re⁡λ≤0\operatorname{Re}\lambda \le 0). If some mode has ∣R(hλ)∣>1|R(h\lambda)| \gt 1 when it shouldn’t, that mode gets amplified every step and the simulation blows up.

On the rotation (λ=±i\lambda = \pm i, z=±ihz = \pm ih):

  • Euler: ∣1+ih∣2=1+h2>1|1 + ih|^2 = 1 + h^2 \gt 1. Unstable for every hh.
  • RK4: with R(ih)=(1−h22+h424)+i(h−h36)R(ih) = \big(1 - \frac{h^2}{2} + \frac{h^4}{24}\big) + i\big(h - \frac{h^3}{6}\big), a short calculation gives ∣R(ih)∣2=1−h672+h8576|R(ih)|^2 = 1 - \frac{h^6}{72} + \frac{h^8}{576}. That’s just below 11 as long as h2<8h^2 \lt 8, i.e. h<22≈2.83h \lt 2\sqrt2 \approx 2.83. RK4 is stable on centers for reasonable steps, and it loses a tiny bit of amplitude per step instead of gaining it.
✏️ Pen & paperEuler and RK4 on a center●●●

Consider x⃗′=Jx⃗\vec x' = J\vec x with x⃗(0)=(1,0)\vec x(0) = (1, 0), integrated for one full revolution (t=2πt = 2\pi) using NN equal steps, h=2π/Nh = 2\pi/N.

  1. Show that forward Euler ends at radius (1+h2)N/2(1 + h^2)^{N/2}, and evaluate it for N=20N = 20.
  2. Show that, for large NN, this radius is approximately e2π2/Ne^{2\pi^2/N}. How many steps does Euler need for a radius error below 1%?
  3. Using ∣R(ih)∣2=1−h672+h8576|R(ih)|^2 = 1 - \frac{h^6}{72} + \frac{h^8}{576} for RK4, estimate the radius after one revolution with N=20N = 20.
Show worked solution
  1. ∥(I+hJ)x⃗∥=1+h2 ∥x⃗∥\|(I + hJ)\vec x\| = \sqrt{1+h^2}\,\|\vec x\|, because I+hJI + hJ is 1+h2\sqrt{1+h^2} times a rotation, and rotations preserve length. After NN steps the radius is (1+h2)N/2(1+h^2)^{N/2}. For N=20N = 20: h=π/10≈0.3142h = \pi/10 \approx 0.3142, h2≈0.09870h^2 \approx 0.09870, and (1.09870)10≈2.56(1.09870)^{10} \approx 2.56. Euler’s “circle” ends at more than two and a half times the true radius.
  2. ln⁡[(1+h2)N/2]=N2ln⁡(1+h2)≈N2h2=N2⋅4π2N2=2π2N\ln\big[(1+h^2)^{N/2}\big] = \frac N2\ln(1 + h^2) \approx \frac N2 h^2 = \frac N2\cdot\frac{4\pi^2}{N^2} = \frac{2\pi^2}{N}. So the radius is about e2π2/N≈1+2π2/Ne^{2\pi^2/N} \approx 1 + 2\pi^2/N. A 1% error needs 2π2/N<0.012\pi^2/N \lt 0.01, i.e. N>200π2≈1974N \gt 200\pi^2 \approx 1974 steps per revolution. That’s first-order convergence in action.
  3. With h=0.3142h = 0.3142: h6≈9.61×10−4h^6 \approx 9.61\times10^{-4} and h8≈9.49×10−5h^8 \approx 9.49\times 10^{-5}, so ∣R∣2≈1−1.335×10−5+1.6×10−7≈1−1.32×10−5|R|^2 \approx 1 - 1.335\times10^{-5} + 1.6\times 10^{-7} \approx 1 - 1.32\times 10^{-5}. Over 20 steps the radius is (∣R∣2)10≈1−1.32×10−4≈0.99987(|R|^2)^{10} \approx 1 - 1.32\times10^{-4} \approx 0.99987. RK4 with only 20 steps has a radius error about ten thousand times smaller than Euler’s, and it errs on the safe side (slightly inward).
🧪 Coding exerciseExercise: one RK4 step is the 4th-order Taylor polynomial of e^(hA)
⌘/Ctrl + Enter

A warning: eA+B≠eAeBe^{A+B} \ne e^A e^B

For numbers, ea+b=eaebe^{a+b} = e^ae^b. For matrices, expand both sides to second order:

eAheBh=I+(A+B)h+(A22+AB+B22)h2+O(h3),e^{Ah}e^{Bh} = I + (A+B)h + \Big(\tfrac{A^2}{2} + AB + \tfrac{B^2}{2}\Big)h^2 + O(h^3), e(A+B)h=I+(A+B)h+12(A2+AB+BA+B2)h2+O(h3).e^{(A+B)h} = I + (A+B)h + \tfrac12\big(A^2 + AB + BA + B^2\big)h^2 + O(h^3).

They agree through first order, but

eAheBh−e(A+B)h=h22 (AB−BA)+O(h3).e^{Ah}e^{Bh} - e^{(A+B)h} = \tfrac{h^2}{2}\,(AB - BA) + O(h^3).

The difference is controlled by the commutator AB−BAAB - BA. If AA and BB commute, all the higher terms cancel too and eA+B=eAeBe^{A+B} = e^Ae^B exactly. Otherwise it fails. Lesson 1.2 showed that matrix multiplication isn’t commutative, and here’s a place where that really matters.

🐍 PythonSplitting error is first order (Lie) or second order (Strang)
⌘/Ctrl + Enter
✅ Concept checkselect all that apply

Select all statements that are true for every pair of square matrices $A$, $B$ (and every $t$).

Computing eAe^{A} yourself

Libraries compute eAe^{A} with scipy.linalg.expm, which uses scaling-and-squaring with a Padé approximation. Shrink AA by a power of two until the series converges fast, then square the result back up, using eA=(eA/2s)2se^{A} = (e^{A/2^s})^{2^s}. The plain series works fine for modest matrices, and writing it yourself is the best way to believe the definition.

🧪 Coding exerciseExercise: e^A from its power series
⌘/Ctrl + Enter

Now verify the Euler limit numerically. The error should shrink by a factor of 10 each time nn grows by 10.

🧪 Coding exerciseExercise: (I + A/n)^n → e^A, with error ~ 1/n
⌘/Ctrl + Enter

Practice problems

✏️ Pen & paperExponentials straight from the series●○○
  1. Compute eDte^{Dt} for D=[−1002]D = \begin{bmatrix} -1 & 0 \\ 0 & 2 \end{bmatrix} and describe the motion of x⃗(t)=eDt(1,1)\vec x(t) = e^{Dt}(1, 1).
  2. For N=[0100]N = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, compute eNte^{Nt} and verify directly that x⃗(t)=eNtx⃗0\vec x(t) = e^{Nt}\vec x_0 solves x1′=x2x_1' = x_2, x2′=0x_2' = 0.
  3. Use part 2 and the fact that 2I2I commutes with NN to compute eAte^{At} for A=[2102]A = \begin{bmatrix} 2 & 1 \\ 0 & 2 \end{bmatrix}.
Show worked solution
  1. eDt=[e−t00e2t]e^{Dt} = \begin{bmatrix} e^{-t} & 0 \\ 0 & e^{2t}\end{bmatrix}, so x⃗(t)=(e−t,e2t)\vec x(t) = (e^{-t}, e^{2t}). The x1x_1 coordinate decays and x2x_2 blows up: a saddle with eigen-directions along the axes. The trajectory satisfies x2=x1−2x_2 = x_1^{-2}, a curve that hugs the x2x_2-axis as t→∞t \to \infty.
  2. N2=0N^2 = 0, so eNt=I+Nt=[1t01]e^{Nt} = I + Nt = \begin{bmatrix} 1 & t \\ 0 & 1\end{bmatrix} and x⃗(t)=(x1(0)+t x2(0), x2(0))\vec x(t) = (x_1(0) + t\,x_2(0),\ x_2(0)). Then x2′=0x_2' = 0 ✓ and x1′=x2(0)=x2x_1' = x_2(0) = x_2 ✓. It’s uniform motion: constant velocity x2x_2 along x1x_1.
  3. A=2I+NA = 2I + N with (2I)N=N(2I)(2I)N = N(2I), so eAt=e2tIeNt=e2t[1t01]e^{At} = e^{2tI}e^{Nt} = e^{2t}\begin{bmatrix} 1 & t \\ 0 & 1\end{bmatrix}. The te2tte^{2t} entry is the signature of a repeated eigenvalue without a full set of eigenvectors, which you’ll meet again in 7.4 Complex & Repeated Eigenvalues.
✏️ Pen & paperA second-order ODE as a system●●○

The equation y′′+3y′+2y=0y'' + 3y' + 2y = 0 becomes a first-order system for x⃗=(y,y′)\vec x = (y, y'):

x⃗ ′=Ax⃗,A=[01−2−3].\vec x\,' = A\vec x,\qquad A = \begin{bmatrix} 0 & 1 \\ -2 & -3 \end{bmatrix}.
  1. Find the eigenvalues and eigenvectors of AA.
  2. Compute eAt=PeDtP−1e^{At} = Pe^{Dt}P^{-1}.
  3. Solve for y(t)y(t) with y(0)=1y(0) = 1, y′(0)=0y'(0) = 0, and check that it satisfies the ODE.
Show worked solution
  1. det⁡(A−λI)=λ(λ+3)+2=λ2+3λ+2=(λ+1)(λ+2)\det(A - \lambda I) = \lambda(\lambda + 3) + 2 = \lambda^2 + 3\lambda + 2 = (\lambda+1)(\lambda+2), so λ1=−1\lambda_1 = -1, λ2=−2\lambda_2 = -2. For λ1=−1\lambda_1 = -1: A+I=[11−2−2]A + I = \begin{bmatrix} 1 & 1 \\ -2 & -2\end{bmatrix} gives v⃗1=(1,−1)\vec v_1 = (1, -1). For λ2=−2\lambda_2 = -2: A+2I=[21−2−1]A + 2I = \begin{bmatrix} 2 & 1 \\ -2 & -1\end{bmatrix} gives v⃗2=(1,−2)\vec v_2 = (1, -2).
  2. P=[11−1−2]P = \begin{bmatrix} 1 & 1 \\ -1 & -2 \end{bmatrix}, det⁡P=−2+1=−1\det P = -2 + 1 = -1, and P−1=[21−1−1]P^{-1} = \begin{bmatrix} 2 & 1 \\ -1 & -1\end{bmatrix}. Then
eAt=[11−1−2][2e−te−t−e−2t−e−2t]=[2e−t−e−2te−t−e−2t−2e−t+2e−2t−e−t+2e−2t].e^{At} = \begin{bmatrix} 1 & 1 \\ -1 & -2 \end{bmatrix}\begin{bmatrix} 2e^{-t} & e^{-t} \\ -e^{-2t} & -e^{-2t}\end{bmatrix} = \begin{bmatrix} 2e^{-t} - e^{-2t} & e^{-t} - e^{-2t} \\ -2e^{-t} + 2e^{-2t} & -e^{-t} + 2e^{-2t}\end{bmatrix}.

Check: at t=0t = 0 this is II ✓, and its derivative at 00 is [−2+2−1+22−41−4]=[01−2−3]=A\begin{bmatrix} -2+2 & -1+2 \\ 2-4 & 1-4\end{bmatrix} = \begin{bmatrix} 0 & 1 \\ -2 & -3\end{bmatrix} = A ✓. 3. x⃗(t)=eAt(1,0)\vec x(t) = e^{At}(1, 0) is the first column, so y(t)=2e−t−e−2ty(t) = 2e^{-t} - e^{-2t} (and y′(t)=−2e−t+2e−2ty'(t) = -2e^{-t} + 2e^{-2t}, matching the second entry). Check: y′′=2e−t−4e−2ty'' = 2e^{-t} - 4e^{-2t}, so y′′+3y′+2y=(2−6+4)e−t+(−4+6−2)e−2t=0y'' + 3y' + 2y = (2 - 6 + 4)e^{-t} + (-4 + 6 - 2)e^{-2t} = 0 ✓, with y(0)=1y(0) = 1 and y′(0)=0y'(0) = 0 ✓. Both modes decay, so the origin is a stable node: an overdamped oscillator (5.2 Constant Coefficients & the Characteristic Equation).

✏️ Pen & paperSpirals from rotation plus scaling●●○

Let A=[a−bba]=aI+bJA = \begin{bmatrix} a & -b \\ b & a \end{bmatrix} = aI + bJ.

  1. Explain why eAt=eat[cos⁡bt−sin⁡btsin⁡btcos⁡bt]e^{At} = e^{at}\begin{bmatrix} \cos bt & -\sin bt \\ \sin bt & \cos bt\end{bmatrix}.
  2. Find the eigenvalues of AA and relate them to the formula in part 1.
  3. For a=−0.2a = -0.2, b=1b = 1 (the spiral sink in the sim), by what factor does the distance to the origin shrink during one revolution?
Show worked solution
  1. aIaI commutes with every matrix, in particular with bJbJ, so e(aI+bJ)t=eatIebtJe^{(aI + bJ)t} = e^{atI}e^{btJ}. Here eatI=eatIe^{atI} = e^{at}I (a diagonal exponential) and ebtJe^{btJ} is the rotation by angle btbt.
  2. det⁡(A−λI)=(a−λ)2+b2=0\det(A - \lambda I) = (a - \lambda)^2 + b^2 = 0 gives λ=a±ib\lambda = a \pm ib. The real part aa is the exponential growth or decay rate eate^{at}, and the imaginary part bb is the angular speed. This is the continuous-time version of “complex eigenvalue = rotation + scaling” from lesson 1.7.
  3. One revolution takes t=2π/b=2πt = 2\pi/b = 2\pi. The radius scales by e−0.2⋅2π=e−0.4π≈0.285e^{-0.2\cdot 2\pi} = e^{-0.4\pi} \approx 0.285, so it shrinks to about 28.5% of its starting value each turn.
✏️ Pen & paperWhen the exponential law fails●●○

Let A=[0100]A = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} and B=[0010]B = \begin{bmatrix} 0 & 0 \\ 1 & 0 \end{bmatrix}.

  1. Compute AB−BAAB - BA.
  2. Compute eAe^A, eBe^B, eAeBe^Ae^B and eBeAe^Be^A.
  3. Compute eA+Be^{A+B}. (Hint: A+BA + B has eigenvalues ±1\pm1.) Compare it with part 2, and check that all three matrices have determinant etr⁡=1e^{\operatorname{tr}} = 1.
Show worked solution
  1. AB=[1000]AB = \begin{bmatrix} 1 & 0 \\ 0 & 0\end{bmatrix} and BA=[0001]BA = \begin{bmatrix} 0 & 0 \\ 0 & 1\end{bmatrix}, so AB−BA=[100−1]≠0AB - BA = \begin{bmatrix} 1 & 0 \\ 0 & -1\end{bmatrix} \ne 0. They don’t commute.
  2. Both are nilpotent (A2=B2=0A^2 = B^2 = 0), so eA=I+A=[1101]e^A = I + A = \begin{bmatrix} 1 & 1 \\ 0 & 1\end{bmatrix} and eB=I+B=[1011]e^B = I + B = \begin{bmatrix} 1 & 0 \\ 1 & 1\end{bmatrix}. Then eAeB=[2111]e^Ae^B = \begin{bmatrix} 2 & 1 \\ 1 & 1\end{bmatrix} and eBeA=[1112]e^Be^A = \begin{bmatrix} 1 & 1 \\ 1 & 2\end{bmatrix}. Even the order matters.
  3. A+B=[0110]A + B = \begin{bmatrix} 0 & 1 \\ 1 & 0\end{bmatrix} has eigenvalues 11 and −1-1 with eigenvectors (1,1)(1,1) and (1,−1)(1,-1). Diagonalizing gives eA+B=[cosh⁡1sinh⁡1sinh⁡1cosh⁡1]≈[1.5431.1751.1751.543]e^{A+B} = \begin{bmatrix} \cosh 1 & \sinh 1 \\ \sinh 1 & \cosh 1\end{bmatrix} \approx \begin{bmatrix} 1.543 & 1.175 \\ 1.175 & 1.543\end{bmatrix}, which differs from both products. Determinants: 2−1=12 - 1 = 1, 2−1=12 - 1 = 1 and cosh⁡21−sinh⁡21=1\cosh^2 1 - \sinh^2 1 = 1. All equal etr⁡(A+B)=e0=1e^{\operatorname{tr}(A+B)} = e^0 = 1 ✓. The products get the area right but the shape wrong: that’s splitting error.

Where this goes next

This lesson closes Module 1, and every piece of it comes back:

Key Takeaways

  • Discrete dynamics x⃗n+1=Ax⃗n\vec x_{n+1} = A\vec x_n is solved by AnA^n. Continuous dynamics x⃗′=Ax⃗\vec x' = A\vec x is solved by the matrix exponential: x⃗(t)=eAtx⃗0\vec x(t) = e^{At}\vec x_0.
  • eAt=I+At+(At)22!+⋯e^{At} = I + At + \frac{(At)^2}{2!} + \cdots converges for every square matrix and satisfies ddteAt=AeAt\frac{d}{dt}e^{At} = Ae^{At}, which is exactly why it solves the system.
  • Diagonalization computes it: eAt=PeDtP−1e^{At} = Pe^{Dt}P^{-1}. In eigen-coordinates each mode evolves as eλte^{\lambda t}, so the sign of Re⁡λ\operatorname{Re}\lambda decides growth or decay, and Im⁡λ\operatorname{Im}\lambda gives rotation.
  • The rotation generator gives eθJ=e^{\theta J} = the rotation matrix: Euler’s formula eiθ=cos⁡θ+isin⁡θe^{i\theta} = \cos\theta + i\sin\theta written as a 2×22\times 2 matrix.
  • eAte^{At} is a flow that moves the whole plane, and it changes areas by det⁡eAt=et tr⁡A\det e^{At} = e^{t\,\operatorname{tr}A}. Trace-free (divergence-free) flows preserve area.
  • Forward Euler is (I+hA)n→eAt(I + hA)^n \to e^{At}, the compound-interest limit, with O(h)O(h) error. Every explicit stepper multiplies by a polynomial R(hA)≈ehAR(hA) \approx e^{hA}, and RK4’s RR is exactly the 4th-order Taylor polynomial of ehAe^{hA}.
  • Stability means ∣R(hλ)∣≤1|R(h\lambda)| \le 1 for every eigenvalue whose true mode doesn’t grow. On a center, Euler’s ∣1+ih∣>1|1 + ih| \gt 1 always spirals outward.
  • eA+B≠eAeBe^{A+B} \ne e^Ae^B unless AB=BAAB = BA. Operator splitting (advect, diffuse, project) pays an error proportional to the commutator.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.

Where this leads

These later lessons build directly on this one: