4.6.21Ordinary Differential Equations
Systems of first-order linear ODEs — matrix method
1,876 words9 min readdifficulty · medium1 backlinks
WHAT we are solving
HOW: derive the solution from scratch
Step 1 — Substitute the ansatz. Let . Then Why this step? We are testing whether such a self-similar solution can exist.
Step 2 — Cancel the scalar . Why this step? never vanishes, so we may divide it out — leaving a purely algebraic condition. This is exactly the eigenvalue equation.
Step 3 — Find eigenvalues. . A nonzero exists iff the matrix is singular: Why this step? A homogeneous linear system has a nontrivial solution only when the coefficient matrix is not invertible, i.e. determinant zero.
Step 4 — Superpose. The system is linear, so any linear combination of solutions is a solution (superposition principle). If has independent eigenvectors with eigenvalues :
Complex and repeated eigenvalues
For a complex pair with eigenvector , two real solutions are
\mathbf{x}_2=e^{\alpha t}(\mathbf p\sin\beta t+\mathbf q\cos\beta t).$$ > [!definition] Defective (repeated) case > If $\lambda$ has algebraic multiplicity 2 but only one eigenvector $\mathbf v$, we need a > **generalized eigenvector** $\mathbf w$ solving $(A-\lambda I)\mathbf w=\mathbf v$. Then a second > independent solution is $\mathbf{x}_2=e^{\lambda t}(t\,\mathbf v+\mathbf w)$. > *Why the $t$ factor?* Substituting $e^{\lambda t}(t\mathbf v+\mathbf w)$ and using $(A-\lambda I)\mathbf w=\mathbf v$ > makes both sides match — the $t$ supplies the missing degree of freedom. --- ![[4.6.21-Systems-of-first-order-linear-ODEs-—-matrix-method.png]] --- ## Worked Example 1 — distinct real eigenvalues Solve $\mathbf{x}'=A\mathbf{x}$, $A=\begin{pmatrix}1&1\\4&1\end{pmatrix}$, $\mathbf x(0)=\binom{2}{-1}$. **Step 1.** Characteristic equation: $\det(A-\lambda I)=(1-\lambda)^2-4=0$. *Why?* Nontrivial eigenvector needs singular $A-\lambda I$. $(1-\lambda)^2=4 \Rightarrow 1-\lambda=\pm2 \Rightarrow \lambda=-1,\,3.$ **Step 2.** Eigenvector for $\lambda=3$: $(A-3I)\mathbf v=\begin{pmatrix}-2&1\\4&-2\end{pmatrix}\mathbf v=0$ $\Rightarrow -2v_1+v_2=0\Rightarrow \mathbf v=\binom{1}{2}$. *Why?* Solve the singular system for the null direction. For $\lambda=-1$: $\begin{pmatrix}2&1\\4&2\end{pmatrix}\mathbf v=0\Rightarrow 2v_1+v_2=0\Rightarrow\mathbf v=\binom{1}{-2}$. **Step 3.** General solution: $$\mathbf{x}=c_1e^{3t}\binom{1}{2}+c_2e^{-t}\binom{1}{-2}.$$ **Step 4 — apply IC.** At $t=0$: $c_1\binom12+c_2\binom1{-2}=\binom{2}{-1}$. $c_1+c_2=2,\;2c_1-2c_2=-1\Rightarrow c_1=\tfrac34,\;c_2=\tfrac54.$ $$\boxed{\mathbf{x}(t)=\tfrac34e^{3t}\binom12+\tfrac54e^{-t}\binom1{-2}.}$$ --- ## Worked Example 2 — complex eigenvalues (spiral) $A=\begin{pmatrix}0&-2\\2&0\end{pmatrix}$. **Step 1.** $\det(A-\lambda I)=\lambda^2+4=0\Rightarrow\lambda=\pm2i$. So $\alpha=0,\beta=2$ — pure rotation. **Step 2.** Eigenvector for $\lambda=2i$: $\begin{pmatrix}-2i&-2\\2&-2i\end{pmatrix}\mathbf v=0\Rightarrow -2i\,v_1-2v_2=0\Rightarrow v_2=-i\,v_1$. Take $\mathbf v=\binom{1}{-i}=\binom10+i\binom0{-1}$, so $\mathbf p=\binom10,\ \mathbf q=\binom0{-1}$. **Step 3.** Real solutions ($\alpha=0,\beta=2$): $$\mathbf{x}_1=\binom10\cos2t-\binom0{-1}\sin2t=\binom{\cos2t}{\sin2t},\quad \mathbf{x}_2=\binom{\sin 2t}{-\cos 2t}.$$ $$\mathbf{x}=c_1\binom{\cos2t}{\sin2t}+c_2\binom{\sin2t}{-\cos2t}.$$ *Why circles?* $\alpha=0$ means no growth — trajectories are closed circles (a **center**). --- ## Worked Example 3 — repeated eigenvalue $A=\begin{pmatrix}3&1\\0&3\end{pmatrix}$. **Step 1.** $\det(A-\lambda I)=(3-\lambda)^2=0\Rightarrow\lambda=3$ (double). **Step 2.** $(A-3I)=\begin{pmatrix}0&1\\0&0\end{pmatrix}$. Eigenvector: $v_2=0\Rightarrow\mathbf v=\binom10$. Only **one** eigenvector → defective. **Step 3.** Generalized eigenvector: $(A-3I)\mathbf w=\mathbf v\Rightarrow w_2=1$, take $\mathbf w=\binom01$. $$\mathbf{x}=c_1e^{3t}\binom10+c_2e^{3t}\!\left(t\binom10+\binom01\right).$$ *Why the $t$?* It manufactures the missing second direction that ordinary exponentials couldn't. --- > [!mistake] Steel-manned common errors > **(1) "Number of eigenvalues = number of independent solutions."** Feels right because for *distinct* > eigenvalues it works. **Fix:** count *eigenvectors*. A repeated eigenvalue may give too few — then use generalized eigenvectors. > > **(2) Forgetting the eigenvector in the solution.** Writing $\mathbf{x}=c_1e^{\lambda_1 t}+c_2e^{\lambda_2 t}$ > (scalars). Tempting from scalar ODEs. **Fix:** each term *must* carry its eigenvector $\mathbf v_i$ — the solution is a vector. > > **(3) Using both complex conjugate pairs separately AND keeping complex eigenvectors.** This double-counts. > **Fix:** one complex pair $\alpha\pm i\beta$ yields exactly **two** real solutions (real & imaginary parts of one branch). > > **(4) Determinant sign slip:** computing $\det(\lambda I-A)$ vs $\det(A-\lambda I)$. Both give the same > roots (they differ by $(-1)^n$), but be consistent so the equation reads cleanly. --- > [!recall]- Feynman: explain to a 12-year-old > Imagine a swarm of arrows all pushing each particle around in a room. Normally the pushes are tangled. > But there are a few *special directions* where the push just makes you move straight out (or straight in) > along that line, faster and faster or slower and slower. Those special lines are eigenvectors; how strongly > the push acts is the eigenvalue. Once you know all the special lines, any motion is just a mix of moving > along them — so the messy swarm becomes easy! If a special direction makes you spin too, you go in spirals. --- > [!mnemonic] "**E**very **V**ector **E**xponential **S**uperposes" > **E**igenvalues from $\det(A-\lambda I)=0$ → **V**ectors (eigenvectors) → **E**xponential $e^{\lambda t}$ per pair → **S**uperpose with constants $c_i$ → fix by initial conditions. --- ## Recall > [!recall] Quick self-test > - The ansatz that decouples $\mathbf{x}'=A\mathbf{x}$? $\;e^{\lambda t}\mathbf v$. > - Equation $A\mathbf v=\lambda\mathbf v$ becomes solvable when? $\;\det(A-\lambda I)=0$. > - Real $\alpha<0$ in complex pair ⇒ trajectory? $\;$ inward spiral (stable). ### #flashcards/maths What ansatz solves the system $\mathbf{x}'=A\mathbf{x}$? ::: $\mathbf{x}=e^{\lambda t}\mathbf v$ with $\mathbf v$ constant. After substituting the ansatz, what algebraic condition remains? ::: $A\mathbf v=\lambda\mathbf v$, the eigenvalue equation. How do you find the eigenvalues? ::: Solve the characteristic equation $\det(A-\lambda I)=0$. Why can you divide out $e^{\lambda t}$? ::: Because the exponential is never zero, so the relation must hold for the constant factors. General solution for $n$ distinct eigenvalues? ::: $\mathbf{x}=\sum_i c_i e^{\lambda_i t}\mathbf v_i$. What fixes the constants $c_i$? ::: The initial condition $\mathbf{x}(0)=\mathbf x_0$. For $\lambda=\alpha\pm i\beta$, what do $\alpha$ and $\beta$ control? ::: $\alpha$: growth/decay rate; $\beta$: rotation frequency. Two real solutions from $\lambda=\alpha+i\beta$, $\mathbf v=\mathbf p+i\mathbf q$? ::: $e^{\alpha t}(\mathbf p\cos\beta t-\mathbf q\sin\beta t)$ and $e^{\alpha t}(\mathbf p\sin\beta t+\mathbf q\cos\beta t)$. When is the second solution of a repeated eigenvalue $e^{\lambda t}(t\mathbf v+\mathbf w)$? ::: When the eigenvalue is defective (fewer eigenvectors than its multiplicity); $\mathbf w$ solves $(A-\lambda I)\mathbf w=\mathbf v$. Stability rule for $\mathbf{x}'=A\mathbf{x}$? ::: Stable (decays) iff all eigenvalues have negative real part. --- ## Connections - [[Eigenvalues and Eigenvectors]] — the algebraic engine of the whole method. - [[Matrix Exponential]] — $\mathbf{x}(t)=e^{At}\mathbf x_0$ unifies all cases. - [[Diagonalization]] — distinct-eigenvalue case is just $A=PDP^{-1}$ change of basis. - [[Phase Portraits and Stability]] — nodes, saddles, spirals, centers from eigenvalue signs. - [[Second-Order Linear ODEs]] — reduces to a $2\times2$ system; same characteristic roots. - [[Euler's Formula]] — converts complex exponentials to real oscillations. ## 🖼️ Concept Map ```mermaid flowchart TD SYS["System x' = Ax"] -->|vector version of| SCALAR["Scalar x' = ax, soln Ce^at"] SYS -->|A tangles variables| COUPLE["Coupled equations"] COUPLE -->|decouple via| ANSATZ["Ansatz x = e^lambda t v"] ANSATZ -->|substitute and cancel e^lambda t| EIG["Eigenvalue eqn Av = lambda v"] EIG -->|nontrivial v needs singular matrix| CHAR["det of A minus lambda I = 0"] CHAR -->|solve for| EVALS["Eigenvalues lambda_i"] EVALS -->|each gives| EVECS["Eigenvectors v_i"] EVECS -->|form| BASIS["Basic solutions e^lambda_i t v_i"] BASIS -->|superposition principle| GEN["General solution sum c_i e^lambda_i t v_i"] SCALAR -->|self-reproduces on differentiation| ANSATZ ``` ## 🔊 Hinglish (regional understanding) > [!intuition]- Hinglish mein samjho > Dekho, ek single equation $x'=ax$ ka solution $Ce^{at}$ hota hai — yeh tum jaante ho. Ab agar do-teen > variables aapas mein juddhe (coupled) ho, jaise $\mathbf{x}'=A\mathbf{x}$, toh seedha solve karna mushkil > hai kyunki matrix $A$ saari variables ko mix kar deta hai. Matrix method ka pura jugaad yeh hai: aise > *special directions* dhundo jahan $A$ sirf scaling karta hai, mixing nahi. Yeh special directions hi > **eigenvectors** hain aur scaling factor **eigenvalue** $\lambda$. > > Process simple hai: pehle $\det(A-\lambda I)=0$ se eigenvalues nikaalo, phir har $\lambda$ ke liye > eigenvector $\mathbf v$ nikaalo. Tab har eigenpair ek solution deta hai $e^{\lambda t}\mathbf v$. Linearity > ki wajah se in sabko jod do (superposition) constants $c_i$ ke saath, aur initial condition se $c_i$ fix > karo. Bas, kaam khatam. > > Ek baat yaad rakho: agar $\lambda$ complex aaye ($\alpha\pm i\beta$), toh Euler formula se solution mein > $\cos\beta t$ aur $\sin\beta t$ aate hain — iska matlab trajectory ghoomti hai (spiral ya circle). $\alpha$ > batata hai growth/decay, $\beta$ batata hai rotation speed. Aur agar koi eigenvalue repeat ho par eigenvector > kam pad jaaye (defective case), toh ek extra solution mein $t$ ka factor lagta hai: $e^{\lambda t}(t\mathbf v+\mathbf w)$. > > Yeh method important kyun? Kyunki real-world systems — coupled springs, circuits, population models, > chemical reactions — sab isi form mein aate hain. Eigenvalues ke signs dekhke hi tum bina solve kiye bata > sakte ho system stable hai ya nahi (saare real parts negative ⇒ stable). Yeh 80/20 concept hai: thoda eigen-stuff > seekho, poora chapter samajh aa jaata hai. ![[audio/4.6.21-Systems-of-first-order-linear-ODEs-—-matrix-method.mp3]]Go deeper — visual, from zero
Test yourself — Ordinary Differential Equations
Connections
Eigenvalues and eigenvectorsAI-ML · 1.1.13Diagonalization — conditions, procedureMaths · 4.5.31Second-order linear ODEs — superposition principle, general theoryMaths · 4.6.9Euler's formula — e^(iθ) = cos θ + i sin θ (proof via Taylor series)Maths · 3.5.6Systems of ODEs — RK4 for systemsMaths · 4.8.27