This is a example from a book. Suppose a fair die is rolled n times, and let X be the number of faces that never show up in these n rolls. $E(X)=?$

The method as suggested in the book is:-

Define $A_i=$ $i^{th}$ face is missing . $\therefore X= \sum_{i=1}^{6}A_i$.

Here is my problem , According to the method suggested above,$ X$ can take values from {0,1,2...6}.

Then the sample space of $ X={0,1,2,3,4,5}$, since at least 1 face has to show up in the n rolls.

Where am I going wrong?

  • $\begingroup$ Keep in mind, Expected Value is linear even if (as here) the variables are dependent. $\endgroup$
    – lulu
    Apr 22, 2018 at 19:48
  • $\begingroup$ It cannot take value six. Do not confuse yourself with how the summation of random variables work. Remember that these variables are dependent on one another, not independent. $\endgroup$
    – JMoravitz
    Apr 22, 2018 at 19:49
  • $\begingroup$ Maybe it clarifies things if you let $A_i$ denote the indicator variable for the absence of the $i^{th}$ face. That is $A_i$=1 if the $i^{th}$ face does not appear, and $A_i=0$ otherwise. $\endgroup$
    – lulu
    Apr 22, 2018 at 19:50
  • 1
    $\begingroup$ You are doing nothing wrong. Would this simpler example convince you? Toss a fair coin, and let the indicator variables $A_H=$ head shows, $A_T=$ tail shows. Let $X= A_H + A_T=$ the no. of heads OR tails that shows. Clearly, $X \equiv 1$. But if you just look at the summation $A_H + A_T$, it would SEEM that this summation can have values $\{0, 1, 2\}$. The fact that it SEEMS that way, does not mean it actually can take all those values (due to dependence). Same for your $\sum^6_{i=1} A_i$, which SEEMS to take values 0 through 6 but in reality only takes values 0 through 5. $\endgroup$
    – antkam
    Apr 23, 2018 at 15:15
  • 1
    $\begingroup$ An indicator variable $I_E$ simply means whether event $E$ happens or not. There are no constraints. Then you can write equations on them, also no constraints (as long as the equations are valid in the problem context). The question is what do you do next. :) The most common/basic use is then take expectations and rely on Linearity of Expectations, even when the indicators are dependent, as in your example and mine. OTOH if you want the distribution $Pr(X=x)$ (for your example), I dont think the indicators $A_i$ would be very helpful. (The summation is still valid, just not helpful.) $\endgroup$
    – antkam
    Apr 23, 2018 at 15:56

2 Answers 2


By way of enrichment here is how to solve it using EGFs. Supposing that the die has $q$ faces and is rolled $n$ times we have from first principles for the expectation

$$\mathrm{E}[X] = \frac{1}{q^n} \sum_{p=0}^q p {q\choose q-p} n! [z^n] (\exp(z)-1)^{q-p} \\ = n! [z^n] (\exp(z)-1)^q \frac{1}{q^n} \sum_{p=0}^q p {q\choose p} (\exp(z)-1)^{-p} \\ = n! [z^n] (\exp(z)-1)^q \frac{q}{q^n} \sum_{p=1}^q {q-1\choose p-1} (\exp(z)-1)^{-p} \\ = n! [z^n] (\exp(z)-1)^{q-1} \frac{q}{q^n} \left(1+\frac{1}{\exp(z)-1}\right)^{q-1} \\ = n! [z^n] \frac{q}{q^n} \exp((q-1)z) = \frac{q}{q^{n}} (q-1)^n = q\left(1-\frac{1}{q}\right)^n.$$

What we see here confirms the result from linearity of expectation with $q$ indicator variables for each possible value and $(1-1/q)^n$ the probability of that value not appearing.

Observe that this technique will produce higher factorial moments and hence the variance, e.g. we get

$$\mathrm{E}[X(X-1)] = n! [z^n] (\exp(z)-1)^q \frac{q(q-1)}{q^n} \sum_{p=2}^q {q-2\choose p-2} (\exp(z)-1)^{-p} \\ = n! [z^n] (\exp(z)-1)^{q-2} \frac{q(q-1)}{q^n} \left(1+\frac{1}{\exp(z)-1}\right)^{q-2} \\ = n! [z^n] \frac{q(q-1)}{q^n} \exp((q-2)z) = \frac{q(q-1)}{q^{n}} (q-2)^n = q(q-1)\left(1-\frac{2}{q}\right)^n.$$

Recall that

$$\mathrm{Var}[X] = \mathrm{E}[X(X-1)] + \mathrm{E}[X] - \mathrm{E}[X]^2$$

so that we obtain

$$\mathrm{Var}[X] = q(q-1)\left(1-\frac{2}{q}\right)^n + q\left(1-\frac{1}{q}\right)^n - q^2\left(1-\frac{1}{q}\right)^{2n}.$$


The trick is to use the following property of the Indicator Function (Called Indicator Function - Mean, Variance and Covariance):

$$ \boldsymbol{1}_{A} \left( x \right) = \begin{cases} 1 & \text{ if } x \in A \\ 0 & \text{ if } x \notin A \end{cases} \Rightarrow \mathbb{E} \left[ \boldsymbol{1}_{A} \left( x \right) \right] = P \left( A \right) $$

Defining $ {A}_{i} $ as the event of the $ i $ -th face doesn't appear.

The, as indicator function of the set:

$$ {\boldsymbol{1}}_{{A}_{i}} = \begin{cases} 1 & \text{ if } \text{The $ i $ -th face doesn't appear} \\ 0 & \text{ if } \text{The $ i $ -th face does appear} \end{cases} $$

This gives the following equality:

$$ X = \sum_{i = 1}^{6} {\boldsymbol{1}}_{{A}_{i}} $$

By the Linearity Property of the Expectation Operator:

$$ X = \sum_{i = 1}^{6} {\boldsymbol{1}}_{{A}_{i}} \Rightarrow \mathbb{E} \left[ X \right] = \mathbb{E} \left[ \sum_{i = 1}^{6} {\boldsymbol{1}}_{{A}_{i}} \right] = \sum_{i = 1}^{6} \mathbb{E} \left[ {\boldsymbol{1}}_{{A}_{i}} \right] $$

Utilizing the property of the Indicator Function:

$$ \mathbb{E} \left[ X \right] = \sum_{i = 1}^{6} \mathbb{E} \left[ {\boldsymbol{1}}_{{A}_{i}} \right] = \sum_{i = 1}^{6} P \left( {A}_{i} \right) = \sum_{i = 1}^{6} {\left( \frac{5}{6} \right)}^{n} = 6 {\left( \frac{5}{6} \right)}^{n} $$

To Do

  • Add simulation.
  • $\begingroup$ I completely understand what you are doing here but my problem is different . My question is that the sample space is changing the mentioned question .Also the number of elements in the sample space is changing. This didnot happen in coupon collectors problem or deriving expectation of a binomial distribution $\endgroup$
    – DRPR
    Apr 22, 2018 at 21:02
  • $\begingroup$ Well, it makes sense since this is a different question then the Coupon Collector Problem. By the way for $ n = 0 $ the sample space of $ X $ includes 6. $\endgroup$
    – Royi
    Apr 22, 2018 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.