Calculate $E(Y)$ when $Y$ is the chosen integer out of $1,..,X$

43 Views Asked by At

The Question :

In the first step we randomly choose an integer out of the values ${1,2,...,10}$. Let X be the chosen integer.

In the second step we randomly choose an integer out of the values ${1,2,...,X}$. Let Y be the chosen integer.

In the third step we randomly choose an integer out of the values ${1,2,...,Y}$ - Let Z be the chosen integer.

(a). Calculate $P(Y≥7)$.

(b). Calculate $P(Z≥8)$.

(c). Calculate $E(X),E(Y),E(Z),V(X),V(Y)$.

I succeed to solve (a) and (b) and most of (c), I know it's a quite simple question but I don't understand why the official handles $E(Y)$ as $E(Y) = E(\frac {X+1} {2})$ I just did the long way by using ${\displaystyle \operatorname {E} (Y)=\sum _{i}x_{i}P(Y=x_{i})}$ which is can cause mistakes easily because, in order to calculate each $P(Y=x_{i})$ for every $1≤i≤10$.

I know that they do it due to Law of total expectation, but I think I have a confusion about the formula and I would like a clarification about it.

In our case we have : ${\displaystyle \operatorname {E} (Y)=\operatorname {E} (\operatorname {E} (Y\mid X))}$ = ${E}({E} (Y\mid X = 1) {\cdot} P(X=1) + ... + {E} (Y\mid X = 10) {\cdot} P(X=10)) $ But, I don't understand how we calculate it. For example ${E} (Y\mid X = 5) $ If I calculate ${E} (Y\mid X = 5) $, We have $5$ options to $Y$ which are $1,..5$ it so ${E} (Y\mid X = 5) $ I thought it's $5 + E(Y)$ , but if I'll do so, I will get the $E(X)$ = $E(Y)$ which is not true, what is incorrect in my way?

1

There are 1 best solutions below

0
On BEST ANSWER

The law of total expectation states $$\operatorname{E}[Y] = \operatorname{E}[\operatorname{E}[Y \mid X]]$$ but students at first tend to find this notation confusing or opaque. What is really happening is that the inner conditional expectation $\operatorname{E}[Y \mid X]$ regards $X$ as fixed, and calculates the expectation with respect to $Y$. The result is a function of the random variable $X$, and then the outer expectation is taken with respect to $X$.

In the sampling process described, what we have is a hierarchical model:

$$X \sim \operatorname{DiscreteUniform}(1,10), \\ Y \mid X \sim \operatorname{DiscreteUniform}(1,X), \\ Z \mid Y \sim \operatorname{DiscreteUniform}(1,Z).$$

Note that it is not the case that $Y$ itself is discrete uniform, because it is only after we sample from $X$ that the conditional distribution of $Y$ is discrete uniform. An intuitive way to see this is to observe that the only way $Y = 10$ is if $X = 10$, but $Y = 1$ can occur for any $X$. Indeed, we are assured that $Y = 1$ if $X = 1$. So the unconditional probability $\Pr[Y = 1]$ must be greater than $\Pr[Y = 10]$.

So when we want to compute $\operatorname{E}[Y \mid X]$, we are interested in the expectation of this conditional variable $Y \mid X$. Given $X$, the mean of a discrete uniform variable on $\{1, \ldots, X\}$ is just $\frac{X+1}{2}$, in the same way that for a discrete uniform variable on $\{a, a+1, \ldots, b\}$ with $a \le b$, the expectation is $\frac{a+b}{2}$.

And in accordance with what we discussed earlier, $\operatorname{E}[Y \mid X] = \frac{X+1}{2}$ is just a function of $X$. Then the outer expectation is $$\operatorname{E}\left[\frac{X+1}{2}\right] = \frac{1}{2}\operatorname{E}[X+1] = \frac{1}{2}(\operatorname{E}[X] + 1).$$ And since $\operatorname{E}[X] = \frac{10+1}{2},$$ the result follows.

The same idea can be used to compute $\operatorname{Var}[Y]$, except we need to use the law of total variance:

$$\operatorname{Var}[Y] = \operatorname{Var}[\operatorname{E}[Y \mid X]] + \operatorname{E}[\operatorname{Var}[Y \mid X]].$$

We already know $\operatorname{E}[Y \mid X] = \frac{X+1}{2}$. So the first term is just $$\operatorname{Var}\left[\frac{X+1}{2}\right].$$ We can use the properties of variance $$\operatorname{Var}[c X] = c^2 \operatorname{Var}[X], \quad \operatorname{Var}[c + X] = \operatorname{Var}[X],$$ when $c$ is a scalar constant, to conclude $$\operatorname{Var}\left[\frac{X+1}{2}\right] = \frac{1}{4}\operatorname{Var}[X].$$

But what about the second term? What is $\operatorname{Var}[Y \mid X]$? This is the variance of the conditional discrete uniform variable $Y \mid X$; i.e., what is the variance of a discrete uniform variable on $\{1, \ldots, X\}$? The result will be a function of $X$.

I leave the remainder of the computations as an exercise.