Probability of taking water from a bottle and pouring back

45 Views Asked by At

We have a bottle with 1 liter of water. We take out $X\sim Uni(0,1)$ water and then put $Y\sim (0,1)$ water. $X$ and $Y$ and independent. Find how the water in the bottle is distributed at the end.

What I did:

Lets denote $Z$ to be the water at the end. We want to find $F_Z(z)$. We can see that: $$ Z=1-X+Y $$ where $z\in(0,2)$. Also we can see that: $$ F_{Z}(z)=P\left(Z\leq z\right)=P\left(1-X+Y\leq z\right)=P\left(Y-X\leq z-1\right) $$ Lets denote $U=Y-X$ where $u\in(-1,1)$. If $X\sim Uni(0,1)$ then $-X\sim Uni(-1,0)$. Using convolusion: $$ f_{U}(u)=\int_{-\infty}^{\infty}f_{Y,X}(y,u-y)dy $$ $X$ and $Y$ are independent so $f_{X,Y}(x,y)=f_{X}(x)f_{Y}(y)$. This means that: $$ \begin{align*} f_{U}(u)&=\int_{-\infty}^{\infty}f_{Y,X}(y,u-y)dy=\int_{-\infty}^{\infty}f_{Y}(y)f_{X}(u-y)dy\\&=\int_{-\infty}^{\infty}1\mathbb{I}_{\{0<y<1\}}1\mathbb{I}_{\{-1<u-y<0\}}dy\\&=\int_{-\infty}^{\infty}\mathbb{I}_{\{0<y<1\}}\mathbb{I}_{\{u<y<u+1\}}dy=\int_{-\infty}^{\infty}\mathbb{I}_{\{0<y<u+1\}\cup\left\{ u<y<1\right\} }dy\\&=\int_{0}^{u+1}dy+\int_{u}^{1}dy=u+1+(1-u)=2 \end{align*} $$

This part I'm not sure about. I believe that I'm wrong because then I don't get $\int_{-1}^1f_U(u)=1$.

But if I'm wrong here, as I understand I should get something like: $$ F_{U}(u)=\int_{-\infty}^{u}tdt=\begin{cases} 0 & u<-1\\ 1.5u^{2} & -1<u<1\\ 1 & u>1 \end{cases} $$ I figured that $F_U(u)$ is like so because I know that $u\in(-1,1)$ and I need $\int_{-1}^1g(u)du=1$ so I guessed that $g(u)=1.5u^2$.

Then I can say that: $$ F_{Z}(z)=P\left(Y-X\leq z-1\right)=P\left(U\leq z-1\right)=1.5\left(z-1\right)^{2} $$ But the solution is - for $z\in(0,1)$ it should be $F_Z(z)=z-0.5$ and for $z\in(1,2)$ it should be $F_Z(z)=-0.5z^2+2z-1$. How did they got here?

1

There are 1 best solutions below

0
On

Assuming the bottle can hold two liters of water,

$Z = 1 - X + Y = 1 - (X-Y) = 1 + (Y-X)$

So we can either find the distribution of $X-Y$ (or $Y-X$) first and then it is straightforward to find distribution of $Z$ or we can directly find distribution of $Z$. I will take the second approach.

$F_Z(z) = P(Z \leq z) = P(Y - X \leq z - 1)$

For ease of understanding, see the sketch.

enter image description here

When $X \geq Y, 0 \lt Z \leq 1$ and when $Y \gt X, 1 \lt Z \lt 2$

For $X \geq Y$, see the shaded area in grey.

$ \displaystyle F_Z(z) = \int_{1-z}^1 \int_0^{x+z-1} ~ dy ~ dx = \frac{z^2}{2}, ~0 \lt z \leq 1$

For $Y \gt X$, it is easier to evaluate $P(Y-X \gt z - 1) $ and subtract from $1$. See the shaded area in light yellow.

$ \displaystyle F_Z(z) = 1 - \int_{0}^{2-z} \int_{x+z-1}^1 ~ dy ~ dx$
$ \displaystyle = 1 - \frac{(2-z)^2}{2}, ~1 \lt z \lt 2$