Schelling Segregation Model

Thomas Schelling's 1971 model demonstrates how mild individual preferences for same-type neighbors can produce dramatic macro-level residential segregation -- a landmark result in complexity science showing emergent collective behaviour from simple micro-level rules.

1. The Model

Consider a two-dimensional square lattice of size \(N \times N\) where each cell is occupied by an agent of type A, an agent of type B, or is empty. Each agent examines its Moore neighbourhood (8 surrounding cells) and counts the fraction of occupied neighbours that are of the same type:

$$f_i = \frac{\text{number of same-type neighbours of } i}{\text{total occupied neighbours of } i}$$

An agent is satisfied if \(f_i \geq T\) where \(T\) is the tolerance threshold. The dynamics proceed as follows:

  1. Select a random unsatisfied agent.
  2. Move that agent to a random empty cell.
  3. Repeat until all agents are satisfied or a maximum number of iterations is reached.

The key insight is that even a modest threshold -- say \(T = 1/3\), meaning an agent only requires one-third of its neighbours to be similar -- leads to near-complete segregation of the grid. Nobody individually demands a segregated neighbourhood, yet the collective outcome is stark separation.

2. Entropy-Based Segregation Index

To quantify how segregated the lattice has become, we use the Shannon entropy of the local neighbourhood compositions. For each occupied cell \(i\), define the local entropy:

$$H_i = -\sum_{k \in \{A,B\}} p_k^{(i)} \ln p_k^{(i)}$$

where \(p_k^{(i)}\) is the fraction of occupied neighbours of cell \(i\) belonging to type \(k\). The maximum possible entropy for two types is:

$$H_{\max} = -2 \cdot \tfrac{1}{2} \ln \tfrac{1}{2} = \ln 2$$

We average over all occupied cells to get the global entropy \(\bar{H} = \frac{1}{M}\sum_i H_i\) where \(M\) is the number of occupied cells. The normalised segregation index is:

$$S = 1 - \frac{\bar{H}}{H_{\max}} = 1 - \frac{\bar{H}}{\ln 2}$$

When \(S = 0\), neighbourhoods are perfectly mixed (maximum entropy); when \(S = 1\), every neighbourhood is completely homogeneous (zero entropy).

Derivation: Why Mild Preferences Segregate

Consider a well-mixed initial state. Each agent has roughly 50% same-type neighbours, so \(f_i \approx 0.5\). If the threshold \(T = 1/3\), most agents are already satisfied. But the few who are not (those near the boundary of a cluster of the other type) will move.

When an unsatisfied agent vacates a cell, it reduces the same-type fraction for remaining neighbours of the same type. This can cause a cascade: one departure makes several previously-satisfied agents unsatisfied. Mathematically, if agent \(i\) leaves neighbourhood \(\mathcal{N}_j\) of same-type agent \(j\):

$$f_j \to f_j' = \frac{n_{\text{same}} - 1}{n_{\text{total}} - 1}$$

For a typical well-mixed neighbourhood with 4 same-type out of 8 total (\(f_j = 0.5\)), losing one same-type neighbour gives \(f_j' = 3/7 \approx 0.43\). Still above \(T=1/3\). But if the departing agent is replaced by an opposite-type agent, \(f_j' = 3/8 = 0.375\). A second such swap gives \(f_j' = 2/8 = 0.25 < 1/3\) -- agent \(j\) now becomes unsatisfied and must move, triggering further cascades. This positive feedback drives the system toward segregation.

3. Phase Transition

The Schelling model exhibits a phase transition as the threshold \(T\) increases. Below a critical threshold \(T_c\), the system remains integrated; above it, the system rapidly segregates.

For a square lattice with Moore neighbourhoods and equal proportions of two types with 10% vacancy, numerical experiments show \(T_c \approx 0.30\)--\(0.35\). The transition is characterised by a rapid increase in the segregation index \(S\):

$$S(T) \approx \begin{cases} 0 & T < T_c \\ 1 - \exp\!\bigl[-\alpha(T - T_c)^{\beta}\bigr] & T \geq T_c \end{cases}$$

This resembles a continuous (second-order) phase transition. Near the critical point, the correlation length of same-type clusters diverges. We can define the cluster correlation function:

$$C(r) = \langle \delta_{\sigma_i, \sigma_j} \rangle_{|r_i - r_j| = r} - \langle \delta_{\sigma_i, \sigma_j} \rangle_{\text{random}}$$

where \(\sigma_i\) is the type of agent at cell \(i\) and the average is over all pairs at distance \(r\). At \(T_c\), this decays as a power law \(C(r) \sim r^{-\eta}\) rather than exponentially, a hallmark of criticality.

4. Python Simulation: Schelling on a Grid

The following simulation implements the full Schelling model on a 50x50 grid. It tracks the segregation index over time for a given threshold and visualises the final state of the grid.

Schelling Segregation: Full Grid Simulation

Python
script.py134 lines

Click Run to execute the Python code

Code will be executed with Python 3 on the server

5. Phase Transition: Entropy vs Threshold

We sweep the threshold \(T\) from 0 to 0.75 and measure the final segregation index for each value. The result reveals a sharp transition around \(T_c \approx 0.30\).

Phase Transition: Segregation Index vs Threshold

Python
script.py92 lines

Click Run to execute the Python code

Code will be executed with Python 3 on the server

6. Urban Implications and Extensions

The Schelling model has profound implications for urban policy:

  • No discriminatory intent needed: Even agents who are comfortable being a minority (threshold well below 0.5) collectively produce segregated patterns.
  • Hysteresis: Once segregation forms, it is very difficult to reverse. Lowering the threshold below \(T_c\) does not spontaneously de-segregate the grid because satisfied agents have no reason to move.
  • Tipping points: The introduction of a small number of dissimilar agents into a homogeneous neighbourhood can trigger cascading departures -- the "white flight" phenomenon studied extensively in American urban sociology.
  • Multi-group extensions: With \(K > 2\) groups, the maximum entropy becomes \(H_{\max} = \ln K\) and the critical threshold generally decreases as \(T_c \sim 1/K\).

Connection to Statistical Mechanics

The Schelling model can be mapped to a zero-temperature Ising model with external field. The agents' utility function plays the role of a local Hamiltonian, and the threshold acts as a coupling constant. The segregation transition is analogous to the ferromagnetic phase transition in the Ising model -- a connection we will explore further in the mean-field theory chapters.