Ising model
A grid of tiny magnets, each pointing up or down. Neighbors want to align. Heat fights order. Below a critical temperature, the spins spontaneously organize — a phase transition from thermal chaos into collective magnetism, governed by nothing but local interactions and statistical mechanics.
H = −J ∑〈ij〉 sisj | Tc = 2/ln(1+√2) ≈ 2.269
Spins and interactions
The Ising model is a lattice of spins — variables that can be +1 (up) or −1 (down). Each spin interacts with its four nearest neighbors on the grid. The energy of the system is H = −J ∑ sisj, summed over all neighboring pairs. When neighbors are aligned (both up or both down), they contribute −J to the energy; when misaligned, +J. The system prefers low energy, so it prefers alignment. But thermal fluctuations work against this preference, and the competition between energy and entropy drives everything interesting.
The Metropolis algorithm
We cannot simulate thermal equilibrium directly, but we can sample from it. The Metropolis algorithm picks a random spin, computes the energy change ΔE that would result from flipping it, and accepts the flip if ΔE ≤ 0 (the flip lowers energy). If ΔE > 0, it accepts anyway with probability exp(−ΔE / kT). This detailed balance condition guarantees that after many steps, the system samples the Boltzmann distribution — the correct thermal equilibrium for temperature T. Each frame of this simulation performs thousands of such trial flips.
Phase transitions and the critical temperature
At high temperature, thermal energy overwhelms the alignment preference. Spins flip freely, the magnetization averages to zero, and the system is paramagnetic — disordered. At low temperature, the energy cost of misalignment dominates. Spins lock into large aligned domains, the magnetization approaches ±1, and the system is ferromagnetic — ordered. The transition between these phases is sharp, occurring at Tc = 2/ln(1+√2) ≈ 2.269 (in units where J = kB = 1). Lars Onsager derived this exactly in 1944, one of the great achievements of statistical mechanics. At the critical point, fluctuations exist at all length scales and domain boundaries form fractal patterns.
Spontaneous symmetry breaking
The Hamiltonian treats up and down symmetrically — there is nothing in the energy function that prefers one direction over the other. Yet below Tc, the system must choose. It settles into a state where most spins point the same way, breaking the up/down symmetry spontaneously. Try the “All Up” button at low temperature: the system stays ordered. Now try “Reset” (random start) at the same temperature: domains of up and down compete, and one eventually wins. The symmetry of the rules does not imply symmetry of the outcome — this is the essence of spontaneous symmetry breaking, a concept central to everything from magnets to the Higgs mechanism.
Connection to real magnets and universality
Real ferromagnets like iron contain quantum spins interacting through exchange coupling, far more complex than this toy model. Yet the Ising model captures the universal features of the phase transition: the critical exponents, the divergence of correlation length, the power-law behavior near Tc. This is the miracle of universality — systems with very different microscopic details share the same large-scale behavior near a critical point. The 2D Ising model belongs to a universality class that describes a vast range of physical systems, from binary alloys to lattice gases to adsorbed monolayers. The details differ, but the mathematics of the transition is the same.