Submitted by sfsolarboy t3_xt82za in askscience
It seem as if some invisible force pulls them together but I know that gravity is too weak to be the answer. I've always wondered this but today when my ear bud cables twisted around each other it annoyed me enough to finally ask. Of course I've asked the search engines, phrasing the query in many different ways, but can't seem to find the answer to this exact phenomenon. It's like some malicious magical force that exists solely to bedevil us (no, I don't believe in magic, but I like the song).
BurnOutBrighter6 t1_iqpsh4f wrote
As others have said, yes it's due to entropy. But I want to get to the "why" a little more.
It's probability. There are thousands, millions, maybe infinite different tangled states a cord can be in, and exactly one non tangled state. Being tangled is the "natural state" simply because it's by far the most likely state.
Every time you put the cord in your pocket and scrunch it around, you're picking another random configuration. Since "untangled" is vanishingly unlikely when picking randomly from all possible configurations, it "spontaneously" comes out tangled ~every time.
The exact phenomenon you're looking for is Spontaneous Knotting of an Agitated String by the way. Here's the landmark paper on it:
Spontaneous knotting of an agitated string - Raymer and Smith 2007
Math blog explaining the above paper.
Video of Raymer doing a talk on the topic.