The maelstrom of Donald Trump’s polarizing presidency has provided few reasons for optimism about any aspect of American race relations.

From Charlottesville to the repeal of the deferred-action program for young undocumented immigrants, to battles over policing, Black Lives Matter, voter-identification laws, and a border wall, racially barbed conflict has been a defining feature of the Trump years—with the president appealing to white racial resentments more explicitly than any national political figure since George Wallace.

But demographic trends offer some guarded reasons for hope that the United States is living through peak years of discord over its growing racial and ethnic diversity—even if the temperature isn’t likely to lower very quickly. That sliver of good news is embedded in an otherwise sobering new study from PolicyLink and the Program for Environmental and Regional Equity at the University of Southern California, which study demographic and economic trends and advocate for low-income communities.

In the study, the two groups track the trajectory and implications of the twin demographic revolutions remaking American society. The country today is simultaneously diversifying, especially among young people, and aging. While kids of color are expected to become a majority of the under-18 population by around 2020 (and already constitute most public-school students), nearly four-fifths of today’s senior population is white.

The contrast and conflict between these kaleidoscopically diverse younger generations and preponderantly white older ones—groups I’ve called the brown and the gray—has emerged as one of the central fault lines in American life. Though hurt by disappointing turnout, Hillary Clinton last year won overwhelming majorities among younger minority voters. Trump, meanwhile, carried over three-fifths of whites older than age 45, and they provided a majority of his votes.

The new study quantifies another implication of what the authors call the “racial generation gap,” a concept initially developed by demographer William Frey. Analyzing state spending trends, they found that since 1990, states and counties with the biggest gaps between mostly white seniors and mostly non-white kids “tend to spend less” on K-12 public education on a per capita basis. (PolicyLink and PERE have partnered with The Atlantic on similar data projects.)

Many of the states with the widest racial generation gaps spend the least per person on public education—a list that includes Arizona, Nevada, New Mexico, Texas, California, and Florida. Conversely, many states that are more racially homogeneous, from Vermont, Connecticut, and New Hampshire to West Virginia, Wyoming, and North Dakota, spend more.

As the authors note, the resistance by so many older whites to invest in future generations is extraordinarily short-sighted. One of the central dynamics of 21st century America is that an increasingly non-white workforce will be paying the taxes that fund Social Security and Medicare for a growing and mostly white retiree population. Older white America needs more of the diverse younger generations to obtain the skills to reach the middle class—not (primarily) on the grounds of fairness or equity, but out of self-interest. As I’ve written before, there is no financial security for the gray without economic opportunity for the brown.

Trump has implicitly mobilized his coalition, centered on older and working-class whites, around the opposite argument: that diverse younger generations can only rise at their expense. Not only does his agenda on crime and immigration precisely target white anxieties, but he tilts starkly toward the gray in his budget proposals. He would hold harmless Social Security and Medicare, which benefit mostly white seniors, while slashing domestic-discretionary programs that invest in the productivity of the highly diverse rising generations. “If that isn’t playing to the racial generation gap, I don’t know what is,” said Manuel Pastor, the PERE director.

Still, even as racial tension brews under Trump, Pastor finds a key reason for optimism. Since the 1990s, the racial generation gap has rapidly widened as the minority share of the youth population has exploded, up from 34 percent in 1995 to 48 percent in 2013. That share has grown much more slowly among seniors, rising only from 16 percent to 21 percent in that same period. But looking forward, the Census Bureau projects that minorities will increase their share of the youth population somewhat more slowly and steadily age into a growing portion of the elderly. The result, as the study observes, is that the racial generation gap already likely peaked around 2013, and will decline, albeit slowly, in years ahead.

One possible political consequence is that as whites recede to less than half the population, even more of them will respond to Trump-like appeals to racial nationalism. But Pastor notes that California, a state at the forward edge of demographic change, experienced its greatest racial tension—with initiatives to ban affirmative action, bilingual education, and services for undocumented immigrants—precisely as its racial generation gap peaked in the mid-1990s. As the gap has diminished, so has the state’s racial conflict.

Pastor said a similar scenario may unfold nationally as diversity extends up the generational ladder. The problem is that the racial generation gap won’t close nearly as fast nationally as it did in California, which means that waiting for demographic change alone to defuse tension “could be a long and grinding process.” That, he said, raises the stakes in finding new ways to build bridges across generations. “I have reason to hope based on the [demographic] data, but actually I think it’s more of a call to action,” Pastor said. “The task is to speed up the process of intergenerational understanding and interdependence.”

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.