As one of the five pillars of Islam, performing the Haj pilgrimage is one of the obligations of every able-bodied Muslim. Each year around two million travel to Mecca to attend the rituals, which this year will take place in November. Yet for many would-be pilgrims, the joy of being able to make the journey is mixed with apprehension. Over the past decade, hundreds of people have been crushed or trampled to death in stampedes that have broken out among the colossal crowds attending the ceremonies.
The Saudi authorities have responded with, among other measures, changes to the layout of key sites to reduce congestion. And so far the modifications seem to have worked: since the terrible stampede in 2006 when more than 300 pilgrims died, the Haj has not suffered another catastrophe. Yet the very success of such measures can be their downfall, through a paradoxical phenomenon known as "risk compensation". Put simply, if safety measures lead to reduced fear, it can trigger changes in behaviour that cancel out the benefit.
The classic example of risk compensation is the wearing of cycle helmets. Statistics show that the rates of head injury among cyclists are far higher in nations where helmet-wearing is compulsory, such as the US, than in those where hardly any cyclists bother to wear helmets, such as Germany. Research suggests the problem lies in a change of behaviour by car drivers, who respond to seeing cyclists wearing helmets by leaving less room when they overtake.
In the case of the Haj, the reduced threat of crowd-related disasters could prompt an increase in the number of pilgrims attending, thus boosting the risk. And the steadily rising attendance figures over recent years seem to confirm that possibility. What is certain is that Haj pilgrims will always benefit from insights from the burgeoning field of crowd dynamics. Using an eclectic combination of mathematics, psychology, sociology and computer science, crowd dynamicists analyse the behaviour of crowds in search of simple yet effective ways of keeping them safe.
Until recently, this would have been dismissed as a hopeless task. For most of the past century, the scientific consensus about crowd behaviour has been dictated by the writings of a 19th century French psychologist. According to Gustave Le Bon, crowds are prone to a kind of mental infection, where the actions of a few rapidly turn the many into an unthinking mob, with potentially disastrous consequences. The mere act of being in a crowd, Le Bon claimed, ensures that every individual "descends several rungs in the ladder of civilization".
Published in 1895 in his book Psychologie des Foules (Psychology of Crowds), Le Bon's unflattering view of crowd behaviour has seeped into the mindset of everyone from politicians to police officers. Even Hitler and Mussolini are said to have drawn inspiration from his claim that people in crowds lose their individuality. A century on, social psychologists are taking a more nuanced view of crowd behaviour. As this newspaper reported in July, studies of real crowds suggest that the people within them do not, in fact, lose their identities and become irrational. Rather, they acquire a strong sense of unity, and consciously try to find ways of preventing chaos breaking out.
But one sure-fire way of triggering Le Bon-style chaos is to hamper people trying to get where they want to be - whether it is into a stadium or out of a burning nightclub. The aim of crowd dynamics is to keep people safe even when they are no longer thinking straight. And according to computer simulations and studies of real crowds, the best strategies can be decidedly paradoxical. Crowd trouble often begins when a small group begins moving faster than everyone else. Even without knowing why they should rush, others start to join in, and suddenly the normal inhibitions about keeping space between each other vanish. Doorways become jammed with people, and only those directly in front have any chance of squeezing through; everyone else is unable to move because of the pressure of people further back. Then one of the standard paradoxes of crowd behaviour kicks in: the rush to get out leads to a dramatic reduction in the speed of escape - and a high risk of crushing injuries.
One obvious potential solution is to make doorways as wide as possible. However, research by Professor Dirk Helbing and colleagues at the Technical University of Dresden has shown that this can make a bad situation worse, by encouraging even more people to barge their way to the front, creating an even bigger jam. Computer simulations by the team pointed to a solution, however: erecting a large, strong pillar in front of the exit. The idea of putting an obstacle in the way of a surging crowd is counterintuitive, but the simulations showed the pillar acted like a "breakwater", reducing the huge crush of people close to the exit, while protecting those closest to it while they make their escape. The risk of injury was also reduced, while the rate of escape greatly increased. Crucially, however, the column had to be positioned slightly away from dead-centre of the doorway, otherwise a perfectly-balanced crush of people develops around it.
So much for the theory: now a team led by Daichi Yanagisawa, a graduate student in the School of Engineering at the University of Tokyo, has confirmed the results with real people. In results to appear in the journal Physical Review Letters, the team found that placing a pillar slightly off-centre in front of a doorway allowed crowds of 50 people to get through the exits significantly faster - as the Dresden team claimed.
Prof Helbing and his colleagues have been advising the Saudi authorities on coping with what the team calls "the biggest pedestrian problem in the world". Now they can claim to have scientific proof that pilgrims really do benefit from encountering obstacles on their spiritual path. Robert Matthews is visiting Reader in Science at Aston University, Birmingham, England