# Integral of cdf times pdf is a probability?

Let $$X$$ be a random variable with distribution function $$F_X$$. Consider $$P=\int_0^\infty (1-F_X(x))e^{-x}dx.$$ Because $$1-F_X(x)$$ is the probability of $$X>x$$ and $$e^{-x}$$ is the pdf of an exponential random variable (with $$\lambda=1$$), this integral $$P$$ apparently equals the probability of $$X>Y$$ where $$Y$$ is an exponential random vairbale with $$\lambda=1$$.

Can anyone explain how we can conclude that $$P$$ is the probability of the event $$X>Y$$? I guess $$X$$ is defined over the same probability space as $$X$$?

• Use the equation (correct only for independent variables $X$ and $Y$) $$\Pr(X\gt Y)=E_Y[E_X[\mathcal{I}(X\gt Y)]]$$ and evaluate the inner expectation using $F_X$ and the outer expectation by integrating against $f_Y.$ For the comparison $X\gt Y$ to make any sense at all, you must consider $(X,Y)$ to be defined on a common probability space. – whuber Feb 25 at 23:01
• @whuber cool, thank you for the quick response. If you leave a short answer, I can accept and upvote it :) – Alex Feb 25 at 23:08
• @Alex I have no idea how to sort this out nor I understand what I wrote, I just copied and pasted few lines form one another site. You may not reward me for copy and paste. Also I am not sure if this answers your question, but looks both X and Y are exponential random variables. – Easy Points Feb 26 at 0:30

I am going to assume that $$X$$ is a non-negative continuous random variable so that $$F_X(0) = 0$$.

Let $$Y \sim \text{Exp}(1)$$ be independent of $$X$$ and note that $$\mathbb{P}(Y < x) = 1-e^{-x}$$. To get the result you want, define the functions $$u(x) \equiv 1-F_X(x)$$ and $$v(x) \equiv -e^{-x}$$ and use integration by parts to get:

\begin{align} \int \limits_0^\infty (1-F_X(x)) e^{-x} \ dx &= \int \limits_0^\infty u(x) \ v'(x) \ dx \\[6pt] &= \Bigg[ u(x) \ v(x) \Bigg]_{x=0}^{x \rightarrow \infty} - \int \limits_0^\infty u'(x) \ v(x) \ dx \\[6pt] &= \Bigg[ -(1-F_X(x)) e^{-x} \Bigg]_{x=0}^{x \rightarrow \infty} - \int \limits_0^\infty f_X(x) \ e^{-x} \ dx \\[6pt] &= \Bigg[ 0-(-1) \Bigg] - \int \limits_0^\infty f_X(x) \ e^{-x} \ dx \\[6pt] &= 1 - \int \limits_0^\infty f_X(x) \ e^{-x} \ dx \\[6pt] &= \int \limits_0^\infty f_X(x) \ (1-e^{-x}) \ dx \\[6pt] &= \int \limits_0^\infty f_X(x) \ \mathbb{P}(Y

(The final step follows from the law of total probability and the independence of $$X$$ and $$Y$$.)

• Why do you assume $F_X(x) = 0$, and would you like to say $X$ is not exponential RV? – Easy Points Feb 26 at 9:41
• If $F_X$ is unknown distribution how can you possible calculate probabilities. – Easy Points Feb 26 at 9:43
• Sorry, that was a typo --- now edited to say that $F_X(0)=0$, which follows from assuming that $X$ is a non-negative continuous random variable. – Ben Feb 26 at 21:53

Can anyone explain how we can conclude that P is the probability of the event $$\mathbb P(X>Y)$$?

Since $$1-F_{X}(x)$$ also called survival function is $$\int_{x}^{\infty} f_{X}(t) \mathrm{d} t = P(X \geq x)$$ because $$F_{X}(x) = \int_{0}^{x} f_{X}(t) \mathrm{d} t$$ where $$\int_{0}^{\infty} f_{X}(t) \mathrm{d} t =1$$, where $$f_{X}(x) = e^{-x}$$ is our PDF.

Also,

$$\int_{0}^{\infty}\left(1-F_{X}(x)\right) \mathrm{d} x=\int_{0}^{\infty} P(X \geq x) \mathrm{d} x=\int_{0}^{\infty} \int_{x}^{\infty} f_{X}(t) \mathrm{d} t \mathrm{~d} x$$ Then change the order of integration $$=\int_{0}^{\infty} \int_{0}^{t} f_{X}(t) \mathrm{d} x \mathrm{~d} t=\int_{0}^{\infty}\left[x f_{X}(t)\right]_{0}^{t} \mathrm{~d} t=\int_{0}^{\infty} t f_{X}(t) \mathrm{d} t$$ Then substitute

$$= \int_{0}^{\infty} x f_{X}(x) \mathrm{d} x = \mathbb E(X)$$

I copied it all.

I read before you may omit $$F_{X}(x)$$ and write just $$F(x)$$ same for the $$f(x)$$ when you know what RV you deal with.