An Agent-Based Model
How Mild Preferences
Create Total Segregation
In 1971, Thomas Schelling proved that tolerant individuals create intolerant cities.
Here's the scenario: Every person in a city is perfectly happy living in a neighborhood that's only 30% like them.
That's remarkably tolerant. It means they're fine with 70% of their neighbors being different. No one is demanding homogeneity.
So what happens?
The city becomes 95% segregated.
Not because anyone wanted it. Because of how individual choices aggregate.
The Rules Are Simple
The model has just two types of agents: Blue and Red. They live on a grid. Some cells are empty.
Check Neighbors
Each agent looks at their 8 surrounding neighbors (Moore neighborhood).
Am I Happy?
If at least 30% of neighbors are the same type, the agent stays.
Move If Unhappy
Unhappy agents move to a random empty cell. Then repeat.
That's the entire model. No complex psychology. No history of discrimination. No institutional forces. Just: "I want 30% of my neighbors to be like me."
Let's watch what happens.
Watch It Happen
Start the simulation below. Watch the yellow-outlined unhappy agents shuffle around. Watch the segregation metric climb.
Agents are happy if at least 30% of neighbors are like them.
Advanced Settings
Steps
0
Happy
83%
Segregation
51%
Metrics over time:
Notice what happens: clusters form and stabilize. Once a critical mass of same-type agents gather, they attract more of their kind—while repelling the other type.
The process is self-reinforcing. Each step toward segregation makes the next step more likely. This is called a tipping point dynamic.
The Tipping Point
Here's where it gets interesting. Try different tolerance thresholds below. How low does individual preference need to be for segregation to vanish?
Tolerance Threshold
30%
Final Segregation
49%
Steps to Equilibrium
0
With just 30% preference for similar neighbors, significant segregation emerges.
At 0-10% threshold
Almost no segregation. Agents have essentially no preference.
At 30% threshold
Significant segregation emerges from what seems like a very tolerant preference.
At 50% threshold
"Fair" preference (50-50) leads to near-total segregation.
At 70%+ threshold
Complete segregation happens almost instantly. No stable diverse state exists.
The tipping point is around ~33%.
Below this, diverse equilibria are possible. Above it, segregation is nearly inevitable.
Integrated
0-33%
Quick convergence, no segregation
Segregated
33-70%
Equilibrium exists, segregation emerges
No Equilibrium
70%+
Geometrically impossible
Green curve: Convergence time. At 70%+ threshold, agents demand 80% same-type neighbors, but in a 50/50 population, this is geometrically impossible for most agents. They keep moving forever, never finding satisfaction.
Why 80% Threshold Never Converges
At 80% tolerance, each agent demands that 80% of their 8 neighbors be the same type (at least 6-7 neighbors). In a 50/50 population with 30% empty cells, even perfectly segregated clusters have agents at boundaries with mixed neighbors. These boundary agents are always unhappy and keep moving, destabilizing the clusters. The system oscillates forever.
How to fix it: In the simulation above, try:
- Lower density (40-50%) - More empty cells allow agents to spread out and form pure clusters
- Imbalanced ratio (30:70) - The minority can cluster easily while the majority fills remaining space
- Extended topology (24 neighbors) - More neighbors means more chance of finding similar ones
The Transformation
Compare the initial random distribution to the final equilibrium. No one wanted this outcome. Everyone got what they wanted (30% similar neighbors). But the macro pattern bears no resemblance to individual preferences.
Initial State (Random)
Segregation: 50%
Current State
Segregation: 0%
Why This Matters
Schelling's model was one of the first agent-based models. It demonstrated something profound about social systems.
Emergent Complexity
Complex patterns arise from simple rules. You cannot predict the macro outcome by examining individual behavior.
Unintended Consequences
Individual rationality does not guarantee collective rationality. Everyone acts reasonably; the outcome is unreasonable.
Policy Implications
Reducing individual prejudice may not reduce segregation. The tipping point dynamic must be addressed directly.
Beyond Race
The model applies to any sorting process: income, education, political views, or even seating at lunch tables.
Macro patterns do not reflect micro preferences.
Observing a 95% segregated city tells you nothing about whether residents are 95% racist, 50% racist, or only 30% preferring similar neighbors.
The model shows that even mild, seemingly harmless preferences can produce extreme outcomes.
Understanding how simple rules create complex outcomes is the first step toward designing better systems.
Want More Explainers Like This?
We build interactive, intuition-first explanations of complex AI and statistics concepts.
Reference: Schelling (1971), "Dynamic Models of Segregation"