Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

If $f(x_1,x_2)= {x_1 \choose x_2}(1/2)^{x_1}(x_1/15)$ where $x_2 = 0,1,\ldots,x_1$ and $x_1 = 1,\ldots,5$, how would you find $E[X_2]$ and $E[X_2|X_1=x_1]$


To find $E[X_2]$ you just perform a double summation from $0$ to $x_1$ for $x_2$ and from $1$ to $5$ for $x_1$, multiplying each value of $x_2$ by the pdf.

To find $E[X_2|X_1=x_1]$, you fix $x_1$, and add the products of all relevant $x_2$ by the pdf.

So for example: if $x_1 = 1$, then $E[X_2|X_1= 1]= 0*pdf + 1* pdf = {1 \choose 1} (1/2)(1/15)= 1/30$. Is the correct reasoning? Do I repeat this process for all the other $x_1$? I'm trying to find an easier way to do this problem.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

By the tower property, $E[X_{2}] = E[ E[X_{2} | X_{1} = x_{1}] ]$, so I would first start by solving for $E[X_{2} | X_{1} = x_{1}]$: $$E[X_{2}|X_{1} = x_{1}] = \sum_{x_{2}=0}^{x_{1}}x_{2}\cdot{}P(X_{2}=x_{2}|X_{1}=x_{1}) = \sum_{x_{2}=0}^{x_{1}}x_{2}\cdot{}\frac{P(X_{2}=x_{2} \cap X_{1}=x_{1})}{P(X_{1}=x_{1})} $$

$$ = \sum_{x_{2}=0}^{x_{1}}x_{2}\cdot{}\frac{\biggl[\begin{pmatrix} x_{1} \\ x_{2}\end{pmatrix} \biggl(\frac{1}{2}\biggr)^{x_{1}}\biggl( \frac{x_{1}}{15}\biggr)\biggr]}{\displaystyle\sum_{x_{2}=0}^{x_{1}}\biggl[\begin{pmatrix} x_{1} \\ x_{2}\end{pmatrix} \biggl(\frac{1}{2}\biggr)^{x_{1}}\biggl( \frac{x_{1}}{15}\biggr)\biggr]}.$$

Next, write down the marginal probability mass function of $X_{1}$, which is given by summing out the $x_{2}$ variable, which is the numerator above.

$$ P(X_{1} = x_{1}) = \sum_{x_{2}=0}^{x_{1}}\biggl[\begin{pmatrix} x_{1} \\ x_{2}\end{pmatrix} \biggl(\frac{1}{2}\biggr)^{x_{1}}\biggl( \frac{x_{1}}{15}\biggr)\biggr].$$

Now you can compute $E[X_{2}]$ as the expectation of $E[X_{2}|X_{1}=x_{1}]$ using the PMF of $X_{1}$: $$ E[X_{2}] = \sum_{x_{1}=1}^{5}\Biggl[\sum_{x_{2}=0}^{x_{1}}x_{2}\cdot{}\frac{\biggl[\begin{pmatrix} x_{1} \\ x_{2}\end{pmatrix} \biggl(\frac{1}{2}\biggr)^{x_{1}}\biggl( \frac{x_{1}}{15}\biggr)\biggr]}{\displaystyle\sum_{x_{2}=0}^{x_{1}}\biggl[\begin{pmatrix} x_{1} \\ x_{2}\end{pmatrix} \biggl(\frac{1}{2}\biggr)^{x_{1}}\biggl( \frac{x_{1}}{15}\biggr)\biggr]}\cdot{}\sum_{x_{2}=0}^{x_{1}}\biggl[\begin{pmatrix} x_{1} \\ x_{2}\end{pmatrix} \biggl(\frac{1}{2}\biggr)^{x_{1}}\biggl( \frac{x_{1}}{15}\biggr)\biggr]\Biggr] $$

$$ = \sum_{x_{1}=1}^{5}\sum_{x_{2}=0}^{x_{1}}x_{2}\cdot{}\biggl[\begin{pmatrix} x_{1} \\ x_{2}\end{pmatrix} \biggl(\frac{1}{2}\biggr)^{x_{1}}\biggl( \frac{x_{1}}{15}\biggr)\biggr]$$

which is just the basic double sum formula for $E[X_{2}]$ as expected.

As for what these sums work out to, I would probably just use SymPy, Maple, or Mathematica if you want closed forms, or NumPy or Matlab if you want the numerical results.

share|improve this answer
I think E[X2] eventually equals the first term in the product –  lord12 Mar 20 '12 at 0:53
But the first term of the product is just for a single value of $x_{1}$. You have to multiply by the probability of that value of $x_{1}$ and sum over all potential choices for $x_{1}$. –  EMS Mar 20 '12 at 0:56
Nevermind, I see what you did –  lord12 Mar 20 '12 at 1:00
You're right. The mistake though is not quite what you mentioned. It is that in my first conditional expectation, I forgot to divide by the marginal probability $P(X_{1} = x_{1})$. Then, multiplying by that again will cancel it to make the last formula correct. I am updating to reflect this. –  EMS Mar 20 '12 at 1:06
add comment

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.