It’s common these days to see Brazil and India lumped together in media reports, particularly the financial press—two emerging economic powerhouses that with Russia and China form the bloc known as BRIC. However, spend a few days in the cities of each country, as we did for this series, and you’ll see a large gap between the South America’s largest nation and one that will soon be Asia’s most populous. And population more than any single factor seems to define that difference between a middle-income nation and a poor one.

At roughly 1.2 billion inhabitants, India’s population is projected to grow to 1.8 billion before stabilizing around the middle of this century. It is already six times Brazil’s current 200 million, a figure that is stable and likely to begin descending in years ahead. Not surprisingly, Brazil’s per capita GDP is more than three times that of India.

The gap is instantly visible in the megacities in our stories: India’s capital New Delhi, whose larger metro area has 23 million inhabitants and Rio de Janeiro, Brazil’s second largest city at 13 million.

Both have seen construction binges in recent years, driven by robust economic growth in general as well as major showcase events. We were in Delhi weeks after it hosted the Commonwealth Games, (an “Olympics-lite” for the 72 nations of the former British Commonwealth), which spurred $7 billion in beautification and construction projects plus a $2.7 billion airport opened in time for the event. Yet it’s impossible to mask the daily stresses on a city that adds an estimated 700,000 inhabitants every year, cramping crowded slums of flimsy shacks, where the only “infrastructure,” likely illegal, are low-hanging wires tapping the power grid.

Most of the newcomers are migrants unable to sustain a living in the vast countryside. In Delhi, the struggle to earn a livelihood is compounded—and interrupted—by the lack of easy access to life’s most basic need: water. People in the Vasant Kunj neighborhood told us they spend four to six hours a day waiting for the municipal tanker truck to arrive. Hundreds of people are forced to share inadequate public toilets, which often malfunction, forcing people to find secluded areas in the open.

“There's a forested area across the street,” said Chanda, who shared only her first name. “It's really humiliating.”

Rio de Janeiro, on the other hand, is beginning a $100 billion facelift as it rolls out the red carpet for two of the world’s most prestigious sporting events: soccer’s World Cup in 2014 and the Olympics in 2016. Electricity and water are much more readily accessible to most residents of the city’s slums or favelas. The pressing challenge here is violent crime. Despite efforts by the city at “pacification” that has dropped the number by almost a half since 1995, more than 4,800 homicides were reported in Rio in 2010 (ten times the total in New York City the same year). A number of non-government groups are working to insure that the long-neglected favela neighborhoods receive a share of the infrastructure spending in what remains one of the world’s most unequal societies.

However, one critical improvement that has already arrived across the class spectrum, including poor neighborhoods, is access to basic health services, including contraception. Combined with growing economic opportunity, particularly in urban areas and a social safety net introduced in recent years, it has brought down Brazil’s fertility rate dramatically to just below replacement level.

“You only get pregnant if you want to,” Liliane Moreira Da Silva, a thirty something resident of the Rocinha neighborhood told us. “We have free access to any sort of family planning.”

Fertility rates have declined in India too but more slowly and unevenly. They are stable in urban centers and the more prosperous south. Unlike Brazil, which is more than 85 percent urban, almost two thirds of India’s population lives in rural, underserved regions. Even though India introduced family planning programs in the 1950s, the effort has had a tortured history. In the seventies, a widespread campaign of coerced sterilization drew massive protests and brought down the government of Prime Minister Indira Gandhi. Since then population has been a third rail few politicians are willing to touch, said demographer Ashish Bose. That leaves development as the best contraceptive alternative, he added.

India is seeing that this small population decline with healthy economic growth, particularly in its services sector, and it has a competitive advantage by having an overwhelmingly young population. More than a quarter of the world’s supply of new workers in the next decade will come from India, according to the U.N. However, it will take significant efforts in public education and health care, among other needs, if the country is to take full advantage of this demographic dividend and join the club of middle-income countries that now counts Brazil as a member—efforts ironically hindered by the pressures of overpopulation.