BrainDen.com - Brain Teasers
• 0

# More random numbers

## Question

Inspired by BMAD's puzzle, consider choosing four random numbers on [0,1].

If you sort them lowest to highest, what is the expected value of the third number?

## Recommended Posts

• 0

If we continue to consider the question to be asking "what value for the third (or Nth) number from smallest to largest is most likely to occur" then

by symmetry from the previous answer, the most likely value for the second number from largest to smallest would be 1/3. The most likely value for the smallest number would be zero -- it's the only value where you can be guaranteed that none of the other random numbers will be smaller -- and the most likely value for the largest number would be one. So they would all be equidistant.

If we instead use the definition of "expected value" as the average value after a large number of trials then

My previous formula showed that if one of the four random numbers, N, is set to a specific value then the probability that it's the third number from smallest to largest is

3 * N2 * (1-N) = 3N2 - 3N3
Remember that there's only a 1/4 chance that N will be the third smallest number out of the four random numbers, so if you integrate that function over N=0 to N=1 you get
Int [3N2 - 3N3] = N3 - 3/4 N4 -> 1 - 3/4 = 1/4
So if you multiply that function by four, you get a probability density function that integrates to one as it should if you're trying to find the probability that a value N (not a specific one of the four variables) is the third smallest.

To find the expected value for the third smallest number if "expected value" is defined as the average value if you were to perform a large number of trials, simply integrate that function (the probability that N is the third smallest number) times the value N over N=0 to N=1.
Int [(12N2 - 12N3) * N] = 3N4 - 12/5 N5
Over N=0 to 1, that's 3 - 12/5 = 3/5 = 0.6

By symmetry, the expected value for the second from the smallest would be 0.4.

By using the formula in the second paragraph in the spoiler of my previous post, the probability of a value N being largest of the four numbers would be
N3
and multiplying that by 4 to turn it into the probability density function that the value N is the largest of the four random numbers gives
4N3
Integrating the product of (the probability density function) times (the value N) over N=0 to N=1
Int[4N3 * N] = Int[4N4] = 4/5 N5
Over N=0 to 1, that ends up being 4/5, or 0.8

Symmetry makes the expected value for the smallest number be 0.2.

So again, the four expected values are equidistant.

• 0

.625

##### Share on other sites

• 0

Hi santhu, welcome to the Den. Your answer is close but not quite it.

##### Share on other sites

• 0

.625

Yeah i gave a crude - well approximate answer.

The answer will be 2*(x/4) + 2*(x/42) +2*(x/43)+ ..... where here x=1, so the answer is 2/3=.666

##### Share on other sites

• 0

I agree with your answer (if the problem is asking "what value is most likely to occur for the third number", which might be different from the expected value if it's defined as "the average outcome if you were to run a large number of trials") but that formula makes me think you took a different approach than I did.

I'll posit (without really proving for now) that this problem is identical to picking four random numbers, with N being one of those numbers, and asking what value for N would make it most likely to be the third number from lowest to highest.

The probability that N is larger than any of the other random numbers is simply N, the probability that N is smaller than any of them is (1-N), and in general the probability that N is larger than P of them and smaller than Q of them is (P+Q)CP NP (1-N)Q. That last part might not be obvious, but you can consider the case posed in the OP: Call the three other random numbers X, Y, and Z, and the probability that N is larger than any two of them and smaller than the other is
[P(N>X)*P(N>Y)*P(N<Z)] + [P(N>X)*P(N<Y)*P(N>Z)] + [P(N<X)*P(N>Y)*P(N>Z)]
= 3 * [N*N*(1-N)]
To find the value of N that will make that probability highest, set the derivative equal to zero.
d/dN [3N2*(1-N)] = d/dN [3N2 - 3N3] = 6N - 9N2
Solving 6N - 9N2 = 0 gives the solution N = 2/3
How'd you solve it to end up with that formula?
##### Share on other sites

• 0

Are the four expected values equally spaced?

##### Share on other sites

• 0

Your second answer is the one I was looking for.

It's a result that was interesting to me.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.