# A simple conditional expectation problem

$X, Y$ iid uniform random variables on $[0,1]$ Z = \left\{ \begin{aligned} X+Y \quad&\text{ if } X>\frac{1}{2} \\ \frac{1}{2} + Y \quad & \text{ if } X\leq\frac{1}{2} \end{aligned} \right. The question is $E\{Z|Z\leq 1\}= ?$

I tried $\displaystyle \int_0^1 E\{Z|Z = z\} P\{Z = z\}dz$ and got $5/8$, but I am not so sure about the result since I haven't touched probability for years.

-
uh... that looks wrong. in general, a variable conditioned on the value of that variable is a constant (that value), say $E(W|W=7)=7$ (which is the expectation of today temperature, given that today temperature is 20 degrees? ... wel... 20 degrees) So, you formula would give $\int_0^1 z dz= 1/2$. – leonbloy Jul 19 '11 at 3:57
thanx for the heads up, I forgot to put the density function for $Z$ – Shuhao Cao Jul 19 '11 at 4:16

For $x \in (1/2,1]$, let $$F_{Z|Z \leq 1}(x) = {\rm P}(Z \leq x | Z \leq 1) = \frac{{{\rm P}(Z \le x)}}{{{\rm P}(Z \le 1)}},$$ and let $$f_{Z|Z \leq 1}(x) = \frac{{\rm d}}{{{\rm d}x}}F_{Z|Z \le 1} (x) = \frac{1}{{{\rm P}(Z \le 1)}}\frac{{\rm d}}{{{\rm d}x}}{\rm P}(Z \le x).$$ Then, $${\rm E}[Z|Z \le 1] = \int_{1/2}^1 {xf_{Z|Z \le 1} (x)\,{\rm d}x} .$$ So now the problem reduces to calculating ${\rm P}(Z \leq x)$, for $x \in (1/2,1]$. This can be done using the law of total probability, conditioning on $X$, leading to $${\rm E}[Z|Z \le 1] = 7/9.$$

EDIT:

Fix $x \in (1/2,1]$. Then, by the law of total probability, $${\rm P}(Z \leq x) = \int_0^{1/2} {{\rm P}(Z \le x|X = s)\,{\rm d}s} + \int_{1/2}^1 {{\rm P}(Z \le x|X = s)\,{\rm d}s} .$$ It thus follows from the definition of $Z$ (and the independence of $X$ and $Y$) that $${\rm P}(Z \leq x) = \int_0^{1/2} {{\rm P}( Y \le x - 1/2)\,{\rm d}s} + \int_{1/2}^1 {{\rm P}(Y \le x - s)\,{\rm d}s} .$$ Now, $$\int_0^{1/2} {{\rm P}( Y \le x - 1/2)\,{\rm d}s} = \frac{1}{2}{\rm P}(Y \le x - 1/2) = \frac{{x - 1/2}}{2} = \frac{x}{2} - \frac{1}{4}$$ and $$\int_{1/2}^1 {{\rm P}(Y \le x - s)\,{\rm d}s} = \int_{1/2}^x {{\rm P}(Y \le x - s)\,{\rm d}s} = \int_{1/2}^x {(x - s)\,{\rm d}s} = \frac{{x^2 }}{2} - \frac{x}{2} + \frac{1}{8}.$$ Hence $${\rm P}(Z \leq x) = \bigg(\frac{x}{2} - \frac{1}{4}\bigg) + \bigg(\frac{{x^2 }}{2} - \frac{x}{2} + \frac{1}{8}\bigg) = \frac{{x^2 }}{2} - \frac{1}{8}.$$ In particular, $${\rm P}(Z \leq 1) = \frac{3}{8}.$$ Thus, $$F_{Z|Z \leq 1}(x) = \frac{8}{3}\bigg(\frac{{x^2 }}{2} - \frac{1}{8}\bigg) = \frac{{4x^2 - 1}}{3},$$ and in turn $$f_{Z|Z \leq 1}(x) = \frac{{8x}}{3}.$$ Finally, $${\rm E}[Z|Z \le 1] = \int_{1/2}^1 {xf_{Z|Z \le 1} (x)\,{\rm d}x} = \frac{8}{3}\int_{1/2}^1 {x^2 \,{\rm d}x} = \frac{8}{3}\bigg(\frac{{1 - 1/8}}{3}\bigg) = \frac{7}{9}.$$

-
+1 for detailed and nicely written answer – mpiktas Jul 19 '11 at 9:33
@mpiktas: Thanks. – Shai Covo Jul 19 '11 at 14:40
thank you very much for such detailed answer. – Shuhao Cao Jul 19 '11 at 17:16
Thanks, glad to help. – Shai Covo Jul 19 '11 at 17:22

Your probability space is the unit square in the $(x,y)$-plane with $dP={\rm d}(x,y)$. The payout $Z$ is ${1\over 2}+y$ in the left half $L$ of the square and $x+y$ in the right half $R$. The region where $Z\leq 1$ consists of the lower half of $L$ and a triangle in the lower left of $R$; it has total area $P(Z\leq 1)={3\over8}$.

It follows that the expectation $E:=E[Z\ |\ Z\leq 1]$ is given by $$E=\left(\int_0^{1/2}\int_0^{1/2}\bigl({1\over2}+y\bigr)dy dx + \int_{1/2}^1\int_0^{1-x}(x+y)dy dx\right)\Bigg/{3\over8} ={{3\over16}+{5\over48}\over{3\over8}}={7\over9}\ .$$

-
+1 thank you, very intuitive and easy to understand using area argument! – Shuhao Cao Jul 19 '11 at 17:17