John Parker is the Globalization editor of The Economist.

Demography, said Auguste Comte, a 19th century social scientist, is destiny. Perhaps his assertion was a bit of an exaggeration because population trends can themselves be changed (for example by social trends, such as a desire for smaller families, or occasionally by political decisions, such as Chinas one-child policy).

Baby with Grandpa

But it is true that population is extremely influential and over the past few years it has become abundantly clear that demography has profound consequences for the environment and climate change, for public health, and even for politics and national security.

Demography used to be the preserve of geeks with vast databases and complicated mathematical formulae. It rarely made it onto the political agenda. But that is changing. Now you see news items about Chinas one-child policy, or gendercide (the abortion of baby girls so as to favour the birth of sons). And you hear a lot about the ageing of populations in rich countries and the health and pensions problems this will bring.

Demography has begun to be a bigger part of public debate partly because the world’s population is changing in unprecedented ways. As recently as 1950, in terms of life expectancy and family size, the world contained two clearly-differentiated types of people, rich and poor, the rich with small families and long lives, the poor with many children and short lifespans. That dichotomy is breaking down. Now, there are many more countries in the middle.

In 1950, a national median age of more than 36 was unheard of (the media age is the point where half a country’s population is older, half younger). Now, half the countries of western Europe have median ages over 40 and by 2050, there will be more than two dozen countries over 50. History has never seen such ageing as this. Hence the public health concerns.

Nor only are countries getting older, they are getting smaller, or some are. At the moment, almost 20 countries have declining populations, including large ones such as Germany, Russia and Japan. By 2050, two dozen more will have joined them, including giant China. Since most countries health and pensions programmes have assumed that each successive generation will be slightly larger than its predecessor, ageing and shrinking implies substantial changes in the way social programmes are run.

For most of the past 50 years, the pattern of demographic change has been the shift from societies with lots of children where people died young, (high fertility, high mortality) to those where families were smaller and people lived longer (low fertility, low mortality). That process is still going on. But it has become clear that countries are traversing the path at different speeds. Western Europe made the transition in about 100 years; America in about 80 or so; Iran and Bangladesh in 20-30 years. Some countries, mainly in Africa, have started out on the transition, and seem to have got stuck halfway through.

The pattern of demographic change.

These national patterns mean it does not make sense to look only at overall trends, such as the size of a country’s population or its growth rate. Population is changing within national borders, too, and this means that different generations are changing in size, with some age groups, notably economically-active adults changing relative to others. If you look at these disaggregated trends, the world divides itself into three categories: young, middle-aged and old.

First come the young countries, where the working-age population is rising relative to everyone else and where the median age stays below 40. This is most of sub-Saharan Africa, India and the Middle East. Then group will reap a so-called demographic dividend because they will have a lot of adult workers relative to the numbers of dependent old people and children (though to reap this dividend they will have to get their policies right: merely having a large number of young adults is not enough by itself).

Next comes a group of countries which might be called middle-aged or the in-betweeners: not as young as Africa and India, not ageing as fast as Europe. They include the United States, most of Latin America, and South East Asia. In this group, the proportion of dependent children and old people will rise, but not a lot, and societies will get older, but the median age will still be in the mid to late 40s.

They will face problems of ageing and of providing workers for everything from productive companies to the army. But these problems will be as nothing compared with the real ageing countries, who are the big losers from the patterns of demographic change: Europe, Japan and China.

By 2050, Japan will have almost as many dependants as working-age adults. No society has seen such a thing before. And China is ageing at an unprecedented rate. In 1980, its median age was 22. In 2020, it will be 38, older than the United States. In 2040, it will be 47, older than Europe. These demographic trends will be a big challenge not only to its continued economic growth but also to its chances of challenging the United States geopolitically, since they will make it harder and more expensive to fill military ranks and modernise the army.

John Parker is the Globalization editor of The Economist.