# Calculating probabilities in two overlapping continuous uniform random variables (with an added constraint)

Given X~unif(a, b) and Y~unif(c, d) with a < c < b < d.

What's the probability that Y>X and Y being realized in the interval (c, b)?

-
 Are you asking for conditional probability $\mathsf{Pr}\left(Y>X | c < Y show 6 more comments ## 2 Answers Here we assume that$X$and$Y$are independent random variables with uniform distributions as specified by OP. Write out the definition of the probability: $$\mathsf{Pr}\left(Y>X, c<Y<b\right) = \int_{c}^{b} \left( \int_{a}^{y}\frac{\mathrm{d}x}{b-a} \right) \frac{\mathrm{d}y}{d-c}$$ Can you finish it off? -  What is the reason for the second integral having an upper limit of y? Shouldn't it be only in terms of a, b, c, and d? – Wuschelbeutel Kartoffelhuhn Aug 30 '12 at 3:30 Maybe I'm misunderstanding it and the second integral ought to be inside the first. – Wuschelbeutel Kartoffelhuhn Aug 30 '12 at 3:36 Sorry, I disambiguated the expression, and put in parenthesis. – Sasha Aug 30 '12 at 3:39 Here is one solution without explicit integration. Let$A$be the event that$Y>X$and$B$the event that$c<Y<b$. Then we know that$\mathrm{Pr}(A \cap B)=\mathrm{Pr}(A|B)\mathrm{Pr}(B)$. The two probabilities on the right are simpler to calculate. First$\mathrm{Pr}(B)=\frac{b-c}{d-c}$. Next we get a handle on$\mathrm{Pr}(A|B)$. Split the event$A$into two disjoint events:$A_1$and$A_2$where$A_1$is the event that$Y>X$and$X<c$; and$A_2$is the event that$Y>X$and$X>c$. Then$\mathrm{Pr}(A_1)=\mathrm{Pr}(X<c)=\frac{c-a}{b-a}$and$\mathrm{Pr}(A_2)=\frac{1}{2}\mathrm{Pr}(X>c)=\frac{1}{2}\left(\frac{b-c}{b-a}\right)$. Putting these two together, we have that$\mathrm{Pr}(A|B)=\frac{c-a}{b-a}+\frac{1}{2}\left(\frac{b-c}{b-a}\right)$. Finally, using$\mathrm{Pr}(A \cap B)=\mathrm{Pr}(A|B)\mathrm{Pr}(B)$and doing some algebra we find that$\mathrm{Pr}(A \cap B)=\frac{-2ab+b^2+2ac-c^2}{2(a-b)(c-d)}\$.

-
 Two things are unclear for me here: In Pr(A_2) where did the factor 1/2 come from and how was Y>X taken into account? Maybe the question answers itself, but I don't see how. – Wuschelbeutel Kartoffelhuhn Sep 2 '12 at 4:51