Image caption How many people were in Tahrir Square earlier this month?

It has been claimed that Egyptians staged the biggest uprising in history in the last few weeks. The nationwide anti-government demonstrations were certainly a massive show of people power. But were the crowds really as large as reported, and how would you try to find out?

Protesters against the government of Islamist Mohammed Morsi, Egypt's first democratically-elected president, took to the streets of Cairo and beyond in huge numbers, before the army then removed the leader on 3 July.

It has been claimed that 30 million people took to the streets.

"I think that's a gross exaggeration," says Middle East correspondent Wyre Davies, from Cairo.

"It doesn't feel any bigger than it did in 2011 when we had the revolution. About half a million people can fit in Tahrir Square. So it's impossible to say when there's a big protest in Tahrir Square, that there are millions of people there.

"I think nationwide there were millions of people this time protesting against the rule of the Muslim Brotherhood, but nothing like the 30 or 40 million people some people quoted. That's 45% of the population - that's impossible; there are too many young people in Egypt for the maths to work."

Media playback is unsupported on your device Media caption How do you work out the size of a crowd?

He's right. A fifth of Egypt's 80m-strong population is made up of children aged under 10.

More or Less: Behind the stats Listen to More or Less on BBC Radio 4 and the World Service, or download the free podcast Download the More or Less podcast More stories from More or Less

So where has the figure of 30 million protesters come from? It's difficult to find a source for it, or for any of the other estimates for that matter.

"One figure that comes up a lot is 17m," says Chris Greenway, from BBC Monitoring, a team which watches the world's media. "However I've not really been able to pin down the source for that, better than people quoting 'experts'.

"The state-owned Mena news agency reported the interior ministry as denying that it had given any estimate, so it doesn't appear to have come from them.

Media playback is unsupported on your device Media caption The workers paid to count crowds in Times Square

"We have Reuters quoting an unnamed military source that evening as saying as many as 14m. And then we have subsequent reports, saying there was another estimate of 33m."

There's a numbers game in play, as both sides try to claim they have popular support, Wyre Davies says.

"What we saw last week was a military coup - there's no two ways about it," he says. "And therefore the only justification for that logically is that this was a popularly-backed military coup. So it's in the interests of the people who supported the overthrow of the president to say that they had these millions of people supporting them."

Since President Morsi was removed from power, both sides have been claiming ever-increasing numbers of supporters on the streets, Wyre says.

And this is so often the case.

Image caption How many tried to get a glimpse of William and Kate on their wedding day?

You have to take every crowd estimation with a huge heap of salt, according to Hannah Fry, a mathematician from University College London.

More on crowds There's an estimated 1.2 billion Catholics worldwide. But how did the Vatican arrive at that figure? Wesley Stephenson investigates. How do you count Catholics?

"It's very rare that you have the report of a crowd size where there isn't some incentive to exaggerate one way or the other," she says.

"So if you take the London Stop the War protest in February 2007, the police claimed that there were 10,000 protesters - meanwhile the organisers' estimate was 60,000, six times the amount."

Even when there's no political agenda, crowd estimates can be quite variable, according to Prof Paul Yip from the University of Hong Kong.

Estimates of the size of the crowd at the royal wedding of Prince William and Kate Middleton ranged from 500,000 to a million, he says. While at the Obama inauguration ceremony, unofficial government estimates put the crowd at 1.8 million. Others, gave estimates closer to one million.

There are several ways to count a crowd, but none of them is perfect.

Image caption Aerial images, like this one of crowds in St Peter's Square, can help calculations

A simple way to estimate the size of a mass of people is to take a satellite image of the event and then draw a grid on it. You can then count the people in one of the grids - to get a measure of crowd density - and multiply that number by the total number of grids.

Estimates of crowds 30 million Hindu pilgrims reported to have taken part in India's 2013 Kumbh Mela festival (pictured)

Hindu pilgrims reported to have taken part in India's 2013 Kumbh Mela festival (pictured) 5-7 million mourners attended Ayatollah Khomenei's funeral in Iran 1989

mourners attended Ayatollah Khomenei's funeral in Iran 1989 4.2 million turned out to see Rod Stewart sing in Brazil in 1996

turned out to see Rod Stewart sing in Brazil in 1996 1.25 million heard Pope John Paul II say mass in Phoenix Park, Dublin in 1979

But crowd boundaries are often not clearly defined, and people do not scatter uniformly, so it it difficult to get an accurate measure of the density of the crowd.

"So the estimation can be a more of a guesstimate," says Prof Yip.

Counting a moving crowd poses even more of a challenge.

Sometimes surveys are done after the event, but people's responses cannot always be trusted, he says.

Another approach is to physically count the number of people moving past a particular point along the moving crowd's route - but how do you account for the people who join the procession at a later location, or for the people who pass by on more than one occasion?

For the past 10 years, Yip has been monitoring the number of people taking part in the annual Hong Kong 1 July protests, which mark the handover of sovereignty from Britain to China.

Image caption A numbers game: This year's 1 July protests in Hong Kong

The counting method he favours is to physically count the crowd at two points - A and B. At the second point, B, he also surveys the people passing by, asking them if they walked past point A. In that way, he minimises the problem of double-counting.

Over the past 10 years, he says, the gap between an organisers' estimate and the police's has been getting wider and wider. This year, the police claimed 66,000 took to the streets. The organisers say it was 420,000. Yip estimates it was more like 100,000.

The organisers tend to exaggerate the number to try to get more political force, he says but, in his opinion, this damages their cause.

One hundred thousand people on the street already sends a strong message to the Hong Kong government that people want change, he says.

"But what happens is the organisers come up with such a huge estimate which makes a lot of people not very happy and not very comfortable with the number. So this huge number itself has become a very negative thing to the organisers."

Counting crowds has become so much more about public relations and point-scoring than a quest for the truth, he observes.

You can follow the Magazine on Twitter and on Facebook