All tied up

A bowl contains N N strands of noodles. You reach into the bowl and grab two free ends at random and attach them. You do this N N times until there are no free ends left.

What is the minimum N N such that the expected number of loops generated by the N N steps described above exceeds 3?


The answer is 57.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

3 solutions

Denton Young
Feb 21, 2017

Assume that we have reached into the bowl and pulled out one end. Then there are 2 N 1 2N - 1 free ends left in the bowl. Therefore, there is a 1 / ( 2 N 1 ) 1/(2N - 1) chance that a loop is formed by choosing the other end of the noodle that we are holding. And there is a ( 2 N 2 ) / ( 2 N 1 ) (2N - 2)/(2N - 1) chance that a loop is not formed. In the former case, we end up with one loop and N 1 N - 1 strands. In the latter case, we just end up with N 1 N -1 strands, because we have simply created a strand of twice the original length, and the length of a strand is irrelevant.

Therefore, after the first step, we see that no matter what happens, we end up with N 1 N - 1 strands and, on average, 1 / ( 2 N 1 ) 1/(2N - 1) loops. We can now repeat this reasoning with N 1 N - 1 strands. After the second step, we are guaranteed to be left with N 2 N - 2 strands and, on average, another 1 / ( 2 N 3 ) 1/(2N - 3) loops. This process continues until we are left with one strand, whereupon the final Nth step leaves us with zero strands, and we (definitely) gain one more loop.

So the average number of loops is 1 / ( 2 N 1 ) 1/(2N-1) + 1 / ( 2 N 3 ) 1/(2N-3) + ... + 1 / 3 1/3 + 1 1 . This first exceeds 3 3 when N = 57. N = 57.

I prefer the simpler formula of E [N+1] = E [N] + 1/(2N-1) which follows logically from your approach which says you either link the first strand to itself or you are back to square one.

Still a nice solution.

Malcolm Rich - 4 years, 3 months ago

Log in to reply

Yes, using linearity of expectation to form a recurrence is a nice method too. How about you post that as a solution?

Agnishom Chattopadhyay - 4 years, 3 months ago

Wow, even though I was aware of this result, it didn't occur to me that it required so many noodles just to get 3 loops on average.

Calvin Lin Staff - 4 years, 3 months ago

How did you sum that series up ?

Vishal Yadav - 4 years, 3 months ago

Log in to reply

With a calculator :)

Denton Young - 4 years, 3 months ago

The real trick is recognizing that regardless of the outcome of the first connection (formed a loop or didn't form a loop), the number of strands has decreased by 1. Once you realize that it is fairly straightforward calculation.

A Former Brilliant Member - 4 years, 3 months ago

Log in to reply

That is a very nice observation. Maybe we can try to come up with a fun problem where the number of threads either increase or decrease by 1, stochastically, and then try figuring out how we could solve it.

Agnishom Chattopadhyay - 4 years, 3 months ago
Peter Macgregor
Mar 6, 2017

We can set up a recurrence relation for the expected number of loops given n strands of noodles. Let E(n) be the expected number of loops for n strands. Now let us introduce one more strand (I imagine it is red) so that our bowl now has n+1 strands. The probability that the red strand ends up looped with just itself is p = 1 2 n + 1 p=\frac{1}{2n+1} . This follows because one end of the red strand must end up joined to one of the other 2n+1 ends in the bowl. Each end is equally likely and just one of those ends is the other red end! If the red strand does not form a one strand loop with itself it must be incorporated into one of the loops formed by n strands. These observations lead to the recurrence relation

E ( n + 1 ) = ( 1 p ) E ( n ) + p ( E ( n ) + 1 ) = E ( n ) + p = E ( n ) + 1 2 n + 1 E(n+1)=(1-p)E(n)+p(E(n)+1)=E(n)+p=E(n)+\frac{1}{2n+1}

and obviously E(1) = 1

Now just crank the handle to get the series

1 + 1 3 + 1 5 + 1 7 + 1 9 + 1 11 + 1 13 + ( 1 ) 1+\frac{1}{3} + \frac{1}{5}+\frac{1}{7} + \frac{1}{9}+\frac{1}{11} + \frac{1}{13}+\dots (1)

where summing the first n terms of the series gives the expected number of loops if we have n strands of noodles.

Summing 56 terms gives 2.994 and adding the 5 7 t h 57^{th} gives 3.0033.

And so the minimum number required is 57 \boxed{57}

Note added later.

I admit that I wrote a short program to evaluate (1), but subsequently I found another way to the answer.

As he often does, Euler (pronounced 'oiler') provided the lubricant.

We will use his result that, to a good approximation,

1 n 1 k = ln n + γ \sum^{n}_{1}\frac{1}{k}=\ln{n}+\gamma where γ = 0.5772 \gamma=0.5772 is the Euler-Mascheroni constant..

It is not too hard to see that the first n terms of (1) can be written as

1 2 n 1 1 k 1 2 1 n 1 1 k \sum^{2n-1}_{1}\frac{1}{k}-\frac{1}{2}\sum^{n-1}_{1}\frac{1}{k}

Now use Euler's result to approximate this as

ln ( 2 n 1 ) + γ 1 2 ( ln ( n 1 ) + γ ) \ln{(2n-1)}+\gamma-\frac{1}{2}\left(\ln{(n-1)}+\gamma \right)

This simplifies to

ln ( 2 n 1 n 1 ) + γ 2 ( 2 ) \ln{\left(\frac{2n-1}{\sqrt{n-1}}\right)+\frac{\gamma}{2}}\dots(2)

Provided n is not too small, this formula approximates the expected number of loops with n strands of noodle.

We can also use this formula to find the number of terms (n) which are needed to make (1) exceed 3. First make a crude estimate by approximating the argument of the log function in (2)

3 ln ( 2 n ) + γ 2 3\approx\ln{(2\sqrt{n})}+\frac{\gamma}{2}

It is easy to make n the subject of this formula yielding n 56.6 n\approx 56.6

Then trying 56 and 57 in (2) yields partial sums 2.994 and 3.0033 agreeing spectacularly well with the results found by actually summing the series.

Bravo Euler!

I found it surprising that the expected number of loops increases so slowly. It does make sense; if n n is large, then p p is very small, and the probability of forming a new loop would be very less compared to the probability of two strands merging into one.

Pranshu Gaba - 4 years, 3 months ago

This seems the neatest approach. I'd be interested to see a closed form solution to the last part as I ended up with 70 using cruder numerical methods.

Malcolm Rich - 4 years, 3 months ago

Log in to reply

I do not think there is any closed form for this. I looked this up on W|A

Agnishom Chattopadhyay - 4 years, 3 months ago

after reading some of the comments I managed to find a closed form which approximates the sum of the first n terms provided n is not too small. I've extended my solution to include this.

Peter Macgregor - 4 years, 3 months ago

I think there is an error in defining "p", it should be 1/(2n-1), not 1/(2n+1).

Денис Мазурак - 4 years, 3 months ago

Log in to reply

p refers to the situation with n+1 strands and so 2n+2 ends.

Peter Macgregor - 4 years, 3 months ago
Mark Hennings
Feb 26, 2017

This problem is another candidate for being handled by indicator random variables.

Every time a pair of ends is joined, the number of strands of noodles in the bowl goes down by one (either one strand is turned into a loop, or else two strands are joined into one). If we let Z j Z_j be the number of loops formed when the j j th pair of ends is joined, then Z = Z 1 + Z 2 + Z 3 + + Z N Z = Z_1 + Z_2 + Z_3 + \cdots + Z_N is the total number of loops formed, and hence E [ Z ] = j = 1 N E [ Z j ] = j = 1 N P [ Z j = 1 ] \mathbb{E}[Z] \; = \; \sum_{j=1}^N \mathbb{E}[Z_j] \; = \; \sum_{j=1}^N \mathbb{P}[Z_j = 1] Just before the j j pair of ends is joined, there are N + 1 j N+1-j strands in the bowl. If we pick one end, then the probability that we form a loop is just the probability that we pick the other end of that loop, ouf of the 2 ( N + 1 j ) 1 2(N+1-j)-1 other ends that could be chosen. Thus P [ Z j = 1 ] = 1 2 N + 1 2 j \mathbb{P}[Z_j=1] \; = \; \tfrac{1}{2N+1-2j} and hence E [ Z ] = J = 1 N 1 2 N + 1 2 j = j = 1 N 1 2 j 1 \mathbb{E}[Z] \; = \; \sum_{J=1}^N \tfrac{1}{2N+1-2j} \; = \; \sum_{j=1}^N \tfrac{1}{2j-1} which first exceeds 3 3 when N = 57 N=\boxed{57} .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...