Probability of two statistically independent, uniformly distributed variables occurring within time frame of each other?

Say two events will occur independently of each other, only once each. The time of each event occurring is uniformly distributed from 0 to 10 seconds. What is the probability that the events will occur within 2seconds of each other?

I have found the joint pdf but I am unsure of how to set up an integral for this...

• What is your joint pdf ? Please show it ! – callculus Jul 20 '16 at 3:30

Outline: Draw the $10\times 10$ square with corners $(0,0)$, $(10,0)$, $(10,10)$, $(0,10)$. Draw the two lines $y=x+2$ and $y=x-2$.

We want the probability of falling in the part $K$ of the square that is between these two lines.

This is the area of $K$ divided by $100$. It is easier to find first the area of the part of the square that is not in $K$.

If you really want to evaluate an integral, use symmetry to observe that if $X,Y$ are our random variables, then the required probability is twice the probability that $X\le Y\le X+2$. Then use the picture to find the bounds of integration.

The time of each event occurring is uniformly distributed from 0 to 10 seconds. What is the probability that the events will occur within 2seconds of each other?

The probability will be the integral of the pdf over where the condition occurs within the support.

That is you want $0\leq x\leq 10$ and $0\leq y\leq 10$ and also $(x-2)\leq y\leq (x+2)$ .

$$\mathsf P(\lvert X-Y\rvert<2) = \int_0^{10} \int_{\max(0,x-2)}^{\min(10,x+2)}f_{X,Y}(x,y)\operatorname d y\operatorname d x$$

This can be partitioned into three integrals, but it is easier to work with the complement.

\begin{align}\mathsf P(\lvert X-Y\rvert<2) =&~ 1- \int_2^{10} \int_0^{x-2}f_{X,Y}(x,y)\operatorname d y\operatorname d x - \int_0^8\int_{x+2}^{10}f_{X,Y}(x,y)\operatorname dy\operatorname d x\\[2ex] =&~ 1- \int_2^{10} \int_0^{x-2}f_{X,Y}(x,y)\operatorname d y\operatorname d x - \int_2^{10} \int_0^{y-2}f_{X,Y}(x,y)\operatorname d x\operatorname d y\end{align}

I have found the joint pdf but I am unsure of how to set up an integral for this...

There you go then.   Just substitute in your pdf, $f_{X,Y}(\cdot, \cdot)$

Or you can do it graphically if you wish; you're cutting a square with two line parallel to the diagonal leaving two triangles and an irregular hexagon.   The region of integration is the hexagon; and the complement region is the two triangles.