Calculate expected value of function of random variables

94 Views Asked by At

I'm stuck on this problem, and I cant seem to figure out where things go wrong. It would be great to get some help on this one.

"Water flows in and out of a dam such that the daily inflow is uniform on $[0,2]$ and the daily outflow is uniform on $[0,1]$, independent of the inflow. Compute the expected value of surplus water in a given day."

My attempted solution goes as this:

We want to calculate the $E[max(X-Y,0)]$ where $X$ is the inflow and $Y$ the outflow.

$E[\max(X-Y,0)] = \displaystyle \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \max(x-y,0)f(x,y)dxdy$.

Now, clearly $f(x,y) = f_X(x)f_Y(y) = 1/2 *1$ because of their independence.

Furthermore, $\max(x-y,0) = x-y \iff x-y>0 \iff y<x$ and zero otherwise.

Thus,

$E[\max(X-Y,0)] = \displaystyle \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} \max(x-y,0)f(x,y)dxdy = \frac{1}{2}\int_{0}^{2}\int_{0}^{1} \max(x-y,0)dydx $

$ \displaystyle = \frac{1}{2}\int_{0}^{2}\int_{0}^{x} (x-y)dydx + \frac{1}{2}\int_{0}^{2}\int_{x}^{1} 0*dydx = \frac{1}{2}\int_{0}^{2}\int_{0}^{x} (x-y)dydx = ... = 8/12=2/3$

The book says, however, that the answer should be 7/12, how is that?

I would really appreciate some help on this.

Thanks again!

2

There are 2 best solutions below

0
On BEST ANSWER

I just figured out what was wrong in my calculation above. Indeed the right answer is $7/12$.

So, when i want to calculate the integral

$\displaystyle \frac{1}{2}\int_{0}^{2}\int_{0}^{1}\max(x-y,0)dydx$

I forgot a small part of the region of which I was supposed to be integrating over. The region consists of $0<y<x<1 $, and $0<x<2$ (in which $\max(x-y,0)=x-y$) and is therefore a "triangle plus a small rectangle" type-of-region. I missed out on the last part.

1
On

Upper limit in integration by $y$ should be $\min(x,1)$, since $x$ changes from $0$ to $2$, however, $y$ can be only as large as $1$:

$$ \frac12\int_0^2\int_0^1\max(x-y,0)\,dy\,dx = \frac12\int_0^2\int_0^{\min(x,1)}(x-y)\,dy\,dx = \\ \frac12\int_0^2\int_0^x(x-y)\,dy\,dx - \frac12\int_1^2\int_1^x(x-y)\,dy\,dx= \frac23 - \frac1{12} $$

The last integral is exactly your missing $1/12$.

enter image description here