Introduction

In 1920, the physicist Wilhelm Lenz gave his student Ernst Ising a simple puzzle: model a magnet using the crudest possible description of atoms. Each atom would be a tiny magnet — a spin — that can point either up (+1) or down (−1). Neighboring spins prefer to align, and temperature fights that preference by shaking everything randomly.

The model Ising analyzed in his 1925 thesis was one-dimensional: a chain of spins. He solved it exactly and found something disappointing — no phase transition at any finite temperature. The chain never snaps from disorder to order; it just gradually becomes more aligned as you cool it. Ising concluded, incorrectly, that the model was too simple to describe real magnets.

He was wrong about the conclusion but right about the chain. The two-dimensional Ising model, on a square grid, is a completely different animal. In 1944, Lars Onsager solved it exactly and found a sharp phase transition at a critical temperature T_c. Below T_c the majority of spins lock into one direction — magnetization snaps into existence. Above T_c, thermal noise wins and the net magnetization vanishes.

That snap is one of the most studied phenomena in all of physics. It is not a gradual fade: at exactly T_c, quantities like correlation length and magnetic susceptibility diverge — they become formally infinite. The system develops long-range order out of purely local, nearest-neighbor interactions, and the mathematics at the transition point is rich enough that the 2D Ising model is still actively studied today.

The model's simplicity is its power. Once you understand the Ising model, you understand the template behind superconductors, neural networks and the Monte Carlo integration methods that power modern simulations.

Try It

The grid below is a 40×40 lattice of spins. Each spin is +1 (light) or −1 (dark). The Metropolis algorithm runs continuously: it picks a random spin, computes the energy cost of flipping it, and flips it with a probability that depends on temperature.

<div class="controls">
  <label>{{temperature_label}}: <span id="temp-val">2.5</span>
    <input type="range" id="temp" min="0.5" max="5.0" step="0.05" value="2.5">
  </label>
  <button id="toggleBtn" type="button">{{pause}}</button>
  <button id="resetBtn" type="button" class="ghost">{{randomize}}</button>
</div>
<canvas id="canvas" width="400" height="400"></canvas>
<div class="stats">
  <div class="stat-row">
    <span class="stat-label">{{magnetization}}</span>
    <div class="bar-wrap"><div class="bar-fill" id="mag-bar"></div></div>
    <span class="stat-num" id="mag-num">0.00</span>
  </div>
  <div class="stat-row">
    <span class="stat-label">{{energy_per_spin}}</span>
    <span class="stat-num wide" id="energy-num">—</span>
  </div>
</div>
<p class="hint">{{hint}}</p>
* { box-sizing: border-box; margin: 0; }
body { font-family: system-ui, sans-serif; font-size: 14px; color: #222; background: #fff; padding: 8px; }
.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
label { display: flex; align-items: center; gap: 6px; font-size: 13px; flex: 1; min-width: 220px; }
input[type=range] { flex: 1; cursor: pointer; }
button { font: 600 13px system-ui; padding: .35rem .8rem; border: 1px solid #1d3557;
         background: #1d3557; color: #fff; border-radius: 7px; cursor: pointer; }
button.ghost { background: #fff; color: #1d3557; }
canvas { display: block; border: 1px solid #cdd9e3; border-radius: 6px;
         width: 400px; height: 400px; max-width: 100%; image-rendering: pixelated; }
.stats { margin: 8px 0 4px; display: flex; flex-direction: column; gap: 4px; }
.stat-row { display: flex; align-items: center; gap: 8px; }
.stat-label { font-size: 12px; color: #555; width: 90px; flex-shrink: 0; }
.bar-wrap { flex: 1; height: 12px; background: #e8eef3; border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: #1d3557; border-radius: 6px; transition: width .15s; }
.stat-num { font: 600 12px ui-monospace, monospace; width: 48px; text-align: right; }
.stat-num.wide { width: auto; }
.hint { font-size: 12px; color: #555; line-height: 1.5; margin-top: 6px; }
// Code not found

Drag the Temperature slider all the way right (hot) and the grid scrambles — disorder wins. Drag it left past the critical temperature (~2.27 in model units) and watch the spins spontaneously organize into large aligned domains. The Magnetization bar shows the average spin: near zero at high temperature, pinned to +1 or −1 at low temperature. The transition between those two regimes is sharp — that sharpness is the phase transition.

The Real Complexity

The Ising model sits at a curious intersection of physics and computational complexity.

  • Onsager's miracle (1944). Lars Onsager found a closed-form expression for the free energy of the 2D Ising model on the square lattice — one of the hardest exact calculations in all of theoretical physics. The critical temperature is T_c = 2 / ln(1 + √2) ≈ 2.269 (in units where the coupling constant J = 1). At that temperature, the spontaneous magnetization is zero but a tiny applied field tips the system into an ordered phase.

  • Computing the partition function is #P-hard. The partition function Z sums over every possible spin configuration, weighted by energy — 2N2^{N} terms for an N-spin system. Exactly computing Z for a general Ising model is #P-complete (Jerrum & Sinclair, 1993), meaning it is at least as hard as counting the solutions to an NP problem. You cannot enumerate your way out.

  • The Metropolis algorithm escapes the trap. Instead of computing Z exactly, the Monte Carlo integration approach samples from the Boltzmann distribution without ever summing all 2N2^{N} states. The Metropolis–Rosenbluth–Teller algorithm (1953) is the prototype: it creates a Markov chain whose stationary distribution is exactly the Boltzmann distribution, so averages over the chain converge to thermodynamic averages.

  • Approximation near the critical point is hard too. The mixing time of the Metropolis Markov chain diverges at T_c — the phenomenon called critical slowing down. At the transition, correlations extend across the whole lattice and the chain takes exponentially long to explore configuration space. This is why simulating critical phenomena accurately is still a research problem; specialized algorithms (Wolff cluster flips, Swendsen–Wang) were invented specifically to fight it.

  • The 3D model is unsolved. No exact closed-form solution exists for the three-dimensional Ising model. Its critical exponents are known only numerically and via the renormalization group — a deep framework developed by Kenneth Wilson, for which he received the Nobel Prize in Physics in 1982.

The Ising model is not a problem with a single hardness class. It is a landscape: exactly solvable in 2D, #P-hard to compute in general, and beautifully tractable in practice via sampling — as long as you stay away from the critical temperature.

Where It Matters

"Binary variables with local interactions and a phase transition" describes far more than magnets:

  • Condensed matter physics: every theory of ferromagnetism, antiferromagnetism, and structural phase transitions descends from the Ising model. Its universality class — the set of critical exponents — describes real iron magnets to high precision.

  • Hopfield networks and Boltzmann machines: John Hopfield's 1982 associative memory model is literally an Ising model whose "energy" landscape stores patterns. Boltzmann machines (used in early deep learning) are stochastic Ising models trained with contrastive divergence. The connection between statistical physics and machine learning runs straight through the Ising Hamiltonian.

  • Spin glasses and hard optimization: when couplings J_ij are random, the Ising model becomes a spin glass — a system with many competing local minima. Finding the ground state of a spin glass is NP-hard. This is exactly the connection to non-convex optimization: energy minimization in a rough landscape.

  • Social and economic models: binary opinions (agree/disagree), binary choices (buy/sell), or binary gene states (on/off) all obey Ising-like dynamics. The voter model and Schelling's segregation model are Ising cousins.

  • Quantum computing: the quantum Ising model (with a transverse magnetic field) is the central example in adiabatic quantum computing and quantum annealing. D-Wave's hardware directly implements an Ising Hamiltonian.

  • Renormalization group: Wilson's Nobel-Prize-winning framework was developed to understand what happens at the Ising critical point when every length scale matters simultaneously. It is now the universal language for understanding phase transitions and quantum field theories.

Learn the Ising model and you have the template for a surprising fraction of theoretical physics and applied machine learning.

Conclusion

Ernst Ising solved a one-dimensional chain and concluded the model was too simple. He was wrong — not about the chain but about the idea. The two-dimensional version turned out to harbor one of the sharpest phenomena in all of physics: a phase transition where global order appears suddenly at a precise critical temperature, born entirely from local nearest-neighbor rules.

Onsager's 1944 exact solution remains a landmark of mathematical physics. The #P-hardness of computing partition functions explains why we simulate with Metropolis rather than enumerate. And the same Hamiltonian that describes iron magnets reappears in Hopfield networks, Boltzmann machines, spin-glass optimization and quantum annealers.

The lesson is one of the deepest in science: local rules can conspire. Given the right coupling and the right temperature, a million independent spins can spontaneously act as one. That is emergence — and the Ising model is perhaps its cleanest demonstration.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/ising-model/Content licensed under CC BY-NC 4.0.