# Expected value and variance of a random variable, defined as the largest of $6$ randomly drawn numbers

Let each of the numbers from $1$ up to $49$ be written on a ball, and let all these balls be contained in a box. From this box, we randomly draw exactly $6$ numbers (without putting them back, so we can get each number at most once). We call the largest one of these $6$ drawn numbers $M$.

I now want to figure out if this random variable $M$ has an expected value and/or a variance, and want to calculate them if they exist.

I know that the expected value $\mathbb E(M)$ (if it exists) is given by $\mathbb E(M) = \sum_{1 ≤ n ≤ 49} n p_n$, where $p_n = \mathbb P(M = n)$ is the probability of $M$ being the number $n$. Since this sum is finite because there are only finitely many combinations of these $6$ drawn numbers, I would deduce that $\mathbb E(M)$ does indeed exist. However, I can't really see an easy way to actually calculate $\mathbb E(M)$, considering that there are quite a lot of possible combinations, way too many to write them all down manually. Surely there is an elegant way to do this?

As for the variance, this is defined be $\text{Var}(M) = \mathbb E((M - E(M))^2)$. Can I already deduce here as well that the variance does exist because $M$ can only take finitely many values? And if I want to calculate the variance, I would need to know the value of $\mathbb E(X)$ beforehand, it seems.

Yes, in a finite case like this the expected value and variance exist; you don't need to prove that in detail.

You can calculate the expected value from the expression you wrote, but quite often, including in this case, it's easier to calculate it like this:

\begin{align} E(M)&=\sum_{m=0}^{48}P(M\gt m) \\ &= \sum_{m=0}^{48}\left(1-P(M\le m)\right) \\ &= \sum_{m=0}^{48}\left(1-\frac{\binom m6}{\binom{49}6}\right) \\ &= 49-\binom{49}6^{-1}\sum_{m=0}^{48}\binom m6 \\ &= 49-\binom{49}6^{-1}\binom{49}7 \\ &= 49-\frac{43}7 \\ &= \frac{300}7 \\ &\approx42.86\;. \end{align}

Alternatively, take $6$ red balls, $43$ black balls and $1$ blue ball, arrange them uniformly randomly in a circle, break the circle into a line at the blue ball (removing it), and consider the position of the last red ball in the line. By symmetry, the $7$ segments between the $7$ coloured balls have the same expected length, so the last red ball is an expected $\frac{43}7$ balls away from the end at $49$, yielding the above result.

The variance is slightly more involved but can also be calculated, using a slightly simplified form of the expression that you wrote, $\operatorname{Var(M)}=E(M^2)-E(M)^2$.

• Thanks, especially the method with the balls are a very intuitive way to see the result. So for $Var(M)$, we have that $E(M)^2 = \frac{300^2}{7^2}$, so we would only need to calculate $E(M^2)$. Can I therefore simply take $P(M > m)^2$ instead of $P(M > m)$ in your chain of equalities, and continue from there using the same method? Or is it more complicated? Jun 24 '16 at 17:04
• @moran: No, it's $M$ that's being squared, not the probability, so you'd need to use $P(M^2\gt m)$ instead of $P(M\gt m)$ if you want to do it that way. For each $k$, that would give you $2k+1$ contributions of $P(M\gt k)$, so you'd have $E(M^2)=\sum_k(2k+1)P(M\gt k)$. You can either let Wolfram|Alpha calculate that sum for you, or obtain it by differentiating $\sum_kP(M\gt k)q^{2k+1}$ with respect to $q$ and then setting $q=1$. Jun 24 '16 at 17:17
• Ok, that makes more sense I guess. Thanks! Jun 24 '16 at 17:40
• @moran: The point of summing over probabilities instead of more directly using the definition of the expected value as you'd proposed in the question was originally to avoid factors of the summation index. Since you get such a factor now anyway ($2k+1$), you could also consider taking the pedestrian route through the definition of $E(M^2)$ -- though $P(M=m)$ is a tiny bit harder to determine than $P(M\le m)$. Jun 24 '16 at 17:48

To make things slightly simpler, say there are $n$ balls in the box.

Tge expected value of the first ball is (n + 1)/2.

Suppose we've drawn k balls already and the maximum so far is M. The expected value of the next maximum is $$E(M_{next}) = M^2/n + (M+1)/n + (M+2)/n + \ldots + n/n$$

This gives you a recurrence relation for $E(M_k)$ that you can calculate up to 6.