1.1 Introduction: Why Start with Deterministic Models?
Welcome to the fascinating world of gene expression. At its heart, life is a story told in molecules. How a cell decides which genes to turn “on” or “off” governs its identity, its function, and its fate. For decades, mathematicians have modeled these processes using the language of calculus: ordinary differential equations (ODEs).
ODE models are powerful. They treat the concentrations of molecules like mRNA and proteins as continuous quantities that change smoothly over time. This approach allows us to analyze the “average” behavior of a large population of cells. We can find steady states, determine their stability, and understand how network structures, or motifs, give rise to complex behaviors like oscillation or decision-making.
In this chapter, we will begin with these classical models. We will analyze two famous motifs—the genetic toggle switch and the repressilator—to build a toolkit for thinking about dynamics, fixed points, and stability. We will introduce the powerful metaphor of an attractor landscape to describe cell fates. But we will quickly find the limits of this worldview. When we look at single cells, we don’t see smooth averages. We see lurching, probabilistic, and noisy processes. This chapter will build the motivation for our transition to stochastic models by showing precisely where and why ODEs fail. Much of this chapter’s approach is inspired by the excellent Biocircuits course materials (Elowitz and Bois 2025).
1.2 The Simplest Gene: Constitutive Expression
Let’s start with the most basic process: a gene that is always “on”. This is often called constitutive expression. We can think of this as a simple process where a protein is produced at a constant rate and is also removed over time.
Figure 1.1: A simple diagram showing a gene producing a protein at a constant rate, which is then degraded or diluted.
We can model this with an ODE. Let x(t) be the protein concentration at time t.
Production: Proteins are synthesized at a constant rate, \beta.
Removal: Proteins are removed through degradation and dilution at a rate proportional to their concentration, with a rate constant \gamma.
This gives us the simple ODE
\frac{dx}{dt} = \underbrace{\beta}_{\text{production}} - \underbrace{\gamma \cdot x}_{\text{removal}}
The steady state (or fixed point) is found by setting the derivative to zero (dx/dt = 0), which gives x_{ss} = \beta/\gamma. This tells us that the steady-state protein level is simply the ratio of its production rate to its removal rate.
1.2.1 Including Transcription and Translation
The central dogma involves two key steps: transcription (DNA to mRNA) and translation (mRNA to protein). Our first model lumped these together. To make it more realistic, let’s separate them. The gene is transcribed to mRNA, which is then translated to protein. Both mRNA and protein are also subject to degradation and dilution.
A diagram showing transcription (gene to mRNA) and translation (mRNA to protein), with degradation steps for both molecules.
This gives us two coupled equations for the mRNA concentration, m, and the protein concentration, p.
\frac{dm}{dt} = \beta_m - \gamma_m m
\frac{dp}{dt} = \beta_p m - \gamma_p p
Here, \beta_m is the transcription rate, \gamma_m is the mRNA degradation/dilution rate, \beta_p is the translation rate, and \gamma_p is the protein degradation/dilution rate.
To find the steady-state protein concentration, we set both derivatives to zero. First for the mRNA:
\frac{dm}{dt} = 0 \quad \implies \quad m_{ss} = \frac{\beta_m}{\gamma_m}
Then, we plug this into the protein equation:
\frac{dp}{dt} = 0 \quad \implies \quad p_{ss} = \frac{\beta_p m_{ss}}{\gamma_p} = \frac{\beta_p \beta_m}{\gamma_p \gamma_m}
The final protein level depends on the synthesis and degradation rates of both the mRNA and the protein itself. This gives the cell multiple levers to pull. It could control protein levels by tuning transcription, translation, or the stability of either the mRNA or the protein.
1.3 Adding Regulation: The Hill Function
Most genes are not simply “on” all the time; they are regulated by transcription factors (TFs). A key insight from molecular biology is that gene regulation often exhibits ultrasensitivity—small changes in regulator concentration can trigger dramatic, switch-like changes in gene expression. This ultrasensitive behavior is mathematically captured by Hill functions.
Hill functions model how molecular interactions can create sharp, switch-like responses through cooperativity—the phenomenon where multiple molecules work together more effectively than they would individually. This cooperative binding creates the S-shaped curves that are the hallmark of ultrasensitive responses.
1.3.1 Repressors Shut Genes Off
A repressor is a protein that binds to a specific DNA site to reduce the rate of transcription.
A diagram of a gene being repressed by a repressor protein R.
How does the binding of a repressor molecule quantitatively affect transcription rate? We can derive this by considering the kinetics of repressor-promoter binding.
The simplest case involves a single repressor binding to the promoter. The kinetic scheme is:
P + R \xrightleftharpoons[k_-]{k_+} P \cdot R
where P is the unbound promoter, R is the repressor, and P \cdot R is the bound promoter-repressor complex.
Using mass action kinetics, the rate of change of unbound promoter concentration p is:
\frac{dp}{dt} = -k_+ p \cdot R + k_- p_{\text{bound}}
At equilibrium (dp/dt = 0), and using the conservation relation p_{\text{bound}} = p_{\text{tot}} - p:
k_+ p \cdot R = k_- (p_{\text{tot}} - p)
Defining the dissociation constant K_d = k_-/k_+ and solving for the fraction of unbound promoter:
\frac{p}{p_{\text{tot}}} = \frac{1}{1 + R/K_d}
Since only the unbound promoter can be transcribed, the production rate becomes:
\beta(R) = \alpha \cdot \frac{p}{p_{\text{tot}}} = \frac{\alpha}{1 + R/K_d}
This is the repressing Hill function with n=1. More generally, the production rate under repressor control can be described by:
\beta(R) = \frac{\alpha}{1 + (R/K)^n}
\alpha is the maximum transcription rate when the repressor is absent.
K is the repression coefficient—the concentration of R needed for half-maximal repression. For simple binding (n=1), this equals the dissociation constant K_d.
n is the Hill coefficient, which controls the steepness of the transition from ON to OFF states. When n = 1, the response follows simple binding kinetics with a gradual transition. When n > 1, the response becomes increasingly ultrasensitive—a sharp, switch-like transition where small changes in repressor concentration cause dramatic changes in gene expression. This cooperativity often reflects multiple repressor molecules binding together, creating a threshold effect where the gene stays ON until a critical repressor concentration is reached, then switches rapidly OFF.
1.3.2 Activators Turn Genes On
Conversely, an activator is a protein that binds to DNA to increase the transcription rate.
A diagram of a gene being activated by an activator protein A.
The corresponding activating Hill function is:
\beta(A) = \alpha \frac{(A/K)^n}{1 + (A/K)^n}
1.3.3 Visualizing Ultrasensitivity: The Power of Cooperativity
To see how the Hill coefficient creates ultrasensitive responses, let’s compare Hill functions with different values of n. The transition from gradual to switch-like behavior becomes dramatically apparent as cooperativity increases.
Code
import numpy as npimport matplotlib.pyplot as pltdef plot_hill_functions():# GeoDataViz Qualitative Palette QUALITATIVE_COLORS = ['#FF1F5B', '#009ADE', '#AF58BA', '#FFC61E', '#F28522', '#00CD6C']# Create regulator concentration range x = np.linspace(0, 5, 500) K =1.0# Half-maximal concentration alpha =1.0# Maximum rate# Different Hill coefficients n_values = [1, 2, 4, 8]# Use palette colors: red, blue, purple, yellow to maintain visual hierarchy colors = [QUALITATIVE_COLORS[0], QUALITATIVE_COLORS[1], QUALITATIVE_COLORS[2], QUALITATIVE_COLORS[3]] fig, (ax1, ax2) = plt.subplots(1, 2)# Plot repressing Hill functionsfor n, color inzip(n_values, colors): y_rep = alpha / (1+ (x/K)**n) ax1.plot(x, y_rep, color=color, linewidth=2.5, label=f'n = {n}') ax1.axvline(K, color='gray', linestyle='--', alpha=0.7, linewidth=1) ax1.axhline(alpha/2, color='gray', linestyle='--', alpha=0.7, linewidth=1) ax1.text(K+0.1, alpha/2+0.05, 'Half-max', fontsize=10, color='gray') ax1.set_xlabel('Repressor Concentration (R/K)') ax1.set_ylabel('Gene Expression Rate') ax1.set_title('(a) Repressing Hill Functions') ax1.legend() ax1.grid(True, alpha=0.3) ax1.set_xlim(0, 5) ax1.set_ylim(0, 1.1)# Plot activating Hill functions for n, color inzip(n_values, colors): y_act = alpha * (x/K)**n / (1+ (x/K)**n) ax2.plot(x, y_act, color=color, linewidth=2.5, label=f'n = {n}') ax2.axvline(K, color='gray', linestyle='--', alpha=0.7, linewidth=1) ax2.axhline(alpha/2, color='gray', linestyle='--', alpha=0.7, linewidth=1) ax2.text(K+0.1, alpha/2+0.05, 'Half-max', fontsize=10, color='gray') ax2.set_xlabel('Activator Concentration (A/K)') ax2.set_ylabel('Gene Expression Rate') ax2.set_title('(b) Activating Hill Functions') ax2.legend() ax2.grid(True, alpha=0.3) ax2.set_xlim(0, 5) ax2.set_ylim(0, 1.1) plt.tight_layout() plt.show()plot_hill_functions()
Figure 1.2: Hill functions demonstrate ultrasensitivity through cooperativity. (a) Repressing Hill functions show how increasing the Hill coefficient n creates sharper transitions from high to low expression. (b) Activating Hill functions show the corresponding sharp transitions from low to high expression. When n=1 (blue), the response follows simple binding kinetics. As n increases (red, green, purple), the response becomes increasingly switch-like, with most of the transition occurring over a narrow range of regulator concentration around K.
1.3.4 A Design Choice: Activators vs. Repressors
A cell can induce gene expression in two seemingly equivalent ways: an activator can turn a gene on, or a repressor can be inhibited from turning a gene off. Are these designs truly equivalent?
In bacteria, high-demand genes (those needed most of the time) are often controlled by activators, while low-demand genes are controlled by repressors. One theory proposes a “use it or lose it” evolutionary argument: a regulator that is constantly needed (like an activator for a high-demand gene) is under stronger selection to avoid being lost to mutation.
A different explanation focuses on minimizing expression errors. This view argues that “naked” DNA is prone to non-specific binding by other transcription factors, causing inappropriate gene expression. To minimize this, a cell should keep regulatory sites occupied most of the time.
For a high-demand gene, an activator-based system ensures the site is bound (and the gene is ON) most of the time.
For a low-demand gene, a repressor-based system ensures the site is bound (and the gene is OFF) most of the time.
Both theories lead to the same prediction, highlighting how different selective pressures can converge on similar design principles.
1.4 Single Gene Bistability: Positive Autoregulation
Now let’s explore how a single gene can create a switch. This occurs through positive autoregulation, where a protein activates its own transcription. This is a fundamental motif found in systems from the lac operon to cell fate determination.
A diagram showing a protein X activating its own gene.
1.4.1 The Model
Consider a protein x that enhances its own transcription. The dynamics can be described by an ODE where the production term is an activating Hill function:
\frac{dx}{dt} = \frac{\alpha x^n}{K^n + x^n} - \delta x
A Note on Non-dimensionalization
This equation has four parameters (\alpha, K, n, \delta), which can make analysis cumbersome. We can simplify it by rewriting the equation in terms of dimensionless variables and parameters. This process, called non-dimensionalization, reduces the number of parameters we need to explore and reveals the key parameter groupings that govern the system’s behavior.
Let’s define a dimensionless protein concentration u = x/K and a dimensionless time \tau = \delta t. Substituting these into the ODE gives:
\frac{d(Ku)}{d(\tau/\delta)} = \frac{\alpha (Ku)^n}{K^n + (Ku)^n} - \delta (Ku)
K\delta \frac{du}{d\tau} = \frac{\alpha K^n u^n}{K^n(1 + u^n)} - K\delta u
Dividing by K\delta, we get the simplified dimensionless ODE:
\frac{du}{d\tau} = \frac{\alpha}{K\delta} \frac{u^n}{1 + u^n} - u
We can define a single dimensionless bifurcation parameter, \beta = \frac{\alpha}{K\delta}. This parameter represents the ratio of the maximum production rate to the degradation rate. The final dimensionless equation is:
\frac{du}{d\tau} = \beta \frac{u^n}{1 + u^n} - u
Now we only have two parameters, \beta and n, to worry about!
1.4.2 Graphical Analysis: Production vs. Degradation
The steady states (fixed points) of the system occur where the production rate equals the degradation rate. We can find them graphically by plotting both functions and looking for their intersections.
Code
import numpy as npimport matplotlib.pyplot as pltfrom scipy.optimize import brentq# GeoDataViz Qualitative PaletteQUALITATIVE_COLORS = ['#FF1F5B', '#009ADE', '#AF58BA', '#FFC61E', '#F28522', '#00CD6C']def find_intersections(beta, n, u_max=5):"""Find intersection points between production and degradation curves.""" func =lambda u: beta * u**n / (1+ u**n) - u # This is the function whose roots we seek intersections = [0.0] u_grid = np.linspace(1e-5, u_max, 1000) f_grid = func(u_grid)for j inrange(len(u_grid) -1):if np.sign(f_grid[j]) != np.sign(f_grid[j+1]):try: sol = brentq(func, u_grid[j], u_grid[j+1])if sol >1e-6and sol < u_max: # Avoid near-zero duplicates and ensure within range intersections.append(sol)except (ValueError, RuntimeError):continuereturnsorted(list({round(x, 6) for x in intersections}))def plot_curves_with_intersections(ax, beta, n, color, label):"""Plot production/degradation curves with marked intersections.""" u_range = np.linspace(0, 5, 1000) production = beta * u_range**n / (1+ u_range**n) ax.plot(u_range, production, color=color, linewidth=3, label=label) intersections = find_intersections(beta, n)for intersection in intersections:# Determine stabilityif intersection >1e-6: prod_slope = (beta * n * intersection**(n-1)) / (1+ intersection**n)**2else: # For intersection at 0 prod_slope = beta * n is_stable =1> prod_slope fill = color if is_stable else'white' ax.plot(intersection, intersection, 'o', color=color, markeredgecolor='black', markerfacecolor=fill, markersize=10, markeredgewidth=2)returnlen(intersections)# Create figure with two panelsfig, (ax1, ax2) = plt.subplots(1, 2)# Panel A: Show cooperativity requirement (n > 1)ax1.plot([0, 5], [0, 5], 'k--', linewidth=2, alpha=0.7, label='Degradation: u')beta_fixed =4# This beta value is used for both n=1 and n=3n1, n2 =1, 3plot_curves_with_intersections(ax1, beta_fixed, n1, QUALITATIVE_COLORS[0], f'Production: n=1, β={beta_fixed}')plot_curves_with_intersections(ax1, beta_fixed, n2, QUALITATIVE_COLORS[1], f'Production: n=3, β={beta_fixed}')ax1.set_xlabel('Protein concentration (u)')ax1.set_ylabel('Rate')ax1.set_title('(a) Cooperativity Required')ax1.legend()ax1.grid(True, alpha=0.3)ax1.set_xlim(0, 5) # Set x-axis limitax1.set_ylim(0, 4.5) # Set y-axis limit# Panel B: Show feedback strength requirement (β must be large enough)ax2.plot([0, 5], [0, 5], 'k--', linewidth=2, alpha=0.7, label='Degradation: u') # Degradation linen_fixed =3beta_low =1# Below threshold for n=3beta_high =4# Above threshold for n=3plot_curves_with_intersections(ax2, beta_low, n_fixed, QUALITATIVE_COLORS[0], f'Production: β={beta_low}, n={n_fixed}')plot_curves_with_intersections(ax2, beta_high, n_fixed, QUALITATIVE_COLORS[1], f'Production: β={beta_high}, n={n_fixed}')ax2.set_xlabel('Protein concentration (u)')ax2.set_ylabel('Rate')ax2.set_title('(b) Strong Feedback Required')ax2.legend()ax2.grid(True, alpha=0.3) # Add gridax2.set_xlim(0, 5) # Set x-axis limitax2.set_ylim(0, 4.5) # Set y-axis limitplt.tight_layout()plt.show()
Figure 1.3: Graphical analysis showing requirements for bistability. (a) Cooperativity requirement: With β=4, n=1 (blue) gives only one intersection (monostable), while n=3 (red) gives three intersections (bistable). (b) Feedback strength requirement: With n=3, β=2 (blue) gives one intersection, while β=4 (red) gives three intersections. Both cooperativity (n>1) AND sufficient feedback strength (β) are needed for bistability.
When there are three intersections, the system is bistable. A fixed point is stable if the slope of the production curve is less than the slope of the degradation line at that point; otherwise, it’s unstable. The cell will end up in either the “low” or “high” state depending on its starting concentration.
1.4.3 Mathematical Conditions for Bistability
We can formalize the requirements for bistability with analysis. The transition from one to three fixed points occurs at a saddle-node bifurcation. While we can see this graphically as the point where the production and degradation curves become tangent, we can derive the precise conditions analytically by analyzing the roots of the steady-state equation.
The steady states are the roots of f(u) = 0: \beta \frac{u^n}{1 + u^n} - u = 0
We know u^*=0 is always a fixed point. For any nonzero fixed points (u > 0), we can rearrange the equation algebraically: \beta u^{n-1} = 1 + u^ng(u) = u^n - \beta u^{n-1} + 1 = 0
Finding the nonzero fixed points is now a matter of finding the positive roots of g(u). To see how many positive roots this equation can have, we can find its minimum by taking the derivative with respect to u and setting it to zero: \frac{dg}{du} = nu^{n-1} - \beta(n-1)u^{n-2} = 0 For u>0, this derivative is zero at u_{min} = \beta \frac{n-1}{n}. For this minimum to exist at a positive concentration, we must have n > 1. If n \le 1, the function g(u) is monotonic for u>0 and can cross zero at most once, meaning there is only one possible nonzero fixed point.
For n>1, the function g(u) starts at g(0)=1, decreases to a minimum at u_{min}, and then increases toward infinity. For two distinct positive roots to exist (giving us a total of three fixed points including the one at zero), this minimum value must be less than zero, i.e., g(u_{min}) < 0.
Substituting u_{min} back into the expression for g(u) gives the condition for bistability: \left(\beta \frac{n-1}{n}\right)^n - \beta \left(\beta \frac{n-1}{n}\right)^{n-1} + 1 < 0 A few steps of algebra simplify this to the critical condition on \beta and n: \beta > n(n-1)^{(1-n)/n}
This single inequality precisely defines the parameter regime for bistability and reveals two clear design principles:
Cooperativity is required:n > 1. As we saw in the derivation, if n \le 1, a minimum in g(u) does not exist for u > 0, and multiple positive roots are not possible. This confirms our graphical intuition that an ultrasensitive, S-shaped production curve is necessary.
Sufficient feedback strength is required:\beta must be large enough to cross the bifurcation boundary defined by the inequality above. This ensures the production “hump” is high enough to cross the degradation line twice.
1.4.4 Bifurcation Diagrams: Mapping the Behavior
This analysis gives us a complete picture of the conditions required for bistability. We can visualize the system’s behavior in two complementary ways.
First, a standard bifurcation diagram shows how the location of the fixed points (u^*) changes as we vary a single parameter, \beta, while holding the cooperativity n constant. This creates the classic “S-curve” that clearly reveals the bistable region bounded by two saddle-node bifurcation points.
Alternatively, we can plot the bifurcation boundary we just derived, \beta = n(n-1)^{(1-n)/n}, directly in the two-parameter design space of (\beta, n). This phase diagram shows the entire region of parameter space where the system is bistable, giving us a comprehensive map for designing a robust switch.
Code
import numpy as npimport matplotlib.pyplot as pltdef plot_bifurcation_s_curve(ax, n, title):"""Plots the S-curve bifurcation diagram (u* vs. beta)."""# GeoDataViz Qualitative Palette QUALITATIVE_COLORS = ['#FF1F5B', '#009ADE', '#AF58BA', '#FFC61E', '#F28522', '#00CD6C'] u_range = np.linspace(0.001, 6, 1000)# From the steady state condition, we can write beta as a function of u* beta_vals = u_range * (1+ u_range**n) / (u_range**n)# The stability of the nonzero fixed points is determined by where the slope# of the production curve is less than the slope of the degradation curve.# The middle branch of the S-curve is where the production slope is steeper. prod_slope = (beta_vals * n * u_range**(n-1)) / (1+ u_range**n)**2 stable_mask = prod_slope <1# Plot the stable and unstable branches of nonzero fixed points ax.plot(beta_vals[stable_mask], u_range[stable_mask], color=QUALITATIVE_COLORS[0], linewidth=3, label='Stable') ax.plot(beta_vals[~stable_mask], u_range[~stable_mask], color=QUALITATIVE_COLORS[0], linestyle='--', linewidth=3, label='Unstable')# The u* = 0 fixed point is always a stable solution ax.plot(np.linspace(0, 10, 100), np.zeros(100), color=QUALITATIVE_COLORS[0], linewidth=3) ax.legend() ax.set_xlabel('Bifurcation parameter (β)') ax.set_ylabel('Fixed point concentration (u*)') ax.set_title(title) ax.set_xlim(0, 8) ax.set_ylim(-0.2, 6) ax.grid(True, alpha=0.3)def plot_bifurcation_phase_diagram(ax, title):"""Plots the 2D phase diagram in (n, beta) parameter space."""# GeoDataViz Qualitative Palette QUALITATIVE_COLORS = ['#FF1F5B', '#009ADE', '#AF58BA', '#FFC61E', '#F28522', '#00CD6C'] n_range = np.linspace(1.001, 10, 400) # Start just above n=1# Analytical boundary for bistability beta_crit = n_range * (n_range -1)**((1- n_range) / n_range) ax.plot(n_range, beta_crit, color=QUALITATIVE_COLORS[0], linewidth=3)# Shade the bistable and monostable regions ax.fill_between(n_range, beta_crit, 3, color='gray', alpha=0.7) ax.fill_between(n_range, 0, beta_crit, color='lightgray', alpha=0.7)# Add text labels to the regions ax.text(6, 2.2, "Bistable", fontsize=12, ha='center', va='center') ax.text(6, 1.0, "Monostable", fontsize=12, ha='center', va='center') ax.set_xlabel('Cooperativity (n)') ax.set_ylabel('Feedback strength (β)') ax.set_title(title) ax.set_xlim(1, 10) ax.set_ylim(0, 3) ax.grid(True, alpha=0.3)# Create the two-panel figurefig, (ax1, ax2) = plt.subplots(1, 2)plt.suptitle("Bifurcation Analysis of Positive Autoregulation", fontsize=16)# Plot each diagramplot_bifurcation_s_curve(ax1, n=4, title="(a) Fixed Point vs. Feedback Strength")plot_bifurcation_phase_diagram(ax2, title="(b) Phase Diagram in Parameter Space")plt.tight_layout(rect=[0, 0.03, 1, 0.95])plt.show()
Figure 1.4: Two views of the positive autoregulation bifurcation. (a) The standard bifurcation diagram plots the fixed point concentration (u^*) versus the feedback strength (eta) for fixed cooperativity (n=4). The S-shaped curve reveals a region of bistability bounded by two saddle-node bifurcations. (b) The two-parameter phase diagram shows the full design space. The system is bistable only in the gray region above the critical boundary, requiring both sufficient cooperativity (n>1) and feedback strength (eta).
The lac operon in E. coli exemplifies this bistable behavior: when lactose is present, it not only prevents the lac repressor from blocking transcription, but also enhances the import of more lactose into the cell. This creates a positive feedback loop that results in an all-or-nothing response—the cell commits fully to lactose metabolism only when lactose concentrations exceed a critical threshold.
Experimental demonstration of bistability in the E. coli lac operon. Single-cell fluorescence measurements show bimodal expression patterns, confirming the theoretical predictions of bistable gene expression. Cells exist in either a low-expression or high-expression state with few cells in intermediate states. Figure adapted from Ozbudak et al. (2004).
1.5 A Bistable Motif: The Genetic Toggle Switch
The genetic toggle switch is a classic synthetic circuit built from two genes that mutually repress each other. This design creates a robust bistable system where one gene is “ON” and the other is “OFF,” or vice versa.
Figure 1.5: A diagram of the genetic toggle switch, with two proteins mutually repressing each other’s genes.
Let x_1 and x_2 be the protein concentrations. We can write the ODEs as:
\frac{dx_1}{dt} = \frac{\alpha_1}{1 + (x_2/K_2)^n} - \gamma_1 x_1 = f_1(x_1, x_2)
\frac{dx_2}{dt} = \frac{\alpha_2}{1 + (x_1/K_1)^n} - \gamma_2 x_2 = f_2(x_1, x_2)
1.5.1 Nullcline Analysis
The steady states are the intersections of the nullclines, where dx_1/dt = 0 and dx_2/dt = 0.
Figure 1.6: Nullcline analysis of the genetic toggle switch. The red line is the p1-nullcline, and the blue line is the p2-nullcline. (a) In the monostable regime, there is only one stable fixed point. (b) In the bistable regime, there are two stable fixed points (black dots) and one unstable saddle point (white dot).
1.5.2 Stability and Bifurcation Analysis
To understand the transition from monostability to bistability, we perform a linear stability analysis. We compute the Jacobian matrix of the system, evaluated at a fixed point (x_1^*, x_2^*). J = \begin{pmatrix} \frac{\partial f_1}{\partial x_1} & \frac{\partial f_1}{\partial x_2} \\ \frac{\partial f_2}{\partial x_1} & \frac{\partial f_2}{\partial x_2} \end{pmatrix}_{(x_1^*, x_2^*)} = \begin{pmatrix} -\gamma_1 & -\frac{\alpha_1 n (x_2^*/K_2)^{n-1}}{K_2(1+(x_2^*/K_2)^n)^2} \\ -\frac{\alpha_2 n (x_1^*/K_1)^{n-1}}{K_1(1+(x_1^*/K_1)^n)^2} & -\gamma_2 \end{pmatrix} The stability of the fixed point is determined by the eigenvalues of this matrix. Let’s analyze the symmetric fixed point where x_1^* = x_2^* = x^* in the simplified dimensionless system (\gamma=1, K=1). The Jacobian becomes: J = \begin{pmatrix} -1 & J_{12} \\ J_{21} & -1 \end{pmatrix} \quad \text{where} \quad J_{12} = J_{21} = -\frac{\alpha n (x^*)^{n-1}}{(1+(x^*)^n)^2} The eigenvalues (\lambda) are the solutions to the characteristic equation, \det(J - \lambda I) = 0, which gives: (-1-\lambda)^2 - (J_{12})^2 = 0 \implies \lambda = -1 \pm |J_{12}| Substituting the expression for the off-diagonal terms, the two eigenvalues are: \lambda = -1 \pm \frac{\alpha n (x^*)^{n-1}}{(1+(x^*)^n)^2} The fixed point becomes unstable (a saddle point) when one of these eigenvalues becomes positive. This can only happen for the eigenvalue \lambda_+ = -1 + |\dots|, which requires: \frac{\alpha n (x^*)^{n-1}}{(1+(x^*)^n)^2} > 1 This condition requires high cooperativity (n) and a sufficiently high synthesis rate (\alpha). When the symmetric point becomes unstable, two new stable asymmetric fixed points emerge in a pitchfork bifurcation. These new fixed points, corresponding to the (high, low) and (low, high) states, are stable nodes. Their stability can be confirmed by evaluating the Jacobian at the asymmetric coordinates, where the product of the off-diagonal terms J_{12}J_{21} is small, ensuring that both eigenvalues remain negative.
Code
import numpy as npimport matplotlib.pyplot as pltfrom scipy.optimize import fsolvedef plot_bifurcation_diagram(ax, n, title):# GeoDataViz Qualitative Palette QUALITATIVE_COLORS = ['#FF1F5B', '#009ADE', '#AF58BA', '#FFC61E', '#F28522', '#00CD6C'] alphas = np.linspace(0.1, 10, 200)# Separate branches for cleaner plotting symmetric_stable = [] symmetric_unstable = [] asymm_high_stable = [] asymm_low_stable = []for alpha in alphas:# Find the symmetric fixed point p* by solving p = alpha / (1 + p^n) p_star_func =lambda p: p - alpha / (1+ p**n)try: p_star = fsolve(p_star_func, alpha /2)[0]# Check stability condition for symmetric point stability_metric = (alpha * n * p_star**(n-1)) / (1+ p_star**n)**2if stability_metric >1:# Symmetric point is unstable symmetric_unstable.append((alpha, p_star))# Find asymmetric fixed points by solving the 2D system# For the toggle switch: (p1, p2) where p1 ≠ p2# We solve: p1 = α/(1+p2^n), p2 = α/(1+p1^n)# High-low asymmetric pointdef equations_high_low(vars): p1, p2 =vars eq1 = alpha / (1+ p2**n) - p1 eq2 = alpha / (1+ p1**n) - p2return [eq1, eq2]try:# Try initial guess favoring high p1, low p2 sol_hl = fsolve(equations_high_low, [alpha*0.8, alpha*0.2])ifabs(equations_high_low(sol_hl)[0]) <1e-6and sol_hl[0] >0and sol_hl[1] >0: asymm_high_stable.append((alpha, sol_hl[0])) # p1 value asymm_low_stable.append((alpha, sol_hl[1])) # p2 value (plotted as p1)except:passelse:# Symmetric point is stable symmetric_stable.append((alpha, p_star))except:continue# Plot each branch separately for clean visualizationif symmetric_stable: alpha_sym_s, p_sym_s =zip(*symmetric_stable) ax.plot(alpha_sym_s, p_sym_s, color=QUALITATIVE_COLORS[0], linewidth=2, label='Stable')if symmetric_unstable: alpha_sym_u, p_sym_u =zip(*symmetric_unstable) ax.plot(alpha_sym_u, p_sym_u, color=QUALITATIVE_COLORS[0], linestyle='--', linewidth=2, label='Unstable')if asymm_high_stable: alpha_high, p_high =zip(*asymm_high_stable) ax.plot(alpha_high, p_high, color=QUALITATIVE_COLORS[0], linewidth=2)if asymm_low_stable: alpha_low, p_low =zip(*asymm_low_stable) ax.plot(alpha_low, p_low, color=QUALITATIVE_COLORS[0], linewidth=2) ax.set_xlabel('Synthesis rate (α)') ax.set_ylabel('Steady-state $p_1$') ax.set_title(title) ax.legend() ax.grid(True, alpha=0.3) ax.set_xlim(0, 10) ax.set_ylim(0, 8)fig, ax = plt.subplots(1, 1)plot_bifurcation_diagram(ax, n=4, title="Bifurcation Diagram: Toggle Switch")plt.tight_layout(); plt.show()
Figure 1.7: Bifurcation diagram for the toggle switch. The steady-state concentration of P1 is plotted against the synthesis rate α. With sufficient cooperativity (n=4), the system undergoes a saddle-node bifurcation, creating a bistable region where two stable states (solid lines) coexist with an unstable state (dashed line).
The theoretical predictions of bistability are convincingly validated by experimental data. Gardner and colleagues built a synthetic toggle switch and demonstrated the key features predicted by our analysis:
Experimental validation of the genetic toggle switch. (a,b) Population switching between states in response to different inducers (IPTG and temperature). (c) Flow cytometry data showing bimodal population distributions at different time points, confirming bistable gene expression where cells exist in either high or low expression states with few intermediate cells. Figure adapted from Gardner, Cantor, and Collins (2000).
1.6 An Oscillatory Motif: The Repressilator
Not all motifs create switches. In 2000, Elowitz and Leibler built the repressilator—a three-gene circuit where each gene represses the next in a cycle. Like a molecular “rock-paper-scissors” game, each protein beats exactly one other in the sequence.
The circuit uses three well-characterized repressor genes (lacI, tetR, cI) arranged in a cycle. Using the same Hill function logic from our previous examples:
Unlike the toggle switch, this system has only one fixed point: the symmetric state x_1 = x_2 = x_3 = x^* where x^* = \alpha/(1+(x^*)^n). But something striking happens with the right parameters—the system oscillates!
Figure 1.8: Repressilator dynamics. (a) Time-series showing sustained oscillations of the three proteins out of phase. (b) Phase portrait showing the trajectory spiraling from the unstable fixed point to the stable limit cycle.
The repressilator demonstrates that the same regulatory mechanisms that create switches can, with different network topology, produce oscillations. When built experimentally, it successfully oscillated but with significant cell-to-cell variability—hinting at the stochastic effects we’ll explore in later chapters. To understand why this system oscillates, we can check the stability of the fixed point numerically:
Code
# Check eigenvalues at the fixed pointfrom scipy.optimize import fsolveimport numpy as npalpha, n =100, 2.5p_star = fsolve(lambda p: p - alpha/(1+ p**n), alpha/2)[0]J_entry =-alpha * n * p_star**(n-1) / (1+ p_star**n)**2J = np.array([[-1, 0, J_entry], [J_entry, -1, 0], [0, J_entry, -1]])eigenvals = np.linalg.eigvals(J)print(f"Fixed point: p* = {p_star:.1f}")print(f"Eigenvalues: {eigenvals}")print(f"Real parts: {eigenvals.real}")print(f"Oscillatory? {np.any(eigenvals.real >0)}")
The repressilator’s transition from stability to oscillation occurs through a Hopf bifurcation. To find this transition, we linearize around the symmetric fixed point x_1^* = x_2^* = x_3^* = x^*. The Jacobian matrix at this fixed point is: J = \begin{pmatrix}
-1 & 0 & a \\
a & -1 & 0 \\
0 & a & -1
\end{pmatrix}
where a = -\frac{\alpha n (x^*)^{n-1}}{(1+(x^*)^n)^2} represents the strength of repression, and x^* satisfies x^* = \alpha/(1+(x^*)^n). Since the derivative of a repressing Hill function is always negative, note that a < 0.
The eigenvalues (\lambda) are the roots of the characteristic equation \det(J - \lambda I) = 0, which is (-1-\lambda)^3 + a^3 = 0. The solutions are:
Oscillatory instability occurs when the real part of the complex eigenvalues becomes positive, i.e., \text{Re}(\lambda_{2,3}) > 0. This requires: -1 - \frac{a}{2} > 0 \implies -a > 2 \implies |a| > 2 Because a represents the strength of repression (a negative value), this condition means the repression must be sufficiently strong.
Through analysis of the fixed point equation, this condition translates to the bifurcation boundary: \alpha > \frac{n}{2}\left(\frac{n}{2} - 1\right)^{-(n+1)/n}
This gives two design requirements:
Cooperativity: n > 2 (otherwise the condition |a|>2 can never be met, and no finite bifurcation point exists).
Strong repression: \alpha must exceed the threshold above to ensure the repression slope is steep enough.
Code
def plot_repressilator_stability_analytical():# GeoDataViz Qualitative Palette QUALITATIVE_COLORS = ['#FF1F5B', '#009ADE', '#AF58BA', '#FFC61E', '#F28522', '#00CD6C']# Parameter range for n n_vals = np.linspace(2.01, 8, 1000) # Start just above n=2# Analytical bifurcation boundary alpha_crit = (n_vals/2) * ((n_vals/2-1)**(-(n_vals+1)/n_vals))# Create the plot fig, ax = plt.subplots()# Plot the analytical boundary using red from palette (consistent with positive autoregulation) ax.plot(n_vals, alpha_crit, color=QUALITATIVE_COLORS[0], linewidth=3)# Shade regions using gray scale (consistent with positive autoregulation) ax.fill_between(n_vals, 0, alpha_crit, color='lightgray', alpha=0.7) ax.fill_between(n_vals, alpha_crit, 20, color='gray', alpha=0.7)# Add text labels to the regions ax.text(2.5, 1.5, "Stable (Fixed Point)", fontsize=12, ha='center', va='center') ax.text(5, 15, "Oscillatory\n(Limit Cycle)", fontsize=12, ha='center', va='center')# Add vertical line at n=2 ax.axvline(x=2, color='gray', linestyle='--', linewidth=2, alpha=0.7) ax.text(2.1, 18, 'n = 2 (critical)', fontsize=10, ha='left')# Formatting ax.set_xlabel('Cooperativity (n)') ax.set_ylabel('Synthesis rate (α)') ax.set_title('Repressilator Linear Stability Diagram') ax.grid(True, alpha=0.3) ax.set_xlim(2, 8) ax.set_ylim(0, 20) plt.tight_layout() plt.show()plot_repressilator_stability_analytical()
Figure 1.9: Linear stability analysis for the repressilator. The analytical bifurcation boundary (blue curve) separates stable and oscillatory regions. Oscillations require both n > 2 and α above the threshold.
1.7 From Dynamics to Landscapes
We have analyzed the dynamics of two foundational motifs, one creating switches and the other oscillations, by identifying their stable attractors. But how do these concepts of stability and attraction generalize to the complex networks inside a cell? These small motifs are essential building blocks, but real biological networks can involve hundreds of interacting genes. How can we possibly hope to understand such a high-dimensional system?
To tackle this complexity, we can shift our perspective from individual components to the collective, global behavior. We can ask: what are the stable, long-term outcomes available to the network? These outcomes are the system’s attractors, and the language of landscapes provides an effective way to visualize them.
1.7.1 The Toggle Switch Landscape: A Decision Between Pre-existing Fates
The biologist Conrad Waddington famously proposed this idea in 1957 with his “epigenetic landscape.” He imagined a developing cell as a ball rolling down a grooved, tilted surface where valleys represent stable cell fates—like a liver cell or a neuron—and the ridges between them are barriers to changing that fate.
Waddington’s original epigenetic landscape illustration showing valleys representing cell fates and paths of development.
This metaphor maps directly onto the attractors of our dynamical systems. For instance, the genetic toggle switch exemplifies a decision between two distinct, pre-existing fates. Its phase portrait is a top-down map of a landscape with two valleys, where a cell’s initial conditions determine which valley it rolls into.
Code
import numpy as npimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dfrom scipy.integrate import odeintfrom scipy.optimize import brentqfrom scipy.interpolate import griddatafrom typing import List, Tuple# * * * Model & Simulation Parameters * * *# Toggle switch parameters (bistable regime)alpha, n =5.0, 4.0# Simulation domain [0, box_max] for each proteinbox_max =6.0# Plotting constantsTRAJ_LIFT =0.2# Vertical lift for trajectory visibilityEPS_LOG =1e-1# Small epsilon for log scaling of potential# * * * ODE System for Deterministic Trajectories * * *def f1(p1: np.ndarray, p2: np.ndarray) -> np.ndarray:"""ODE for protein 1. Corrected to use np.maximum for array inputs."""return alpha / (1.0+ np.maximum(p2, 0.0)**n) - np.maximum(p1, 0.0)def f2(p1: np.ndarray, p2: np.ndarray) -> np.ndarray:"""ODE for protein 2. Corrected to use np.maximum for array inputs."""return alpha / (1.0+ np.maximum(p1, 0.0)**n) - np.maximum(p2, 0.0)def toggle_odes(y: Tuple[float, float], t: float) -> List[float]:"""Combined ODE system for the integrator.""" p1, p2 = y# Note: The integrator calls this with scalars, but f1/f2 also support arrays.return [f1(p1, p2), f2(p1, p2)]# * * * Landscape Computation via Fokker-Planck Equation * * *def compute_landscape( N: int=120, D: float=0.04, dt: float=8e-4, steps: int=4000) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:""" Computes the potential landscape U = -log(P_ss) by solving the Fokker-Planck equation for the steady-state probability distribution (P_ss). The equation is dP/dt = -∇·J, where the probability flux J = F*P - D*∇P. 'F' is the deterministic force (from the ODEs) and 'D' is the diffusion coefficient representing noise. This function uses a finite-volume method to find the steady state. """# 1. Set up the grid x_grid = np.linspace(0.0, box_max, N) y_grid = np.linspace(0.0, box_max, N) dx = x_grid[1] - x_grid[0] X, Y = np.meshgrid(x_grid, y_grid, indexing="ij")# 2. Compute the deterministic force field F = (f1, f2) on the grid F1 = f1(X, Y) F2 = f2(X, Y)# 3. Initialize a uniform probability distribution P P = np.ones((N, N), dtype=float) P /= P.sum()# 4. Time-step to find the steady-state distributionfor _ inrange(steps):# Calculate fluxes across the x-faces and y-faces of each grid cell Jx =0.5* (F1[:-1,:] + F1[1:,:]) *0.5* (P[:-1,:] + P[1:,:]) - D * (P[1:,:] - P[:-1,:]) / dx Jy =0.5* (F2[:,:-1] + F2[:,1:]) *0.5* (P[:,:-1] + P[:,1:]) - D * (P[:,1:] - P[:,:-1]) / dx# Pad flux arrays to handle zero-flux boundary conditions Jx_pad = np.zeros_like(P); Jx_pad[:-1, :] = Jx Jy_pad = np.zeros_like(P); Jy_pad[:, :-1] = Jy# Update P using the divergence of the flux divJ = (Jx_pad - np.roll(Jx_pad, 1, axis=0)) / dx +\ (Jy_pad - np.roll(Jy_pad, 1, axis=1)) / dx P -= dt * divJ P[P <0] =0.0# Enforce positivity P /= P.sum() # Conserve total probability# 5. Calculate potential U and log-scaled version Z for plotting U =-np.log(P +1e-12) U -= U.min() Z = np.log10(U + EPS_LOG)return x_grid, y_grid, Z# * * * Main script * * *# Compute the landscape surfacex, y, Z = compute_landscape()Xg, Yg = np.meshgrid(x, y, indexing="ij")# * * * Compute Deterministic Trajectories * * *# Find the unstable saddle point on the diagonal (p1=p2)diag_eq =lambda p: p - alpha / (1.0+ p**n)p_saddle = brentq(diag_eq, 1e-9, box_max -1e-6)# Set initial conditions for trajectoriesinitial_conditions = [ [p_saddle +0.1, p_saddle -0.1], [p_saddle -0.1, p_saddle +0.1], [p_saddle +0.3, p_saddle -0.3], [p_saddle -0.3, p_saddle +0.3], [5.8, 5.5], [5.4, 5.6], [5.2, 5.0]]t_span = np.linspace(0, 40, 400)trajectories = [odeint(toggle_odes, y0, t_span) for y0 in initial_conditions]# Interpolate surface height Z along each trajectory for 3D plottingflat_points = np.column_stack([Xg.ravel(), Yg.ravel()])flat_Z = Z.ravel()# * * * Plotting * * *# GeoDataViz Qualitative PaletteQUALITATIVE_COLORS = ['#FF1F5B', '#009ADE', '#AF58BA', '#FFC61E', '#F28522', '#00CD6C']fig = plt.figure()ax = fig.add_subplot(111, projection='3d')ax.plot_surface(Xg, Yg, Z, cmap='turbo', alpha=0.9, edgecolor='none', rstride=2, cstride=2)# Overlay the trajectoriesfor traj in trajectories: Z_traj = griddata(flat_points, flat_Z, (traj[:, 0], traj[:, 1]), method='linear') valid_points =~np.isnan(Z_traj)ifnot np.any(valid_points): continue ax.plot(traj[valid_points, 0], traj[valid_points, 1], Z_traj[valid_points] + TRAJ_LIFT, color=QUALITATIVE_COLORS[0], lw=2.0) ax.plot([traj[0, 0]], [traj[0, 1]], [Z_traj[0] + TRAJ_LIFT], 'o', color=QUALITATIVE_COLORS[0], ms=6)ax.set_title("Potential Landscape of the Genetic Toggle Switch", pad=16, fontsize=14)ax.set_xlabel('Protein 1 Concentration'); ax.set_ylabel('Protein 2 Concentration')ax.set_zlabel('log₁₀(Potential + ε)'); ax.view_init(elev=38, azim=-56)ax.set_xlim(0, box_max); ax.set_ylim(0, box_max)plt.tight_layout(); plt.show()
Figure 1.10: The potential landscape of the genetic toggle switch. The 3D potential landscape shows the valleys representing the two stable, high-probability cell fates (P1 high/P2 low, and vice versa). Deterministic trajectories (red lines) show the system evolving ‘downhill’ to one of these two attractors, depending on the starting conditions.
1.7.2 Developmental Landscapes: Creating New Fates Through Branching
The toggle switch exemplifies a decision where two potential fates exist from the start. But Waddington’s iconic drawing shows something different: a single fate that splits into two new ones. This process, a pitchfork bifurcation, is characteristic of developmental decisions driven by symmetric competition, such as lateral inhibition. In this process, two initially identical cells interact to push each other into different fates; one might become a neuron while its neighbor is forced to become a skin cell. We can model this with a simple system where a parameter representing the strength of the cell-cell interaction acts as the developmental “time” axis. As this interaction strength increases, the landscape itself changes: the single valley for the identical-cell state splits into two new valleys, representing the two divergent fates.
Wang and colleagues quantified this branching process using a toggle switch where both genes also activate themselves, with slowly decreasing self-activation strength representing developmental time:
The slowly varying parameter a controls self-activation strength. As a decreases, the symmetric fixed point (progenitor state) destabilizes via pitchfork bifurcation, creating two new asymmetric stable states (differentiated fates).
Quantitative Waddington landscape showing developmental bifurcation. As the self-activation parameter decreases (back to front), the single stable valley splits into two, representing cell fate specification. The horizontal axis shows the order parameter x_1 - x_2. Red trajectories show developmental paths. Adapted from Wang et al. (2011).
To understand what drives this developmental bifurcation, we can analyze the fixed point structure at two key timepoints: early development (t=0, undifferentiated state) when a=1.5, and late development (differentiated state) when a \approx 0 after self-activation has decayed.
Code
def plot_waddington_nullclines(ax, a, title):"""Plot nullclines for the Waddington landscape system using contour method."""# GeoDataViz Qualitative Palette QUALITATIVE_COLORS = ['#FF1F5B', '#009ADE', '#AF58BA', '#FFC61E', '#F28522', '#00CD6C']# Parameters from Wang et al. S, n, b, k =0.5, 4, 1.0, 1.0# Grid setup x_range = np.linspace(0, 2.5, 400) x1_grid, x2_grid = np.meshgrid(x_range, x_range)# Calculate derivatives on the grid dx1_dt = a * x1_grid**n / (S**n + x1_grid**n) + b * S**n / (S**n + x2_grid**n) - k * x1_grid dx2_dt = a * x2_grid**n / (S**n + x2_grid**n) + b * S**n / (S**n + x1_grid**n) - k * x2_grid# Plot nullclines as zero contours cs1 = ax.contour(x1_grid, x2_grid, dx1_dt, levels=[0], colors=[QUALITATIVE_COLORS[0]], linewidths=2) cs2 = ax.contour(x1_grid, x2_grid, dx2_dt, levels=[0], colors=[QUALITATIVE_COLORS[1]], linewidths=2)# Add flow field for direction visualization skip =slice(None, None, 20) # Subsample for cleaner arrows ax.streamplot(x1_grid[skip, skip], x2_grid[skip, skip], dx1_dt[skip, skip], dx2_dt[skip, skip], color='gray', linewidth=0.7, density=1.0)# Find and plot fixed points numericallyfrom scipy.optimize import fsolvefrom scipy.linalg import eigvalsdef system(vars): x1, x2 =vars f1 = a * x1**n / (S**n + x1**n) + b * S**n / (S**n + x2**n) - k * x1 f2 = a * x2**n / (S**n + x2**n) + b * S**n / (S**n + x1**n) - k * x2return [f1, f2]def jacobian(x1, x2):"""Calculate Jacobian matrix for stability analysis."""# df1/dx1, df1/dx2, df2/dx1, df2/dx2 df1_dx1 = a * n * x1**(n-1) * S**n / (S**n + x1**n)**2- k df1_dx2 =-b * n * S**n * x2**(n-1) / (S**n + x2**n)**2 df2_dx1 =-b * n * S**n * x1**(n-1) / (S**n + x1**n)**2 df2_dx2 = a * n * x2**(n-1) * S**n / (S**n + x2**n)**2- kreturn np.array([[df1_dx1, df1_dx2], [df2_dx1, df2_dx2]])# Comprehensive search for all equilibria using grid of initial guesses x_vals = np.linspace(0.01, 2.5, 12) # More thorough search equilibria = []for x1_guess in x_vals:for x2_guess in x_vals:try: sol = fsolve(system, [x1_guess, x2_guess], xtol=1e-12)ifall(s >=0for s in sol) andall(s <=2.5for s in sol): residual = system(sol)ifabs(residual[0]) <1e-10andabs(residual[1]) <1e-10:# Check if we already have this point is_new =Truefor existing_eq in equilibria:if (abs(sol[0] - existing_eq[0]) <1e-6andabs(sol[1] - existing_eq[1]) <1e-6): is_new =Falsebreakif is_new: equilibria.append((sol[0], sol[1]))except:continue# Classify and plot equilibria based on stability stable_equilibria = [] saddle_points = []for x1, x2 in equilibria: J = jacobian(x1, x2) eigenvalues = eigvals(J)# Classify based on eigenvaluesifall(eigenvalues.real <0): stable_equilibria.append((x1, x2))elifany(eigenvalues.real >0) andany(eigenvalues.real <0): saddle_points.append((x1, x2))# Plot stable equilibria (filled black circles)for x1, x2 in stable_equilibria: ax.plot(x1, x2, 'ko', markersize=8, markerfacecolor='black', zorder=10)# Plot saddle points (open circles)for x1, x2 in saddle_points: ax.plot(x1, x2, 'ko', markersize=8, markerfacecolor='white', markeredgewidth=2, zorder=10) ax.set_xlabel('Gene 1 ($x_1$)') ax.set_ylabel('Gene 2 ($x_2$)') ax.set_title(title)# Create legend with proper line handlesfrom matplotlib.lines import Line2D legend_elements = [Line2D([0], [0], color=QUALITATIVE_COLORS[0], lw=2, label='$x_1$-nullcline'), Line2D([0], [0], color=QUALITATIVE_COLORS[1], lw=2, label='$x_2$-nullcline'), Line2D([0], [0], marker='o', color='black', lw=0, markersize=8, markerfacecolor='black', label='Stable equilibria'), Line2D([0], [0], marker='o', color='black', lw=0, markersize=8, markerfacecolor='white', markeredgewidth=2, label='Saddle points')] ax.legend(handles=legend_elements, loc='upper right') ax.set_xlim(0, 2.5) ax.set_ylim(0, 2.5) ax.set_aspect('equal') ax.grid(True, alpha=0.3)fig, (ax1, ax2) = plt.subplots(1, 2)plot_waddington_nullclines(ax1, a=1.5, title="(a) Early Development (t=0)")plot_waddington_nullclines(ax2, a=0, title="(b) Late Development (t>>0)")plt.tight_layout()plt.show()
Figure 1.11: Fixed point analysis at developmental extremes. (a) Early development (t=0, undifferentiated): Three stable states include the symmetric undifferentiated state. (b) Late development (differentiated): Only two asymmetric differentiated states remain, forcing cell fate specification.
This analysis reveals the mathematical mechanism behind the landscape bifurcation. Early in development (t=0, undifferentiated state with a=1.5), cells can remain in the symmetric undifferentiated state or transition to either differentiated fate. As development progresses and self-activation decays (t \gg 0, with a \to 0), the undifferentiated state disappears, forcing cells into one of the two differentiated valleys—exactly the developmental commitment captured in the Waddington landscape.
These examples show how the landscape concept provides a powerful framework for understanding cell-fate decisions, whether they involve choosing between existing states or branching into new ones. In this clean, deterministic world, a cell’s fate is entirely predictable. This ordered view provides the essential foundation for our final section, where we return to the toggle switch to confront what happens when the messy, random reality of molecular life is added to the picture.
1.8 Scaling Up the Landscape: Stability in Large Networks
The Waddington landscape gives us a powerful intuition for a two-gene circuit, but can we make quantitative predictions about the stability of a landscape for a network with hundreds of genes? To do so, we must return to the mathematics of stability, combining the Jacobian analysis from our simple motifs with powerful tools from random matrix theory. Does the landscape for a 100-gene network have one deep valley, or is it a rugged, complex terrain with countless possible fates?
To find out, we start with a general model for a network of N genes. For simplicity, we will assume all genes share a uniform degradation/turnover rate, \gamma.
\frac{dx_i}{dt} = \beta_i\, f_i\!\left(\sum_{j=1}^N w_{ij} x_j\right) - \gamma\, x_i
The crucial question is one of stability. As we did for the simpler motifs, we must analyze the system’s behavior near a fixed point, \mathbf{x}^*, by linearizing it. For this analysis, we assume that at least one such fixed point exists. Our goal is not to prove its existence, but to determine its stability if it does exist. This gives us the Jacobian matrix, J, whose entries tell us how a small nudge to one gene affects another.
1.8.1 The Derivation: From the Jacobian to a Single Parameter
The stability of the fixed point is determined by the eigenvalues of the Jacobian; the fixed point is stable only if all eigenvalues have negative real parts. Let’s derive the structure of this matrix. The entry J_{ij} is the partial derivative of dx_i/dt with respect to x_j.
J_{ij} = \beta_i f_i'(u_i^*)\, w_{ij} - \gamma \delta_{ij}, \qquad \text{where } u_i^* = \sum_k w_{ik} x_k^*
In matrix form, this can be written concisely as
\mathbf{J} = \mathbf{D}\mathbf{W} - \gamma\mathbf{I}
This decomposition is key:
\mathbf{W} is the weighted connectivity matrix. Its entries w_{ij} represent the network’s static blueprint—the inherent strength and sign of each regulatory link.
\mathbf{D}=\mathrm{diag}(\beta_i f_i'(u_i^*)) is a diagonal matrix of dynamic sensitivities. It reflects the current operating state of each gene at the fixed point.
The full effective interaction matrix is their product, \mathbf{DW}. This structure means the eigenvalues are directly related by:
\lambda(\mathbf{J}) = \lambda(\mathbf{D}\mathbf{W}) - \gamma
The stability condition, \text{Re}(\lambda(\mathbf{J})) < 0, now becomes \text{Re}(\lambda(\mathbf{D}\mathbf{W})) < \gamma. This simplifies the problem immensely: we just need to find the largest real part of the eigenvalues of the matrix \mathbf{D}\mathbf{W}.
This is where random matrix theory provides a useful shortcut. The theory suggests that for a large, random matrix, its eigenvalues are roughly contained within a disk in the complex plane centered at the origin. The radius of this disk is approximately
R \approx \rho(\mathbf{W})\, \bar d
Here, \bar d is a representative sensitivity from the diagonal of \mathbf{D}. The spectral radius, \rho(\mathbf{W}), is the largest absolute eigenvalue of the weighted connectivity matrix \mathbf{W}. Its value is critically dependent on the network’s topology and the distribution of its static weights w_{ij}. For a large random graph (an Erdős-Rényi network) where the non-zero interaction strengths w_{ij} are drawn from a distribution with mean zero and variance \sigma^2, and each gene regulates k others, the spectral radius can be approximated as \rho(\mathbf{W}) \approx \sigma\sqrt{k}. Other network structures, such as small-world or scale-free networks, have different, well-characterized spectral radii. In all cases, \rho(\mathbf{W}) quantifies the maximum amplification potential inherent in the network’s static wiring, which is then scaled by the dynamic sensitivities in \mathbf{D}.
Our stability condition means the entire disk of eigenvalues must lie to the left of \gamma on the real axis. The most stringent requirement is for the rightmost edge of the disk, so we need its radius to be less than \gamma.
\rho(\mathbf{W})\, \bar d < \gamma
Rearranging this gives us a single, critical “network gain” parameter, g. The system is stable when g < 1:
\boxed{\, g \;=\; \dfrac{\rho(\mathbf{W})\, \bar d}{\gamma} \;=\; \frac{\text{Feedback Strength} \times \text{Sensitivity}}{\text{Turnover Rate}} < 1 \,}
A Worked Example
Let’s make this concrete. For an activating Hill function f(u) = \frac{u^n}{1+u^n}, the derivative f'(u) = \frac{nu^{n-1}}{(1+u^n)^2} reaches its maximum at the switching midpoint. A good approximation for the sensitivity near this point is \bar d \approx \beta \frac{n}{4K_H}, where K_H is the half-activation concentration. Consider a network with:
High cooperativity and synthesis: n=3, \beta=20, K_H=5 \implies \bar d \approx 3.
A fast turnover rate: \gamma=1.
Connectivity where each gene regulates k=8 others with an interaction variance of \sigma^2 = 0.36 (\sigma=0.6).
Plugging these in, the gain is g \approx (1.7 \times 3) / 1 \approx 5.1. Since g > 1, we predict this network will have unstable, complex dynamics. To stabilize it, we would need to increase turnover (\gamma), or decrease sensitivity (\bar d) or feedback strength (\sigma).
1.8.2 Interpreting the Landscape
This single parameter tells us about the character of the network’s landscape:
When g < 1 (Ordered Regime): The system is stable. The stabilizing turnover rate \gamma is strong enough to overcome feedback amplification. The landscape is dominated by a single, stable attractor—one primary valley that the cell will reliably fall into.
When g > 1 (Complex Regime): Feedback is too strong and the system becomes unstable. The primary fixed point becomes a saddle, and the landscape “wrinkles” to create many new, complex attractors. The cell’s fate becomes unpredictable, leading to multistability or oscillations.
A Subtle but Crucial Detail: Scaling Conventions
How the feedback strength \rho(\mathbf{W}) scales with the number of inputs per gene, k, is a critical modeling choice.
Unnormalized edges: If the strength of each regulatory link (w_{ij}) is independent of k, then the total feedback strength grows with connectivity, \rho(\mathbf{W}) \sim \sigma\sqrt{k}. In this case, more connections are inherently destabilizing.
Normalized edges: If the strength of each link is scaled down by connectivity (w_{ij} has variance \sigma^2/k), then the total input is bounded, and feedback strength becomes independent of connectivity, \rho(\mathbf{W}) \sim \sigma. Here, stability depends on the average strength of connections, not their number. Both conventions appear in the literature; it’s essential to be explicit about which you assume.
This perspective shows that even in enormously complex systems, the global landscape is shaped by a fundamental tug-of-war between destabilizing feedback and stabilizing decay.
1.8.3 From Global Statistics to Local Circuits: Why Study Motifs at All?
In the previous section, we saw how tools from random matrix theory can help us understand the stability of a vast, complex gene network. That approach treats the network’s wiring diagram as if it were drawn from a random distribution. But this leads to a crucial question: are biological networks actually random? If they are, then what was the point of carefully analyzing specific, highly structured motifs like the toggle switch and the repressilator?
We can answer this question with a rigorous statistical test. The key is to compare the real biological network to a null model—a randomly generated network with similar baseline properties. If a specific circuit pattern, or subgraph, appears far more often in the real network than in the random one, we can conclude the network is not random and that this pattern is a “network motif” likely selected for a specific function.
1.8.3.1 A Statistical Test for Network Structure
Let’s use the Feed-Forward Loop (FFL) as our test case. An FFL is a three-gene pattern with a specific regulatory structure. One transcription factor (let’s call it X) regulates a second transcription factor (Y), and both X and Y jointly regulate a target gene (Z). This creates two parallel regulatory pathways from X to Z: a direct path (X→Z) and an indirect one that passes through Y (X→Y→Z).
Our null model will be a simple Erdős-Rényi random graph built with parameters derived from the real network:
N = 424 nodes: This number represents the 424 genes and transcription factors that were part of the well-documented E. coli transcriptional regulation network at the time of the study. It’s not the entire genome, but rather the set of components whose interactions were known.
A probability p: This is the probability that a directed edge (a regulatory interaction) exists between any two nodes in our random model. To ensure a fair comparison, p is chosen so that the random network has the same overall connection density as the real one. It’s calculated as the number of real edges (E=519) divided by the total possible number of edges (N(N-1)), giving p = 519 / (424 \times 423) \approx 0.0029.
The expected number of FFLs, \langle n_{\text{FFL}} \rangle, can then be calculated:
Count Potential Triplets: First, we count the number of ways to choose an ordered set of three distinct genes from the N genes in the network (e.g., {X, Y, Z}). This is given by N(N-1)(N-2).
Calculate the Probability of an FFL: For any single triplet to form an FFL, a precise wiring pattern is required. The three necessary edges (X→Y, Y→Z, and X→Z) must exist (each with probability p), while the three other potential edges (Y→X, Z→Y, and Z→X) must not exist (each with probability 1-p). The probability of this exact configuration is therefore p^3(1-p)^3.
Combining these gives the expected number of FFLs in the random network:
\langle n_{\text{FFL}} \rangle = \underbrace{N(N-1)(N-2)}_{\text{Number of ordered triplets}} \cdot \underbrace{p^3(1-p)^3}_{\text{Probability any one triplet is an FFL}}
1.8.3.2 The Verdict: Biological Networks Are Not Random
When this analysis is performed on the E. coli transcriptional network, the result is striking. The actual network contains 40 FFLs, while a random network of the same size and connection density would be expected to have only 7 \pm 3 FFLs by chance.
This significant over-representation is the statistical proof we were looking for. The wiring of a real gene network is fundamentally non-random.
This is precisely why we study motifs. They are the recurring, statistically significant building blocks that evolution has apparently favored and preserved for their specific functional roles—like creating switches, filtering noise, or generating oscillations. Analyzing a network through its motifs allows us to move beyond a view of the system as a random tangle of wires and instead see it as a purposefully designed circuit built from a library of fundamental components. For more details on this, see the foundational work (Milo et al. 2002).
1.9 The Limits of Determinism
The ODE analysis we’ve developed is a powerful lens. It gives us the compelling and intuitive language of landscapes, where cell fates are valleys and decisions are paths rolling downhill. In this deterministic world, a cell’s fate is sealed by its initial conditions; start on one side of a ridge, and you are destined for the corresponding valley.
But this deterministic picture has a crack in its foundation. It assumes that molecules exist in continuous concentrations and that reactions happen at smooth, predictable rates. The reality inside a single cell is far messier. Life is fundamentally discrete and probabilistic. A gene doesn’t transcribe smoothly; it fires off an mRNA molecule in a random burst. A protein doesn’t decay away in a gentle exponential curve; each individual molecule persists for a random lifetime before it’s degraded.
When molecule numbers are small—as they often are for transcription factors—these random, discrete events create intrinsic noise that can dramatically change a circuit’s behavior. To see how, let’s revisit the toggle switch, a circuit whose entire purpose is to make a clean, robust, binary decision.
The ODE model makes an absolute prediction: a cell will pick a state (P1 high or P2 high) and stay there forever. But what happens if we add randomness to our deterministic framework? We can simulate the system with the same underlying dynamics:
\frac{dx}{dt} = f(x) + \text{noise}
We’ll carefully construct the noise term to reflect the randomness inherent in molecular processes, though we won’t yet detail exactly how this noise arises (that’s the subject of our next chapter). What does this noisy version reveal?
Code
import numpy as np import matplotlib.pyplot as pltfrom scipy.optimize import fsolveimport matplotlib.gridspec as gridspecdef simulate_stochastic_toggle(p0, t_max, dt, alpha, n, K, volume=1.0):""" Simulates the genetic toggle switch using a continuous stochastic model (SDE). p0: initial protein counts [p1, p2] t_max: maximum simulation time dt: time step for the simulation alpha, n, K: parameters for the Hill function dynamics volume: system volume, used to control the noise magnitude (smaller volume = more noise) """ times = np.arange(0, t_max, dt) proteins = np.zeros((len(times), 2)) proteins[0, :] = p0 p = np.array(p0, dtype=float)for i inrange(1, len(times)): p_safe = np.maximum(0, p) # Ensure protein counts are non-negative# Deterministic part (drift) drift = np.array([ alpha / (1+ (p_safe[1] / K)**n) - p_safe[0], alpha / (1+ (p_safe[0] / K)**n) - p_safe[1] ])# Stochastic part (diffusion) diffusion_mag = np.sqrt([ alpha / (1+ (p_safe[1] / K)**n) + p_safe[0], alpha / (1+ (p_safe[0] / K)**n) + p_safe[1] ])# Euler-Maruyama step noise_term = (1.0/ np.sqrt(volume)) * diffusion_mag * np.sqrt(dt) * np.random.normal(size=2) p += drift * dt + noise_term proteins[i, :] = preturn times, proteins# * * * Parameters * * *alpha, n, K =100, 2.5, 40# A small effective volume amplifies noise to make switching visiblevolume =0.75p_max = alpha +20# * * * Simulation * * *# Find the high-P1, low-P2 stable fixed point to use as a starting pointdef toggle_system(vars): p1, p2 =vars eq1 = alpha / (1+ (p2/K)**n) - p1 eq2 = alpha / (1+ (p1/K)**n) - p2return [eq1, eq2]p_high_low = fsolve(toggle_system, [alpha*0.8, alpha*0.2])# Run a long trajectory that shows switchingnp.random.seed(45)t_traj, p_traj = simulate_stochastic_toggle(p0=p_high_low, t_max=5000, dt=0.2, alpha=alpha, n=n, K=K, volume=volume)# * * * Plotting Setup * * *# GeoDataViz Qualitative PaletteQUALITATIVE_COLORS = ['#FF1F5B', '#009ADE', '#AF58BA', '#FFC61E', '#F28522', '#00CD6C']fig = plt.figure()gs = gridspec.GridSpec(2, 2, figure=fig)ax_top = fig.add_subplot(gs[0, :])ax_bl = fig.add_subplot(gs[1, 0])ax_br = fig.add_subplot(gs[1, 1])fig.suptitle("The Deterministic Prediction vs. Stochastic Reality", fontsize=16)# * * * Panel (a): Time Series Plot * * *ax_top.plot(t_traj, p_traj[:, 0], lw=1.5, label='Protein 1', color=QUALITATIVE_COLORS[0])ax_top.plot(t_traj, p_traj[:, 1], lw=1.5, label='Protein 2', color=QUALITATIVE_COLORS[1])ax_top.set_xlabel('Time')ax_top.set_ylabel('Protein Count')ax_top.set_title('(a) Single Cell Time Series')ax_top.legend()ax_top.grid(True, alpha=0.3)ax_top.set_xlim(0, t_traj[-1])# * * * Panel (b): Phase Portrait * * *p_range = np.linspace(0.01, p_max, 500)p1_null = alpha / (1+ (p_range / K)**n)p2_null = alpha / (1+ (p_range / K)**n)ax_bl.plot(p1_null, p_range, color=QUALITATIVE_COLORS[0], linewidth=2.5, label='p1-nullcline')ax_bl.plot(p_range, p2_null, color=QUALITATIVE_COLORS[1], linewidth=2.5, label='p2-nullcline')# Find and plot fixed pointssymmetric_func =lambda p: p - alpha / (1+ (p / K)**n)p_symmetric = fsolve(symmetric_func, K)[0]p_low_high = fsolve(toggle_system, [alpha*0.2, alpha*0.8])ax_bl.plot(p_high_low[0], p_high_low[1], 'ko', markersize=9, label='Stable States', zorder=10)ax_bl.plot(p_low_high[0], p_low_high[1], 'ko', markersize=9, zorder=10)ax_bl.plot(p_symmetric, p_symmetric, 'o', color='white', markeredgecolor='k', markeredgewidth=2, markersize=9, label='Unstable State', zorder=10)# Down-sample trajectory for cleaner plottingstep =max(1, len(p_traj) //1000)p_traj_ds = p_traj[::step]ax_bl.plot(p_traj_ds[:, 0], p_traj_ds[:, 1], color=QUALITATIVE_COLORS[5], lw=1.0, alpha=0.9, label='Single Cell Path')ax_bl.set_xlabel('Protein 1 count')ax_bl.set_ylabel('Protein 2 count')ax_bl.set_title('(b) A Single Cell\'s Journey')ax_bl.legend(loc='upper right')ax_bl.grid(True, alpha=0.3)ax_bl.set_xlim(-5, p_max)ax_bl.set_ylim(-5, p_max)# * * * Panel (c): Population Histogram * * *all_p1_endpoints = []np.random.seed(123)for i inrange(500): p0_dist = p_high_low if np.random.rand() >0.5else p_low_high t_dist, p_dist = simulate_stochastic_toggle(p0=p0_dist, t_max=500, dt=0.1, alpha=alpha, n=n, K=K, volume=volume) all_p1_endpoints.append(p_dist[-1, 0])ax_br.hist(all_p1_endpoints, bins=60, density=True, alpha=0.6, color=QUALITATIVE_COLORS[5], edgecolor='none', label='Stochastic Population')mean_val = np.mean(all_p1_endpoints)ax_br.axvline(mean_val, color=QUALITATIVE_COLORS[2], linestyle='-', linewidth=3.5, label=f'Population Mean ({mean_val:.1f})')ax_br.axvline(p_symmetric, color=QUALITATIVE_COLORS[3], linestyle='--', linewidth=2.5, label=f'Unstable Point ({p_symmetric:.1f})')ax_br.set_xlabel('Protein 1 count')ax_br.set_ylabel('Probability Density')ax_br.set_title('(c) Population View')ax_br.legend()ax_br.grid(True, alpha=0.3)plt.tight_layout(rect=[0, 0.03, 1, 0.95])plt.show()
Figure 1.12: Stochastic dynamics of the genetic toggle switch. (a) Time series of a single stochastic trajectory showing spontaneous switching between high P1 (blue) and high P2 (red) states. (b) The same trajectory plotted in the phase plane, overlaid on the deterministic nullclines. Intrinsic noise allows the cell to cross the separatrix and jump between stable states (black circles). (c) The bimodal probability distribution for Protein 1 from many simulations. The population average (red line) falls on the unstable saddle point (gray dashed line), a state individual cells rarely occupy.
The result is a complete reversal of the deterministic prediction. The stochastic simulation reveals that the ODE model is not just slightly inaccurate—it is profoundly incomplete.
It cannot describe switching. The most striking discovery is that noise allows the system to switch between stable states. The deterministic model, which predicts that fates are permanent, misses this essential dynamic behavior.
It cannot predict the distribution’s shape. The ODE model offers no information about the probability of being in the “high” or “low” state, nor can it tell us about the variance or shape of the fluctuations around those states.
The average is a lie. Perhaps most damningly, the population average concentration—the very quantity the ODE model is supposed to describe—falls at the unstable fixed point. If you were to only measure the average protein level across a population of cells, you would conclude that the typical cell exists in a state that almost no single cell ever actually visits.
But this raises deeper questions: what does it even mean for a concentration to fluctuate by a fractional amount when there are only ~10 molecules in the cell? Can we meaningfully speak of x(t) = 9.3 proteins? These conceptual puzzles point to the need for a fundamentally discrete description of molecular processes—one that tracks individual reaction events rather than smooth concentration changes.
This is the core motivation for moving beyond deterministic models. To understand the distributions, the switching, and the true probabilistic nature of a cell’s state, we need a new toolkit. In the next chapter, we will build that toolkit by developing the Chemical Master Equation, the fundamental framework for stochastic chemical kinetics.
1.10 Chapter Summary
In this chapter, we explored the classical, deterministic view of gene regulation using ODEs. We saw how this framework reveals complex behaviors like bistability and oscillation in key circuit motifs and introduced the influential attractor landscape metaphor. However, we then confronted the fundamental limitation of this approach: the average behavior predicted by ODEs can be a deeply misleading description of a system where noise and discreteness are dominant. The deterministic model cannot predict the probability of being in a “high” or “low” state, nor can it describe how a cell might randomly transition between them. To answer these questions, we need a new toolkit, which we will develop in the next chapter by introducing the Chemical Master Equation, the fundamental equation of stochastic chemical kinetics.
Gardner, Timothy S, Charles R Cantor, and James J Collins. 2000. “Construction of a Genetic Toggle Switch in Escherichia Coli.”Nature 403 (6767): 339–42. https://doi.org/10.1038/35002131.
Milo, Ron, Shai Shen-Orr, Shalev Itzkovitz, Nadav Kashtan, Dmitri Chklovskii, and Uri Alon. 2002. “Network Motifs: Simple Building Blocks of Complex Networks.”Science 298 (5594): 824–27. https://doi.org/10.1126/science.298.5594.824.
Ozbudak, Ertugrul M, Mukund Thattai, Han N Lim, Boris I Shraiman, and Alexander Van Oudenaarden. 2004. “Multistability in the Lactose Utilization Network of Escherichia Coli.”Nature 427 (6976): 737–40. https://doi.org/10.1038/nature02298.
Wang, Jin, Kun Zhang, Li Xu, and Erkang Wang. 2011. “Quantifying the Waddington Landscape and Biological Paths for Development and Differentiation.”Proceedings of the National Academy of Sciences 108 (20): 8257–62. https://doi.org/10.1073/pnas.1017017108.