Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose we throw a fair dice, and let $X$ be the random variable representing each face (each result: $1,2,3,4,5,6$).
Suppose that we drew $k$ on the dice; we then flip a fair coin $k$ times.
let $Y$ be the random variable representing how many times we drew $H$ (head).
Now, I need to calculate $E(Y|X=3)$, and $E(Y)$.

My answer to the first:
The random variable $Z=(Y|X=3)$ distribution is:


So finding $E(Z)$ is easy.
But I have no idea how to find $E(Y)$, beacuse I am not really sure how the joint distribution table looks like for $X$ and $Y$ - it's dimensions depends on the $X=x$ value. meaning, for every $x\in X$, $Y$ gets different possible values!
for example, what would be $\mathbb{P}_{X,Y}(X=2,Y=6)$? we don't know, because we throw the coin only two times!

Thank you in advance.

share|cite|improve this question
From what you told us, it seems $P(X=2,Y=6)=0$. One way of finding $E[Y]$ is finding $E[Y|X=k]$ for each $k$ and then applying $E[Y] = \sum_{k=1}^{6}{E[Y|X=k]P(X=k)}$. – madprob Jan 13 '14 at 16:00
Beware that "The random variable Z=(Y|X=3)" is a nonexistent object. – Did Jan 13 '14 at 16:53
Thank you all for the help. – so.very.tired Jan 13 '14 at 20:47
@Did, what's wrong with Z? why is it nonexistent? – so.very.tired Jan 14 '14 at 18:57
Because the notion is in no (decent) textbook. How would you define it? – Did Jan 14 '14 at 19:26
up vote 1 down vote accepted

Because the probability of head is the same as the probability of tail, $E(Y|X=3)=3-E(Y|X=3)$ which gives $E(Y|X=3)=1.5$. Thus, $E(Y)=\sum_{j=1}^6 E(Y|X=j)/6 =\sum_{j=1}^6 (j/2)/6 = 6 \times (6+1) /24 = 42/24=7/4$.

share|cite|improve this answer

One can do the calculation "from basics," but there are faster ways.

Given that $X=k$, the random variable $Y$ has binomial distribution, $k$ trials, probability of success $\frac{1}{2}$. Thus $E(Y|X=k)=\frac{k}{2}$.

Then $E(Y)=E(E(Y|X))=\frac{1}{6}\left(\frac{1}{2}+\frac{2}{2}+\cdots+\frac{6}{2}\right)=\frac{7}{4}$.

Remark: The joint distribution of $X$ and $Y$ can be written down. The probability that $X=k$ and $Y=y$ is $\frac{1}{6}\binom{k}{y}\left(\frac{1}{2}\right)^y$. Then we can use the table directly to find $E(Y)$, or first use the table to write down the distribution of $Y$, and then $E(Y)$. That is less efficient than working directly with expectations.

share|cite|improve this answer
You've swapped an $X$ and $Y$ there. – Byron Schmuland Jan 13 '14 at 16:04
Thank you, fixed. – André Nicolas Jan 13 '14 at 16:11
Look at the sentence that begins with the word "Thus". – Byron Schmuland Jan 13 '14 at 16:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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