# Probability that a random variable lies between two different random variables.

Say we have three different random variables $X_{1}$, $X_{2}$, and $X_{3}$ with pdf's $f_{X_{1}}$, $f_{X_{2}}$, and $f_{X_{3}}$. Random variable $X_{2}$ is independent of random variables $X_{1}$ and $X_{3}$. But random variables $X_{1}$ and $X_{3}$ are not independent of each other. What is the probability that $X_{1}$ < $X_{2}$ < $X_{3}$.

My solution: Pr{$X_{1}$ < $X_{2}$ < $X_{3}$} = Pr{$X_{2}$ < $X_{3}$} - Pr{ $X_{2}$ > $X_{1}$}. From here on, I take the standard approach. Is this correct?

• Shouldn't it be $Pr(X_2\lt X_3)-Pr(X_2\le X_1)$ or $Pr((X_2\lt X_3)\cap (X_1\lt X_2))$? – herb steinberg Jul 6 '18 at 23:49

## 2 Answers

The equation is wrong. In that difference you are discarding the cases (regions) where $X_1<X_3$. You can solve that probability by integrating over the region where $X_1<X_2<X_3$: \begin{align} P(X_1<X_2<X_3)&=\int_{-\infty}^{\infty}\int_{-\infty}^{z}\int_{-\infty}^{y}f_{X_1,X_2,X_3}(x,y,z)\,dx\,dy\,dz\\ &=\int_{-\infty}^{\infty}\int_{-\infty}^{z}\int_{-\infty}^{y}f_{X_1|X_2,X_3}(x|y,z)f_{X_2,X_3}(y,z)\,dx\,dy\,dz\\ &=\int_{-\infty}^{\infty}\int_{-\infty}^{z}\int_{-\infty}^{y}f_{X_1}(x)f_{X_2,X_3}(y,z)\,dx\,dy\,dz. \end{align}

• Thanks a lot @Roberto. – RSA Jul 9 '18 at 20:37

No! I don't know how you arrived at that equation. The correct method is this: $P\{X_1<X_2<X_3\}=E\int_{X_1}^{X_3} f_{{X_2}}(x) \, dx=\int \int\int_u^{v} f_{{X_2}}(x) \, dx \, f_{{X_1},{X_3}}(u,v) \, du \, dv$ which depends on the joint distribution of $(X_1,X_3)$. You cannot express this in terms of the marginal densities $f_{{X_1}}$ and $f_{{X_3}}$.