Ten problems on matrix exponentials and linear systems of differential equations: solving x′ = Ax from the eigenvectors and the initial condition, e^(At) = Ve^(Λt)V⁻¹ for a 2×2 matrix, a repeated eigenvalue with one eigenvector and e^(At) = e^(λt)(I + Nt), the rotation e^(Jt) from the series and a decaying spiral, classifying four equilibria from the trace and determinant, a second-order equation rewritten as a first-order system, det e^(At) = e^(t tr A), two matrices with e^(A+B) ≠ e^A e^B, a two-state machine with rate matrix Q and P(t) = e^(Qt), and gradient flow on a quadratic loss compared with gradient descent, with worked solutions and the mistakes of exponentiating entry by entry, splitting e^(A+B) when A and B do not commute, writing V⁻¹e^(Λt)V, treating a defective matrix as diagonalizable and reading stability off the diagonal.
Before you start
A single linear differential equation x′=ax has the solution .x(t)=eatx(0). A system of them, x′=Ax with a vector x and a square matrix ,A, has exactly the same solution, ,x(t)=eAtx(0), once the exponential of a matrix is defined by the same power series. Computing eAt is an eigenvalue problem: each eigenvector of A grows or decays at its own rate ,eλt, complex eigenvalues turn the motion into a rotation, and the signs of the real parts decide whether every solution dies out. The same object turns a rate matrix into the transition probabilities of a continuous-time Markov chain, and it is what gradient descent approximates when the step size is small. These ten problems compute eAt in each of the cases that come up by hand, and the places where the scalar rules stop working for matrices.
The matrix exponential is ,eM=I+M+2!1M2+3!1M3+⋯, which converges for every square matrix. It satisfies dtdeAt=AeAt and ,eA⋅0=I, so x(t)=eAtx(0) solves .x′=Ax.
Diagonalizable case. If Avi=λivi and V has the eigenvectors as columns, then A=VΛV−1 and ,eAt=VeΛtV−1, where eΛt is diagonal with entries .eλit. Equivalently ,x(t)=∑icieλitvi, with the constants .c=V−1x(0).
Commuting matrices. If AB=BA then .eA+B=eAeB. In particular ,e(λI+N)t=eλteNt, and if N2=0 the series stops: .eNt=I+Nt. Without AB=BA the product rule fails.
Complex eigenvaluesα±βi of a real matrix give solutions eαt times a rotation at angular speed :β: a spiral, inward if .α<0.
Stability. Every solution tends to 0 exactly when every eigenvalue has negative real part. For a 2×2 matrix with trace τ and determinant Δ the eigenvalues solve :λ2−τλ+Δ=0:Δ<0 is a saddle; with Δ>0 the origin is stable if τ<0 and unstable if ,τ>0, a center if ,τ=0, and a spiral when .τ2<4Δ.
,deteA=etrA, so eA is never singular, and its inverse is .e−A.
Solve x′=Ax with A=(4213) and ,x(0)=(2,−1), using the eigenvalues and eigenvectors of .A.
··
For the matrix A of Problem 1, compute ,eAt=VeΛtV−1, and check that it reproduces the solution of Problem 1.
··
Show that A=(3−111) has a repeated eigenvalue with only one independent eigenvector. Compute eAt by writing ,A=2I+N, and solve x′=Ax with .x(0)=(1,0).
··
Let .J=(01−10). Compute eJt from the power series. Then solve x′=Bx for B=(−12−2−1) with ,x(0)=(1,0), and find x(π/2) and .∣x(t)∣.
·
Classify the equilibrium at the origin of x′=Ax from the trace and determinant, and confirm with the eigenvalues, for
A1=(−311−3),A2=(11−5−1),
A3=(1320),A4=(23−32).
··
Rewrite y′′+3y′+2y=0 with ,y(0)=1,y′(0)=0 as a first-order system x′=Ax for ,x=(y,y′), and solve it with eigenvectors.
·
Check that deteAt=ettrA for the matrices of Problems 2 and 3, and explain why eAt is always invertible.
···
Let A=(0010) and .B=(0100). Compute ,eA,,eB,,eAeB,eBeA and ,eA+B, and explain the difference.
··
A machine is up (U) or down (D). It fails at rate 1 per day and is repaired at rate 3 per day, so its rate matrix is Q=(−131−3) and its transition matrix is .P(t)=eQt. Find ,P(t), the probability that a machine up now is down 12 hours from now, and the long-run fraction of time it is up.
···
Gradient flow on the loss L(w)=21w⊤Hw with H=(3113) is .w′=−Hw. Starting from ,w(0)=(2,0), find ,w(t),L(w(t)) and when L first drops below .0.01. Then compare gradient descent wk+1=(I−ηH)wk with η=0.1 for 10 steps against the flow at ,t=1, and find the step sizes for which gradient descent converges.
Answers
x(t)=(e5t+e2t,e5t−2e2t)
eAt as in step 3; eAt(2,−1)=(e5t+e2t,e5t−2e2t)
x(t)=e2t(1+t,−t)
x(π/2)=(−e−π/2,0)≈(−0.208,0) and ∣x(t)∣=e−t
A1 stable node, A2 center, A3 saddle, A4 unstable spiral
y(t)=2e−t−e−2t
deteAt=e7t and ,e4t, never ;0; the inverse is e−At
eA+B equals neither eAeB nor ,eBeA, because AB=(1000)=(0001)=BA
P(t) as in step 2; down at 12 hours with probability ;≈0.216; up 43 of the time
,w(t)=e−4t(1,1)+e−2t(1,−1),,L=4e−8t+2e−4t, below 0.01 from ;t≈1.33; gradient descent converges exactly for 0<η<21
Worked solutions
Problem 1
Solve x′=Ax with A=(4213) and ,x(0)=(2,−1), using the eigenvalues and eigenvectors of .A.
,λ2−7λ+10=0, so ,λ1=5,λ2=2The trace is 7 and the determinant .12−2=10.
c1(1,1)+c2(1,−2)=(2,−1) gives ,c1=1,c2=1Subtracting the second equation from the first: .3c2=3.
x(t)=e5t(1,1)+e2t(1,−2)Each eigenvector component grows at its own rate .eλt.
x(t)=(e5t+e2t,e5t−2e2t)Check: x(0)=(2,−1) and .x′(0)=(5+2,5−4)=(7,1)=A(2,−1). For large t the e5t term dominates and x points along .(1,1).
Problem 2
For the matrix A of Problem 1, compute ,eAt=VeΛtV−1, and check that it reproduces the solution of Problem 1.
,V=(111−2),V−1=31(211−1)The eigenvectors of Problem 1 as columns; .detV=−3.
eΛtV−1=31(2e5te2te5t−e2t)A diagonal matrix on the left scales the rows.
eAt=31(2e5t+e2t2e5t−2e2te5t−e2te5t+2e2t)Multiply by V on the left.
At t=0 it is ,I, and its derivative there is 31(12639)=AThe two properties that define .eAt.
eAt as in step 3; eAt(2,−1)=(e5t+e2t,e5t−2e2t)The first entry is ,31(4e5t+2e2t−e5t+e2t), matching Problem 1. Writing V−1eΛtV instead gives the transpose of this matrix (Mistake 3).
Problem 3
Show that A=(3−111) has a repeated eigenvalue with only one independent eigenvector. Compute eAt by writing ,A=2I+N, and solve x′=Ax with .x(0)=(1,0).
λ2−4λ+4=(λ−2)2Trace ,4, determinant .3+1=4.
,N=A−2I=(1−11−1), and Nv=0 only for multiples of (1,−1)N has rank ,1, so there is one eigenvector and V cannot be built.
,N2=0, so eNt=I+NtThe series stops after the linear term.
eAt=e2t(I+Nt)=e2t(1+t−tt1−t)2I commutes with every matrix, so .e(2I+N)t=e2teNt.
x(t)=e2t(1+t,−t)The first column of .eAt. Check: .x′(0)=(2+1,−1)=(3,−1)=A(1,0). The factor t next to e2t is what a repeated eigenvalue adds, as tert does for a repeated characteristic root (Mistake 4).
Problem 4
Let .J=(01−10). Compute eJt from the power series. Then solve x′=Bx for B=(−12−2−1) with ,x(0)=(1,0), and find x(π/2) and .∣x(t)∣.
,J2=−I, so J3=−J and J4=IThe powers cycle with period ,4, like the powers of .i.
eJt=(1−2!t2+⋯)I+(t−3!t3+⋯)JGroup the even and the odd powers.
eJt=(costsint−sintcost)The two series are cost and :sint: rotation by the angle .t.
,B=−I+2J, so eBt=e−te2Jt−I commutes with .J. The eigenvalues of B are .−1±2i.
x(t)=e−t(cos2t,sin2t)The first column of e−t times the rotation by .2t.
x(π/2)=(−e−π/2,0)≈(−0.208,0) and ∣x(t)∣=e−tA spiral that turns at angular speed ,2, the imaginary part of the eigenvalues, and shrinks at rate ,1, the negative of the real part. By t=2π it has turned through the angle ,π, halfway around.
Problem 5
Classify the equilibrium at the origin of x′=Ax from the trace and determinant, and confirm with the eigenvalues, for
A1=(−311−3),A2=(11−5−1),
A3=(1320),A4=(23−32).
:A1:,τ=−6,,Δ=8,τ2−4Δ=4>0Real eigenvalues :2−6±2=−2,−4: a stable node.
:A2:,τ=0,Δ=−1+5=4Eigenvalues :±2i: a center. Orbits are closed curves that neither shrink nor grow.
:A3:Δ=−6<0Eigenvalues 3 and ,−2, of opposite signs: a saddle, unstable.
:A4:,τ=4,,Δ=13,τ2−4Δ=−36<0Eigenvalues :2±3i: an unstable spiral.
A1 stable node, A2 center, A3 saddle, A4 unstable spiralOnly A1 sends every solution to .0.A4 has Δ>0 like ,A1, so the determinant alone cannot decide stability; and a matrix with a negative diagonal can still be a saddle (Mistake 5).
Problem 6
Rewrite y′′+3y′+2y=0 with ,y(0)=1,y′(0)=0 as a first-order system x′=Ax for ,x=(y,y′), and solve it with eigenvectors.
,A=(0−21−3),x(0)=(1,0)The first row says ;y′=y′; the second is the equation solved for .y′′.
,det(A−λI)=λ2+3λ+2, so λ=−1,−2The characteristic polynomial of A is the characteristic equation of the ODE.
,v1=(1,−1),v2=(1,−2)For this companion matrix the eigenvector for λ is :(1,λ):y=eλt has .y′=λeλt.
,c1+c2=1,,−c1−2c2=0, so ,c1=2,c2=−1Match .x(0)=(1,0).
y(t)=2e−t−e−2tThe first entry of .2e−t(1,−1)−e−2t(1,−2). Check: y(0)=1 and .y′(0)=−2+2=0. Both eigenvalues are negative and real, so y decays without oscillating: the system is overdamped.
Problem 7
Check that deteAt=ettrA for the matrices of Problems 2 and 3, and explain why eAt is always invertible.
Problem 2: 9deteAt=(2e5t+e2t)(e5t+2e2t)−2(e5t−e2t)2The factor 31 squared comes out as .91.
=(2e10t+5e7t+2e4t)−(2e10t−4e7t+2e4t)=9e7tSo ,deteAt=e7t, and .trA=7.
Problem 3: deteAt=e4t((1+t)(1−t)+t2)=e4tPulling e2t out of both rows gives ;e4t; the bracket is .1..trA=4.
In general deteAt=∏ieλit=et∑iλiThe eigenvalues of eAt are ,eλit, and the determinant is their product.
deteAt=e7t and ,e4t, never ;0; the inverse is e−AtAt and −At commute, so .eAte−At=e0=I. Running the system backward in time undoes it.
Problem 8
Let A=(0010) and .B=(0100). Compute ,eA,,eB,,eAeB,eBeA and ,eA+B, and explain the difference.
,eA=I+A=(1011),eB=I+B=(1101),A2=B2=0, so each series stops.
,eAeB=(2111),eBeA=(1112)Already the two orders disagree.
,(A+B)2=I, so eA+B=(cosh1)I+(sinh1)(A+B)Even powers are I and odd powers are ,A+B, like eJ in Problem 4 without the signs.
eA+B=(cosh1sinh1sinh1cosh1)≈(1.5431.1751.1751.543)Symmetric, unlike either product.
eA+B equals neither eAeB nor ,eBeA, because AB=(1000)=(0001)=BAThe step eaeb=ea+b rearranges as past bs, which matrices allow only when they commute. All three matrices have determinant ,1=etr(A+B), so the determinant cannot catch the error (Mistake 2).
Problem 9
A machine is up (U) or down (D). It fails at rate 1 per day and is repaired at rate 3 per day, so its rate matrix is Q=(−131−3) and its transition matrix is .P(t)=eQt. Find ,P(t), the probability that a machine up now is down 12 hours from now, and the long-run fraction of time it is up.
The eigenvalues of Q are 0 and −4Each row of Q sums to ,0, so ;Q1=0; the trace gives the other, .−4.
P(t)=41(3+e−4t3−3e−4t1−e−4t1+3e−4t)The two-state formula of the Markov chains set with λ2n replaced by ;e−4t; at t=0 it is ,I, and its derivative there is .Q.
Pr(D at t=21∣U)=41(1−e−2)≈0.216Twelve hours is t=21 day, so .e−4t=e−2≈0.135.
As ,t→∞, both rows tend to (43,41)The stationary distribution solves :πQ=0:.−πU+3πD=0.
P(t) as in step 2; down at 12 hours with probability ;≈0.216; up 43 of the timeThe mean up time is 1 day and the mean repair 31 day, and .1/(1+31)=43. The other entry of the top row at t=21 is ,≈0.784, and each row sums to ,1, which an entrywise exponential does not (Mistake 1).
Problem 10
Gradient flow on the loss L(w)=21w⊤Hw with H=(3113) is .w′=−Hw. Starting from ,w(0)=(2,0), find ,w(t),L(w(t)) and when L first drops below .0.01. Then compare gradient descent wk+1=(I−ηH)wk with η=0.1 for 10 steps against the flow at ,t=1, and find the step sizes for which gradient descent converges.
H has eigenvalues 4 and 2 with eigenvectors (1,1) and ,(1,−1), and w(0)=(1,1)+(1,−1)H is symmetric, so its eigenvectors are orthogonal.
w(t)=e−4t(1,1)+e−2t(1,−1)e−Ht multiplies each eigenvector component by .e−λt.
L(w(t))=21(4⋅2e−8t+2⋅2e−4t)=4e−8t+2e−4tOrthogonal components add in ;w⊤Hw; each (1,±1) has squared length .2. At ,t=0,.L=6.
With :u=e−4t:4u2+2u=0.01 gives u≈0.00495 and t=−41lnu≈1.33The positive root of the quadratic. The slow direction, eigenvalue ,2, sets the time.
Gradient descent multiplies the components by 1−0.1⋅4=0.6 and 1−0.1⋅2=0.8 per step(I−ηH) has the same eigenvectors as .H.
After 10 steps: 0.610≈0.00605 and ,0.810≈0.107, against e−4≈0.0183 and e−2≈0.135Each step is the first two terms of ;e−ηH; with η=0.1 that is close for the slow direction and rough for the fast one.
,w(t)=e−4t(1,1)+e−2t(1,−1),,L=4e−8t+2e−4t, below 0.01 from ;t≈1.33; gradient descent converges exactly for 0<η<21Convergence needs ∣1−ηλ∣<1 for both eigenvalues, so .η<2/λmax=21. The flow converges for every ;t; only the discrete steps can overshoot.
Where this goes wrong
1. Exponentiating entry by entry
The scalar exponential is applied to each entry, as np.exp does to an array.
,Q=(−131−3),t=21Right so far: Problem 9.
“,P(21)=eQt, so exponentiate each entry of .21Q.”eM is the power series in the matrix ;M; its entries mix all the entries of .M. In Python it is scipy.linalg.expm, not numpy's np.exp.
P(21)=(e−0.5e1.5e0.5e−1.5)Its first row is ,(0.607,1.649), which sums to ,2.255, and at t=0 the same rule gives a matrix of ones instead of .I. The correct first row is .(0.784,0.216).
2. Splitting e^(A+B) when A and B do not commute
The scalar rule ea+b=eaeb is used to split a matrix into easy pieces.
A=(1012)=D+N with ,D=(1002),N=(0010)Right so far: a diagonal part and a part with .N2=0.
“.eAt=eDteNt=eDt(I+Nt).”DN=(0010) but ,ND=(0020), so the split is not allowed. It worked in Problems 3 and 4 because the diagonal part there was a multiple of .I.
eA=(e0ee2)The eigenvectors (1,0) and (1,1) give ,eAt=(et0e2t−ete2t), so the corner of eA is ,e2−e≈4.671, not .e≈2.718.
3. V⁻¹ e^(Λt) V instead of V e^(Λt) V⁻¹
The two outer factors are written in the wrong order.
,V=(111−2),V−1=31(211−1) for A=(4213)Right so far: Problem 2.
“.eAt=V−1eΛtV.”:A=VΛV−1:V−1 converts x into eigenvector coordinates, eΛt scales them, and V converts back, so V−1 acts first and sits on the right.
eAt=31(2e5t+e2te5t−e2t2e5t−2e2te5t+2e2t)Its derivative at t=0 is ,(4123)=A⊤, not :A: here it is the transpose of the right answer, because this V happens to be symmetric. In general V−1eΛtV is the exponential of ,V−1ΛV, a different matrix with the same eigenvalues, so a check of the trace or the determinant cannot catch the slip.
4. A repeated eigenvalue treated as two eigenvectors
The eigenvalue 2 is listed twice and V is assumed to exist.
A=(3−111) has the double eigenvalue 2Right so far: Problem 3.
“So Λ=2I and .eAt=Ve2tIV−1=e2tI.”That would make .A=V(2I)V−1=2I. A matrix that is not already 2I has only one eigenvector here, and V is singular.
x(t)=e2t(1,0) for x(0)=(1,0)Its derivative at 0 is ,(2,0), but .A(1,0)=(3,−1). The correct solution is ,e2t(1+t,−t), with the extra t from .eNt=I+Nt.
5. Stability read off the diagonal
Each entry on the diagonal is treated as a decay rate, as if the coordinates were separate equations.
x′=Ax with A=(−133−1)Right so far.
“x1′=−x1+… and :x2′=−x2+…: both coordinates decay.”The off-diagonal terms couple the coordinates, and stability is set by the eigenvalues. Here .Δ=1−9=−8<0.
Every solution tends to 0The eigenvalues are 2 and :−4: a saddle. From ,x(0)=(1,1), an eigenvector for ,2, the solution is ,e2t(1,1), already e2≈7.39 times as large at .t=1.