1

pretty much trying to solve the question in the title, what I tried is:

  1. consider $Z=\left|Y-X\right|$, and try to compute $F_{Z}\left(t\right)=1-P\left(Z>t\right)=1-\left(P\left(X-Y>t\right)+P\left(Y-X\geq t\right)\right)$
  2. So I propused a random variable $Z_{1}=Y-X$, and got $$f_{Z_{1}}\left(x\right)=\intop_{-\infty}^{\infty}f_{Y}\left(y\right)f_{-X}\left(x-y\right)dy=\intop_{x}^{l}f_{Y}\left(y\right)f_{-X}\left(x-y\right)dy$$ which came out as $\frac{l-x}{l^{2}}$
  3. I then compute $P\left(X-Y>t\right)=\intop_{t}^{\infty}f_{Z}\left(x\right)dx=\intop_{t}^{l}f_{Z}\left(x\right)dx=\frac{\left(l-x\right)^{2}}{l^{2}}$ and deduced $f_{Z_{1}}\left(t\right)=1-\frac{2\left(l-x\right)^{2}}{l^{2}}$ so it came out that $f_{Z}\left(t\right)=\frac{4(l-x)}{l^{2}}$, but checking on other theards it seems that the right answer is $\frac{2(l-x)}{l^{2}}$. when $x\in\left[0,l\right]$ of course

I am trying to understand what went wrong, maybe i got $f_{Z_{1}}\left(x\right)$ wrong? at the other theards they used some methods I don't know yet, so I will appreciate if you can help me solve it this way, thank you!

Semiclassical
  • 15,842
Abzikro
  • 121
  • One lazy suggestion is to fix $l=1$, so that your expressions are simpler and thus easier to notice any errors. – Semiclassical Jan 21 '23 at 19:42
  • One other way to detect an error: $f_{Z_1}(t)$ should be zero when $t=0$. But $1-2(l-0)^2/l^2=-1$. – Semiclassical Jan 21 '23 at 19:50
  • Setting $l:=1$ as suggested Semiclassical and solving for it. Then, the other cases should followed by an affine transformation. – A. P. Jan 21 '23 at 19:55
  • @Semiclassical Is my 1,2 steps are correct? I feel like step 2 should come out as $\frac{l-x}{2l^{2}}$, and it will fix my problem, but it also doesn't look wrong to me, for $x\in\left[0,l\right]$, isn't it comes out as $$\intop_{-\infty}^{\infty}f_{Y}\left(y\right)f_{-X}\left(x-y\right)=\intop_{x}^{l}f_{Y}\left(y\right)f_{-X}\left(x-y\right)dy=\intop_{x}^{l}\frac{1}{l^{2}}dy$$? – Abzikro Jan 21 '23 at 19:57
  • @A.P. I am not too familiar affine transformation yet, and fixing $l=1$ doesn't really help with my how I solved it(is my logic right, or am I just straight up wrong?), it seems that $f_{Z_{1}}\left(x\right)=\frac{1}{2}\frac{l-x}{l^{2}}$ which will fix my problem, but I don't under stand what I wrong, I used convolution to get $f_{Z_{1}}\left(x\right)=\intop_{-\infty}^{\infty}f_{Y}\left(y\right)f_{-X}\left(x-y\right)dy$ and I got to $\frac{l-x}{l^{2}}$ as I wrote in last comment, why is it wrong? – Abzikro Jan 21 '23 at 20:06
  • I managed to do it at the end, using $$f_{X-Y}(x)=\begin{cases} \intop_{x}^{l}f_{X}\left(y\right)f_{-Y}\left(x-y\right)dy=\frac{l-x}{l^{2}} & x\geq0\ \intop_{0}^{l+x}f_{X}\left(y\right)f_{-Y}\left(x-y\right)dy=\frac{l+x}{l^{2}} & x\leq0 \end{cases}$$ and $P\left(\left|X-Y\right|\leq t\right)=\intop_{-t}^{t}f_{Z_{1}}\left(x\right)dx=\frac{1}{l^{2}}\left(2lt-t^{2}\right)$ – Abzikro Jan 21 '23 at 21:45
  • Answered at https://math.stackexchange.com/q/1681363/321264. – StubbornAtom Jan 22 '23 at 06:56

1 Answers1

1

There are some calculations you make that I can't follow, but the idea makes sense to me. Maybe you should check the limits of integration, supports, etc. I will write a version of the solution as I commented previously with an idea that I once learned from a friend. The idea is basic: work on $[0,1]$ taking advantage of uniformity and use definitions moving to $[0,L]$.

Suppose $X,Y\sim U[0,L]$ for $L>0$. Then notice that transformation $$(Z_1,Z_2)\to\left(\frac{1}{L}X,\frac{1}{L}Y\right) \implies Z_1,Z_2\sim U(0,1).$$ Thus for $t\in [0,L]$, we have $$P(|X-Y|\leqslant t)=P(|LZ_1 -LZ_2 |\leqslant t)=P(|Z_1-Z_2)|\leqslant t/L),\quad (*)$$

Thus, it is sufficient to work with $X, Y\sim U[0,1]$ and then use $(*)$ to conclude with the result. Indeed, suppose that $X,Y\sim U(0,1)$ and by independence the joint density is given by $$f(x,y)=\begin{cases}1,\quad 0\leqslant x,y\leqslant 1,\\0\quad \text{otherwise}\end{cases}$$

We want $P(|X-Y|\leqslant t)$ for $t\in [0,1]$. But, by complement we have $$P(|X-Y|\leqslant t)=1-P(|X-Y|\geqslant t)$$

Thus, it is sufficient to find $\boxed{P(|X-Y|\geqslant t)}$.

Since we want to find $P(|X-Y|\geqslant t)$ for $t\in [0,1]$ so we need to know the points $(x,y)$ so that $|x-y|\geqslant t$. The easy way is to locate the points that divide the regions $x-y\geqslant t$ or $x-y\leqslant -t$. These points are on the straight lines $|x-y|=t$ that is $x-y=t$ or $-(x-y)=t$, a first plot it useful.

enter image description here

It is easier to use geometry here, but we can continue using of the definition, so we need to use doubles integrals.

$$P(Y-X\geqslant t)=\int_{t}^{1}\int_{0}^{y-t}1\, dxdy=\frac{(t-1)^{2}}{2}$$ $$P(X-Y\geqslant t)=\int_{t}^{1}\int_{0}^{x-t}1\, dydx=\frac{(t-1)^{2}}{2}$$

Thus, $$P(|X-Y|\leqslant t)=1-P(|X-Y|\geqslant t)=\boxed{1-P(Y-X\geqslant t)-P(X-Y\geqslant t)}$$ give $$\boxed{P(|X-Y\leqslant t)=1-(t-1)^{2}}$$

The probability density function is given so $$\boxed{f(t)=\begin{cases}2-2t, 0\leqslant t\leqslant 1,\\0,\quad \text{otherwise}\end{cases}}$$

Using $(*)$, then we have $P(|X-Y|\leqslant t/L)=1-(t/L-1)^{2}$ and taking the derivative we find the probability density function $$\boxed{f(t)=\begin{cases} 2(L-t)/L^{2}\quad 0\leqslant t\leqslant L,\\0,\quad \text{otherwise}\end{cases}}$$

A. P.
  • 5,978
  • Oh I see now, it really is a nice way to do it, thank you! I ended up using the density of X-Y in the region [-1,1] as I commented below my initial thread. But your answer really helped me understand what I am trying to compute at all. – Abzikro Jan 23 '23 at 10:32
  • It's my pleasure to help, I'm glad my answer was useful for you. Success in your studies. – A. P. Jan 23 '23 at 14:40