Chemistry · Advanced

Oscillating reaction Brusselator

Written by SignalsLab

Early edition: these lessons are being reviewed.

Content

Summary

The Brusselator is a minimal model of a chemical reaction network with autocatalysis that can sustain oscillations far from equilibrium. Two reactants A and B are continuously supplied, and the concentrations of intermediates X and Y rise and fall periodically when B exceeds a critical value 1+A2. The simulation shows the transition from a stable steady state to a limit cycle (a Hopf bifurcation).

Intuition

Imagine X as a species that makes more of itself, but only when two X meet a Y (the step 2X + Y -> 3X). X is also destroyed by B, which converts it to Y. When X is low, Y builds up because nothing consumes it. Once Y is high enough, the autocatalytic step fires and X surges, burning through Y. Then X is converted to product by B and decays, Y has been depleted, and the cycle restarts. This is a delayed negative feedback combined with fast positive feedback, which is the standard recipe for a chemical clock. The system must be held open, with constant feeding of A and B and removal of products, otherwise thermodynamics forces it to equilibrium and the oscillations die.

Key equations

A→X,B+X→Y+D,2X+Y→3X,X→E
(1)

The four Brusselator steps, with rate constants set to 1 and A, B held constant.

dXdt=A−(B+1)X+X2Y
(2)

Rate of change of X: supply, loss through B and decay, and autocatalytic gain.

dYdt=BX−X2Y
(3)

Y is produced from X by B and consumed by the autocatalytic step.

(X∗,Y∗)=(A,BA)
(4)

The unique steady state.

Bc=1+A2
(5)

Critical value where the steady state loses stability via a Hopf bifurcation.

ω≈A
(6)

Angular frequency of small oscillations near onset, so period is about 2π/A.

Derivation

  1. Apply mass action with all rate constants equal to 1 to get dXdt=A−(B+1)X+X2Y and dYdt=BX−X2Y.
  2. Set both derivatives to zero. Adding the two equations gives A - X = 0, so X* = A. Then the second gives Y* = B/A.
  3. Linearise: the Jacobian entries are J11=−(B+1)+2XY=B−1, J12=X2=A2, J21=B−2XY=−B, J22=−X2=−A2.
  4. Trace T=B−1−A2 and determinant D=A2(−(B−1))+A2B... compute: D=(B−1)(−A2)−(A2)(−B)=A2.
  5. Stability needs T<0 and D>0. D=A2 is always positive, so stability is lost when T=0, i.e. B=1+A2.
  6. At T = 0 the eigenvalues are ±i√D = ±iA, purely imaginary, giving a Hopf bifurcation with frequency A.
  7. For B>1+A2 the steady state is an unstable focus and trajectories approach a stable limit cycle.

Worked example

Problem

For A = 1 and B = 3, find the steady state, decide whether it is stable, and estimate the oscillation period near onset.

  1. Steady state: X* = A = 1, Y* = B/A = 3.
  2. Critical value: Bc=1+A2=2.
  3. Trace: T=B−1−A2=3−1−1=1, which is positive, and D=A2=1.
  4. Eigenvalues: λ=T±T2−4D2=1±−32=0.5±0.87i. Positive real part means unstable focus.
  5. Frequency is about 0.87 here (close to A = 1 as an approximation), so period is about 2π/0.87 ≈ 7.2 time units; the nonlinear limit cycle will differ somewhat.

Answer Steady state (1, 3) is unstable (B = 3 > 2), so the system oscillates on a limit cycle with a period of roughly 7 dimensionless time units from linear theory.

Common mistakes

  • Thinking the oscillations occur in a closed system; A and B must be maintained constant, otherwise the system relaxes to equilibrium.
  • Confusing the steady state with the oscillation: the steady state still exists above B_c, it is just unstable.
  • Using B>1+A rather than B>1+A2 for the threshold.
  • Assuming amplitude equals the linear prediction; far above threshold the cycle is strongly nonlinear (relaxation-like).
  • Believing oscillating reactions violate the second law; total free energy is still dissipated.

Animation

Animation coming soon

The animated version of this lesson is being prepared for the web. In the Signals AI app, lessons are drawn step by step.

Code

scene.py(179 lines)
import sys
import numpy as np
from manim import *
from blocks import *


def simulate_brusselator(A, B, dt, steps):
    """
    Simulate the homogeneous Brusselator ODEs.
    dX/dt = A - (B+1)X + X^2*Y
    dY/dt = BX - X^2*Y
    
    Returns arrays of time, X, Y.
    """
    t = np.zeros(steps + 1)
    X = np.zeros(steps + 1)
    Y = np.zeros(steps + 1)
    
    # Steady state: X_ss = A, Y_ss = B/A
    # Oscillations if B > 1 + A^2
    X[0] = A + 0.5  # Perturbation
    Y[0] = B / A
    
    for i in range(steps):
        t[i+1] = t[i] + dt
        dX = (A - (B + 1) * X[i] + X[i]**2 * Y[i]) * dt
        dY = (B * X[i] - X[i]**2 * Y[i]) * dt
        
        X[i+1] = X[i] + dX
        Y[i+1] = Y[i] + dY
        
        # Clamp to prevent negative concentrations
        X[i+1] = max(0.01, X[i+1])
        Y[i+1] = max(0.01, Y[i+1])
        
    return t, X, Y


# Parameters
A_PARAM = 1.0
B_PARAM = 3.0  # 3 > 1 + 1^2, so oscillations occur
DT = 0.05
STEPS = 400
TRACE = simulate_brusselator(A_PARAM, B_PARAM, DT, STEPS)

# Compute steady state for reference
X_SS = A_PARAM
Y_SS = B_PARAM / A_PARAM


class Main(Scene):
    def construct(self):
        self.camera.background_color = "#111111"
        
        TitleCard(self, "Brusselator Oscillator", "Temporal concentration dynamics")
        
        # Setup Plot
        # Max concentration roughly 4-5, min 0.5. Range 0 to 5.
        plot = CurvePlot(
            lambda t: 0,
            x_range=(0, STEPS * DT, 5),
            y_range=(0, 5.0, 1.0),
            x_label="Time (s)",
            y_label="Concentration",
            x_length=9.0,
            y_length=4.5,
            color=WHITE
        )
        # Center the plot horizontally and vertically
        plot.move_to(ORIGIN)
        
        # Draw axes first
        self.play(Create(plot.axes), FadeIn(plot.labels))
        
        # Prepare data points
        t_vals = TRACE[0]
        x_vals = TRACE[1]
        y_vals = TRACE[2]
        
        # Create line objects
        line_X = VMobject(color=C_MAIN)
        line_Y = VMobject(color=C_BAD)
        
        # Initial empty lines
        line_X.set_points_as_corners([plot.axes.c2p(0, 0), plot.axes.c2p(0, 0)])
        line_Y.set_points_as_corners([plot.axes.c2p(0, 0), plot.axes.c2p(0, 0)])
        
        self.add(line_X, line_Y)
        
        # Labels - positioned at the end of the plot area to avoid overlap with y-axis label
        label_X = Text("X", font_size=24, color=C_MAIN)
        label_Y = Text("Y", font_size=24, color=C_BAD)
        
        # Initial positions (will be updated)
        label_X.move_to(plot.axes.c2p(0, 0)).shift(RIGHT * 0.3)
        label_Y.move_to(plot.axes.c2p(0, 0)).shift(RIGHT * 0.3)
        
        self.add(label_X, label_Y)
        
        # Animation loop
        def update_lines(mob):
            t_curr = tracker.get_value()
            # Find index closest to current time
            idx = np.searchsorted(t_vals, t_curr)
            idx = min(idx, len(t_vals) - 1)
            
            # Get points up to idx
            pts_x = [plot.axes.c2p(t_vals[i], x_vals[i]) for i in range(idx + 1)]
            pts_y = [plot.axes.c2p(t_vals[i], y_vals[i]) for i in range(idx + 1)]
            
            if len(pts_x) > 1:
                line_X.set_points_as_corners(pts_x)
            if len(pts_y) > 1:
                line_Y.set_points_as_corners(pts_y)
                
            # Update label positions at the tip
            if len(pts_x) > 0:
                label_X.move_to(pts_x[-1]).shift(RIGHT * 0.2)
            if len(pts_y) > 0:
                label_Y.move_to(pts_y[-1]).shift(RIGHT * 0.2)

        tracker = ValueTracker(0)
        
        self.play(
            UpdateFromFunc(line_X, update_lines),
            UpdateFromFunc(line_Y, update_lines),
            run_time=10,
            rate_func=linear
        )
        
        # Show steady state lines
        ss_line_x = DashedLine(
            plot.axes.c2p(0, X_SS),
            plot.axes.c2p(STEPS * DT, X_SS),
            color=C_DIM,
            dash_length=0.2
        )
        ss_text_x = MathTex(r"X_{ss} = A", font_size=20, color=C_DIM)
        ss_text_x.next_to(ss_line_x, LEFT, buff=0.2)
        
        ss_line_y = DashedLine(
            plot.axes.c2p(0, Y_SS),
            plot.axes.c2p(STEPS * DT, Y_SS),
            color=C_DIM,
            dash_length=0.2
        )
        ss_text_y = MathTex(r"Y_{ss} = B/A", font_size=20, color=C_DIM)
        ss_text_y.next_to(ss_line_y, LEFT, buff=0.2)
        
        self.play(Create(ss_line_x), FadeIn(ss_text_x), Create(ss_line_y), FadeIn(ss_text_y))
        
        StepCaption(self, "Oscillations arise when B > 1 + A^2. Concentrations cycle around steady state.")
        self.wait(2)


if __name__ == "__main__" and "--selftest" in sys.argv:
    t, X, Y = TRACE
    
    # Check initial conditions (perturbed from steady state)
    assert abs(X[0] - (A_PARAM + 0.5)) < 1e-6
    assert abs(Y[0] - (B_PARAM / A_PARAM)) < 1e-6
    
    # Check that X and Y remain positive
    assert np.all(X > 0)
    assert np.all(Y > 0)
    
    # Check that there is oscillatory behavior:
    # The values should not be monotonic.
    # Let's check the sign of differences.
    dx_diffs = np.diff(X)
    dy_diffs = np.diff(Y)
    
    # There should be both positive and negative changes
    assert np.any(dx_diffs > 0.01), "X did not increase"
    assert np.any(dx_diffs < -0.01), "X did not decrease"
    assert np.any(dy_diffs > 0.01), "Y did not increase"
    assert np.any(dy_diffs < -0.01), "Y did not decrease"
    
    print("ok")

The Manim scene code that draws this lesson's animation in the Signals AI app (Python, Manim Community).

ccBYNC© 2026 SignalsLab. Lesson text shared as is under CC BY-NC 4.0.