Stochastic thermodynamics is just energy bookkeeping for a system too small to be smooth: moving its energy landscape does work; random collisions trade heat; and entropy measures how much more plausible its movie is forward than backward.
A bath does two things at once: it pulls back and it kicks
Our one example is a bead in water, held near the center of an optical trap. The trap pulls a displaced bead home. Meanwhile, water molecules hit it unpredictably. A large object averages those hits away; this bead cannot. Its position is therefore a jagged, random path.
The two bath effects have names: friction is the systematic pull that removes motion, and thermal noise is the random kick that restores it. They must come together. A bath with drag but no kicks would cool the bead to a point; kicks with no drag would heat it forever.
Formal version
In the overdamped limit (inertia is negligible), position \(x\) follows the Langevin equation \(\dot x=-\mu\,\partial_xU(x)+\sqrt{2\mu k_BT}\,\xi(t)\). Here \(U\) is the trap energy, \(\mu\) is mobility, \(T\) is bath temperature, and \(\xi\) is idealized white noise. The linked strengths \(\mu\) and \(2\mu k_BT\) are the fluctuation–dissipation relation.
Warmth decides how widely the bead explores the landscape
Let the trap energy be a bowl, \(U(x)=\tfrac12kx^2\). Far from the middle costs more energy, so the pull favors the center. Noise keeps tossing the bead outward. At equilibrium, these opposing tendencies balance: the bead keeps moving, but its distribution stops changing.
That settled distribution is the Boltzmann rule: a place costs energy \(U\), so it is weighted by \(e^{-U/(k_BT)}\). This is not an extra law pasted onto the motion. It is what the matched kicks and drag produce after a long time.
Why the exponential has this shape
At equilibrium, probability cannot keep flowing from one position to another. The force \(-\partial_xU\) pulls probability downhill; diffusion pushes it from crowded to sparse places. Setting those two flows equal gives \(\partial_xp=-(\partial_xU/k_BT)p\). Dividing by \(p\) and integrating gives \(p(x)\propto e^{-U(x)/(k_BT)}\). For this widget's \(k=1\) and \(T=0.45\), the variance is \(k_BT/k=0.45\), so its standard deviation is \(\sqrt{0.45}=0.671\).
Heat moves the bead; work moves the bowl
Now slide the trap center to the right. There are two ways the bead's energy can change. If the bead shifts around inside an unchanged bowl, energy crossed the bead–bath boundary: that is heat, \(Q\). If the bowl itself shifts while the bead is momentarily where it is, an external hand changed the energy landscape: that is work, \(W\).
This distinction is the whole first law for one trajectory. It does not say each contribution is smooth or positive. It says the ledger closes exactly: \(\Delta U=W+Q\).
The discrete ledger used by the simulation
At each time step first change the center \(\lambda\) while holding \(x\) fixed: \(w=U(x,\lambda_{\rm new})-U(x,\lambda_{\rm old})\). Then update \(x\) in the fixed new bowl: \(q=U(x_{\rm new},\lambda_{\rm new})-U(x,\lambda_{\rm new})\). Adding those definitions telescopes over all steps, so \(W+Q=U_{\rm final}-U_{\rm initial}\) by construction—not approximately.
A fast pull leaves a telltale lag
If the trap moves slowly, the bead has time to re-equilibrate and almost follows it. If it moves quickly, the bead lags behind. The extra work paid by that lag is called dissipation: energy that ends up as heat in the bath.
At this scale, a strange thing becomes visible: occasionally a lucky sequence of kicks helps the pull, making the work unusually small. So the second law is not “negative entropy production never happens.” It is sharper: forward-looking movies are exponentially more likely than their time-reversed counterparts. Large systems hide these rare reversals; this bead lets you see why they are allowed.
The trajectory-level second law
For a system starting in equilibrium, Jarzynski’s equality says \(\langle e^{-W/(k_BT)}\rangle=e^{-\Delta F/(k_BT)}\). Our shifted harmonic trap has the same shape before and after, so \(\Delta F=0\). Jensen’s inequality then gives \(\langle W\rangle\ge0\). The exponential average is sensitive to rare low-work trajectories—the very “lucky pulls” that make the equality compatible with a positive mean.
The bookkeeping makes the arrow precise
The bath makes a trajectory noisy, not lawless. Its matched drag and kicks produce the Boltzmann distribution. When we move the landscape, the energy change separates cleanly into work from the hand and heat from the bath. A rushed change leaves extra heat behind, making the forward movie statistically easier to tell from its reverse. That is stochastic thermodynamics: ordinary thermodynamics, but with every fluctuation left in the frame.
Where this shows up
- Molecular motors: ATP changes a protein’s energy landscape; stochastic work and heat decide how reliably it walks.
- Single-molecule pulling: optical tweezers pull DNA or proteins quickly, then use many noisy work measurements to infer equilibrium free-energy differences.