What happens to a system after a small perturbation? Does it return
to its original state, or drift further and further away? The answer to
this question determines whether a bridge will collapse in the wind,
whether an ecosystem can maintain balance, and whether economic cycles
will spiral out of control. Stability theory gives us the mathematical
tools to answer these questions. In this chapter, we'll start from
intuition and gradually build Lyapunov stability theory, seeing its wide
applications in engineering, biology, and physics.
Starting with an Inverted
Pendulum
Imagine a vertical stick that you're balancing on your fingertip.
Two equilibrium states: 1. Stick pointing
down (center of mass below support point): Give it a slight
push, it will swing a few times and return to vertical — this is
stable 2. Stick pointing up (center of
mass above support point): The slightest deviation and it will fall —
this is unstable
Mathematically, both equilibrium points satisfy the same condition
(derivative equals zero), but their nature is completely different. The
task of stability theory is to distinguish these cases.
Precise Definitions of
Stability
Lyapunov Stability
Consider an autonomous system: Letbe an equilibrium point,
i.e.,.
Definition (Lyapunov stable): The equilibrium
pointis
stable if for any, there existssuch that when, we havefor all.
Intuition: Starting near the equilibrium, the
trajectory never goes too far.
Definition (Asymptotically stable): Ifis stable, and there
existssuch that
when, then.
Intuition: Not only doesn't go far, but eventually
returns to the equilibrium.
Definition (Unstable): Ifis not stable, it is called
unstable.
Basin of Attraction
Definition: The basin of attraction
of equilibrium pointis
the set of all initial valuessatisfying.
The basin of attraction can be the entire space (globally
asymptotically stable), or just a region around the equilibrium
(locally asymptotically stable).
For a nonlinear system, perform Taylor expansion near
equilibrium point:Since, let:whereis the Jacobian
matrix.
Jacobian
Matrix
Hartman-Grobman Theorem
Theorem: If all eigenvalues ofhave nonzero
real parts (hyperbolic equilibrium point), then the
qualitative behavior of the nonlinear system nearis the same as the linearized
system.
Precise meaning of "same qualitative behavior":
There exists a homeomorphism (continuous bijection with continuous
inverse) that maps trajectories of the nonlinear system to trajectories
of the linear system, preserving time direction.
Important corollaries: - If all eigenvalues ofhave negative real parts → origin is
asymptotically stable - Ifhas any
eigenvalue with positive real part → origin is unstable
Warning: Ifhas
purely imaginary eigenvalues, the linearization method
fails! Higher-order analysis is needed.
Example: Damped Pendulum
Pendulum equation (without small angle approximation):Writing as a first-order system (,):$
$
Equilibrium points:and, i.e.,,Jacobian matrix:At:Eigenvalues:If, both eigenvalues have negative real parts →
asymptotically stable (hanging position)
At:Eigenvalues:One positive, one negative → saddle
point → unstable (inverted position)
defpendulum(X, t): x, y = X dxdt = y dydt = -gamma * y - omega0**2 * np.sin(x) return [dxdt, dydt]
fig, axes = plt.subplots(1, 2, figsize=(14, 6))
# Phase space ax1 = axes[0] t = np.linspace(0, 50, 2000)
# Trajectories from different initial values for x0 in np.linspace(-3*np.pi, 3*np.pi, 15): for y0 in np.linspace(-3, 3, 5): X0 = [x0, y0] sol = odeint(pendulum, X0, t) ax1.plot(sol[:, 0], sol[:, 1], 'b-', linewidth=0.3, alpha=0.5)
# Mark equilibrium points for n inrange(-2, 3): if n % 2 == 0: # Stable equilibrium ax1.plot(n*np.pi, 0, 'go', markersize=10, label='Stable'if n == 0else'') else: # Unstable equilibrium (saddle) ax1.plot(n*np.pi, 0, 'rx', markersize=10, mew=2, label='Unstable'if n == 1else'')
# Calculate eigenvalues print("Equilibrium point analysis:") for eq_name, x_eq in [("Hanging position (0, 0)", 0), ("Inverted position (π, 0)", np.pi)]: A = np.array([[0, 1], [-omega0**2 * np.cos(x_eq), -gamma]]) eigenvalues = np.linalg.eigvals(A) print(f"\n{eq_name}:") print(f" Jacobian matrix:\n{A}") print(f" Eigenvalues: {eigenvalues}") ifall(ev.real < 0for ev in eigenvalues): print(f" Conclusion: Asymptotically stable") elifany(ev.real > 0for ev in eigenvalues): print(f" Conclusion: Unstable")
Lyapunov's Direct Method
Inspiration from Energy
The stability of physical systems is usually related to energy: -
States with minimum energy are stable - If energy keeps decreasing, the
system will tend toward a stable state
Lyapunov's direct method mathematizes this idea.
Lyapunov Functions
Definition: For system,
if there exists a functionsatisfying: 1.$V(^) =
0V() > 0 ^ = V V$is called a Lyapunov
function.
Stability Theorems
Theorem (Lyapunov stability theorem): 1. If a
Lyapunov function exists with, thenis
stable 2. Iffor all, thenis asymptotically
stable 3. If there exists a functionwith, thenis
unstable
Intuition:is
like "generalized energy." If it always decreases, the system will
eventually reach the lowest energy point (equilibrium).
How to Construct Lyapunov
Functions?
This is an art; there's no universal formula. But there are some
commonly used techniques:
Technique 1: Physical energy
For mechanical systems, total energy(kinetic + potential) is often a good candidate.
Technique 2: Quadratic forms
For linear systems, try, whereis a positive definite matrix.If we can findsuch that(positive
definite), then→
asymptotically stable.
This is called the Lyapunov equation.
Technique 3: Trial and error
Start from simple forms (like), check the sign of.
Example: Stability
of Van der Pol Oscillator
Van der Pol equation:This describes an electronic tube
oscillator with nonlinear damping.
Theorem: If all eigenvalues ofhave negative real parts, then for any
positive definite matrix, there
exists a unique positive definite matrixsatisfying:This is called the
continuous Lyapunov equation.
Corollary: If we can findsuch thatis negative definite, the system is asymptotically
stable.
import numpy as np from scipy.linalg import solve_continuous_lyapunov import matplotlib.pyplot as plt
# Lyapunov analysis of linear system A = np.array([[-2, 1], [-1, -3]])
# Check stability (eigenvalues) eigenvalues = np.linalg.eigvals(A) print("Eigenvalues:", eigenvalues) print("All eigenvalues have Re < 0:", all(ev.real < 0for ev in eigenvalues))
# Solve Lyapunov equation A'P + PA = -Q Q = np.eye(2) # Take identity matrix P = solve_continuous_lyapunov(A.T, -Q)
print("\nQ =") print(Q) print("\nP =") print(P)
# Verify P is positive definite eigenvalues_P = np.linalg.eigvals(P) print("\nEigenvalues of P:", eigenvalues_P) print("P is positive definite:", all(ev > 0for ev in eigenvalues_P))
When the real part of complex eigenvalues changes from negative to
positive, a Hopf bifurcation occurs: the equilibrium
changes from a stable spiral to an unstable spiral, and a limit cycle
appears.
Supercritical Hopf bifurcation: The limit cycle is
stable Subcritical Hopf bifurcation: The limit cycle is
unstable
Example$
In polar coordinates:$
- When: The origin is a stable spiral
- When: The origin is an
unstable spiral, a stable limit cycle exists at
Equilibrium points: 1.: Both species extinct 2.: Coexistence
Jacobian matrix at the coexistence equilibrium:Eigenvalues:(purely imaginary)
Conclusion: The coexistence equilibrium is a
center (non-hyperbolic), linearization fails. In fact,
the system has infinitely many closed orbits, with populations
oscillating periodically.
import numpy as np from scipy.linalg import solve_continuous_are import matplotlib.pyplot as plt from scipy.integrate import odeint
# Inverted pendulum parameters M = 1.0# Cart mass m = 0.1# Pendulum mass l = 0.5# Pendulum length g = 9.81# Gravitational acceleration
# State space matrices (linearized around θ=0) A = np.array([ [0, 1, 0, 0], [0, 0, -m*g/M, 0], [0, 0, 0, 1], [0, 0, (M+m)*g/(M*l), 0] ])
B = np.array([[0], [1/M], [0], [-1/(M*l)]])
print("Open-loop eigenvalues:", np.linalg.eigvals(A)) print("System is unstable (has positive eigenvalue)")
# LQR design Q = np.diag([10, 1, 100, 1]) # State weights R = np.array([[0.1]]) # Control weight
# Solve Riccati equation P = solve_continuous_are(A, B, Q, R) K = np.linalg.inv(R) @ B.T @ P
print("\nFeedback gain K:", K.flatten()) print("Closed-loop eigenvalues:", np.linalg.eigvals(A - B @ K)) print("System is stable (all eigenvalues have Re<0)")
# Simulation definverted_pendulum(X, t, K, A, B): u = -K @ X return (A @ X + B @ u).flatten()
definverted_pendulum_open(X, t, A): return (A @ X).flatten()
fig, axes = plt.subplots(2, 2, figsize=(14, 10))
t = np.linspace(0, 5, 500) X0 = [0, 0, 0.2, 0] # Initial angle deviation of 0.2 rad
Write a program to automatically determine the equilibrium type
of 2D linear systems (given matrix).
Implement a Lyapunov equation solver and use it to verify
stability of linear systems.
Simulate the Van der Pol oscillator, creating an animation
showing the formation of the limit cycle.
Design a PID controller for the inverted pendulum and compare
performance with the LQR controller.
Thought Questions
Why does the Hartman-Grobman theorem require eigenvalues to have
nonzero real parts? Give a counterexample showing how linearization can
fail in the center case.
Is the energy of a physical system always a good Lyapunov
function candidate? When isn't it?
What is "critical slowing down" near bifurcation points? What is
its practical significance?
References
Strogatz, S. H. (2015). Nonlinear Dynamics and Chaos. CRC
Press.
Khalil, H. K. (2002). Nonlinear Systems. Prentice
Hall.
Perko, L. (2001). Differential Equations and Dynamical
Systems. Springer.
Guckenheimer, J., & Holmes, P. (1983). Nonlinear
Oscillations, Dynamical Systems, and Bifurcations of Vector Fields.
Springer.
Slotine, J.-J. E., & Li, W. (1991). Applied Nonlinear
Control. Prentice Hall.