MoMath Mindbender: Yarn Loops

Posted on May 15, 2026

Source

Monthly Mindbenders (May 2026). Variation of a classic random-pairing problem.

Problem

To keep your visiting five-year-old niece busy, you mix 50 strings of orange yarn in a box and ask her to successively grab two random ends and tie them together until there are no loose ends remaining. The result will of course be some number of loops of string.

How many, on average?

Answer

On average, about \(2.9378\) loops.

More exactly, the expected number is

\[ 1+\frac13+\frac15+\cdots+\frac1{99}. \]

Why

At any moment before the process finishes, every connected piece of yarn is either:

Only the open chains matter for the next step. Suppose there are currently \(m\) open chains left. Then there are \(2m\) loose ends in the box.

When your niece grabs two random loose ends, there are

\[ \binom{2m}{2} \]

possible pairs in total.

How many of those pairs instantly create a new loop? Exactly \(m\): for each open chain, there is one special pair, namely its own two loose ends.

So when there are \(m\) open chains, the probability that the next tie closes a loop is

\[ \frac{m}{\binom{2m}{2}} = \frac{m}{m(2m-1)} = \frac1{2m-1}. \]

After that tie, the number of open chains drops from \(m\) to \(m-1\), no matter what happened:

That means the process passes through the states

\[ 50,49,48,\dots,1 \]

open chains, in order.

Let \(X_m\) be the indicator for the event that a loop is created while going from \(m\) open chains to \(m-1\). Then

\[ \mathbb{E}[X_m] = \Pr(X_m=1) = \frac1{2m-1}. \]

If \(L\) is the total number of loops at the end, then

\[ L = X_{50}+X_{49}+\cdots+X_1. \]

By linearity of expectation,

\[ \mathbb{E}[L] = \sum_{m=1}^{50}\mathbb{E}[X_m] = \sum_{m=1}^{50}\frac1{2m-1} = 1+\frac13+\frac15+\cdots+\frac1{99}. \]

Numerically,

\[ \mathbb{E}[L] \approx 2.937774848. \]

So the average number of loops is just under 3.

General Form

For \(n\) initial strings, the same reasoning gives

\[ \mathbb{E}[L_n] = \sum_{m=1}^{n}\frac1{2m-1}. \]

This can also be written as

\[ \mathbb{E}[L_n] = H_{2n}-\frac12 H_n, \]

where \(H_n\) is the \(n\)-th harmonic number.

More MoMath Mindbenders: Previous | Next

Back to blog