When I was a freshman at the University of Chicago in 1996, I heard the same thing again and again: Do not leave the boundaries of Hyde Park. Do not go north of 47th Street. Do not go south of 61st Street. Do not go west of Cottage Grove Avenue.

These boundaries were fairly explicit, almost to the point of being an official university policy. The campus police department was not committed to protecting students beyond the area, and the campus safety brochure advised students not to use the “El” train stops just a couple of blocks beyond them unless “traveling in groups and during the daytime.”

What usually wasn’t said — on a campus that brags about the diversity of its urban setting but where only about 5 percent of students are black — was that the neighborhoods beyond these boundaries were overwhelmingly black and poor. The U. of C. has, for many decades, treated Hyde Park as its “fortress on the South Side,” and its legacy of trying to keep its students within the neighborhood — and the black residents of surrounding communities out — has left its mark on Chicago.

On Dustin Cable’s interactive “Dot Map” of racial residency patterns, Hyde Park appears as an island of blue and red dots — meaning, mostly white and Asian students and residents — in contrast to Chicago’s almost uniformly black South Side, designated in green dots. Washington Park, the neighborhood just to Hyde Park’s west, is 97 percent black . Woodlawn — the neighborhood on the other side of 60th Street — is 87 percent black.

Chicago deserves its reputation as a segregated city. But it is also an extremely diverse city. And the difference between those terms — which are often misused and misunderstood — says a lot about how millions of American city dwellers live. It is all too common to live in a city with a wide variety of ethnic and racial groups — including Chicago, New York, and Baltimore — and yet remain isolated from those groups in a racially homogenous neighborhood.

You can see that by zooming out on Cable’s map and taking the 30,000-foot view of Chicago. Things start to look a little different: You notice the city’s diversity as much as its segregation. Citywide, Chicago’s population is almost evenly divided between non-Hispanic blacks (33 percent of its population), non-Hispanic whites (32 percent) and Hispanics (29 percent). So at a macro level, Chicago is quite diverse. At a neighborhood level, it isn’t.

The contrast to Chicago is a city like Lincoln, Nebraska. By one statistical measure of racial segregation called the index of dissimilarity, Lincoln counts as being highly racially integrated — it’s more integrated than New York, according to this statistic! But what does that integration look like? Here’s Cable’s map again:

In Lincoln, this supposed integration looks awfully blue — which is to say, awfully white, since blue is Cable’s color for caucasians, who make up 83 percent of Lincoln’s population. True, Lincoln’s few nonwhite residents are fairly evenly distributed throughout the city. But while Lincoln may be integrated, it’s not very diverse.

So let’s aim to develop a slightly richer vocabulary. I’m going to describe three statistical measures of segregation and diversity. Like any statistical definitions, they are precise but limited in scope. They refer to racial diversity only and not economic diversity or diversity within racial groups. They pertain to where people live, and not where they work or go to school. In other words: They’re a starting point and not an end point. No one of them is inherently more valid than the others; it’s best if you look at them holistically.

The data we’ll use is drawn from Brown University’s American Communities Project, which is, in turn, based on the 2010 Census. Brown’s data defines five racial groups: whites, blacks, Hispanics, Asians and “other,” where “other” principally refers to Native Americans. The groups are exhaustive (they add up to 100 percent of the population) and mutually exclusive (they don’t overlap).

In this article, we’ll look at cities proper rather than metropolitan areas. Venturing beyond the city limits and into the surrounding area can sometimes lead you to different conclusions about a city’s demographic makeup, so we’ll look at those in a follow-up post. But cities themselves matter too, especially for questions of urban planning and city-administered services like schooling and policing.

In order to provoke a few questions, I’m going to list the top 10 and bottom 10 U.S. cities by each of these measures (out of the 100 most populous cities). Chicago, for example, ranks near the top of the charts by one metric, but is at the very bottom on another.

The first measure is the citywide diversity index. It’s defined as the answer to this question: For an average resident in the city, what percent of the people belong to a different racial group?

The lowest possible citywide diversity index is 0 percent, which is what you get if everyone is the same race. The highest possible one is 80 percent. Why not 100 percent? Because the Brown data only includes five racial groups. Even if the population is divided exactly evenly between these groups, you’ll still have 20 percent of the people belong to the same race as you.

A few cities actually get pretty close to this ideal of complete diversity. Oakland, California, is not far from being evenly divided between whites, blacks, Hispanics and Asians; its citywide diversity index is 75 percent. New York’s is 73 percent. And Chicago’s is 70 percent.

At the low end of the scale are extremely white cities like Lincoln and Scottsdale, Arizona. There’s also extremely black cities like Detroit, and extremely Hispanic cities like Laredo, Texas. Laredo, which is almost entirely Hispanic, has a citywide diversity index of just 8 percent.

There’s something else important here. The term “diverse” is sometimes used colloquially as a euphemism for “nonwhite.” But our statistics don’t handle whites differently than the other racial groups. One advantage of this approach is that it can account for the degree of segregation between different nonwhite groups. While blacks and Hispanics are highly segregated from one another in Chicago, for example, they’re reasonably well integrated in Phoenix.

The counterpart to the citywide diversity index is the neighborhood diversity index. It answers basically the same question we asked above, but applied at the neighborhood level. That is: For an average resident in the city, what percent of the people in her neighborhood belong to a different racial group? (I’m using the term “neighborhood” loosely. More precisely, the index is based on census tracts, which are units of about 4,000 people. )

The neighborhood diversity index is always equal to or lower than the citywide diversity index. In other words, if a city doesn’t have much diversity overall, it can’t have racially diverse neighborhoods.

But the reverse can be true, and often is: You can have a diverse city, but not diverse neighborhoods. Whereas Chicago’s citywide diversity index is 70 percent, seventh best out of the 100 most populous U.S. cities, its neighborhood diversity index is just 36 percent, which ranks 82nd. New York also has a big gap. Its citywide diversity index is 73 percent, fourth highest in the country, but its neighborhood diversity index is 47 percent, which ranks 49th.

To be clear, New York and Chicago are still more diverse than cities like Lincoln, even at the neighborhood level. But as the numbers show, they are segregated because they underachieve their potential to have racially diverse neighborhoods.

This is what the final metric, the integration-segregation index, gets at. It’s defined by the relationship between citywide and neighborhood diversity scores. If we graph the 100 most populous cities on a scatterplot, they look like this:

This chart is key to understanding our approach, so let’s take a quick tour, starting in the top-right corner of the chart and moving counterclockwise.

The top-right quadrant contains cities like Sacramento, California, that have high neighborhood and citywide diversity scores. They’re both diverse and integrated.

The top-left quadrant is empty. In theory, you’d place cities here if they had high neighborhood diversity but poor citywide diversity. But as we’ve said, you can’t have diverse neighborhoods if there’s no diversity in the overall population.

In the bottom-left quadrant are cities like Laredo and Lincoln that score poorly on both neighborhood and citywide diversity. Because they’re so racially uniform, you can’t really define them as being either segregated or integrated.

The bottom-right quadrant contains highly segregated cities like Chicago, Baltimore and St. Louis. They have average-to-good citywide diversity, but poor neighborhood diversity.

The largest group of cities, including those like Los Angeles, are clustered just above these in the middle-right portion of the chart. They’re near the red regression line that indicates the typical relationship between citywide diversity and neighborhood diversity. These cities are reasonably diverse, but a very long way from being perfectly integrated. However, they’re not quite as segregated as cities like Chicago.

The integration-segregation index is determined by how far above or below a city is from the regression line. Cities below the line are especially segregated. Chicago, which has a -19 score, is the most segregated city in the country. It’s followed by Atlanta, Milwaukee, Philadelphia, St. Louis, Washington and Baltimore.

Cities above the red line have positive scores, which mean they’re comparatively well-integrated. Sacramento’s score is a +10, for instance.

But here’s the awful thing about that red line. It grades cities on a curve. It does so because there aren’t a lot of American cities that meet the ideal of being both diverse and integrated. There are more Baltimores than Sacramentos.

Furthermore, most of the exceptions are cities like Sacramento that have large Hispanic or Asian populations. Cities with substantial black populations tend to be highly segregated. Of the top 100 U.S. cities by population, 35 are at least one-quarter black, and only 6 of those cities have positive integration scores.

So while Chicago really is something of an extraordinary case, Baltimore isn’t an outlier, exactly. Most cities east of the Rocky Mountains with substantial black populations are quite segregated. There’s not a lot to distinguish Baltimore from Cleveland, Memphis, Milwaukee, New Orleans, Philadelphia or St. Louis.

We’ll follow this up with an analysis of what these numbers look like when taken at the the metro rather than city level. In the meantime, you can find where your city ranks below: