Researchers at Aston University in the UK set out to investigate the 'Murphy's Law of String' - that is, 'if string can get into knots, it will do'.
Building on earlier mathematical research, the study, led by Robert Matthews, Visiting Reader in Science at Aston University, found that string really does have a perverse tendency to knot spontaneously.
The longer the string is, the more likely it is to spontaneously knot, the study found.
Joining the ends together dramatically reduces the probability of the string performing the manoeuvres needed to form knots, making tangling less likely, something Matthews calls the Loop Conjecture.
To test the Loop Conjecture, he asked schools in UK to conduct experiments, jumbling up regular parcel string varying lengths and then repeating this process with each string having its ends joined, forming a loop.
The results of the experiments confirmed the Loop Conjecture, proving that simply joining the ends of your headphone cable together can dramatically cut the chance of it knotting.
"The study explains why your headphone cable mysteriously turns into one big jumbled mess while it's in your bag or pocket," Matthews said.
"We've also struck upon an easy solution - simply clipping together the two ends of the cords makes the cable less likely to form a knot - saving the frustration of having to untangle it before plugging in," he said.