# Probability, expectancy value and variance of the random variable

A six-sided dice is being rolled $3$ times. Let $X$ be the median of the results. What is the probability for the event $\{X=k\}$ as a function of $k$?

I am not quite sure if I got it right, but my approach was to write down the cases for $k=1,2,3,4,5,6$. So for $k=1$ the dicing results that can occur are $111,112,113,114,115,116$ if I am not mistaken. Should I go on writing it down for the other cases and if so, how do I determine the probability subject to $k$?

Also how do I calculate the expectancy value and the variance of the random variable $X$? Just got introduced to this new topic, not too familiar with it.. Some hints are much appreciated.

If you want $\texttt{k}$ to be the median of three dice rolls, you have to multiply the probability of rolling the number $\texttt{k}$, a number $k_1$ s.t. $k_1 \leq k$ and a number $k_2$ s.t. $k_2 \geq k$.

Let us take k = 2 for example.

The probability that you will roll a 2 is $\frac{1}{6}$. Now, for $k_1$ you either want a 2 or a 1, which has probability $\frac{2}{6} = \frac{1}{3}$ happening. Lastly, for $k_2$ you want 2, 3, 4, 5, or 6. This has probability $\frac{5}{6}$ of happening. Therefore the probability of the median being 2 is $6 \times\frac{1}{6}\times\frac{1}{3}\times\frac{5}{6} = \frac{5}{18}$. We multiply by 6 because order does not matter so there are 3! different permutations that 2 can be the median.

Apply this logic to other values of k.

• I will leave it up to you to find a function for this, as well as try to figure out the variance and expectancy. If you get stuck, we can work it out together. Commented Jan 20, 2017 at 19:51
• Thanks! Ok I wrote it down for $k=1,2,3$, it seems like the probability for a median $k$ to occur is $\frac{k}{6} \cdot \frac{7-k}{6}$. Is that correct? Commented Jan 20, 2017 at 20:14
• And yea, maybe some explanation how to figure out variance and expectancy, I haven't worked with these since midschool.. Commented Jan 20, 2017 at 20:18
• Expectation $\mathsf E(X) = \sum_{k=1}^6 k~\mathsf P(X=k)$. Variance $\mathsf{Var}(X) = \sum_{k=1}^6 k^2~\mathsf P(X=k) ~-~\mathsf E(X)^2$. Commented Jan 20, 2017 at 20:19
• @David The logic is not quite right, because you only multiply by 6 when you have distinct values for all three die; in the case when two die are tied for median value, then you multiply by 3, and when all three die are ties for the value, then there is only one permutation. \begin{align} \mathsf P(X=k) ~&=~ \mathsf P(X_2=k)~{\bigl(6~\mathsf P(X_1<k)~\mathsf P(k<X_3) \\+ 3~\mathsf P(X_1<k)~\mathsf P(k=X_3)\\+ 3~\mathsf P(X_1=k)~\mathsf P(k<X_3)\\+\mathsf P(X_1=k)~\mathsf P(k=X_3)\bigr)} \end{align} Commented Jan 20, 2017 at 20:48