# Finding probability density function of a conditional expectation

I´m solving the next exercise of a probability book about conditional expectation:

Let $(X,Y)$ a discrete random vector with probability density function given by

$$f_{x,y}(x,y)=(x+y)/36\quad x,y\in\{1,2,3\}$$ and zero in other case.

a) Find the probability density function of the random variable $E(X|Y).$

b) Check the formula $E(E(X|Y))=E(X)=78/36.$

I've begun computing marginal density for variable $Y.$ My computations lead me to get $$f_{Y}(y)=\dfrac{2+y}{12}\quad\text{if}\quad y\in\{1,2,3\}$$ and zero in other case.

Then I use the definition of $E(X|Y=y),$ so doing the computations I get $$E(X|Y=y)=\dfrac{6y+14}{6+3y}.$$

Due to the above, we conclude that $E(X|Y)=\dfrac{6Y+14}{6+3Y}.$ Then we want to calculate $$P(\dfrac{6Y+14}{6+3Y}=y)$$ which is equivalent to compute $f_{Y}(\frac{6y-14}{6-3y}),$ but here is my problem. I don't know how to calculate that term, because random variable $Y$ is discrete, so the point of evaluation must be a natural number where marginal density of $Y$ takes these values.

How can I compute that value? I would like that $\frac{6y-14}{6-3y}=z$ for every value of $z\in\{1,2,3\},$ but when I do that, the new values of $y$ are rationals.

What am I doing wrong? Is there another way to solve this easily?

Any kind of help is thanked in advanced.

• Note: $\mathsf P(\tfrac{6Y+14}{6+3Y}=z)=\mathsf P(Y=\tfrac{14-6z}{3z-6})$ where $z\in\{\tfrac {20}9,\tfrac{26}{12},\tfrac{32}{15}\}$ – Graham Kemp Feb 19 '17 at 13:16

$$f_{X,Y}(x,y)=(x+y)/36\quad\Big[(x,y)\in\{1,2,3\}^2\Big]$$


I have no idea why you would want to do this save as a pure exercise. However you were almost there, when you found that, if we let $Z=\E(X\mid Y)$ :

\begin{align}f_Y(y) & = \sum_{x=1}^3 (x+y)/36~\Big[(x,y)\in\{1,2,3\}^2\Big] \\[1ex] &= (2+y)/12 \quad\Big[y\in\{1,2,3\}\Big]\\[2ex]Z &= \mathsf E(X\mid Y) \\[1ex] &= \frac{\sum_{x=1}^3 x(x+Y)/36}{\sum_{x=1}^3 (x+Y)/36}\quad\Big[y\in\{1,2,3\}\Big] \\[1ex] &= \frac{2(7+3Y)}{3(2+Y)}\quad\Big[y\in\{1,2,3\}\Big]\end{align}

At this point you started to go awry. Because what you were looking for should have been: $\P(Z=z)=\P(\tfrac{6Y+14}{6+3Y}=z)=\P(Y=\tfrac{14-6z}{3z-6})$.   That is:

\begin{align} Y &= \frac{2(7-3Z)}{3(Z-2)} \quad\Big[z\in\{\tfrac{20}{9},\tfrac{26}{12},\tfrac{32}{15}\}\Big]\\[2ex] f_Z(z) & = f_Y(\tfrac{2(7-3z)}{3(z-2)}) \\[1ex] &= \frac{2+\frac{2(7-3z)}{3(z-2)}}{12}\quad\Big[z\in\{\tfrac{20}{9},\tfrac{26}{12},\tfrac{32}{15}\}\Big]\\[1ex] &= \frac{1}{18 (z - 2)}\quad\Big[z\in\{\tfrac{20}{9},\tfrac{26}{12},\tfrac{32}{15}\}\Big]\end{align}

Then you find $\mathsf E(Z)=\tfrac{13}6$ as ... expected.

• Thanks a lot @Graham Kemp. It was a doubt that I've had. Thanks to every one to help me. – Suiz96 Feb 20 '17 at 23:49

Why do you need $f_{Y}(\frac{6y-14}{6-3y})$? You are trying to calculate $E(E(X|Y))$ knowing that $E(X|Y=y)=\frac{6y+14}{6+3y}$ and $f_{Y}(y)=\frac{2+y}{12}$. Hence $E(E(X|Y))=\sum_{y\in\{1,2,3\}}\frac{6y+14}{6+3y}\frac{2+y}{12}$.

• Thanks to answer @Jan, but for the part a), how can I compute the density function of the expected value? – Suiz96 Feb 17 '17 at 23:00
• You don't need density of the expected value. You need density of $Y$ since that is what changes in $E(X|Y=y)$ and you already have it. – Jan Feb 18 '17 at 8:26

$\require{cancel}$You've the right calculations for $$f_{Y}(y)=\frac{2+y}{12} \text{ if } y\in\{1,2,3\}$$ and $$E(X \mid Y=y)=\frac{6y+14}{6+3y} \text{ if } y\in\{1,2,3\}.$$

The interpretation of $E(E(X \mid Y))$ should be

\begin{align} & E(E(X \mid Y)) \\ =& \sum_{y = 1}^3 E(X \mid Y = y) P(Y = y) \\ =& \sum_{y = 1}^3 \frac{6y + 14}{\cancelto{3}{6 + 3y}} \frac{\cancel{2+y}}{12} \\ =& \sum_{y = 1}^3 \frac{6y + 14}{36} \\ =& \frac{6 \times 6 + 3 \times 14}{36} \\ =& \frac{78}{36}. \end{align}

\begin{align} & E(X) \\ =& \sum_{x = 1}^3 \sum_{y = 1}^3 x f_{X,Y}(x,y) \\ =& \sum_{x = 1}^3 \sum_{y = 1}^3 x \frac{x+y}{36} \\ =& \sum_{x = 1}^3 \frac{3x^2+6x}{36} \\ =& \sum_{x = 1}^3 \frac{x^2+2x}{12} \\ =& \frac{1+4+9+2\times6}{12} \\ =& \frac{26}{12} \\ =& \frac{78}{36}. \end{align}

This is not a coincidence. In fact,

\begin{align} & E(E(X \mid Y)) \\ =& \sum_y E(X \mid Y = y) P(Y = y) \\ =& \sum_y \sum_x x P(X \mid Y = y) P(Y = y) \\ =& \sum_y \sum_x x \frac{f_{X,Y}(x,y)}{\cancel{f_Y(y)}} \cancel{f_Y(y)} \\ =& \sum_y \sum_x x f_{X,Y}(x,y) \\ =& E(X). \end{align}

Edit in response to OP's comment

\begin{align} f_Y(y) =& \sum_{x = 1}^3 f_{X,Y}(x,y) \\ =& \sum_{x = 1}^3 \frac{x+y}{36} \\ =& \frac{1+2+3+3y}{36} \\ =& \frac{2+y}{12} \end{align}

• Thanks @GNU Supporter. Exactly. This is a property of conditional expectation. My doubt comes in calculate the density function for the conditional expectation, i.e., $f_{Y}(\dfrac{6y-14}{6-3y}).$ – Suiz96 Feb 17 '17 at 23:04
• $$f_{Y}\left(\frac{6y-14}{6-3y}\right) = P\left(Y=\frac{6y-14}{6-3y}\right) = 0$$ since the value of $Y$ is an integer by hypothesis, by as you've written in the question, $\frac{6y-14}{6-3y}$ isn't an integer since 3 divides the denominator but not the numerator. – GNUSupporter 8964民主女神 地下教會 Feb 17 '17 at 23:42