Lab 24: Linear Algebra and Differential Equations
Lab goals
In this independent-study lab, you will use Python and an interactive visualization to study linear differential equations through linear algebra.
By the end, you should be able to:
- solve \(\mathbf x'=A\mathbf x\) using \(e^{At}\);
- compute eigenvalues and use them to classify stability;
- compare exact matrix exponential solutions with forward Euler approximations;
- simulate diffusion on a graph using a graph Laplacian;
- recognize how eigenvectors are the natural coordinates for differential equations.
Python practice notebook
Download and work through the notebook first:
The notebook contains worked examples, similar practice questions, and solutions. It is designed for independent study.
Interactive lab
After the notebook, use the interactive lab:
The interactive page lets you explore:
- a two-dimensional system \(\mathbf x'=A\mathbf x\);
- eigenvalues, trace, determinant, and stability;
- vector fields and trajectories;
- forward Euler time stepping;
- graph heat diffusion on a path graph.
Independent-study instructions
For each section, do the following:
- Read the short explanation.
- Run the Python code.
- Answer the practice question before opening the solution.
- Use the interactive page to test at least two additional examples.
- Write a short reflection connecting the computation to the theorem.
Problems to submit or discuss
Problem 1: Matrix exponential solution
Let
\[ A=\begin{bmatrix}2&1\\1&2\end{bmatrix}, \qquad \mathbf x_0=\begin{bmatrix}4\\2\end{bmatrix}. \]
Use eigenvectors to find \(\mathbf x(t)\).
Solution
The eigenpairs are
\[ \lambda_1=3, \quad \mathbf v_1=\begin{bmatrix}1\\1\end{bmatrix}, \qquad \lambda_2=1, \quad \mathbf v_2=\begin{bmatrix}1\\-1\end{bmatrix}. \]
Since
\[ \begin{bmatrix}4\\2\end{bmatrix} =3\begin{bmatrix}1\\1\end{bmatrix} +1\begin{bmatrix}1\\-1\end{bmatrix}, \]
we have
\[ \mathbf x(t)=3e^{3t}\begin{bmatrix}1\\1\end{bmatrix} +e^t\begin{bmatrix}1\\-1\end{bmatrix}. \]
Problem 2: Stability
Classify the equilibrium \(\mathbf 0\) for
\[ A=\begin{bmatrix}-1&-4\\1&-1\end{bmatrix}. \]
Solution
The characteristic polynomial is
\[ \lambda^2+2\lambda+5=0. \]
Thus
\[ \lambda=-1\pm2i. \]
The real parts are negative, so the equilibrium is asymptotically stable. The nonzero imaginary parts mean solutions spiral as they decay.
Problem 3: Jordan block
Compute \(e^{Jt}\) for
\[ J=\begin{bmatrix}3&1\\0&3\end{bmatrix}. \]
Solution
Write \(J=3I+N\), where
\[ N=\begin{bmatrix}0&1\\0&0\end{bmatrix} \]
and \(N^2=0\). Therefore
\[ e^{Jt}=e^{3t}(I+tN) =e^{3t}\begin{bmatrix}1&t\\0&1\end{bmatrix}. \]
Problem 4: Euler stability
For \(x'=-10x\), determine the range of \(h>0\) for which forward Euler decays.
Solution
Forward Euler gives
\[ x_{k+1}=(1-10h)x_k. \]
Decay requires
\[ |1-10h|<1. \]
Thus
\[ 0<h<\frac15. \]
Reflection questions
- Why does an eigenbasis make a system easier to solve?
- What does the sign of \(\operatorname{Re}(\lambda)\) tell you about long-time behavior?
- Why can Euler’s method be unstable even when the exact system is stable?
- In the graph heat equation, why does the final state become constant on a connected graph?
AI companion prompts
Try these prompts after completing your own work:
- “Explain the matrix exponential solution of \(\mathbf x'=A\mathbf x\) using a \(2\times2\) example.”
- “Give me a stable spiral matrix and explain its eigenvalues.”
- “Help me compare forward Euler with the exact matrix exponential for a stiff system.”
- “Explain graph heat diffusion using eigenvectors of the Laplacian.”