% =============================================================================
% ch08_systems.tex
% Chapter 8: Systems of Linear ODEs
% =============================================================================

\section{Systems of Linear ODEs}
\label{ch:systems}

Many physical systems are naturally modeled by coupled first-order differential equations rather than a single higher-order equation. The systematic study of such systems relies on linear algebra --- in particular, eigenvalues and eigenvectors --- to produce closed-form solutions.

\subsection{Matrix Form of Linear Systems}
\label{sec:ch08_matrix_form}

A \textbf{system of $n$ first-order linear ODEs with constant coefficients} can be written in compact matrix notation as
\begin{equation}
  \label{eq:system_matrix}
  \mathbf{x}'(t) = A\,\mathbf{x}(t),
\end{equation}
where $\mathbf{x}(t) \in \R^n$ is the vector of unknown functions and $A$ is a constant $n \times n$ matrix.

\paragraph{Converting an $n$th-order ODE to a first-order system.}
Any linear $n$th-order equation
\[
  y^{(n)} + a_{n-1}\,y^{(n-1)} + \cdots + a_1\,y' + a_0\,y = 0
\]
can be converted to a system of $n$ first-order equations by introducing the state variables
\[
  x_1 = y,\quad x_2 = y',\quad x_3 = y'',\quad \ldots,\quad x_n = y^{(n-1)}.
\]
Differentiating each and using the original ODE to substitute for the highest derivative yields
\[
  \begin{pmatrix} x_1' \\ x_2' \\ \vdots \\ x_n' \end{pmatrix}
  =
  \begin{pmatrix}
    0 & 1 & 0 & \cdots & 0 \\
    0 & 0 & 1 & \cdots & 0 \\
    \vdots & \vdots & \vdots & \ddots & \vdots \\
    0 & 0 & 0 & \cdots & 1 \\
    -a_0 & -a_1 & -a_2 & \cdots & -a_{n-1}
  \end{pmatrix}
  \begin{pmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{pmatrix}.
\]
This is the \textbf{companion matrix} form.

\begin{workedexample}
  Convert the third-order equation $y''' + 4y'' + 3y' - 2y = 0$ into a $3 \times 3$ first-order system.

  \textbf{Solution.} Define
  \[
    x_1 = y,\qquad x_2 = y',\qquad x_3 = y''.
  \]
  Then $x_1' = x_2$, $x_2' = x_3$, and from the ODE,
  \[
    x_3' = y''' = -4y'' - 3y' + 2y = -4x_3 - 3x_2 + 2x_1.
  \]
  In matrix form:
  \[
    \begin{pmatrix} x_1' \\ x_2' \\ x_3' \end{pmatrix}
    =
    \begin{pmatrix}
      0 & 1 & 0 \\
      0 & 0 & 1 \\
      2 & -3 & -4
    \end{pmatrix}
    \begin{pmatrix} x_1 \\ x_2 \\ x_3 \end{pmatrix}.
  \]
\end{workedexample}

\begin{workedexample}
  Convert $y'' + 3y' + 2y = 0$ to system form.

  \textbf{Solution.} Set $x_1 = y$, $x_2 = y'$. Then
  \[
    x_1' = x_2, \qquad x_2' = y'' = -3y' - 2y = -3x_2 - 2x_1.
  \]
  The system is
  \[
    \begin{pmatrix} x_1' \\ x_2' \end{pmatrix}
    =
    \begin{pmatrix} 0 & 1 \\ -2 & -3 \end{pmatrix}
    \begin{pmatrix} x_1 \\ x_2 \end{pmatrix}.
  \]
  Notice that the characteristic polynomial of the matrix,
  $\det(A - \lambda I) = \lambda^2 + 3\lambda + 2$, matches the original characteristic equation exactly.
\end{workedexample}

\subsection{Eigenvalue Method: Real Distinct Eigenvalues}
\label{sec:ch08_real_distinct}

The eigenvalue method is the principal tool for solving $\mathbf{x}' = A\mathbf{x}$ when $A$ is a constant matrix. The key idea is that eigenvectors of $A$ generate single-mode solutions of the form $e^{\lambda t}\mathbf{v}$.

\paragraph{Eigenvalue-eigenvector ansatz.}
If $\lambda$ is an eigenvalue of $A$ and $\mathbf{v}$ is a corresponding eigenvector ($A\mathbf{v} = \lambda\mathbf{v}$), then
\[
  \mathbf{x}(t) = e^{\lambda t}\mathbf{v}
\]
is a solution of $\mathbf{x}' = A\mathbf{x}$, since
\[
  \frac{d}{dt}\bigl(e^{\lambda t}\mathbf{v}\bigr) = \lambda e^{\lambda t}\mathbf{v}
  = e^{\lambda t}(A\mathbf{v}) = A\bigl(e^{\lambda t}\mathbf{v}\bigr).
\]

\begin{keyresult}
  \textbf{Real distinct eigenvalues.}
  If the $n \times n$ matrix $A$ has $n$ distinct real eigenvalues
  $\lambda_1, \ldots, \lambda_n$ with corresponding eigenvectors
  $\mathbf{v}_1, \ldots, \mathbf{v}_n$, then the general solution of
  $\mathbf{x}' = A\mathbf{x}$ is
  \[
    \mathbf{x}(t) = c_1 e^{\lambda_1 t}\mathbf{v}_1 + c_2 e^{\lambda_2 t}\mathbf{v}_2 + \cdots + c_n e^{\lambda_n t}\mathbf{v}_n,
  \]
  where $c_1, \ldots, c_n \in \R$ are arbitrary constants.
\end{keyresult}

\paragraph{Finding eigenvalues and eigenvectors.}
The eigenvalues are roots of the \textbf{characteristic polynomial} $\det(A - \lambda I) = 0$. For a $2 \times 2$ matrix
\[
  A = \begin{pmatrix} a & b \\ c & d \end{pmatrix},
\]
the characteristic equation is $\lambda^2 - (a+d)\lambda + (ad-bc) = 0$, or equivalently
\[
  \lambda^2 - \tr(A)\,\lambda + \det(A) = 0.
\]

For each eigenvalue $\lambda$, the eigenvectors are nonzero solutions of $(A - \lambda I)\mathbf{v} = \mathbf{0}$.

\begin{workedexample}
  Solve the system
  \[
    \begin{pmatrix} x' \\ y' \end{pmatrix}
    =
    \begin{pmatrix} 1 & 2 \\ 3 & 2 \end{pmatrix}
    \begin{pmatrix} x \\ y \end{pmatrix}.
  \]

  \textbf{Step 1: Eigenvalues.}
  \[
    \det\!\begin{pmatrix} 1-\lambda & 2 \\ 3 & 2-\lambda \end{pmatrix}
    = (1-\lambda)(2-\lambda) - 6
    = \lambda^2 - 3\lambda - 4 = 0.
  \]
  Factoring: $(\lambda - 4)(\lambda + 1) = 0$, so $\lambda_1 = 4$ and $\lambda_2 = -1$.

  \textbf{Step 2: Eigenvector for $\lambda_1 = 4$.}
  Solve $(A - 4I)\mathbf{v} = \mathbf{0}$:
  \[
    \begin{pmatrix} -3 & 2 \\ 3 & -2 \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix}.
  \]
  The first row gives $-3v_1 + 2v_2 = 0$, so $v_2 = \frac{3}{2}v_1$. Choosing $v_1 = 2$ gives $\mathbf{v}_1 = \begin{pmatrix} 2 \\ 3 \end{pmatrix}$.

  \textbf{Step 3: Eigenvector for $\lambda_2 = -1$.}
  Solve $(A + I)\mathbf{v} = \mathbf{0}$:
  \[
    \begin{pmatrix} 2 & 2 \\ 3 & 3 \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix}.
  \]
  The first row gives $2v_1 + 2v_2 = 0$, so $v_2 = -v_1$. Choosing $v_1 = 1$ gives $\mathbf{v}_2 = \begin{pmatrix} 1 \\ -1 \end{pmatrix}$.

  \textbf{Step 4: General solution.}
  \[
    \begin{pmatrix} x(t) \\ y(t) \end{pmatrix}
    = c_1 e^{4t} \begin{pmatrix} 2 \\ 3 \end{pmatrix}
      + c_2 e^{-t} \begin{pmatrix} 1 \\ -1 \end{pmatrix}.
  \]
  In components:
  \[
    x(t) = 2c_1 e^{4t} + c_2 e^{-t}, \qquad
    y(t) = 3c_1 e^{4t} - c_2 e^{-t}.
  \]
\end{workedexample}

\begin{workedexample}
  Solve
  \[
    \begin{pmatrix} x' \\ y' \end{pmatrix}
    =
    \begin{pmatrix} 4 & 1 \\ 2 & 3 \end{pmatrix}
    \begin{pmatrix} x \\ y \end{pmatrix}.
  \]

  \textbf{Step 1: Eigenvalues.}
  \[
    \det\!\begin{pmatrix} 4-\lambda & 1 \\ 2 & 3-\lambda \end{pmatrix}
    = (4-\lambda)(3-\lambda) - 2
    = \lambda^2 - 7\lambda + 10 = 0.
  \]
  Factoring: $(\lambda - 5)(\lambda - 2) = 0$, so $\lambda_1 = 5$ and $\lambda_2 = 2$.

  \textbf{Step 2: Eigenvector for $\lambda_1 = 5$.}
  \[
    (A - 5I)\mathbf{v} = \mathbf{0}
    \quad\Longrightarrow\quad
    \begin{pmatrix} -1 & 1 \\ 2 & -2 \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix}.
  \]
  From the first row: $-v_1 + v_2 = 0$, so $v_2 = v_1$. Choose $\mathbf{v}_1 = \begin{pmatrix} 1 \\ 1 \end{pmatrix}$.

  \textbf{Step 3: Eigenvector for $\lambda_2 = 2$.}
  \[
    (A - 2I)\mathbf{v} = \mathbf{0}
    \quad\Longrightarrow\quad
    \begin{pmatrix} 2 & 1 \\ 2 & 1 \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix}.
  \]
  From the first row: $2v_1 + v_2 = 0$, so $v_2 = -2v_1$. Choose $\mathbf{v}_2 = \begin{pmatrix} 1 \\ -2 \end{pmatrix}$.

  \textbf{Step 4: General solution.}
  \[
    \begin{pmatrix} x(t) \\ y(t) \end{pmatrix}
    = c_1 e^{5t} \begin{pmatrix} 1 \\ 1 \end{pmatrix}
      + c_2 e^{2t} \begin{pmatrix} 1 \\ -2 \end{pmatrix}.
  \]
\end{workedexample}

\subsection{Eigenvalue Method: Complex Eigenvalues}
\label{sec:ch08_complex}

When $A$ is a real matrix, complex eigenvalues always occur in conjugate pairs $\lambda = \alpha \pm i\beta$ (with $\beta \neq 0$). The corresponding eigenvectors also come in conjugate pairs.

\paragraph{From complex to real-valued solutions.}
Let $\lambda = \alpha + i\beta$ be a complex eigenvalue of $A$ with eigenvector $\mathbf{w} = \mathbf{a} + i\mathbf{b}$, where $\mathbf{a}, \mathbf{b} \in \R^2$. The complex-valued solution is
\[
  \mathbf{x}_c(t) = e^{(\alpha + i\beta)t}(\mathbf{a} + i\mathbf{b}).
\]
By Euler's formula:
\begin{align*}
  \mathbf{x}_c(t)
  &= e^{\alpha t}\bigl[\cos(\beta t) + i\sin(\beta t)\bigr](\mathbf{a} + i\mathbf{b}) \\
  &= e^{\alpha t}\Bigl[\bigl(\mathbf{a}\cos(\beta t) - \mathbf{b}\sin(\beta t)\bigr)
     + i\bigl(\mathbf{a}\sin(\beta t) + \mathbf{b}\cos(\beta t)\bigr)\Bigr].
\end{align*}
Since the original system has real coefficients, both the real and imaginary parts are real-valued solutions:
\[
  \mathbf{x}_1(t) = e^{\alpha t}\bigl[\mathbf{a}\cos(\beta t) - \mathbf{b}\sin(\beta t)\bigr],
  \qquad
  \mathbf{x}_2(t) = e^{\alpha t}\bigl[\mathbf{a}\sin(\beta t) + \mathbf{b}\cos(\beta t)\bigr].
\]

\begin{keyresult}
  \textbf{Complex eigenvalues.}
  Let $A$ be a real $2 \times 2$ matrix with eigenvalues $\lambda = \alpha \pm i\beta$ ($\beta > 0$) and corresponding eigenvector
  $\mathbf{w} = \mathbf{a} + i\mathbf{b}$ (where $\mathbf{a}, \mathbf{b} \in \R^2$).
  Then two linearly independent real-valued solutions are
  \[
    \begin{aligned}
      \mathbf{x}_1(t) &= e^{\alpha t}\bigl[\mathbf{a}\cos(\beta t) - \mathbf{b}\sin(\beta t)\bigr], \\
      \mathbf{x}_2(t) &= e^{\alpha t}\bigl[\mathbf{a}\sin(\beta t) + \mathbf{b}\cos(\beta t)\bigr].
    \end{aligned}
  \]
  The general real-valued solution is $\mathbf{x}(t) = c_1 \mathbf{x}_1(t) + c_2 \mathbf{x}_2(t)$.
\end{keyresult}

\begin{remark}
  The sign of $\alpha$ determines whether solutions spiral inward ($\alpha < 0$, stable spiral), spiral outward ($\alpha > 0$, unstable spiral), or trace closed orbits ($\alpha = 0$, center).
\end{remark}

\begin{workedexample}
  Solve
  \[
    \begin{pmatrix} x' \\ y' \end{pmatrix}
    =
    \begin{pmatrix} 0 & -2 \\ 2 & 0 \end{pmatrix}
    \begin{pmatrix} x \\ y \end{pmatrix}.
  \]

  \textbf{Step 1: Eigenvalues.}
  \[
    \det\!\begin{pmatrix} -\lambda & -2 \\ 2 & -\lambda \end{pmatrix}
    = \lambda^2 + 4 = 0,
    \quad\text{so}\quad \lambda = \pm 2i.
  \]
  Here $\alpha = 0$ and $\beta = 2$.

  \textbf{Step 2: Eigenvector for $\lambda = 2i$.}
  Solve $(A - 2iI)\mathbf{v} = \mathbf{0}$:
  \[
    \begin{pmatrix} -2i & -2 \\ 2 & -2i \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix}.
  \]
  From the first row: $-2i\,v_1 - 2\,v_2 = 0$, so $v_2 = -i\,v_1$. Choose $v_1 = 1$, giving
  \[
    \mathbf{w} = \begin{pmatrix} 1 \\ -i \end{pmatrix}
    = \begin{pmatrix} 1 \\ 0 \end{pmatrix} + i\begin{pmatrix} 0 \\ -1 \end{pmatrix}
    = \mathbf{a} + i\mathbf{b},
  \]
  where $\mathbf{a} = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$ and $\mathbf{b} = \begin{pmatrix} 0 \\ -1 \end{pmatrix}$.

  \textbf{Step 3: Real-valued solutions.}
  Since $\alpha = 0$ and $\beta = 2$:
  \[
    \begin{aligned}
      \mathbf{x}_1(t) &= \mathbf{a}\cos(2t) - \mathbf{b}\sin(2t)
        = \begin{pmatrix} 1 \\ 0 \end{pmatrix}\cos(2t) - \begin{pmatrix} 0 \\ -1 \end{pmatrix}\sin(2t)
        = \begin{pmatrix} \cos(2t) \\ \sin(2t) \end{pmatrix}, \\[8pt]
      \mathbf{x}_2(t) &= \mathbf{a}\sin(2t) + \mathbf{b}\cos(2t)
        = \begin{pmatrix} 1 \\ 0 \end{pmatrix}\sin(2t) + \begin{pmatrix} 0 \\ -1 \end{pmatrix}\cos(2t)
        = \begin{pmatrix} \sin(2t) \\ -\cos(2t) \end{pmatrix}.
    \end{aligned}
  \]

  \textbf{Step 4: General solution.}
  \[
    \begin{pmatrix} x(t) \\ y(t) \end{pmatrix}
    = c_1 \begin{pmatrix} \cos(2t) \\ \sin(2t) \end{pmatrix}
      + c_2 \begin{pmatrix} \sin(2t) \\ -\cos(2t) \end{pmatrix}.
  \]

  \textbf{Phase plane interpretation.} Eliminating $t$: for any nonzero constants $c_1, c_2$,
  $x(t)^2 + y(t)^2 = c_1^2 + c_2^2 = \text{constant}$. Trajectories are circles centered at the origin, traversed counterclockwise. This is a \textbf{center} --- neutrally stable closed orbits.
\end{workedexample}

\begin{workedexample}
  Solve
  \[
    \begin{pmatrix} x' \\ y' \end{pmatrix}
    =
    \begin{pmatrix} -1 & 2 \\ -2 & -1 \end{pmatrix}
    \begin{pmatrix} x \\ y \end{pmatrix}.
  \]

  \textbf{Step 1: Eigenvalues.}
  \[
    \det\!\begin{pmatrix} -1-\lambda & 2 \\ -2 & -1-\lambda \end{pmatrix}
    = (-1-\lambda)^2 + 4
    = \lambda^2 + 2\lambda + 5 = 0.
  \]
  The roots are $\lambda = \dfrac{-2 \pm \sqrt{4-20}}{2} = -1 \pm 2i$.
  So $\alpha = -1$ and $\beta = 2$.

  \textbf{Step 2: Eigenvector for $\lambda = -1 + 2i$.}
  \[
    (A - (-1+2i)I)\mathbf{v} = \mathbf{0}
    \quad\Longrightarrow\quad
    \begin{pmatrix} -2i & 2 \\ -2 & -2i \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix}.
  \]
  From the first row: $-2i\,v_1 + 2\,v_2 = 0$, so $v_2 = i\,v_1$. Choose $v_1 = 1$, giving
  \[
    \mathbf{w} = \begin{pmatrix} 1 \\ i \end{pmatrix}
    = \begin{pmatrix} 1 \\ 0 \end{pmatrix} + i\begin{pmatrix} 0 \\ 1 \end{pmatrix}
    = \mathbf{a} + i\mathbf{b}.
  \]

  \textbf{Step 3: Real-valued solutions.}
  \[
    \begin{aligned}
      \mathbf{x}_1(t) &= e^{-t}\Bigl[\begin{pmatrix} 1 \\ 0 \end{pmatrix}\cos(2t)
        - \begin{pmatrix} 0 \\ 1 \end{pmatrix}\sin(2t)\Bigr]
        = e^{-t}\begin{pmatrix} \cos(2t) \\ -\sin(2t) \end{pmatrix}, \\[8pt]
      \mathbf{x}_2(t) &= e^{-t}\Bigl[\begin{pmatrix} 1 \\ 0 \end{pmatrix}\sin(2t)
        + \begin{pmatrix} 0 \\ 1 \end{pmatrix}\cos(2t)\Bigr]
        = e^{-t}\begin{pmatrix} \sin(2t) \\ \cos(2t) \end{pmatrix}.
    \end{aligned}
  \]

  \textbf{Step 4: General solution.}
  \[
    \begin{pmatrix} x(t) \\ y(t) \end{pmatrix}
    = e^{-t}\Bigl[
        c_1 \begin{pmatrix} \cos(2t) \\ -\sin(2t) \end{pmatrix}
        + c_2 \begin{pmatrix} \sin(2t) \\ \cos(2t) \end{pmatrix}
      \Bigr].
  \]

  \textbf{Phase plane interpretation.} The factor $e^{-t}$ causes all trajectories to spiral inward toward the origin. This is a \textbf{stable (sink) spiral}.
\end{workedexample}

\subsection{Eigenvalue Method: Repeated Eigenvalues}
\label{sec:ch08_repeated}

A repeated eigenvalue creates a subtlety: if $A$ has only one linearly independent eigenvector for a double eigenvalue $\lambda$, the matrix is called \textbf{defective} and we cannot form two independent solutions using just $e^{\lambda t}\mathbf{v}$. Instead, we need a \textbf{generalized eigenvector}.

\paragraph{Generalized eigenvectors.}
Suppose $A$ has a repeated eigenvalue $\lambda$ with only one eigenvector $\mathbf{v}_1$ satisfying $(A - \lambda I)\mathbf{v}_1 = \mathbf{0}$. We find a \textbf{generalized eigenvector} $\mathbf{v}_2$ by solving
\begin{equation}
  \label{eq:generalized_eigen}
  (A - \lambda I)\mathbf{v}_2 = \mathbf{v}_1.
\end{equation}
The two linearly independent solutions are
\[
  \mathbf{x}_1(t) = \mathbf{v}_1 e^{\lambda t},
  \qquad
  \mathbf{x}_2(t) = \bigl(\mathbf{v}_2 + \mathbf{v}_1\,t\bigr)e^{\lambda t}.
\]

\begin{keyresult}
  \textbf{Repeated eigenvalue with one eigenvector (defective case).}
  If $A$ has a double eigenvalue $\lambda$ and a single eigenvector $\mathbf{v}_1$, let $\mathbf{v}_2$ satisfy \cref{eq:generalized_eigen}. The general solution of $\mathbf{x}' = A\mathbf{x}$ is
  \[
    \mathbf{x}(t) = c_1 \mathbf{v}_1 e^{\lambda t} + c_2 \bigl(\mathbf{v}_2 + \mathbf{v}_1\,t\bigr)e^{\lambda t}.
  \]
\end{keyresult}

\begin{remark}
  If $A$ has a repeated eigenvalue but \emph{two} linearly independent eigenvectors (which occurs only when $A = \lambda I$), the solution is the same as the distinct case: $\mathbf{x}(t) = (c_1 \mathbf{v}_1 + c_2 \mathbf{v}_2)e^{\lambda t}$.
\end{remark}

\begin{workedexample}
  Solve
  \[
    \begin{pmatrix} x' \\ y' \end{pmatrix}
    =
    \begin{pmatrix} 3 & 1 \\ 0 & 3 \end{pmatrix}
    \begin{pmatrix} x \\ y \end{pmatrix}.
  \]

  \textbf{Step 1: Eigenvalues.} Since $A$ is upper triangular, the eigenvalues are the diagonal entries: $\lambda = 3$ (double root).

  \textbf{Step 2: Eigenvector.} Solve $(A - 3I)\mathbf{v} = \mathbf{0}$:
  \[
    \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix}.
  \]
  The first row gives $v_2 = 0$. The free variable $v_1$ gives $\mathbf{v}_1 = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$.
  Only one eigenvector, so $A$ is defective.

  \textbf{Step 3: Generalized eigenvector.} Solve $(A - 3I)\mathbf{v}_2 = \mathbf{v}_1$:
  \[
    \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix}
    \begin{pmatrix} u_1 \\ u_2 \end{pmatrix}
    =
    \begin{pmatrix} 1 \\ 0 \end{pmatrix}.
  \]
  The first row gives $u_2 = 1$. The second row gives $0 = 0$, so $u_1$ is free. Choose $u_1 = 0$, giving $\mathbf{v}_2 = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$.

  \textbf{Step 4: General solution.}
  \[
    \begin{aligned}
      \mathbf{x}_1(t) &= \begin{pmatrix} 1 \\ 0 \end{pmatrix}e^{3t}, \\
      \mathbf{x}_2(t) &= \left[\begin{pmatrix} 0 \\ 1 \end{pmatrix} + t\begin{pmatrix} 1 \\ 0 \end{pmatrix}\right]e^{3t}
        = \begin{pmatrix} t \\ 1 \end{pmatrix}e^{3t}.
    \end{aligned}
  \]
  Therefore
  \[
    \begin{pmatrix} x(t) \\ y(t) \end{pmatrix}
    = c_1 \begin{pmatrix} 1 \\ 0 \end{pmatrix}e^{3t}
      + c_2 \begin{pmatrix} t \\ 1 \end{pmatrix}e^{3t}
    = e^{3t}\begin{pmatrix} c_1 + c_2 t \\ c_2 \end{pmatrix}.
  \]
\end{workedexample}

\begin{workedexample}
  Solve
  \[
    \begin{pmatrix} x' \\ y' \end{pmatrix}
    =
    \begin{pmatrix} -2 & 1 \\ -1 & 0 \end{pmatrix}
    \begin{pmatrix} x \\ y \end{pmatrix}.
  \]

  \textbf{Step 1: Eigenvalues.}
  \[
    \det\!\begin{pmatrix} -2-\lambda & 1 \\ -1 & -\lambda \end{pmatrix}
    = (-2-\lambda)(-\lambda) + 1
    = \lambda^2 + 2\lambda + 1 = (\lambda + 1)^2 = 0.
  \]
  Double eigenvalue: $\lambda = -1$.

  \textbf{Step 2: Eigenvector.} Solve $(A + I)\mathbf{v} = \mathbf{0}$:
  \[
    \begin{pmatrix} -1 & 1 \\ -1 & 1 \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix}.
  \]
  From $-v_1 + v_2 = 0$: choose $\mathbf{v}_1 = \begin{pmatrix} 1 \\ 1 \end{pmatrix}$.

  \textbf{Step 3: Generalized eigenvector.} Solve $(A + I)\mathbf{v}_2 = \mathbf{v}_1$:
  \[
    \begin{pmatrix} -1 & 1 \\ -1 & 1 \end{pmatrix}
    \begin{pmatrix} u_1 \\ u_2 \end{pmatrix}
    =
    \begin{pmatrix} 1 \\ 1 \end{pmatrix}.
  \]
  From $-u_1 + u_2 = 1$, choose $u_1 = 0$, giving $u_2 = 1$. So $\mathbf{v}_2 = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$.

  \textbf{Step 4: General solution.}
  \[
    \begin{aligned}
      \mathbf{x}_1(t) &= \begin{pmatrix} 1 \\ 1 \end{pmatrix}e^{-t}, \\
      \mathbf{x}_2(t) &= \left[\begin{pmatrix} 0 \\ 1 \end{pmatrix} + t\begin{pmatrix} 1 \\ 1 \end{pmatrix}\right]e^{-t}
        = \begin{pmatrix} t \\ 1+t \end{pmatrix}e^{-t}.
    \end{aligned}
  \]
  The general solution is
  \[
    \begin{pmatrix} x(t) \\ y(t) \end{pmatrix}
    = c_1 \begin{pmatrix} 1 \\ 1 \end{pmatrix}e^{-t}
      + c_2 \begin{pmatrix} t \\ 1+t \end{pmatrix}e^{-t}.
  \]
  All trajectories decay to the origin as $t \to \infty$ (since $\lambda = -1 < 0$), but with the additional polynomial factor $t$ in the second component.
\end{workedexample}

\subsection{Phase Plane Analysis}
\label{sec:ch08_phase_plane}

For $2 \times 2$ systems $\mathbf{x}' = A\mathbf{x}$, the qualitative behavior of solutions near the equilibrium $\mathbf{x} = \mathbf{0}$ is determined entirely by the eigenvalues of $A$. The \textbf{phase plane} --- a plot of trajectories in the $(x_1, x_2)$-plane --- reveals the system's dynamics.

\paragraph{Six equilibrium classifications.}

\begin{keyresult}
  \textbf{Phase plane classification for $2 \times 2$ systems $\mathbf{x}' = A\mathbf{x}$.}

  \begin{center}
  \begin{tabular}{l l}
    \toprule
    \textbf{Eigenvalues} & \textbf{Classification} \\
    \midrule
    Real, both positive & Unstable node (source) --- trajectories leave $\mathbf{0}$ \\[4pt]
    Real, both negative & Stable node (sink) --- trajectories enter $\mathbf{0}$ \\[4pt]
    Real, opposite signs & Saddle point --- trajectories approach along one eigenvector, depart along the other \\[4pt]
    Purely imaginary $\pm i\beta$ & Center --- closed orbits (ellipses) around $\mathbf{0}$ \\[4pt]
    Complex, $\Re(\lambda) > 0$ & Unstable spiral --- trajectories spiral outward \\[4pt]
    Complex, $\Re(\lambda) < 0$ & Stable spiral --- trajectories spiral inward \\
    \bottomrule
  \end{tabular}
  \end{center}
\end{keyresult}

\paragraph{Reading trajectories from eigenvectors.}
For real eigenvalues, the eigenvectors define \textbf{invariant lines} through the origin. Trajectories on these lines are straight, while all other trajectories are curves that become tangent to the \textbf{slow eigenvector} (the eigenvector associated with the eigenvalue closest to zero) as $t \to \infty$.

\subsubsection{Saddle Point}

\begin{center}
\begin{tikzpicture}[scale=1.0]
  % Axes
  \draw[->, thick] (-3.2,0) -- (3.2,0) node[right] {$x$};
  \draw[->, thick] (0,-3.2) -- (0,3.2) node[above] {$y$};

  % Eigenvector lines (dashed)
  \draw[dashed, thick, blue!60] (-2,-6) -- (2,6);
  \draw[dashed, thick, red!60] (-3,1.5) -- (3,-1.5);

  % Eigenvector arrows
  \draw[-{Latex[length=3mm]}, thick, blue] (0,0) -- (0.6,1.8);
  \draw[-{Latex[length=3mm]}, thick, blue] (0,0) -- (-0.6,-1.8);
  \draw[-{Latex[length=3mm]}, thick, red] (0,0) -- (1.5,-0.75);
  \draw[-{Latex[length=3mm]}, thick, red] (0,0) -- (-1.5,0.75);

  % Trajectories approaching along stable manifold
  \draw[thick, purple!70, ->] (-2.5,1.25) .. controls (-1,0.5) and (-0.5,0.2) .. (-0.15,0.075);
  \draw[thick, purple!70, ->] (2.5,-1.25) .. controls (1,-0.5) and (0.5,-0.2) .. (0.15,-0.075);
  \draw[thick, purple!70, ->] (-3,1.5) .. controls (-1.5,0.7) and (-0.5,0.25) .. (-0.2,0.1);
  \draw[thick, purple!70, ->] (3,-1.5) .. controls (1.5,-0.7) and (0.5,-0.25) .. (0.2,-0.1);

  % Trajectories departing along unstable manifold
  \draw[thick, orange!70, ->] (0.15,0.45) .. controls (0.6,1.5) and (1,2.5) .. (1.2,3.2);
  \draw[thick, orange!70, ->] (-0.15,-0.45) .. controls (-0.6,-1.5) and (-1,-2.5) .. (-1.2,-3.2);

  % General hyperbolic trajectories
  \draw[thick, ->, opacity=0.55] (-2,2.5) .. controls (-0.5,0.1) and (0.5,-0.3) .. (2.5,-1.5);
  \draw[thick, ->, opacity=0.55] (-2,-2.5) .. controls (-0.5,-0.1) and (0.5,0.3) .. (2.5,1.5);
  \draw[thick, ->, opacity=0.55] (2,2.5) .. controls (0.5,0.3) and (-0.5,-0.1) .. (-2.5,-1.5);
  \draw[thick, ->, opacity=0.55] (2,-2.5) .. controls (0.5,-0.3) and (-0.5,0.1) .. (-2.5,1.5);

  % Equilibrium point
  \filldraw[black] (0,0) circle (2pt) node[below left=1pt] {$\mathbf{0}$};

  % Label
  \node[font=\footnotesize, align=center] at (2.5,2.7) {Saddle point\\$(\lambda_1 > 0 > \lambda_2)$};
\end{tikzpicture}
\end{center}

\paragraph{Saddle for $A = \begin{pmatrix} 1 & 2 \\ 3 & 2 \end{pmatrix}$.}
From \cref{sec:ch08_real_distinct}, $\lambda_1 = 4$ (unstable) with $\mathbf{v}_1 = (2,3)^\top$, and $\lambda_2 = -1$ (stable) with $\mathbf{v}_2 = (1,-1)^\top$. The diagram above shows the generic saddle pattern: trajectories converge along the stable manifold (dashed red, direction of $\mathbf{v}_2$) and diverge along the unstable manifold (dashed blue, direction of $\mathbf{v}_1$).

\subsubsection{Stable Node (Sink)}

\begin{center}
\begin{tikzpicture}[scale=1.0]
  % Axes
  \draw[->, thick] (-3.2,0) -- (3.2,0) node[right] {$x$};
  \draw[->, thick] (0,-3.2) -- (0,3.2) node[above] {$y$};

  % Eigenvector lines (dashed)
  \draw[dashed, thick, blue!50] (-0.6,-1.8) -- (0.6,1.8);
  \draw[dashed, thick, red!50] (-2,-1) -- (2,1);

  % Trajectories (all inward)
  % Tangent to slower eigenvector (less negative eigenvalue) as t -> inf
  \draw[thick, ->] (2.5,3) .. controls (1.5,1.8) and (0.6,0.7) .. (0.1,0.04);
  \draw[thick, ->] (2.5,-3) .. controls (1.5,-1.8) and (0.6,-0.7) .. (0.1,-0.04);
  \draw[thick, ->] (-2.5,3) .. controls (-1.5,1.8) and (-0.6,0.7) .. (-0.1,0.04);
  \draw[thick, ->] (-2.5,-3) .. controls (-1.5,-1.8) and (-0.6,-0.7) .. (-0.1,-0.04);

  \draw[thick, ->] (3,0.5) .. controls (1.8,0.2) and (0.5,0.05) .. (0.1,0.005);
  \draw[thick, ->] (-3,0.5) .. controls (-1.8,0.2) and (-0.5,0.05) .. (-0.1,0.005);
  \draw[thick, ->] (3,-0.5) .. controls (1.8,-0.2) and (0.5,-0.05) .. (0.1,-0.005);
  \draw[thick, ->] (-3,-0.5) .. controls (-1.8,-0.2) and (-0.5,-0.05) .. (-0.1,-0.005);

  \draw[thick, ->] (0,3) .. controls (0.1,1.5) and (0.02,0.3) .. (0.005,0.05);
  \draw[thick, ->] (0,-3) .. controls (-0.1,-1.5) and (-0.02,-0.3) .. (-0.005,-0.05);

  % Equilibrium point
  \filldraw[black] (0,0) circle (2pt) node[below left=1pt] {$\mathbf{0}$};

  % Label
  \node[font=\footnotesize, align=center] at (2.5,2.7) {Stable node (sink)\\$(\lambda_1 < \lambda_2 < 0)$};
\end{tikzpicture}
\end{center}

All trajectories converge to the origin. Far from the origin, trajectories approach tangent to the eigenvector associated with the eigenvalue closer to zero (the ``slow'' direction).

\subsubsection{Stable Spiral (Sink Spiral)}

\begin{center}
\begin{tikzpicture}[scale=1.0]
  % Axes
  \draw[->, thick] (-3.2,0) -- (3.2,0) node[right] {$x$};
  \draw[->, thick] (0,-3.2) -- (0,3.2) node[above] {$y$};

  % Spiral trajectory
  \draw[thick, purple!80] plot[domain=0:20, samples=200, smooth, variable=\t]
    ({0.15*\t*exp(-0.25*\t)*cos(1.2*\t)}, {0.15*\t*exp(-0.25*\t)*sin(1.2*\t)});

  % Arrows along the spiral
  \draw[thick, purple!80, ->] (2.5,0) -- (2.35,0.6);
  \draw[thick, purple!80, ->] (0.25,1.9) -- (-0.5,1.55);
  \draw[thick, purple!80, ->] (-2.1,-0.5) -- (-2.15,-1.1);
  \draw[thick, purple!80, ->] (0,-1.7) -- (0.6,-1.4);

  % Second spiral
  \draw[thick, orange!60] plot[domain=3:18, samples=200, smooth, variable=\t]
    ({0.25*\t*exp(-0.25*\t)*cos(1.2*\t + 1)}, {0.25*\t*exp(-0.25*\t)*sin(1.2*\t + 1)});

  % Equilibrium point
  \filldraw[black] (0,0) circle (2pt) node[below left=1pt] {$\mathbf{0}$};

  % Label
  \node[font=\footnotesize, align=center] at (2.3,2.7) {Stable spiral\\$(\alpha \pm i\beta,\;\alpha < 0)$};
\end{tikzpicture}
\end{center}

Trajectories spiral toward the origin. The number of complete rotations depends on the ratio $\beta / |\alpha|$ (frequency vs.\ decay rate).

\subsubsection{Center}

\begin{center}
\begin{tikzpicture}[scale=1.0]
  % Axes
  \draw[->, thick] (-3.2,0) -- (3.2,0) node[right] {$x$};
  \draw[->, thick] (0,-3.2) -- (0,3.2) node[above] {$y$};

  % Circular trajectories
  \draw[thick, blue!60] (0,0) circle (1.0);
  \draw[thick, blue!60] (0,0) circle (1.7);
  \draw[thick, blue!60] (0,0) circle (2.5);

  % Arrows on circles (counterclockwise)
  \draw[thick, blue!60, ->] (1.7,0) -- (1.6,0.55);
  \draw[thick, blue!60, ->] (1,0) -- (0.95,0.32);
  \draw[thick, blue!60, ->] (2.5,0) -- (2.4,0.8);
  \draw[thick, blue!60, ->] (0,1.7) -- (-0.55,1.6);
  \draw[thick, blue!60, ->] (0,1) -- (-0.32,0.95);
  \draw[thick, blue!60, ->] (0,2.5) -- (-0.8,2.4);

  % Equilibrium point
  \filldraw[black] (0,0) circle (2pt) node[below left=1pt] {$\mathbf{0}$};

  % Label
  \node[font=\footnotesize, align=center] at (2.2,2.7) {Center\\$(\lambda = \pm i\beta)$};
\end{tikzpicture}
\end{center}

Trajectories are closed orbits (circles or ellipses). The equilibrium is \textbf{Lyapunov stable} but not asymptotically stable: nearby solutions stay nearby but do not converge to the origin.

\subsubsection{Unstable Node (Source)}

\begin{center}
\begin{tikzpicture}[scale=1.0]
  % Axes
  \draw[->, thick] (-3.2,0) -- (3.2,0) node[right] {$x$};
  \draw[->, thick] (0,-3.2) -- (0,3.2) node[above] {$y$};

  % Eigenvector lines (dashed)
  \draw[dashed, thick, blue!50] (-0.6,-1.8) -- (0.6,1.8);
  \draw[dashed, thick, red!50] (-2,-1) -- (2,1);

  % Trajectories (all outward)
  \draw[thick, ->] (0.1,0.04) .. controls (0.6,0.7) and (1.5,1.8) .. (2.5,3);
  \draw[thick, ->] (0.1,-0.04) .. controls (0.6,-0.7) and (1.5,-1.8) .. (2.5,-3);
  \draw[thick, ->] (-0.1,0.04) .. controls (-0.6,0.7) and (-1.5,1.8) .. (-2.5,3);
  \draw[thick, ->] (-0.1,-0.04) .. controls (-0.6,-0.7) and (-1.5,-1.8) .. (-2.5,-3);

  \draw[thick, ->] (0.1,0.005) .. controls (0.5,0.05) and (1.8,0.2) .. (3,0.5);
  \draw[thick, ->] (-0.1,0.005) .. controls (-0.5,0.05) and (-1.8,0.2) .. (-3,0.5);
  \draw[thick, ->] (0.1,-0.005) .. controls (0.5,-0.05) and (1.8,-0.2) .. (3,-0.5);
  \draw[thick, ->] (-0.1,-0.005) .. controls (-0.5,-0.05) and (-1.8,-0.2) .. (-3,-0.5);

  \draw[thick, ->] (0.005,0.05) .. controls (0.02,0.3) and (0.1,1.5) .. (0,3);
  \draw[thick, ->] (-0.005,-0.05) .. controls (-0.02,-0.3) and (-0.1,-1.5) .. (0,-3);

  % Equilibrium point
  \filldraw[black] (0,0) circle (2pt) node[below left=1pt] {$\mathbf{0}$};

  % Label
  \node[font=\footnotesize, align=center] at (2.5,2.7) {Unstable node (source)\\$(\lambda_1 > \lambda_2 > 0)$};
\end{tikzpicture}
\end{center}

All trajectories diverge from the origin. Far from the origin, trajectories become tangent to the eigenvector associated with the larger eigenvalue (the ``fast'' direction).

\subsubsection{Unstable Spiral (Source Spiral)}

\begin{center}
\begin{tikzpicture}[scale=1.0]
  % Axes
  \draw[->, thick] (-3.2,0) -- (3.2,0) node[right] {$x$};
  \draw[->, thick] (0,-3.2) -- (0,3.2) node[above] {$y$};

  % Spiral trajectory (outward)
  \draw[thick, purple!80] plot[domain=-20:0, samples=200, smooth, variable=\t]
    ({0.15*\t*exp(0.25*\t)*cos(1.2*\t)}, {0.15*\t*exp(0.25*\t)*sin(1.2*\t)});

  % Arrows along the spiral (outward)
  \draw[thick, purple!80, ->] (0.5,-0.35) -- (1.1,-0.2);
  \draw[thick, purple!80, ->] (1.6,0.9) -- (2.0,1.5);
  \draw[thick, purple!80, ->] (-1.8,1.7) -- (-2.3,1.2);
  \draw[thick, purple!80, ->] (-1.0,-1.4) -- (-1.5,-1.9);

  % Second spiral
  \draw[thick, orange!60] plot[domain=-18:-3, samples=200, smooth, variable=\t]
    ({0.25*\t*exp(0.25*\t)*cos(1.2*\t + 1)}, {0.25*\t*exp(0.25*\t)*sin(1.2*\t + 1)});

  % Equilibrium point
  \filldraw[black] (0,0) circle (2pt) node[below left=1pt] {$\mathbf{0}$};

  % Label
  \node[font=\footnotesize, align=center] at (2.3,2.7) {Unstable spiral\\$(\alpha \pm i\beta,\;\alpha > 0)$};
\end{tikzpicture}
\end{center}

Trajectories spiral outward from the origin. The rate of divergence is governed by the real part $\alpha$ of the eigenvalues, while the frequency of rotation depends on $\beta$.

\subsubsection{Classifying Equilibria: Worked Examples}

\begin{workedexample}
  Classify the equilibrium of $\mathbf{x}' = \begin{pmatrix} 1 & 2 \\ 3 & 2 \end{pmatrix}\mathbf{x}$.

  \textbf{Solution.} We computed the eigenvalues in \cref{sec:ch08_real_distinct}: $\lambda_1 = 4 > 0$ and $\lambda_2 = -1 < 0$. Opposite signs $\implies$ \textbf{saddle point}. The unstable manifold is along $\mathbf{v}_1 = (2,3)^\top$ and the stable manifold along $\mathbf{v}_2 = (1,-1)^\top$.
\end{workedexample}

\begin{workedexample}
  Classify the equilibrium of $\mathbf{x}' = \begin{pmatrix} -2 & 1 \\ 0 & -3 \end{pmatrix}\mathbf{x}$.

  \textbf{Solution.} Since $A$ is upper triangular, the eigenvalues are the diagonal entries:
  $\lambda_1 = -2$ and $\lambda_2 = -3$. Both are negative $\implies$ \textbf{stable node (sink)}.

  \textbf{Eigenvectors.} For $\lambda_1 = -2$, solve $(A + 2I)\mathbf{v} = \mathbf{0}$:
  \[
    \begin{pmatrix} 0 & 1 \\ 0 & -1 \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix},
  \]
  giving $v_2 = 0$ and $\mathbf{v}_1 = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$ (fast eigendirection, along the $x$-axis).

  For $\lambda_2 = -3$, solve $(A + 3I)\mathbf{v} = \mathbf{0}$:
  \[
    \begin{pmatrix} 1 & 1 \\ 0 & 0 \end{pmatrix}
    \begin{pmatrix} v_1 \\ v_2 \end{pmatrix}
    =
    \begin{pmatrix} 0 \\ 0 \end{pmatrix},
  \]
  giving $v_1 + v_2 = 0$, so $\mathbf{v}_2 = \begin{pmatrix} 1 \\ -1 \end{pmatrix}$ (slow eigendirection).

  Since $\lvert\lambda_1\rvert > \lvert\lambda_2\rvert$, trajectories approach the origin tangent to the slow eigenvector $\mathbf{v}_2$.
\end{workedexample}

\subsection{Trace-Determinant Classification}
\label{sec:ch08_trace_det}

For a $2 \times 2$ matrix $A$, the eigenvalues are determined by two scalar quantities:
\[
  \tau = \tr(A) = \lambda_1 + \lambda_2,
  \qquad
  \Delta = \det(A) = \lambda_1 \lambda_2.
\]
The characteristic equation $\lambda^2 - \tau\lambda + \Delta = 0$ has discriminant
\[
  D = \tau^2 - 4\Delta.
\]
The sign of $D$ determines whether the eigenvalues are real ($D > 0$) or complex ($D < 0$).

\begin{keyresult}
  \textbf{Trace-determinant classification.}
  The equilibrium $\mathbf{0}$ of $\mathbf{x}' = A\mathbf{x}$ is classified by the position of $(\tau, \Delta)$ in the trace-determinant plane:

  \begin{center}
  \begin{tabular}{l l l}
    \toprule
    \textbf{Region} & \textbf{Conditions} & \textbf{Classification} \\
    \midrule
    $\Delta < 0$ & (below $\tau$-axis) & Saddle \\[4pt]
    $\Delta > 0$, $\tau > 0$, $\tau^2 > 4\Delta$ & (above parabola, right of $\Delta$-axis) & Unstable node \\[4pt]
    $\Delta > 0$, $\tau < 0$, $\tau^2 > 4\Delta$ & (above parabola, left of $\Delta$-axis) & Stable node \\[4pt]
    $\Delta > 0$, $\tau > 0$, $\tau^2 < 4\Delta$ & (below parabola, right of $\Delta$-axis) & Unstable spiral \\[4pt]
    $\Delta > 0$, $\tau < 0$, $\tau^2 < 4\Delta$ & (below parabola, left of $\Delta$-axis) & Stable spiral \\[4pt]
    $\Delta > 0$, $\tau = 0$ & (on positive $\Delta$-axis) & Center \\
    \bottomrule
  \end{tabular}
  \end{center}
\end{keyresult}

\paragraph{The trace-determinant plane.}

\begin{center}
\begin{tikzpicture}[scale=0.85]
  % Axes
  \draw[->, thick] (-5,0) -- (5,0) node[right] {$\tau$ (trace)};
  \draw[->, thick] (0,-1) -- (0,5) node[above] {$\Delta$ (det)};

  % Parabola \Delta = \tau^2 / 4
  \draw[thick, dashed, red!80] plot[domain=-4.5:4.5, samples=100, smooth, variable=\t]
    ({\t}, {\t*\t/4});
  \node[red!80, font=\footnotesize, anchor=west] at (3.8, 4.3) {$\Delta = \tau^2/4$};

  % Fill saddle region (below \tau-axis)
  \fill[pattern=north west lines, pattern color=red!30] (-5,0) rectangle (5,-0.4);

  % Stability boundary (\tau = 0 line)
  \draw[dashed, thick, blue!60] (0,0) -- (0,5);

  % Labels for regions
  \node[font=\footnotesize, align=center] at (0,-0.25) {\textbf{Saddle}\\$(\Delta < 0)$};

  \node[font=\footnotesize, align=center] at (-3,3.5) {\textbf{Stable node}\\$(\tau < 0,\; D > 0)$};
  \node[font=\footnotesize, align=center] at (3,3.5) {\textbf{Unstable node}\\$(\tau > 0,\; D > 0)$};

  \node[font=\footnotesize, align=center] at (-2,1.2) {\textbf{Stable spiral}\\$(\tau < 0,\; D < 0)$};
  \node[font=\footnotesize, align=center] at (2,1.2) {\textbf{Unstable spiral}\\$(\tau > 0,\; D < 0)$};

  \node[font=\footnotesize, align=center] at (0,4.5) {\textbf{Center}\\$(\tau = 0,\; \Delta > 0)$};

  % Origin
  \filldraw[black] (0,0) circle (1.5pt);
  \node[font=\scriptsize, below left] at (0,0) {$(0,0)$};

  % Parabola tip label
  \node[font=\scriptsize, red!80, align=center] at (0,0.15) {parabola};
\end{tikzpicture}
\end{center}

The parabola $\Delta = \tau^2/4$ separates real from complex eigenvalues. The $\Delta$-axis ($\tau = 0$) separates stable from unstable systems. The $\tau$-axis ($\Delta = 0$) separates saddles from nodes/spirals/centers.

\begin{workedexample}
  Classify the system $\mathbf{x}' = \begin{pmatrix} 1 & 2 \\ 1 & -2 \end{pmatrix}\mathbf{x}$ using the trace-determinant plane.

  \textbf{Solution.} Compute:
  \[
    \tau = \tr(A) = 1 + (-2) = -1, \qquad
    \Delta = \det(A) = (1)(-2) - (2)(1) = -4.
  \]
  Since $\Delta = -4 < 0$, the point $(\tau, \Delta) = (-1, -4)$ lies below the $\tau$-axis in the saddle region. This confirms: \textbf{saddle point}.

  Verification: eigenvalues satisfy $\lambda^2 + \lambda - 4 = 0$, giving
  $\lambda = \frac{-1 \pm \sqrt{17}}{2} \approx 1.56, -2.56$ --- opposite signs, consistent with a saddle.
\end{workedexample}

\begin{workedexample}
  Classify $\mathbf{x}' = \begin{pmatrix} -1 & 2 \\ -3 & -1 \end{pmatrix}\mathbf{x}$.

  \textbf{Solution.}
  \[
    \tau = -1 + (-1) = -2, \qquad
    \Delta = (-1)(-1) - (2)(-3) = 1 + 6 = 5.
  \]
  Discriminant: $D = \tau^2 - 4\Delta = 4 - 20 = -16 < 0$.
  Since $\tau = -2 < 0$ and $D < 0$, the point $(-2, 5)$ lies in the \textbf{stable spiral} region (left of $\Delta$-axis, below the parabola). This is consistent with the eigenvalues $\lambda = -1 \pm 2i$ found in \cref{sec:ch08_complex}.
\end{workedexample}

\begin{workedexample}
  Classify $\mathbf{x}' = \begin{pmatrix} 0 & -5 \\ 2 & 0 \end{pmatrix}\mathbf{x}$.

  \textbf{Solution.}
  \[
    \tau = 0, \qquad \Delta = 0 - (-10) = 10.
  \]
  The point $(0, 10)$ lies on the positive $\Delta$-axis, which corresponds to \textbf{center} classification.
  Verification: $\lambda^2 + 10 = 0$, so $\lambda = \pm i\sqrt{10}$ --- purely imaginary, confirming closed orbits.
\end{workedexample}

\subsection{Stability Theory}
\label{sec:ch08_stability}

Stability analysis for linear systems follows directly from the eigenvalue structure.

\begin{theorem}[Asymptotic stability of linear systems]
  \label{thm:ch08_asymptotic_stability}
  The equilibrium $\mathbf{x} = \mathbf{0}$ of $\mathbf{x}' = A\mathbf{x}$ is \textbf{asymptotically stable} if and only if every eigenvalue $\lambda$ of $A$ satisfies $\Re(\lambda) < 0$.
\end{theorem}

\begin{proof}
  If $A$ has a basis of eigenvectors $\{\mathbf{v}_1, \ldots, \mathbf{v}_n\}$ with eigenvalues $\{\lambda_1, \ldots, \lambda_n\}$, the general solution is
  \[
    \mathbf{x}(t) = \sum_{k=1}^n c_k e^{\lambda_k t} \mathbf{v}_k.
  \]
  Each term satisfies $\lvert e^{\lambda_k t} \rvert = e^{\Re(\lambda_k)t}$. If $\Re(\lambda_k) < 0$ for all $k$, then every term decays exponentially to zero as $t \to \infty$, so $\mathbf{x}(t) \to \mathbf{0}$. Conversely, if any $\Re(\lambda_k) > 0$, the corresponding term grows without bound; if any $\Re(\lambda_k) = 0$ with nontrivial Jordan block, polynomial growth occurs. Hence the criterion is both necessary and sufficient.
\end{proof}

\begin{corollary}[Stability for $2 \times 2$ systems]
  \label{cor:ch08_stability_2x2}
  For a $2 \times 2$ matrix $A$, the equilibrium $\mathbf{0}$ is asymptotically stable if and only if
  \[
    \tr(A) < 0 \quad\text{and}\quad \det(A) > 0.
  \]
\end{corollary}

\begin{proof}
  The eigenvalues are $\lambda = \frac{\tau \pm \sqrt{\tau^2 - 4\Delta}}{2}$.
  \begin{itemize}
    \item If $\Delta < 0$, one eigenvalue is positive $\implies$ unstable.
    \item If $\Delta > 0$ and $\tau \geq 0$, at least one eigenvalue has nonnegative real part $\implies$ not asymptotically stable.
    \item If $\Delta > 0$ and $\tau < 0$, both eigenvalues have negative real parts (either both real negative, or complex with negative real part $\tau/2$) $\implies$ asymptotically stable.
  \end{itemize}
\end{proof}

\begin{theorem}[Lyapunov stability]
  \label{thm:ch08_lyapunov}
  The equilibrium $\mathbf{x} = \mathbf{0}$ is \textbf{Lyapunov stable} (but not asymptotically stable) if and only if all eigenvalues satisfy $\Re(\lambda) \leq 0$ and every eigenvalue with $\Re(\lambda) = 0$ has a trivial Jordan block (i.e.\ the matrix is diagonalizable over the imaginary axis).
\end{theorem}

\begin{remark}
  The most common example of Lyapunov stability without asymptotic stability is the \textbf{center} ($\lambda = \pm i\beta$). Nearby solutions stay close to the origin forever but never converge to it.
\end{remark}

\begin{workedexample}
  Show that $\mathbf{x}' = \begin{pmatrix} -2 & 3 \\ -1 & 0 \end{pmatrix}\mathbf{x}$ is asymptotically stable.

  \textbf{Solution.}
  \[
    \tau = -2 + 0 = -2 < 0, \qquad \Delta = (-2)(0) - (3)(-1) = 3 > 0.
  \]
  By \cref{cor:ch08_stability_2x2}, both conditions are satisfied.
  Eigenvalues: $\lambda = \frac{-2 \pm \sqrt{4-12}}{2} = -1 \pm i\sqrt{2}$. Real part $-1 < 0$, confirming asymptotic stability (stable spiral).
\end{workedexample}

\begin{workedexample}
  Show that $\mathbf{x}' = \begin{pmatrix} 3 & 1 \\ 1 & 3 \end{pmatrix}\mathbf{x}$ is unstable.

  \textbf{Solution.}
  \[
    \tau = \tr(A) = 3 + 3 = 6, \qquad
    \Delta = \det(A) = (3)(3) - (1)(1) = 9 - 1 = 8.
  \]
  Discriminant: $D = \tau^2 - 4\Delta = 36 - 32 = 4 > 0$. Since $\tau = 6 > 0$ and $\Delta = 8 > 0$ with $D > 0$, the point $(6, 8)$ lies in the \textbf{unstable node} region (right of $\Delta$-axis, above the parabola).

  Verification: eigenvalues satisfy $\lambda^2 - 6\lambda + 8 = 0$, giving
  \[
    \lambda = \frac{6 \pm \sqrt{36-32}}{2} = \frac{6 \pm 2}{2},
    \quad\text{so}\quad \lambda_1 = 4, \;\; \lambda_2 = 2.
  \]
  Both eigenvalues are positive, confirming an \textbf{unstable node (source)}. All nonzero solutions diverge from the origin as $t \to \infty$.
\end{workedexample}

\subsection{Matrix Exponential}
\label{sec:ch08_matrix_exp}

The \textbf{matrix exponential} provides a compact, general formula for the solution of $\mathbf{x}' = A\mathbf{x}$, analogous to $e^{at}$ for the scalar equation $x' = ax$.

\paragraph{Definition.}
For any square matrix $A$, define
\begin{equation}
  \label{eq:matrix_exp_def}
  e^{At} = I + At + \frac{(At)^2}{2!} + \frac{(At)^3}{3!} + \cdots = \sum_{k=0}^{\infty} \frac{(At)^k}{k!}.
\end{equation}
This power series converges for all square matrices $A$ and all $t \in \R$.

\begin{keyresult}
  \textbf{Properties of the matrix exponential.}
  \begin{enumerate}
    \item $e^{A \cdot 0} = I$.
    \item $\dfrac{d}{dt} e^{At} = A\,e^{At} = e^{At}\,A$.
    \item $e^{A(t+s)} = e^{At}\,e^{As}$ for all $s, t \in \R$.
    \item $e^{At}$ is always invertible, with $(e^{At})^{-1} = e^{-At}$.
  \end{enumerate}
\end{keyresult}

\paragraph{Solution of initial value problems.}
  If $A$ has distinct eigenvalues and is diagonalizable as $A = PDP^{-1}$, where $D = \operatorname{diag}(\lambda_1, \ldots, \lambda_n)$, then
\begin{equation}
  \label{eq:matrix_exp_diag}
  e^{At} = P\,e^{Dt}\,P^{-1} = P\,
    \begin{pmatrix}
      e^{\lambda_1 t} & 0 & \cdots & 0 \\
      0 & e^{\lambda_2 t} & \cdots & 0 \\
      \vdots & \vdots & \ddots & \vdots \\
      0 & 0 & \cdots & e^{\lambda_n t}
    \end{pmatrix}
    P^{-1}.
\end{equation}
The solution of the initial value problem $\mathbf{x}' = A\mathbf{x}$, $\mathbf{x}(0) = \mathbf{x}_0$ is then
\begin{equation}
  \label{eq:ivp_solution}
  \mathbf{x}(t) = e^{At}\,\mathbf{x}_0.
\end{equation}

\begin{workedexample}
  Compute $e^{At}$ for $A = \begin{pmatrix} 2 & 1 \\ 0 & 3 \end{pmatrix}$.

  \textbf{Step 1: Diagonalization.}
  The eigenvalues are $\lambda_1 = 2$ and $\lambda_2 = 3$ (diagonal entries, since $A$ is triangular).

  Eigenvector for $\lambda_1 = 2$: $(A - 2I)\mathbf{v} = \mathbf{0}$ gives
  $\begin{pmatrix} 0 & 1 \\ 0 & 1 \end{pmatrix}\mathbf{v} = \mathbf{0}$, so $v_2 = 0$ and $\mathbf{v}_1 = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$.

  Eigenvector for $\lambda_2 = 3$: $(A - 3I)\mathbf{v} = \mathbf{0}$ gives
  $\begin{pmatrix} -1 & 1 \\ 0 & 0 \end{pmatrix}\mathbf{v} = \mathbf{0}$, so $-v_1 + v_2 = 0$ and $\mathbf{v}_2 = \begin{pmatrix} 1 \\ 1 \end{pmatrix}$.

  Construct:
  \[
    P = \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}, \qquad
    D = \begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix}, \qquad
    P^{-1} = \begin{pmatrix} 1 & -1 \\ 0 & 1 \end{pmatrix}.
  \]

  \textbf{Step 2: Compute $e^{At} = P e^{Dt} P^{-1}$.}
  \[
    e^{Dt} = \begin{pmatrix} e^{2t} & 0 \\ 0 & e^{3t} \end{pmatrix}.
  \]
  \[
    \begin{aligned}
      P\,e^{Dt}
      &= \begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}
         \begin{pmatrix} e^{2t} & 0 \\ 0 & e^{3t} \end{pmatrix}
       = \begin{pmatrix} e^{2t} & e^{3t} \\ 0 & e^{3t} \end{pmatrix}, \\[8pt]
      P\,e^{Dt}\,P^{-1}
      &= \begin{pmatrix} e^{2t} & e^{3t} \\ 0 & e^{3t} \end{pmatrix}
         \begin{pmatrix} 1 & -1 \\ 0 & 1 \end{pmatrix}
       = \begin{pmatrix} e^{2t} & -e^{2t} + e^{3t} \\ 0 & e^{3t} \end{pmatrix}.
    \end{aligned}
  \]
  Therefore
  \[
    e^{At} = \begin{pmatrix} e^{2t} & e^{3t} - e^{2t} \\ 0 & e^{3t} \end{pmatrix}.
  \]

  \textbf{Verification.} Check $e^{A\cdot 0} = I$: substituting $t = 0$ gives $\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}$. $\checkmark$
\end{workedexample}

\begin{workedexample}
  Solve the initial value problem $\mathbf{x}' = \begin{pmatrix} 1 & 3 \\ 3 & 1 \end{pmatrix}\mathbf{x}$, $\mathbf{x}(0) = \begin{pmatrix} 2 \\ 0 \end{pmatrix}$.

  \textbf{Step 1: Eigenvalues and eigenvectors.}
  \[
    \det\!\begin{pmatrix} 1-\lambda & 3 \\ 3 & 1-\lambda \end{pmatrix}
    = (1-\lambda)^2 - 9 = 0,
    \quad\text{so}\quad \lambda = 1 \pm 3.
  \]
  $\lambda_1 = 4$, $\lambda_2 = -2$.

  For $\lambda_1 = 4$: $\begin{pmatrix} -3 & 3 \\ 3 & -3 \end{pmatrix}\mathbf{v} = \mathbf{0} \implies \mathbf{v}_1 = \begin{pmatrix} 1 \\ 1 \end{pmatrix}$.

  For $\lambda_2 = -2$: $\begin{pmatrix} 3 & 3 \\ 3 & 3 \end{pmatrix}\mathbf{v} = \mathbf{0} \implies \mathbf{v}_2 = \begin{pmatrix} 1 \\ -1 \end{pmatrix}$.

  \[
    P = \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}, \qquad
    P^{-1} = \frac{1}{-2}\begin{pmatrix} -1 & -1 \\ -1 & 1 \end{pmatrix}
    = \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}.
  \]

  \textbf{Step 2: $e^{At}$.}
  \[
    \begin{aligned}
      e^{At} &= P \begin{pmatrix} e^{4t} & 0 \\ 0 & e^{-2t} \end{pmatrix} P^{-1} \\
      &= \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}
         \begin{pmatrix} e^{4t} & 0 \\ 0 & e^{-2t} \end{pmatrix}
         \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} \\
      &= \frac{1}{2}
         \begin{pmatrix} e^{4t} + e^{-2t} & e^{4t} - e^{-2t} \\
                         e^{4t} - e^{-2t} & e^{4t} + e^{-2t} \end{pmatrix}.
    \end{aligned}
  \]

  \textbf{Step 3: Solution.}
  \[
    \begin{aligned}
      \mathbf{x}(t) &= e^{At}\begin{pmatrix} 2 \\ 0 \end{pmatrix}
        = \frac{1}{2}
          \begin{pmatrix} e^{4t} + e^{-2t} & e^{4t} - e^{-2t} \\
                          e^{4t} - e^{-2t} & e^{4t} + e^{-2t} \end{pmatrix}
          \begin{pmatrix} 2 \\ 0 \end{pmatrix} \\
        &= \begin{pmatrix} e^{4t} + e^{-2t} \\ e^{4t} - e^{-2t} \end{pmatrix}.
    \end{aligned}
  \]
  In components: $x(t) = e^{4t} + e^{-2t}$, $y(t) = e^{4t} - e^{-2t}$. The dominant behavior for large $t$ is $e^{4t}$ (consistent with the positive eigenvalue $\lambda_1 = 4$).
\end{workedexample}

\subsection{Summary}
\label{sec:ch08_summary}

\begin{table}[htbp]
\centering
\caption{Eigenvalue cases for $\mathbf{x}' = A\mathbf{x}$ ($2 \times 2$ systems)}
\label{tab:ch08_eigenvalue_cases}
\begin{tabular}{l l p{4.5cm}}
\toprule
\textbf{Eigenvalues} & \textbf{Eigenvectors} & \textbf{General solution} \\
\midrule
Real distinct: $\lambda_1 \neq \lambda_2$
  & Two independent $\mathbf{v}_1, \mathbf{v}_2$
  & $\mathbf{x}(t) = c_1 e^{\lambda_1 t}\mathbf{v}_1 + c_2 e^{\lambda_2 t}\mathbf{v}_2$ \\[8pt]
Complex conjugate: $\alpha \pm i\beta$
  & $\mathbf{a} \pm i\mathbf{b}$
  & $\mathbf{x}(t) = c_1 e^{\alpha t}[\mathbf{a}\cos\beta t - \mathbf{b}\sin\beta t]
                        + c_2 e^{\alpha t}[\mathbf{a}\sin\beta t + \mathbf{b}\cos\beta t]$ \\[8pt]
Repeated, one eigenvector: $\lambda$ (defective)
  & $\mathbf{v}_1$ (eigenvector), $\mathbf{v}_2$ (generalized)
  & $\mathbf{x}(t) = c_1 e^{\lambda t}\mathbf{v}_1 + c_2 e^{\lambda t}(\mathbf{v}_2 + t\mathbf{v}_1)$ \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Phase plane classifications and stability}
\label{tab:ch08_phase_plane}
\begin{tabular}{l l l l}
\toprule
\textbf{Eigenvalues} & \textbf{Phase plane} & \textbf{Trace/Det} & \textbf{Stability} \\
\midrule
$\lambda_1 > 0 > \lambda_2$ & Saddle & $\Delta < 0$ & Unstable \\
$\lambda_1 > \lambda_2 > 0$ & Unstable node & $\Delta > 0,\; \tau > 0,\; \tau^2 > 4\Delta$ & Unstable \\
$\lambda_1 < \lambda_2 < 0$ & Stable node & $\Delta > 0,\; \tau < 0,\; \tau^2 > 4\Delta$ & Asymptotically stable \\
$\pm i\beta$ & Center & $\Delta > 0,\; \tau = 0$ & Lyapunov stable (not asymptotic) \\
$\alpha \pm i\beta$, $\alpha > 0$ & Unstable spiral & $\Delta > 0,\; \tau > 0,\; \tau^2 < 4\Delta$ & Unstable \\
$\alpha \pm i\beta$, $\alpha < 0$ & Stable spiral & $\Delta > 0,\; \tau < 0,\; \tau^2 < 4\Delta$ & Asymptotically stable \\
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htbp]
\centering
\caption{Key formulas}
\label{tab:ch08_formulas}
\begin{tabular}{l p{8cm}}
\toprule
\textbf{Concept} & \textbf{Formula} \\
\midrule
Companion matrix ($y'' + a_1 y' + a_0 y = 0$) & $A = \begin{pmatrix} 0 & 1 \\ -a_0 & -a_1 \end{pmatrix}$ \\
Characteristic equation & $\det(A - \lambda I) = \lambda^2 - \tau\lambda + \Delta = 0$ \\
Generalized eigenvector & $(A - \lambda I)\mathbf{v}_2 = \mathbf{v}_1$ \\
Matrix exponential & $e^{At} = \displaystyle\sum_{k=0}^{\infty} \frac{(At)^k}{k!}$ \\
Solution via diagonalization & $e^{At} = P\,\operatorname{diag}(e^{\lambda_1 t}, \ldots, e^{\lambda_n t})\,P^{-1}$ \\
IVP solution & $\mathbf{x}(t) = e^{At}\,\mathbf{x}_0$ \\
Asymptotic stability ($2 \times 2$) & $\tr(A) < 0$ and $\det(A) > 0$ \\
\bottomrule
\end{tabular}
\end{table}

\begin{hintbox}
  \textbf{Problem-solving workflow for $\mathbf{x}' = A\mathbf{x}$.}
  \begin{enumerate}
    \item Compute $\tau = \tr(A)$ and $\Delta = \det(A)$.
    \item Calculate the discriminant $D = \tau^2 - 4\Delta$.
    \item Classify using the trace-determinant plane (\cref{sec:ch08_trace_det}).
    \item Find eigenvalues $\lambda$ and eigenvectors $\mathbf{v}$ explicitly.
    \item Assemble the general solution using the appropriate case from \cref{tab:ch08_eigenvalue_cases}.
    \item If initial conditions are given, solve for the constants $c_k$.
  \end{enumerate}
\end{hintbox}
