Scientists have developed the first mathematical model to explain how things go viral online.

A team at Aberdeen University looked at comparisons between the transmission of social phenomena and infectious diseases to come up with the model, which includes the impact of friends and acquaintances in the sudden spread of new ideas.

The research uses maths to explain explosive contagion in social networks - such as posts going viral - and shows how people's reluctance to accept a new idea is overcome if its transmission is strong enough.

The study highlights how social media can make explosive contagion more visible, but scientists found the intrinsic value of the idea or product, and whether friends and acquaintances adopt it, remains the crucial factor in whether it goes viral.

Dr Francisco Perez-Reche, from Aberdeen University's School of Natural and Computing Sciences, led the study.

He said: "We often witness social phenomena that become accepted by many people overnight, especially now in the age of social media.

"This is especially relevant to social contexts in which individuals initially hesitate to join a collective movement, for example a strike, because they fear becoming part of a minority that could be punished. But it also applies to new ideas or products.

"Mathematical models proposed in the past typically neglected the synergistic effects of acquaintances and were unable to explain explosive contagion, but we show that these effects are ultimately responsible for whether something catches on quickly.

"In very basic terms, our model shows that people's opposition to accept a new idea acts as a barrier to large contagion, until the transmission of the phenomenon becomes strong enough to overcome that reluctance - at this point, explosive contagion happens."

He said the model, published in Nature Scientific Reports, could potentially be used to address social issues, or by companies to give their product the edge over rivals by engineering viral posts.

The study was carried out with teams from Cambridge University, Zaragoza University in Spain and the National University of Colombia.