ODE stability: equilibria, attraction, and basins

Classify equilibria of a nonlinear rate law, use a phase line to find basins of attraction, and compare exact trajectories without confusing model stability with numerical stability.

By 12 min read

What you will learn

  • Distinguish staying near an equilibrium from converging to it.
  • Read a scalar phase line and identify basins of attraction.
  • Apply the local derivative test and recognize its inconclusive zero case.
  • Use exact trajectories to explain stability without numerical stepping artifacts.

Before you start

A system can sit perfectly still at a state that repels every nearby starting point. Observing that one motionless trajectory tells us that the state is an equilibrium. To determine its stability, we have to examine what happens after a small change in the starting state.

This lesson follows one nonlinear ordinary differential equation with exact solutions. Its three parameter settings show attraction, repulsion, and slow convergence that a first-order approximation misses.

Find the states that do not move

An autonomous scalar ODE has the form y′ = f(y): its rate depends on the current state, with no explicit time dependence. An equilibrium, also called a fixed point, is a state y⋆ where f(y⋆) = 0. Starting there gives the constant solution y(t) = y⋆.

Use the dimensionless teaching model:

y′ = ay − y³,   a ∈ {−1, 0, 1}

The state y, time t, and parameter a use normalized, dimensionless units. A physical model would need scales and coefficients with compatible units before combining these terms. No measured robot data underlies this example.

For a = 1, solve y − y³ = y(1 − y²) = 0. The equilibria are −1, 0, and +1. For a = 0 or a = −1, zero is the only real equilibrium. The rate law is smooth, giving unique solutions from each starting state. Its inward-pointing cubic term keeps forward trajectories bounded.

Separate stability from attraction

An equilibrium is stable in the sense of Lyapunov if starting sufficiently close guarantees staying as close as requested for every future time. Formally, for every tolerance ε > 0, some starting tolerance δ > 0 ensures:

|y(0) − y⋆| < δ ⇒ |y(t) − y⋆| < ε for all t ≥ 0

Attraction means that nearby starts converge to the equilibrium as t tends to infinity. Asymptotic stability requires both stability and attraction. These are the distinctions used in MIT's Underactuated Robotics notes.

For a stable equilibrium without attraction, consider y′ = 0. Every trajectory stays at its own initial value. Starting 0.01 from a chosen equilibrium keeps that distance forever: the trajectory stays close but never returns to that equilibrium.

An unstable equilibrium fails the staying-close requirement. Instability does not require escape to infinity. In our a = 1 model, the origin repels nearby states even though those trajectories remain bounded and approach −1 or +1.

Read direction and basins from a phase line

A phase line shows the state axis, equilibria, and direction of motion. Where f(y) is positive, the state increases; where it is negative, the state decreases. Time is absent from this axis. MIT's autonomous-equations lecture develops this sign-based construction.

For a = 1, factor f(y) = y(1 − y²) and inspect the four intervals:

State intervalRate signMotion
y < −1PositiveIncreases toward −1
−1 < y < 0NegativeDecreases toward −1
0 < y < 1PositiveIncreases toward +1
y > 1NegativeDecreases toward +1

The arrows approach −1 and +1 from both sides and point away from zero. Solutions cannot cross an equilibrium in finite time in this smooth, uniquely solvable model: the constant solution already occupies that state.

A basin of attraction is the set of initial states whose trajectories converge to a particular attracting equilibrium. Here, all negative starts converge to −1, so its basin is (−∞, 0). All positive starts converge to +1, whose basin is (0, ∞). Zero lies on the boundary and stays at zero.

These basins describe the whole mathematical model, beyond the experiment's bounded controls. The phase line and exact solutions establish them; a few sampled trajectories alone would leave other starting states unchecked.

Use the derivative at an equilibrium

Let η = y − y⋆ be a small displacement from an equilibrium. If f is continuously differentiable near y⋆, its first-order approximation gives:

η′ ≈ f′(y⋆)η
η_linear(t) = η(0)e^(f′(y⋆)t)

The scalar local derivative test follows this approximation: f′(y⋆) < 0 gives local asymptotic stability, with exponential attraction nearby; f′(y⋆) > 0 gives instability. A zero derivative leaves the test inconclusive because the discarded nonlinear terms may decide the motion. This is a local test at an equilibrium, not a classification of arbitrary states.

For our model, f′(y) = a − 3y². At a = 1, the derivatives at −1, 0, and +1 are −2, +1, and −2. The result agrees with the phase line. It does not by itself determine how far either basin extends.

The Taylor expansion lesson explains the local approximation. In several dimensions, the derivative becomes a Jacobian matrix, and coupled directions require a matrix stability analysis.

Calculate an exact trajectory

For a = 1 and initial state y₀, the exact solution for t ≥ 0 is:

y(t) = y₀ / √[e⁻²ᵗ + y₀²(1 − e⁻²ᵗ)]

One route to this formula sets z = y². The chain rule gives z′ = 2yy′ = 2z − 2z², a separable equation. Solve for z, then restore the initial sign of y. The formula also gives y(t) = 0 when y₀ = 0.

Start at y₀ = 0.25. The initial rate is 0.25 − 0.25³ = 0.234375, so the state initially increases. Substitution at t = 5 gives:

y(5) = 1 / √(1 + 15e⁻¹⁰) ≈ 0.999660

The trajectory approaches +1 without reaching or crossing it at any finite time. Starting at 0.30 instead gives approximately 0.999771 at t = 5. Their initial separation of 0.05 has shrunk to approximately 0.000111.

Now start exactly at zero. Its trajectory stays zero. Starting just 0.05 away gives approximately 0.991064 at the same observation time. This comparison reveals the origin's repelling behavior, despite the first trajectory's perfectly flat graph.

Compare two nearby starts

Choose a parameter and initial state. The solid curve starts at y₀; the dashed curve starts at y₀ + 0.05. Both curves come from exact formulas. The time control changes the observation point, not a numerical integration step.

Exact nonlinear dynamics

Follow the flow around equilibria

For y′ = ay − y³, compare a chosen start with a nearby start 0.05 higher. All states and times use normalized, dimensionless coordinates.

0.250
5.0

Phase line: which way does the state move?

Phase line for y prime equals 1 y minus y cubed. Equilibria: -1, asymptotically stable; 0, unstable; 1, asymptotically stable. Initial state 0.250000.-2-1012y
Arrows show increasing or decreasing y, with no time axis. Filled green circles mark attracting stable equilibria; open amber circles mark unstable ones. The blue dot above the line marks y₀.

Exact state against time

Two exact trajectories with initial states 0.250000 and 0.300000. At time 5, their states are 0.999660 and 0.999771. Fixed axes show time zero to ten and state −2.25 to 2.25.y(t)-2-10120510t
Solid blue starts at y₀. Dashed amber starts at y₀ + 0.05. The vertical guide selects the observation time. Both axes stay fixed; these curves use exact formulas with no numerical time step.
Initial rate
0.234375
State y(t)
0.999660
Nearby state y₊(t)
0.999771
Initial separation
0.050000
Separation at t
0.000111
Limit from y₀
1.000000
Limit from y₀ + 0.05
1.000000
Origin classification
Unstable
Linear test at origin
Unstable

Both selected starts approach 1.000000. The phase-line and exact analysis establish stability; this pair illustrates one fixed perturbation.

  • Equilibrium y* = -1

    Asymptotically stable

    f′(y*) = -2. Linear test: asymptotically stable.

    Every negative initial state approaches −1.

  • Equilibrium y* = 0

    Unstable

    f′(y*) = 1. Linear test: unstable.

    Only an initial state exactly zero remains at zero.

  • Equilibrium y* = 1

    Asymptotically stable

    f′(y*) = -2. Linear test: asymptotically stable.

    Every positive initial state approaches +1.

The origin readouts always concern y* = 0, even when you choose another start. The fixed +0.05 comparison is one pair of trajectories. Stability requires a statement about every sufficiently close initial state for all future times.

Displayed values round to six decimals. The limit readouts come from the analytic model, not from rounding the state at t = 10 to an equilibrium.

Use Across basin boundary to start at −0.025 and +0.025 with a = 1. At t = 5 the states are approximately −0.965567 and +0.965567. A small initial separation has grown to 1.931133, and the two limits are −1 and +1.

Use At attracting equilibrium to compare the constant solution at +1 with a start at 1.05. The second trajectory moves toward the first. Use At unstable equilibrium to compare the constant solution at zero with one that moves away.

The origin classification always refers to y⋆ = 0, even when the chosen initial state is elsewhere. The individual equilibrium cards describe the other fixed points. Small displayed differences can round to zero while remaining mathematically nonzero.

Resolve the zero-derivative case

Set a = 0. The equation becomes y′ = −y³, and f′(0) = 0. Its linearized equation η′ = 0 omits the entire restoring rate. The full exact solution is:

y(t) = y₀ / √(1 + 2y₀²t)

For every initial state, |y(t)| ≤ |y₀| and y(t) → 0. The first statement proves stability: choose δ = ε. The second proves attraction. Together they establish global asymptotic stability, even though the linear test says nothing.

At y₀ = 0.25 and t = 5, the state is 1/√26 ≈ 0.196116. For a fixed nonzero start, its magnitude eventually decreases like 1/√(2t). That is algebraic decay, slower than exponential decay. With a = −1, the exact solution instead satisfies |y(t)| ≤ |y₀|e⁻ᵗ; the same start reaches approximately 0.001634 at t = 5.

An energy-like check reaches the same conclusion for a = 0. Choose V(y) = y²/2. Then dV/dt = yy′ = −y⁴, strictly negative away from zero. This V is positive away from zero and grows without bound as |y| grows. Those properties satisfy the global asymptotic-stability conditions in MIT's Lyapunov analysis notes.

Changing the sign to y′ = +y³ would leave f′(0) equal to zero while reversing the phase-line arrows. A zero derivative alone cannot distinguish these systems.

Connect the model to control and optimization

Suppose y represents a normalized tracking error in a synthetic closed-loop robot model. Dynamics y′ = −y − y³ drive every modeled error toward zero. Dynamics y′ = y − y³ make small errors grow toward nonzero values. Merely finding y = 0 as an equilibrium would miss that difference. These conclusions depend on the assumed rate law; this scalar example leaves out actuator limits, sampling, disturbances, and additional robot states.

The same family has an optimization interpretation. Define a potential U_a(y) = y⁴/4 − ay²/2. Our equation is its continuous gradient flow, y′ = −U_a′(y), and:

dU_a/dt = U_a′(y)y′ = −[U_a′(y)]² ≤ 0

At a = 1, U has minima at ±1 and a local maximum at zero. At a = 0, U = y⁴/4 has a flat minimum at zero, with zero second derivative there. The slow attraction connects a flat objective to weak restoring motion. A trajectory started exactly at a stationary point stays there, including the maximum in the a = 1 case.

Gradient descent replaces continuous motion with discrete updates. A step-size choice can make those updates oscillate or diverge even when the continuous equilibrium attracts. Numerical integration studies this approximation problem. The stability of an ODE and the stability of a numerical method answer different questions.

With two state coordinates, a phase portrait plots velocity directions over a plane. For states constrained to a curved surface, those velocities must belong to the appropriate tangent spaces. Our scalar phase line is the one-coordinate starting point for that broader description.

Reproduce the exact comparison in Python

This standard-library program evaluates the same three exact formulas. It uses no time-stepping method. The nearby comparison adds 0.05 to the starting state before evaluating the second trajectory.

import math


def exact(a, y0, t):
    if a not in (-1, 0, 1) or t < 0:
        raise ValueError("Use a = -1, 0, or 1 and t >= 0.")
    if y0 == 0:
        return 0.0
    if a == 0:
        return y0 / math.sqrt(1 + 2 * y0 * y0 * t)
    decay = math.exp(-2 * t)
    one_minus_decay = -math.expm1(-2 * t)
    if a == 1:
        return y0 / math.sqrt(decay + y0 * y0 * one_minus_decay)
    return y0 * math.exp(-t) / math.sqrt(1 + y0 * y0 * one_minus_decay)


for a, y0 in [(1, 0.25), (1, 0), (1, -0.025), (0, 0.25), (-1, 0.25)]:
    state = exact(a, y0, 5)
    print(f"a={a:2d}, y0={y0:6.3f}, y(5)={state: .6f}")

separation = abs(exact(1, 0.025, 5) - exact(1, -0.025, 5))
print(f"Boundary separation: {separation:.6f}")
a= 1, y0= 0.250, y(5)= 0.999660
a= 1, y0= 0.000, y(5)= 0.000000
a= 1, y0=-0.025, y(5)=-0.965567
a= 0, y0= 0.250, y(5)= 0.196116
a=-1, y0= 0.250, y(5)= 0.001634
Boundary separation: 1.931133

The formulas are exact mathematical solutions; the computed decimals use floating-point arithmetic. The long-time limits follow from the formulas and phase line, independently of how many decimal places the program prints.

Try it yourself

Exercise 1. Let a = 1 and y₀ = −0.5. Find the initial rate, the attracting equilibrium and its basin, and the state at t = 1. Does the state cross that equilibrium?

Show solution 1

The initial rate is −0.5 − (−0.5)³ = −0.375, so the state decreases. It approaches −1, whose basin is every negative initial state. The local derivative at −1 is 1 − 3 = −2, confirming local attraction. The exact formula gives y(1) = −1/√(1 + 3e⁻²) ≈ −0.843347. The state approaches −1 from above and never crosses it in finite time.

Exercise 2. At zero, compare the equations y′ = −y³, y′ = +y³, and y′ = 0. All three have f′(0) = 0. Classify the equilibrium in each case and explain what evidence resolves the inconclusive linear test.

Show solution 2

For y′ = −y³, the arrows point toward zero and the exact formula proves both staying close and convergence. Zero is asymptotically stable. For y′ = +y³, arrows point away from zero on both sides; arbitrarily small nonzero starts eventually leave a fixed neighborhood, so zero is unstable. For y′ = 0, each state stays at its own starting value. Zero is stable without attraction. The nonlinear signs and exact trajectories settle questions that the identical zero first derivative cannot answer.

Sources and further study