The notion that cities are all alike borders on blasphemy. Residents of the world’s great metropolises, from New York to London to Tokyo, speak of their homes as of a first love or old friend. But decades of analyses hint that cities, mathematically speaking, might actually all be the same. Now for the first time, those observations have been tidily and elegantly drawn together into a formula that describes what a city is.

That new work is part of a growing field dedicated to the science of ci...