# The Mathematical Puzzle That Is the Complexity of the City

On an intuitive level, we know that a small village with only a single traffic light is far less complex than London or New York City. But is it possible to accurately measure the relative complexity of any given city? What are the variables you’d have to include?

It’s easy enough to get started. We can begin by examining a city’s population, its economic output, and its physical expanse (many of which have been explored by Luis Bettencourt, Geoffrey West, and their colleagues at the Santa Fe Institute). But where do you go next? An accounting of a city’s infrastructure and how it all works together? An analysis of social behavior that occurs within a city’s boundaries? The feedback loop of natural ecosystems and human intervention? And where do you draw the line? Is there a single number that could somehow encompass the incredibly intricate nature of cities?

In the world of physics, there is a number that comes close to this called Kolmogorov complexity. One of numerous ways of measuring complexity, it seeks to measure the size of an algorithm that can describe the pattern or object being examined.

For example, let’s look at the following two sequences of numbers:

121212121212121212…

31415926535897932…

While both are regular, the first requires the algorithm of simply repeating ‘12’ while the second is a more complicated sequence, requiring us to develop an algorithm that generates the digits of π. While algorithms are very precise and mathematical, we can encode the first sequence as a simple sentence that basically says, “repeat ‘12’ over and over."

The second sequence, however, requires something much more complicated. Perhaps something like this:

The second sequence clearly requires a longer and more complex algorithmic description, so it therefore has a higher Kolmogorov complexity.

To do this with cities, we would have to throw every aspect of cities into a massively complicated data set and determine how to generate these properties using some algorithm. It’s pretty hard.

Or we can use SimCity.

Ever since I was young, I’ve been playing SimCity. I first started playing the original version in the early 1990s, and then graduated to SimCity 2000. I can remember poring over the information and references about urban planning and the nature of cities included in the original SimCity manual. I recall waiting for hours while playing in order to have enough money to construct an airport, or seeing what the smallest sustainable city with a positive cash-flow it was possible to create. While the game is by no means a simulacrum of actual cities (for example, scientific discovery in cities seems to be imperfectly modeled), it is as good a first pass at an all-encompassing model of how cities really work that I’ve ever encountered.

And even better, we can easily use SimCity to measure a city’s Kolmogorov complexity, because we have files for each simulated city in SimCity. And each file is a city’s complete description, so its file size is, in a rough sense, a measure of its complexity.

Using a small dataset of population sizes and file sizes of some cities constructed in SimCity 3000, I checked to see how complexity scales with population size. It turns out that urban complexity scales linearly with population:

What this means is that for each additional simulated individual in a city, the algorithmic complexity increases by a constant amount.

While proxies for energy usage, such as the number of gas stations, scale sublinearly - as a city grows, fewer gas stations are needed per person - proxies for productivity and innovation, such as number of patents, scale superlinearly - in other words, as a city grows, more is produced per person. So perhaps the overall complexity of a city is a balance between the economies of scale of energy usage and the increasing returns of innovation.

Or it could also be that SimCity is too different from the real world and we shouldn’t read too much into these results.

There are other attempts to more realistically model cities, such as a simulation of Portland, Oregon, that’s been used to better understand traffic patterns and the spread of disease. Similarly, much work has been done to understand the fractal structure of cities, where there are certain self-similar properties in urban geometries.

Nonetheless, many simple models can be used to strip away the intricacy of a complicated system and help us to better understand it. Perhaps the forthcoming updated version of SimCity will be able to guide us to an even better way to understand how to computationally compress an entire city.

*Top image: Screencap of SimCity 2000* courtesy Electronic Arts*

*An earlier version of this piece misidentified the screencap above as being from SimCity 3000. It is from the 2000 version.