# Variance of a random variable $X$ as a function of the survival function $S(x)$

Suppose $$X$$ is a nonnegative and continuous random variable with a survival function $$S(x)$$. Show that

$$\mathsf{Var}(X)=2\int_0^\infty tS(t) \, dt-\left( \int_0^\infty S(t) \, dt\right)^2$$

Using the fact that

$$f(x) =−\frac{dS(x)}{dx}$$

we have that

\begin{align*} \mathsf{Var}(X) &=\mathsf{E}(X^2)-\mathsf{E}(X)^2\\\\ &=\int_0^\infty t^2 f(t)\,dt-\left(\int_0^ \infty tf(t) \, dt \right)^2 \\\\ &=-\int_0^\infty t^2 \, dS(t)-\left(\int_0^\infty t \, dS(t) \right)^2 \\\\ &=-\left(t^2 S(t)\bigg\rvert_0^\infty-\int_0^\infty 2tS(t) \, dt \right) - \left(tS(t)\bigg\rvert_0^\infty-\int_0^\infty S(t) \, dt \right)^2 \end{align*}

I could get the desired result by showing

$$t^2 S(t) \bigg\rvert_0^\infty = tS(t) \bigg\rvert_0^\infty = 0$$

but how do we know if $$t$$ and $$t^2$$ go to $$\infty$$ slower than $$S(t)$$?

• It may be worth considering the finiteness of the variance in the case of a distibution where $S(t)$ goes to 0 slowly enough that the integrals you look at don't have a finite value (you may want to write improper integrals out as a limit). You may need to make some assumptions about $S$ sufficient to guarantee it has a variance (otherwise the whole exercise is kind of moot), and then see whether under those assumptions the integral converges.. Sep 9, 2019 at 2:48

Your attempt to prove this using integration-by-parts is the wrong approach, and that is what is leading you to require unnecessary conditions. The simpler approach is to express the moments using double-integration, and then use interchange of integrals to get the survival function. For any non-negative continuous random variable $$X$$ you can use the interchange of integrals to write the $$k$$th raw moment as:
\begin{aligned} \mathbb{E}(X^k) = \int \limits_0^\infty t^k f(t) \ dt &= \int \limits_0^\infty \Bigg[ r^k f(t) \Bigg]_{r=0}^{r=t} \ dt \\[6pt] &= \int \limits_0^\infty \int \limits_0^t k r^{k-1} f(t) \ dr \ dt \\[6pt] &= k \int \limits_0^\infty r^{k-1} \int \limits_r^\infty f(t) \ dt \ dr \\[6pt] &= k \int \limits_0^\infty r^{k-1} S(r) \ dr. \\[6pt] \end{aligned}