# conditional expectation — a specific problem

Suppose that $X$ and $Y$ are independent random variables, $X$ is uniformly distributed on $[0,1]$, and $Y$ is uniformly distributed on $\{ 1,2,3\}$. How to get $E((X+Y)^2 | Y)$?

It seems to me that the conditional density $p_{X|Y}(x|y)$ is equal to $p_X(x)$, so what is the role of $Y$ here?

-
Since $Y$ can have only three possible values, you can just treat each of the three cases separately, i.e. $$E[(X+Y)^2\,|\,Y] = \begin{cases} E[(X+1)^2] & \text{if }Y=1 \\ E[(X+2)^2] & \text{if }Y=2 \\ E[(X+3)^2] & \text{if }Y=3 \end{cases}$$ Hopefully this may help you come up with a general rule, but if not, a case-by-case answer is still a valid answer. – Ilmari Karonen Aug 28 '11 at 11:53

Since $Y$ is a discrete random variable, one can rely on the elementary definition of conditional expectations: $E((X+Y)^2\mid Y)=u(Y)$ where the function $u$ is such that, for every $y$ in $\{1,2,3\}$, $u(y)=E((X+Y)^2\mid Y=y)$.

Now, on $[Y=y]$, $(X+Y)^2=(X+y)^2$ almost surely, hence $u(y)=E((X+y)^2\mid Y=y)$. But the random variables $(X+y)^2$ and $Y$ are independent (why?), hence $u(y)=E((X+y)^2)$.

So the question reduces to: What is $E((X+y)^2)$ for each $y$ in $\{1,2,3\}$? I am sure you can answer that.

-