For non negative integers $\sum{P\left(X\geq x\right)}=\int{\left(1-F\left(x\right)\right)\mathrm{d}x}$

I want to show that for non negative integers $X$ we have $$\sum_{x=1}^{\infty}{P\left(X\geq x\right)}=\int_{0}^{\infty}{\left(1-F\left(x\right)\right)\mathrm{d}x}$$

I know that $P\left(X\geq x\right)=1-P\left(X < x\right)$ and $F\left(x\right)=P\left(X\leq x\right)$. So I rewrite the summation like this: $$\sum_{x=1}^{\infty}{\left(1-P\left(X < x\right)\right)}=\sum_{x=0}^{\infty}{\left(1-P\left(X \leq x\right)\right)}=\sum_{x=0}^{\infty}{\left(1-F\left(x\right)\right)}$$

But I don't know how to show it's that integral. Would someone please help?


One has

\begin{align*} \int_0^{+\infty} (1-F(x)) dx &= \sum_{k=0}^{+\infty} \int_k^{k+1} (1-F(x)) dx\\ &=\sum_{k=0}^{+\infty} \int_k^{k+1} (1-\mathbb{P}(X \leq x)) dx\\ &=\sum_{k=0}^{+\infty} \int_k^{k+1} \mathbb{P}(X > x) dx\\ &=\sum_{k=0}^{+\infty} \int_k^{k+1} \mathbb{P}(X > k) dx\\ \end{align*}

the last step coming from the fact that since $X$ takes only integer values, then for every $x \in [k, k+1)$, the events $\lbrace X > x \rbrace$ and $\lbrace X > k \rbrace$ are equal. So \begin{align*} \int_0^{+\infty} (1-F(x)) dx &= \sum_{k=0}^{+\infty} \int_k^{k+1} \mathbb{P}(X > k) dx\\ &=\sum_{k=0}^{+\infty} \mathbb{P}(X > k) \\ &=\sum_{k=0}^{+\infty} \mathbb{P}(X \geq k+1) \\ \end{align*}

i.e. finally $$\boxed{\int_0^{+\infty} (1-F(x)) dx = \sum_{k=1}^{+\infty} \mathbb{P}(X \geq k) }$$