[Math] Expected Number of Loops from $n$ Ropes

probability

A box contains $n$ ropes. You randomly tie up any two loose ends until there is
none left. Let $X$ be the number of loops. What is $E(X)$?

I've only been able to solve the problem when the number of rope is defined
(say, $n=2$ or $n=3$), but I approached the solution by calculating the
probability of each possible $X$ value and calculating the expectation by the
weighted average of the probability.
I feel like there should be an easier solution to get to the general case.

Best Answer

When you tie the first pair of ends, you either make a loop or do not. You make a loop with probability $\frac 1{2n-1}$ In either case you are left with a box with $n-1$ ropes in it, so the expected number of loops from $n$ ropes is $\frac 1{2n-1}$ plus the expected number from $n-1$ ropes. The expected number then becomes $$\sum_{i=1}^n\frac 1{2i-1}$$

Related Question