Stability and Classification
"Stable" is used loosely in everyday speech. For differential equations it has precise meanings, and the difference matters: a pendulum hanging down is stable but keeps swinging, a damped one also returns to rest. This lesson defines the notions, gives the eigenvalue test, and introduces Lyapunov functions, which prove stability without solving anything.
Definitions
Let be a critical point of .
- Stable (Lyapunov stable): solutions that start close enough stay as close as you like for all future time.
- Asymptotically stable: stable, and nearby solutions actually converge to .
- Unstable: not stable; some solutions starting arbitrarily close move away.
A center is stable but not asymptotically stable; a sink (node or spiral) is asymptotically stable; sources and saddles are unstable.
The eigenvalue test
For the Jacobian at :
- all eigenvalues with negative real part: asymptotically stable;
- some eigenvalue with positive real part: unstable;
- otherwise (largest real part exactly 0): undecided by linearization.
For matrices, asymptotic stability is and .
import numpy as np
def verdict(J):
re = np.linalg.eigvals(J).real
if np.all(re < -1e-12): return "asymptotically stable"
if np.any(re > 1e-12): return "unstable"
return "undecided by linearization"
# damped pendulum x'' + 0.5 x' + sin x = 0 at x = 0 and at x = pi
print("hanging down:", verdict(np.array([[0, 1], [-1, -0.5]])))
print("upside down: ", verdict(np.array([[0, 1], [1, -0.5]])))
print("no damping: ", verdict(np.array([[0, 1], [-1, 0]])))hanging down: asymptotically stable
upside down: unstable
no damping: undecided by linearization
Lyapunov functions
A Lyapunov function for is a function with
- and nearby (a "bowl");
- along solutions (it never increases).
Then is stable. If except at , it is asymptotically stable. Think of as an energy that can only drain.
Example. , . Try :
So the origin is asymptotically stable, and in fact every solution converges to it (the bowl is global). Linearization agrees here, but gives more: a region of attraction.
import sympy as sp
x, y = sp.symbols("x y")
F = sp.Matrix([-x + y**2, -y - x * y])
V = x**2 + y**2
Vdot = sp.expand((sp.Matrix([V]).jacobian([x, y]) * F)[0])
print("dV/dt =", Vdot)dV/dt = -2*x**2 - 2*y**2
An example where linearization fails
, : the Jacobian at the origin is the zero matrix, so linearization says nothing. With , : asymptotically stable, but the decay is slow (like , not exponential).
import numpy as np
from scipy.integrate import solve_ivp
sol = solve_ivp(lambda t, z: [-z[0]**3, -z[1]**3], (0, 1000), [1.0, 0.5], t_eval=[10, 100, 1000], rtol=1e-10, atol=1e-14)
for t, xv in zip(sol.t, sol.y[0]):
print(f"t = {t:6.0f}: x = {xv:.5f}, 1/sqrt(2t + 1) = {1 / np.sqrt(2 * t + 1):.5f}")t = 10: x = 0.21822, 1/sqrt(2t + 1) = 0.21822
t = 100: x = 0.07053, 1/sqrt(2t + 1) = 0.07053
t = 1000: x = 0.02236, 1/sqrt(2t + 1) = 0.02236
In software
- Control design proves closed-loop stability with Lyapunov functions; for linear systems the quadratic comes from the Lyapunov equation , which
scipy.linalg.solve_continuous_lyapunovsolves. - In optimization, the loss is a Lyapunov function for gradient flow : .
Exercises
Exercise 1: Trace and determinant
Is the critical point with asymptotically stable?
Answer
No: , , a linear center, undecided.
Solution
The eigenvalues are ; the nonlinear terms decide.
Exercise 2: A Lyapunov function
Show the origin of , is asymptotically stable using .
Answer
away from the origin.
Solution
.
Exercise 3: Lyapunov equation (code)
For , solve and check that is positive definite.
Answer
, positive definite.
Solution
For this scaled rotation, , so works.
import numpy as np
from scipy.linalg import solve_continuous_lyapunov
A = np.array([[-1.0, 2.0], [-2.0, -1.0]])
P = solve_continuous_lyapunov(A.T, -np.eye(2))
print(np.round(P, 6) + 0, np.linalg.eigvalsh(P))[[0.5 0. ]
[0. 0.5]] [0.5 0.5]
Test yourself
A center is…
- asymptotically stable
- stable but not asymptotically stable
- unstable
- a saddle
A Lyapunov function must…
- increase along solutions
- be positive near the point, zero at it, and not increase along solutions
- be linear
- solve the ODE
A Jacobian with and means…
- asymptotically stable
- unstable
- a saddle
- undecided