rng_58's blog

By rng_58, history, 9 years ago, In English
x = 0;

while(x < 1){
    y = x;
    x += rand(); // returns a real number between 0 and 1, uniformly at random
}

What is the expected value of y?

It's not very hard, but the result is surprising.

  • Vote: I like it
  • +223
  • Vote: I do not like it

»
9 years ago, hide # |
 
Vote: I like it +44 Vote: I do not like it
My solution
  • »
    »
    9 years ago, hide # ^ |
     
    Vote: I like it +28 Vote: I do not like it
    Spoiler
»
9 years ago, hide # |
Rev. 6  
Vote: I like it +108 Vote: I do not like it
My Solution

But I don't see why this is strange?

»
9 years ago, hide # |
 
Vote: I like it -8 Vote: I do not like it

Suppose that we have N independent random variables X_i with a continuous uniform distribution on the interval [0, 1]. What is the expected value of min (abs (x_i-x_j))?

Ps. This is weakly related to the discussion, sorry

  • »
    »
    9 years ago, hide # ^ |
    Rev. 2  
    Vote: I like it +3 Vote: I do not like it
    Answer

    It was posed on MSU contest on Petrozavodsk Winter 16. However proof is not easy, probably going through some integrals.

»
9 years ago, hide # |
 
Vote: I like it +24 Vote: I do not like it

I searched answer by a randomize algorithm and I made distribution of each time's result of y.
I think the distribution of y is both surprising.

My approach


Distribution Graph