Can you compare a continuous vs. discrete random variable?

Let's say X is a continuous random variable: say $$X \sim Uniform(0,n)$$ for some n.

Let's say Y is a discrete random variable: say $$Y \sim Binomial(n,p)$$ for that same n and some $$0 \le p \le 1$$.

Would it make sense to compare these distributions to each other? For example, how would one go about finding $$P(X\le Y)$$? There's not really a common "area of integration" or something to link them together (via double integral). Since both X and Y are independent, I can't see how one RV's value would matter for the other either.

• You can compare them; this is done all the time in limiting case, where for large $n$ the binomial distribution looks more and more Gaussian. The easiest way to compare is the bin the results of the continuous distribution, where each bin corresponds to a result of the discrete distribution. – Paul Nov 19 '19 at 12:58

If $$X$$ and $$Y$$ are independent then $$P(X\leq Y)= \sum\limits_{k=0}^{n} P(X\leq k)\binom {n} {k} p^{k}(1-p)^{n-k}=\sum\limits_{k=0}^{n} \frac k n \binom {n} {k} p^{k}(1-p)^{n-k}$$.
• It is interesting to note that the sum equals $\frac{1}{n}E(Y)=p.$ – Aditya Ghosh Nov 19 '19 at 13:39
More generally, if $$X, Y$$ are independent and $$Y$$ is discrete, then $$\Pr(X\leq Y)=\sum_{y} \Pr(X\le y) \Pr(Y=y) = \text{E}(F_X(Y))$$ where $$F_X(t)=\Pr(X\le t)$$ is the CDF of $$X.$$
For your problem, $$F_X(t)=t/n$$ for $$0\le t\le n$$ and $$Y$$ takes values in $$[0,n]$$. Hence, $$E(F_X(Y))=E(Y/n)=p.$$
$$\textbf{Further note.}$$ We do not require $$Y$$ to be discrete as well. Suppose that $$X, Y$$ are independent, and $$Y$$ has finite expectation. Denote $$Z=\mathbf{1}(X\le Y)$$ (a random variable which equals $$1$$ if $$X\le Y$$, equals 0 otherwise). Then, $$\Pr(X\le Y) = E(Z) = E(E(Z | Y)) = E(F_X(Y)).$$
In similar fashion, if $$X, Y$$ are independent and $$X$$ has finite expectation then we can show that $$\Pr(X\le Y) = 1- E(F_Y(X)).$$