# Probability of $X > Y$ given that $X, Y$ are i.i.d. continuous r.v.s

Can someone please explain why is $$P(X > Y) = \frac{1}{2}$$, when $$X, Y$$ are i.i.d. continuous random variables? I have seen people use the symmetry argument to justify this answer. The argument goes as follows: there are two ways of arranging two numbers $$x$$ and $$y$$, and out of these arrangements only one has $$x > y$$. So, the probability using symmetry is $$0.5$$.

I don't understand this conclusion. Doesn't this argument make an assumption that the values of $$X$$ and $$Y$$ that are drawn are not equal? To take a more concrete example, if we assume $$X, Y$$ are standard normal, wouldn't the sample space be divided into three events: $$X > Y, X < Y, X = Y$$? Based on this, we can say that $$X > Y$$ and $$X < Y$$ must be equal using symmetry, and let's call this value $$\alpha$$. So,

$$2\alpha + P(X=Y) = 1$$.

Clearly, $$\alpha < 0.5$$, contrary to the first argument. So, which is the correct argument and why?

Edit: based on the comments I am adding the calculations for $$X=Y$$ in case of normal distributions. Can someone point out the mistake? Thanks!

$$P(X=Y) = \int_{-\infty}^{\infty} P(X=Y|Y=y) P(Y=y) dy$$

$$P(X=Y) = \int_{-\infty}^{\infty} \frac{1}{2\pi} e^{-y^{2}} dy$$

$$P(X=Y) = \frac{1}{2\sqrt\pi}$$.

Intuitively, the symmetry argument feels like an approximation (probably a very good one). Imagine we have a bivariate normal distribution, which is formed using $$X$$ and $$Y$$. $$P(X>Y)$$ represents the region below the line $$X=Y$$ (in the 1st quadrant). Similarly, we can argue about the values in the other 3 quadrants. By geometry, the area of line is zero (because the line has no width?), and hence you arrive at the 1D analogy that the probability it takes a specific value is zero. Still not sure though why it doesn't show up in the calculations above.

Edit: I realize the mistake I made in the above calculations. Going from step 1 to step 2, when I replaced $$P(X=Y|Y=y)$$ with $$f_{X}(y)$$, this is wrong. As pointed out in the comments and answer below, this must be equal to zero. I confused (/abused) the notation for the discrete and continuous cases. Thanks everyone for an interesting discussion.

• Are we talking about continuous or discrete random variables? Commented Apr 17, 2020 at 17:23
• The point is the probability that two continuous random variables assume the same value is $0$ which gives $\alpha = 1/2$. Had they been discrete, then yes one would very much need to account for that probability. Commented Apr 17, 2020 at 17:23
• Let $X,Y$ two continuous random variables on $\mathbb R$. Then $X=Y$ implies $X-Y=0$. If $Z=X-Y$ then $Z$ is continuous as well. And therefore $P(Z=0)=0$. Commented Apr 17, 2020 at 17:30
• Your $\frac1{2\sqrt{\pi}}$ is maybe the pdf, but the probability is still $P(X=Y)=0$ Commented Apr 17, 2020 at 17:34
• Just to complete the previous coments: in general we have the equality of events $(X=x)=(X\leq x)\setminus (X<x)$, so $P(X=x)=F(x)-F(x-)$, $F$ being the cdf of $X$. If $F$ is a continuous function (this is the case for any continuous rv), then $F(x)=F(x-)$ and $P(X=x)=0$. Then if $Y,X$ are continuous iid $P(X=Y)=E[1_{X=Y}]=\int P(X=x,Y=x)dF(x,y)=0$. So as @callculus pointed out, for the gaussian rv $P(X=Y)=0$.
– RLC
Commented Apr 17, 2020 at 17:47

Another perspective (using measure-theoretic probability): $$P(X > Y) = \int_{-\infty}^\infty P(X > y)dF(y) = \int_{-\infty}^\infty (1 - F(y))dF(y) = 1 - \int_{-\infty}^\infty F(y)dF(y) = 1/2.$$
Literally, we can evaluate $$\int_{-\infty}^\infty F(y)dF(y) = \int_0^1 zdz = 1/2$$ given $$F$$ is continuous. A more rigorous proof for it rests on Fubini's theorem. Interested people may refer to Theorem $$18.4$$ of Probability and Measure by Patrick Billingsley.
The distribution of $$X-Y$$ is symmetric around zero, that is $$\mathsf{P}(X-Y\le v)=\mathsf{P}(Y-X\le v)$$ for all $$v\in \mathbb{R}$$ (for example, you may show that the characteristic function of $$X-Y$$ and $$Y-X$$ are equal, i.e. $$\varphi_{X-Y}(t)=\varphi_{Y-X}(t)=\varphi_X(t)\varphi_X(-t)$$). Then as you noticed $$\mathsf{P}(X-Y>0)+\mathsf{P}(Y-X>0)+\mathsf{P}(X-Y=0)=1,$$ and the result follows assuming that $$\mathsf{P}(X-Y=0)=0$$. (This is always true for continuous r.v.s.)