Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

How can I compute this probability? I do not know what to do since it involves two random variables.

Let $X$ and $Y$ be uniform random variables on $(0,1)$. How can I compute this?

$$ P(|X-Y| < 0.25). $$

I tried to do it using an integral $$ \int_0^1 P(|X-y| < 0.25) \,dy $$

but I do not know what to do next.

edit: I forgot to mention the independence of the random variables. Thanks for warning.

share|improve this question
3  
Draw a sketch of the plane with $x$ and $y$ axes and mark on it a square with opposite corners $(0,0)$ and $(1,1)$. The random point $(X,Y)$ always lies in this square. Draw the region where $|X-Y| < 0.25$. Integrate the joint density function of $X$ and $Y$ over this region. If you are given that $X$ and $Y$ are independent (you did not mention this in the question), then you can get the answer more simply by an area computation (Think about this) that does not require explicit integration of the joint density. –  Dilip Sarwate Feb 6 '12 at 20:17

2 Answers 2

up vote 2 down vote accepted

To accompany André's: answer:

Note $$|Y-X|\le {1\over4}\iff\ \color{darkgreen}{ X-{1\over 4}}\le\ Y\le \color{maroon}{X+{1\over4}}.$$


enter image description here




As André makes clear in his answer, you need to compute $$ \int\kern-4pt\int_A 1 dy\,dx $$ where $A$ is the pink region above. The best way to do this directly, if unimaginatively (see the end of André's comment below), is to split $A$ into three pieces:

enter image description here

and integrate over each piece; then, add the three integrals together.

Let's set up the double integral over the light green region:

You can imagine that the light green region is generated as the line $\color{darkgreen}{\ell_x}$ sweeps across the region starting at $x=1/4$ and ending at $x=3/4$. The limits of integration for the inner integral will be from the bottom of $\ell_x$ (namely $x-1/4$) to the top of $\ell_x$ (namely $x+1/4$). Here, we integrate with respect to $y$ (we "add function values over the line $\ell_x$"): $$ \int_{x-1/4}^{x+{1/4}} 1\,dy. $$ Now we integrate the above expression with respect to $x$ as $\ell_x$ ranges from its leftmost value $x=1/4$ to its right most value $x=3/4$: $$ \int_{1/4}^{3/4}\int_{x-1/4}^{x+{1/4}} 1\,dy\,dx. $$

So, that's the integral over the light green region.

I'll leave it you you to evaluate the integral and to set up and evaluate the integrals for the other two regions (but if you need help, please ask).

share|improve this answer
    
+1 for a nice picture! Since the homework tag was attached, I wrote a comment in which I suggested to OP alice that she draw the sketch for herself, but you have saved her the trouble. –  Dilip Sarwate Feb 6 '12 at 20:40
    
Thank you for your answers, but I want to learn how to do it using integrals. In this case, the region was good so this could be done by graphics. What happens if we have higher dimensions or distributions different than uniform? –  alice Feb 6 '12 at 20:44
    
@alice Generally, you set up a double integral over the region defined by the event: $P[(X,Y)\in B]=\int\int_{\lower5pt\kern-6pt B } f_{X,Y} (x,y) dA$. Here, $f_{X,Y}$ is the joint distribution of $X$ and $Y$. It really boils down to a multivariable calc. problem. For your problem, you are integrating the function $1$ over the pink region shown above. –  David Mitra Feb 6 '12 at 20:47
    
@alice: Look at David Mitra's very nice picture. Let's integrate first with respect to $y$. Need to break up the region into $3$ parts, $x\le 0.25$, $0.25\le x\le 0.75$, $0.75\le x\le 1$. In the first region, $y$ goes $0$ to $x+0.25$. In the second region, $y$ goes from $x-0.25$ to $x+0.25$. In the third region, $y$ goes from $x-0.25$ to $1$. Three integrations! You can save time by finding instead the sum of the integrals over the two triangles, subtracting from $1$. –  André Nicolas Feb 6 '12 at 20:59

Hint: In order to compute an answer, you will have to make an assumption. One natural one is that $X$ and $Y$ are independent. Perhaps that was included in the question, and you forgot to mention it. Or perhaps it was (by mistake) left out.

Assuming independence, the pair $(X,Y)$ has uniform distribution on the square. So the joint density function is $1$ in the square, and $0$ outside.

The answer is then $$\iint_A 1\,dy\;dx,$$ where $A$ is the part of the square where $|x-y|<0.25$, or if you wish, $\le 0.25$, it makes no difference to the answer.

We can now do the integration, maybe by expressing our double integral as an iterated integral. But there is a much simpler way to solve the problem. We are integrating $1$ over $A$, so the result is the area of $A$.

Draw the region $A$ carefully. After you do that, you will not find it difficult to find its area. No integration, just basic geometry.

Remark: To see that we need some sort of assumption about $X$ and $Y$, let $X$ be uniformly distributed on $(0,1)$, and let $Y=X$. Then $X$ and $Y$ satisfy the conditions of the problem as stated, but are very much not independent. It is clear that $P(|X-Y|<0.25)=1$.

share|improve this answer
    
+1 for explicitly mentioning independence when the original poster didn't. That often gets forgotten. –  Michael Hardy Feb 6 '12 at 20:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.