Vilas Winstein: Simulating Phase Changes with the Boltzmann Distribution

A simple lattice model connects temperature, entropy and energy to liquid–vapor transitions, critical points and magnetism.

VWVilas Winstein연사
채널
3Blue1Brown
게시일
2025년 8월 28일
영상
41:03
읽기
8분
슬라이드
10
원문
영어
YouTube에서 열기
스크롤하면 영상이 오른쪽 아래로 작아져 계속 재생됩니다. 자막은 읽기 언어를 따릅니다.
읽기 언어2개 언어로 읽을 수 있음
이 글은 아직 한국어 번역이 없어 영어 원문으로 표시합니다.
요약

30초 요약

In this guest lesson for 3Blue1Brown, Vilas Winstein builds a liquid–vapor simulation from statistical mechanics. He derives the Boltzmann distribution, explains a sampling algorithm, and uses the model to explore metastability, universality and related magnetic systems.

  1. 1A lattice fluidOccupied and empty pixels model molecules; temperature and chemical potential control the simulation.
  2. 2Energy versus entropyBoltzmann weights and the number of configurations combine into free energy E − TS.
  3. 3Defining temperatureWhen two systems exchange energy, the entropy derivative with respect to energy equalizes; it is inverse temperature.
  4. 4Sampling the distributionRandom pixel swaps, accepted with probabilities derived from Boltzmann weights, approximate equilibrium.
  5. 5Metastability and criticalityDroplets can require a kickstart, while at the critical point structures appear across scales.
  6. 6The same model as a magnetOccupied and empty pixels can be reinterpreted as spins in the Ising model.

핵심 정리

  1. Phase describes equilibrium behavior, and changing parameters can produce abrupt transitions between macrostates.
  2. Temperature mediates a competition between lower energy and the greater number of high-entropy configurations.
  3. The Boltzmann distribution follows from treating a small system as coupled to a much larger heat bath.
  4. Markov chain Monte Carlo samples configurations without enumerating all possible microstates.
  5. A simplified lattice can reproduce qualitative phase behavior shared by much more complicated systems.
전문

챕터별로 다듬은 전문 읽기

원본 자막만 보기
01

What is a phase transition?

Winstein introduces equilibrium phases and the liquid–vapor lattice model.

This lesson builds a simulation of a liquid–vapor phase transition. To understand it, we will derive the Boltzmann distribution, construct a sampling algorithm and explore the surprising behavior it produces. A second video on Spectral Collective takes up a simpler model that can be analyzed more completely.

Phase transitions are not chemical reactions: ice, liquid water and steam all contain H₂O. They differ in how molecules interact and in their large-scale behavior. Ice has a rigid structure, water can transmit ripples, and a small local disturbance in steam has little effect far away.

Water phase diagram
슬라이드 1 / 10Water phase diagramThe diagram separates ice, liquid water and steam.

A phase diagram describes equilibrium behavior after a system has had time to settle at a given temperature and pressure. Crossing a phase boundary produces a discontinuity in equilibrium properties; it does not mean that boiling or freezing must happen instantaneously in real time.

At sufficiently high temperature and pressure, water can become a supercritical fluid. One can move continuously through that region from liquid-like to gas-like behavior without crossing a phase boundary. Our simplified model focuses on this part of the diagram.

Lattice fluid
슬라이드 2 / 10Lattice fluidOccupied and empty sites represent molecules and vacancies near the critical point.

In the simulation, each blue pixel represents a molecule and each white pixel an empty site. Temperature T is one control; the other is chemical potential, which controls particle exchange. The computer array has fixed size, so varying molecule number is easier than changing volume to impose pressure.

Temperature is paired with energy, pressure with volume, and chemical potential with molecule number. Fixing one of these control variables allows its corresponding quantity to fluctuate. Higher chemical potential generally favors more molecules, increasing density somewhat like compressing a fluid.

Temperature controls how strongly energy matters relative to randomness. At high temperature the density changes smoothly as chemical potential varies, like a supercritical fluid. At low temperature, crossing a threshold produces a jump between low-density gas and high-density liquid.

The simulation itself still changes gradually: when the phase transition is underway, liquid-like and gas-like regions coexist, separated by a well-defined interface. To explain why those patterns appear, we need the Boltzmann law.

02

Boltzmann weights and free energy

Random microstates explain how energy and entropy compete.

The Boltzmann law assigns probabilities to molecular configurations, or microstates. This randomness need not come from quantum mechanics: even a deterministic many-particle system is too complicated to track exactly, so a probability distribution can represent our uncertainty about its microscopic state.

Tracking 20 colliding particles might already be difficult, and a teaspoon of water contains roughly 10²³ molecules. Fortunately, we do not need every position and velocity to distinguish water from ice. Macroscopic behavior depends on statistical patterns, not complete knowledge of the microstate.

Treating microstates probabilistically is a useful postulate, though proving that the approximation works in general is a difficult mathematical problem. The distribution gives a configuration x probability proportional to exp(−E(x)/T), using units in which Boltzmann’s constant is one.

A lower-energy microstate has a higher individual weight, but that does not mean the lowest-energy level is always the most likely. We must also count how many microstates have each energy E. If Ω(E) is that set, its total weight is proportional to |Ω(E)| exp(−E/T).

Entropy and energy-level probability
슬라이드 3 / 10Entropy and energy-level probabilityThe number of microstates and the Boltzmann weight determine an energy level’s probability.

The entropy S(E) is the logarithm of the number of configurations at energy E. The most likely energy level maximizes S − E/T, or equivalently minimizes free energy E − TS. At low temperatures the energy term dominates; at high temperatures the multiplicity represented by entropy matters more.

Consider a fixed number of molecules on a grid. A site holds at most one molecule, and each neighboring pair contributes −1 to the energy. This mimics a preference for nearby molecules while keeping the model simple; kinetic energy is ignored, so the simulation is not a detailed model of real fluid motion.

Interactions in the lattice model
슬라이드 4 / 10Interactions in the lattice modelAdjacent occupied sites lower the model’s energy.

At high temperature, configurations look gas-like: molecules are dispersed, with relatively high energy and many possible arrangements. At low temperature they form a droplet, lowering energy by creating more neighboring pairs, but also reducing entropy because comparatively few arrangements resemble a droplet.

There is no configuration that simultaneously achieves both the lowest energy and the greatest entropy. The competition between these tendencies, controlled by temperature, is central to the phase behavior. We can now ask where the Boltzmann weights themselves come from.

03

Temperature and the Boltzmann law

A heat bath and entropy counting motivate temperature and derive the distribution.

Start with an isolated system at fixed energy and assume its accessible microstates are equally likely. This equal-probability assumption is the starting point for counting configurations, not a consequence of simply knowing the energy alone.

Put two such systems into contact so that they can exchange energy while the combined system remains isolated. The number of combined microstates for a particular energy split is the product of the numbers available to each subsystem, so their entropies add.

If shifting a small amount of energy from one subsystem to the other increases the total entropy, that direction has more compatible combined states. At equilibrium there is no net preferred direction, so the derivatives of the two entropies with respect to their energies are equal.

Two systems exchanging energy
슬라이드 5 / 10Two systems exchanging energyCounting combined microstates explains the preferred direction of energy transfer.

Energy normally flows from hot to cold, whereas it flows toward the larger entropy derivative. Thus the derivative ∂S/∂E is inverse temperature, 1/T in these units. At low temperature a small energy increase opens up relatively more configurations; a hotter system can donate energy to increase total entropy.

To keep a small system at temperature T, place it in contact with a much larger heat bath. Their temperatures equalize, while the reservoir is so large that exchanging energy barely changes its own temperature.

A small system in a heat bath
슬라이드 6 / 10A small system in a heat bathA large reservoir sets the small system’s temperature.

For a particular small-system microstate x, the compatible bath must have total energy minus E(x). Because combined microstates are equally weighted, the chance of x is proportional to the number of compatible bath states, or the exponential of the bath’s entropy at that remaining energy.

The bath’s entropy changes approximately linearly over the relevant energy range, with slope 1/T. The factor independent of x cancels in normalization, leaving P(x) proportional to exp(−E(x)/T). This is the Boltzmann distribution sampled by the simulation.

A formula alone does not make sampling easy: the number of possible configurations grows exponentially. Instead of enumerating them, we can make a sequence of small random changes, analogous to shuffling cards until their arrangement is sufficiently mixed.

04

Sampling with Monte Carlo

The lesson constructs a practical random-swap algorithm.

For the fixed-particle model, choose two random pixels. If one is occupied and the other empty, consider swapping them. The ratio of the Boltzmann probabilities before and after the swap is Q = exp((E(x) − E(x′))/T), so choose the swapped state with probability Q/(1+Q).

Random-swap sampling
슬라이드 7 / 10Random-swap samplingThe ratio of Boltzmann weights determines the probability of swapping two sites.

Repeat this step to construct a Markov chain Monte Carlo algorithm known here as Kawasaki dynamics. The energy difference depends only on the nearby pixels, making each step cheap. Given enough steps, the random walk samples approximately from the desired equilibrium distribution.

Swapping only neighboring pixels would look more like physical motion, but typically takes longer to mix. The long-distance swap is a sampling device, not a literal simulation of molecules teleporting. In either version, changing temperature produces dispersed gas-like and clustered liquid-like states over time.

05

Chemical potential and a phase diagram

Allowing particle exchange yields a two-parameter simulation.

The first model has only temperature as a control. To build a two-dimensional phase diagram without changing the grid’s size, allow particles to pass between the system and a reservoir. The quantity that equalizes when a particular kind of particle can be exchanged is its chemical potential.

For this convention, chemical potential C is −T times the derivative of entropy with respect to particle number. Unlike temperature in this presentation, it can be negative. A system exchanging both energy and particles with a large reservoir has weight proportional to exp((−E + CN)/T).

A positive chemical potential favors configurations with more particles. Now each update can add or remove a molecule at one pixel, rather than swapping two. This single-site approach is Glauber dynamics; careful parallelization makes a larger GPU simulation practical.

The phase diagram maps temperature and chemical potential to density. Above the critical temperature, density varies smoothly; below it, a line separates low-density gas and high-density liquid. This resembles the corresponding region of the water phase diagram even though the model is drastically simplified.

Real molecules move in three dimensions, have complicated shapes and interactions, and possess kinetic energy. The simple model nevertheless reproduces qualitative features of phase change. Universality is the idea that a small number of fundamental ingredients can govern shared large-scale behavior despite different microscopic details.

06

Metastability, criticality and related models

The model connects droplets and critical behavior to magnets and universality.

Below the critical temperature, liquid droplets or gas bubbles form as the phase boundary is crossed. At very low temperature the square lattice makes droplets more square; at higher subcritical temperatures they appear rounder. Their shapes can be studied mathematically using the Wulff construction.

Crossing the boundary slightly may leave the system trapped in the gas-like state. Small droplets shrink before becoming stable, but an artificially inserted droplet above a critical size can grow and transform the system. This long-lived departure from equilibrium is metastability, analogous to supercooled water freezing after a disturbance.

Critical-point structures
슬라이드 8 / 10Critical-point structuresThe simulation shows clusters at multiple scales.

At the critical point, clusters appear on many scales and the image has approximate self-similarity under coarse-graining. Away from the critical point, zooming out instead produces a more uniform picture. Winstein mentions the critical-brain hypothesis as a speculative connection beyond the lesson’s scope.

The liquid–vapor lattice is also an Ising model of a magnet: identify an occupied site with an up spin and an empty site with a down spin, and reinterpret chemical potential as an external magnetic field. Fixed opposing spin directions at the borders are Dobrushin boundary conditions.

Liquid–vapor and Ising models
슬라이드 9 / 10Liquid–vapor and Ising modelsOccupied and empty sites correspond to up and down spins.

If spins can point in any direction in a plane, the related XY model behaves differently in two dimensions. Its colored direction field can form vortices of opposite orientations: opposite types attract and like types repel, in an analogy to electrical forces.

The XY model
슬라이드 10 / 10The XY modelColors represent spin directions in a two-dimensional field.

These models can also be studied in higher dimensions and other geometries. Even the three-dimensional version of the simple liquid–vapor model is much less completely understood: unlike in two dimensions, the critical temperature is known numerically rather than by the same exact formula.

A rigorous microscopic model of real water would need to account for molecular geometry, electrical asymmetry and free motion in three dimensions. Mathematics often gains understanding by simplifying a system while keeping the features that matter. The follow-up video simplifies the lattice model further to show rigorously how its phases arise.

같은 채널의 다른 글

슬라이드 20장40:44EN
3Blue1Brown· 2026년 10월 16일Grant Sanderson: There's never been a better time to go into mathGrant Sanderson, Constantin Kogler · 3Blue1BrownStudents fear AI has solved mathematics. Grant Sanderson argues the opposite: even if machines prove theorems better than we do, the institution of math stays valuable—and this is a rare moment when newcomers can reshape it.MathematicsAI for scienceHuman-AI Collaboration+2
슬라이드 29장51:55EN
3Blue1Brown· 2026년 9월 18일The last IMO problem AI could not solveGrant Sanderson · 3Blue1BrownGrant Sanderson walks through IMO 2025 Problem 6 — a tiling puzzle that frontier models missed — and the visual patience it takes to prove a construction is optimal.MathematicsAI researchReasoning & test-time compute+2
0:55EN
3Blue1Brown· 2026년 7월 24일The 64 Sugar Cubes Puzzle: Six Equal DistancesA 4×4×4 block has three colors; prove that six same-colored pairs share a distance.MathematicsEducation
슬라이드2:25EN
3Blue1Brown· 2026년 6월 12일How Shannon Measured the Entropy of EnglishA guessing game helped Claude Shannon estimate how much information English text contains, and why prediction is central to compression.MathematicsAI History
슬라이드1:02EN
3Blue1Brown· 2026년 6월 10일A Robot Walk and the Puzzle of Optimal Binary EncodingHow few bits does it take to send directions that occur with unequal frequencies?MathematicsScience Communication
슬라이드 4장32:19EN
3Blue1Brown· 2026년 6월 7일Reinventing Entropy: Why Prediction Helps Compress LanguageA robot’s movement code leads from prefix-free encoding to Shannon information and the entropy of language.MathematicsScience Communication