TExcelTAD
Home › Differential Equations › Stability and Classification

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 x∗\mathbf{x}^* be a critical point of x′=F(x)\mathbf{x}' = \mathbf{F}(\mathbf{x}).

  • 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 x∗\mathbf{x}^*.
  • 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 JJ at x∗\mathbf{x}^*:

  • 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 2×22 \times 2 matrices, asymptotic stability is tr⁡J<0\operatorname{tr}J < 0 and det⁡J>0\det J > 0.

python · try it yourself
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 x∗\mathbf{x}^* is a function V(x)V(\mathbf{x}) with

  1. V(x∗)=0V(\mathbf{x}^*) = 0 and V(x)>0V(\mathbf{x}) > 0 nearby (a "bowl");
  2. V˙=∇V⋅F≤0\dot V = \nabla V \cdot \mathbf{F} \le 0 along solutions (it never increases).

Then x∗\mathbf{x}^* is stable. If V˙<0\dot V < 0 except at x∗\mathbf{x}^*, it is asymptotically stable. Think of VV as an energy that can only drain.

Example. x′=−x+y2x' = -x + y^2, y′=−y−xyy' = -y - xy. Try V=x2+y2V = x^2 + y^2:

V˙=2x(−x+y2)+2y(−y−xy)=−2x2−2y2+2xy2−2xy2=−2(x2+y2)<0.\dot V = 2x(-x + y^2) + 2y(-y - xy) = -2x^2 - 2y^2 + 2xy^2 - 2xy^2 = -2(x^2 + y^2) < 0.

So the origin is asymptotically stable, and in fact every solution converges to it (the bowl is global). Linearization agrees here, but VV gives more: a region of attraction.

python · try it yourself
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

x′=−x3x' = -x^3, y′=−y3y' = -y^3: the Jacobian at the origin is the zero matrix, so linearization says nothing. With V=x2+y2V = x^2 + y^2, V˙=−2x4−2y4<0\dot V = -2x^4 - 2y^4 < 0: asymptotically stable, but the decay is slow (like 1t\frac{1}{\sqrt{t}}, not exponential).

python · try it yourself
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 x′=Ax\mathbf{x}' = A\mathbf{x} the quadratic V=xTPxV = \mathbf{x}^TP\mathbf{x} comes from the Lyapunov equation ATP+PA=−QA^TP + PA = -Q, which scipy.linalg.solve_continuous_lyapunov solves.
  • In optimization, the loss is a Lyapunov function for gradient flow x′=−∇L\mathbf{x}' = -\nabla L: L˙=−∥∇L∥2≤0\dot L = -\lVert\nabla L\rVert^2 \le 0.

Exercises

Exercise 1: Trace and determinant

Is the critical point with J=[−13−21]J = \begin{bmatrix} -1 & 3 \\ -2 & 1 \end{bmatrix} asymptotically stable?

Answer

No: tr⁡J=0\operatorname{tr}J = 0, det⁡J=5\det J = 5, a linear center, undecided.

Solution

The eigenvalues are ±i5\pm i\sqrt{5}; the nonlinear terms decide.

Exercise 2: A Lyapunov function

Show the origin of x′=−x−yx' = -x - y, y′=x−y3y' = x - y^3 is asymptotically stable using V=x2+y2V = x^2 + y^2.

Answer

V˙=−2x2−2y4<0\dot V = -2x^2 - 2y^4 < 0 away from the origin.

Solution

V˙=2x(−x−y)+2y(x−y3)=−2x2−2xy+2xy−2y4\dot V = 2x(-x - y) + 2y(x - y^3) = -2x^2 - 2xy + 2xy - 2y^4.

Exercise 3: Lyapunov equation (code)

For A=[−12−2−1]A = \begin{bmatrix} -1 & 2 \\ -2 & -1 \end{bmatrix}, solve ATP+PA=−IA^TP + PA = -I and check that PP is positive definite.

Answer

P=12IP = \frac{1}{2}I, positive definite.

Solution

For this scaled rotation, AT+A=−2IA^T + A = -2I, so P=12IP = \frac{1}{2}I works.

python · try it yourself
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…

  1. asymptotically stable
  2. stable but not asymptotically stable
  3. unstable
  4. a saddle

A Lyapunov function must…

  1. increase along solutions
  2. be positive near the point, zero at it, and not increase along solutions
  3. be linear
  4. solve the ODE

A 2×22 \times 2 Jacobian with tr⁡J<0\operatorname{tr}J < 0 and det⁡J>0\det J > 0 means…

  1. asymptotically stable
  2. unstable
  3. a saddle
  4. undecided