The membrane as an electrical circuit
In 1952 Alan Hodgkin and Andrew Huxley published a model of the squid giant axon built from a simple physical idea: the cell membrane, being a thin insulating layer separating charge, behaves like a capacitor with capacitance Cm ≈ 1 μF/cm². Embedded in it are ion channels — proteins that open and close in response to voltage — which behave like voltage-dependent resistors. The driving force on each ion species is the gap between the membrane potential V and that ion's own equilibrium (Nernst) potential E. Put those pieces together and the membrane voltage obeys a current-balance equation:
C_m·dV/dt = I_ext − I_Na − I_K − I_L I_Na = g_Na·m³h·(V − E_Na) // sodium current I_K = g_K·n⁴·(V − E_K) // potassium current I_L = g_L·(V − E_L) // leak current
Hodgkin and Huxley measured the sodium and potassium conductances directly with voltage-clamp experiments on the squid axon and fit the numerical constants that still reproduce their original results today: Cm = 1 μF/cm², g_Na = 120, E_Na = +50 mV, g_K = 36, E_K = −77 mV, g_L = 0.3, E_L = −54.4 mV, giving a resting potential around −65 mV.
Four coupled equations, three gates
The full system has one equation for voltage and three more for the gating variables m, h and n — each is the probability, between 0 and 1, that a particular gate in an ion channel protein is open. The sodium channel needs three m-gates and one h-gate open together, giving the m³h term; the potassium channel needs four identical n-gates, giving n⁴. Each gate relaxes toward a steady-state value with its own voltage-dependent time constant, governed by empirical rate functions α(V) and β(V) fit to the original voltage-clamp data:
dm/dt = α_m(V)(1−m) − β_m(V)·m dh/dt = α_h(V)(1−h) − β_h(V)·h dn/dt = α_n(V)(1−n) − β_n(V)·n
The h gate is the interesting one: it starts mostly open at rest (around 0.6) and closes as the membrane depolarises, cutting off the sodium current and terminating the spike even while the stimulus is still present — that is what makes an action potential a self-limiting pulse rather than a runaway.
Integrating a stiff system: why RK4
A spike lasts about a millisecond, and the fastest gate, m, has a time constant near 0.1 ms at threshold — a workable step size is dt = 0.01 ms. Plain Euler integration is unstable on this system at that step size; the classic fourth-order Runge-Kutta method (RK4) evaluates the derivative four times per step and stays both stable and accurate:
k1 = f(state) k2 = f(state + dt/2·k1) k3 = f(state + dt/2·k2) k4 = f(state + dt·k3) state_next = state + dt/6·(k1 + 2k2 + 2k3 + k4)
Applied to all four state variables — V, m, h, n — together, this is the integrator that reproduces Hodgkin and Huxley's 1952 curves to within numerical precision.
The four phases of a spike
Inject a brief current pulse and the membrane potential runs through a characteristic sequence. At rest (≈ −65 mV) the inward sodium and outward potassium currents balance, with m ≈ 0.05, h ≈ 0.60, n ≈ 0.32. During the rising phase, depolarisation opens the fast m gates almost immediately, driving a surge of sodium influx while h is still open. At the peak (+30 to +40 mV) the h gate closes, cutting off sodium current, while the slower n gates finish opening and potassium efflux begins repolarisation. The undershoot follows as n closes slowly, briefly hyperpolarising the membrane below rest and creating a refractory period during which a second spike cannot fire. Below roughly −55 mV a stimulus simply decays back to rest; above it, positive feedback between rising voltage and further sodium-channel opening takes over regardless of stimulus strength — the all-or-nothing property that makes a nerve impulse a genuine binary signal.
Beyond a single neuron
Couple many HH neurons on a grid through diffusive coupling and the system becomes an excitable medium, adding a diffusion term to the voltage equation: C_m·∂V/∂t = D∇²V − I_Na − I_K − I_L + I_ext. In two dimensions a broken planar wave can curl into a re-entrant spiral — the computational analogue of dangerous cardiac arrhythmias such as ventricular fibrillation. For large-scale tissue simulations, the full four-variable model is often replaced by the two-variable FitzHugh-Nagumo reduction, which keeps the excitability and bifurcation structure at a fraction of the cost, while more detailed work adds multi-compartment dendrites via the cable equation, or replaces the smooth gating ODEs with stochastic Markov-chain channel openings to capture channel noise near threshold.
Frequently asked questions
What do the gating variables m, h and n actually represent?
Each is the probability, between 0 and 1, that a particular gate inside a voltage-gated ion channel protein is open. The sodium channel needs three independent m-gates and one h-gate open together (giving the m³h term); the potassium channel needs four identical n-gates open together (giving the n⁴ term). They are not physical positions, just statistical fractions of open gates across the whole population of channels.
Why does the Hodgkin-Huxley model need RK4 instead of simple Euler integration?
The fastest gate variable, m, has a time constant near 0.1 ms at threshold, and the whole spike lasts about a millisecond. Euler integration at a workable step size is numerically unstable on this system — the fast dynamics blow up. RK4 evaluates the derivatives four times per step and is fourth-order accurate, which keeps the simulation stable at a practical step size such as 0.01 ms.
Why is the action potential all-or-nothing?
Below roughly −55 mV the depolarising sodium current and the repolarising leak and potassium currents are still balanced, so a sub-threshold stimulus decays back to rest. Above that threshold, the positive feedback between rising voltage and further-opening sodium gates dominates and the membrane rockets to the sodium equilibrium potential regardless of how much stronger the stimulus was — an emergent property of the non-linear coupling between m, h and V, not a separate rule.
Try it live
Inject current into Hodgkin-Huxley Neuron and watch the m, h and n gates drive the spike, the refractory period and repetitive firing in real time. Everything runs client-side in your browser.
▶ Open Hodgkin-Huxley Neuron simulation