AMERICANS are an optimistic lot. If there is one thing they believe in above all, it is the ability to move ahead. In poll after poll, a majority reject the notion that success is determined by forces beyond their control. In early 2009, hardly a sunny period, 71% still agreed that hard work and personal skill are the main ingredients for success. A high degree of social mobility has always defined American culture, from the work of Alexis de Tocqueville and Horatio Alger to the remarkable story of Barack Obama himself.

But the reality for most Americans is becoming more complicated. The recession came at the end of a period marked by record levels of inequality. Many Americans, lacking true upward mobility, bought its trappings, such as a bigger house or better car. Disaster duly followed. As a result, American optimism has been pierced by doubt. In a new poll for The Economist by YouGov, 36% of respondents said they had less opportunity than their parents did, compared with 39% who thought they had more. Half thought the next generation would have a lower standard of living, double the share that thought living standards would rise. As the country recovers, two problems cloud its future. Rates of social mobility are unlikely to grow. Inequality, however, may widen even further.

These trends have been building up for years. In 1963 John Kennedy declared that a rising tide lifts all boats. Indeed, in 1963 this was true. Between 1947 and 1973, the typical American family's income roughly doubled in real terms. Between 1973 and 2007, however, it grew by only 22%—and this thanks to the rise of two-worker households. In 2004 men in their 30s earned 12% less in real terms than their fathers did at a similar age, according to Pew's Economic Mobility Project. This has been blamed on everything from immigration to trade to declining rates of unionisation. But the driving factor, most economists agree, has been technological change and the consequent lowering of demand for middle-skilled workers.

The most highly skilled, meanwhile, have stuffed their pockets happily. Between 1970 and 2008 the Gini coefficient, a measure of income inequality, grew from 0.39 to 0.47. In mid-2008 the typical family's income was lower than it had been in 2000. The richest 10% earned nearly half of all income, surpassing even their share in 1928, the year before the Great Crash.

Compared with people in other rich countries, Americans tend to accept relatively high levels of income inequality because they believe they may move up over time. The evidence is that America does offer opportunity; but not nearly as much as its citizens believe.

Parental income is a better predictor of a child's future in America than in much of Europe, implying that social mobility is less powerful. Different groups of Americans have different levels of opportunity. Those born to the middle class have about an equal chance of moving up or down the income ladder, according to the Economic Mobility Project. But those born to black middle-class families are much more likely than their white counterparts to fall in rank. The children of the rich and poor, meanwhile, are less mobile than the middle class's. More than 40% of those Americans born in the bottom quintile remain stuck there as adults.

Family background is not insurmountable, explain Isabel Sawhill and Ron Haskins of the Brookings Institution. In particular, earning a degree and marrying before having children can help someone climb to a higher rung. However, family background influences the likelihood of education and marriage (see article).

How rising inequality affects social mobility is still unclear. Those born since inequality started to rise sharply are only just now becoming adults. However there are some troubling signs according to two papers to be presented at the Tobin Project, an alliance of scholars, this month. Christopher Jencks of Harvard University finds that income inequality has been accompanied by a widening gap in college attendance. Ms Sawhill argues that a rising correlation between income levels, likelihood of marriage and level of education will make society more stagnant.

The recession, meanwhile, may have exacerbated trends in inequality. The capital markets, points out Timothy Smeeding of the University of Wisconsin, have recovered more quickly than the housing or labour markets. This is troubling for the poor and the middle class, since homes represent a greater share of their wealth. Unemployment has been concentrated in America's lower ranks. As the rich recover, poor and middle-class people may lag behind. Young workers may fare badly, too. Those who graduate in recessions have lower incomes in the long term, according to Lisa Kahn of Yale University.

What can government do to help? Few politicians dare favour too much income redistribution. During his campaign Mr Obama told an Ohio voter that he wanted to “spread the wealth”; outrage duly followed. Conservatives now argue, however, that Mr Obama has carried this creed into office. The health bill expands care for the poor by taxing the rich, and George Bush's tax cuts for the rich are due to expire at the end of the year, while Mr Obama has extended those for people of lesser means.

Policies that help equalise opportunity are more popular, and it is here that Mr Obama may have the greater impact. In February his “middle-class task-force” touted measures such as expanded child care and, less encouragingly, support for unionisation. Most promising is his plan to overhaul education. This includes raising standards and expanding the role of charter schools and merit pay for teachers. Last month Mr Obama succeeded in passing reforms for college loans, part of a bid to raise stagnant graduation rates.

Paying for such investments will be difficult, however. Democrats wanted the student-loan bill to include provisions for early education and community colleges. In the end, spending for community colleges was lowered from $10 billion to $2 billion. The allocation for early education was scrapped entirely.

Ms Sawhill and Mr Haskins argue for a drastic shift in federal priorities: rather than pay for the consumption of the old, America should invest in the productivity of the young. Reducing entitlement programmes will be tricky, to say the least. But stagnant rates of mobility risk turning the American dream to delusion.