proving the following$\sum_{x=R}^{x=\infty}(x-R)p(x)=E(x)-\sum_{x=0}^{x=R-1}P(x)$ How to prove the following
$\sum_{x=R}^{x=\infty}(x-R)p(x)=E(x)-\sum_{x=0}^{x=R-1}P(x)$
where p(x) is the probability mass function
the pmf takes non negative integers.
and P(x) is the cumulative distribution function
and E(x) is the mean.
How would I prove this.
I mean I know that $\sum_{x=R}^{x=\infty}p(x)=1-\sum_{x=0}^{x=R-1}p(x)=1-P(x)$
But I am not sure how to proceed here.
 A: You want to show for positive integer $R$,
$$\sum_{x=R}^{\infty}(x-R)p(x)=E(X)-\sum_{x=0}^{R-1}P(x),$$
where $p(x)$ is the PMF and $P(x)$ is the CDF associated with nonnegative random variable $X$. But this clearly cannot be correct in general. Take $X\sim Bern(p),R=1$. Then LHS is zero and RHS is $p-(1-p)$. However, your claim would be correct if we instead define $P(x):=\mathbb{P}(X>x)$. Let's see why:

Lemma:
$$\sum_{x=0}^{R-1}xp(x)=-RP(R-1)+\sum_{y=0}^{R-1}P(y)$$
Proof of lemma:
$$\small \sum_{x=0}^{R-1}xp(x)=\sum_{x=0}^{R-1}\sum_{y=0}^{R-1}1_{y\leq x-1} p(x)=\sum_{y=0}^{R-1}\sum_{x=0}^{R-1}1_{y\leq x-1} p(x)=\sum_{y=0}^{R-1}\sum_{x=y+1}^{R-1}p(x)=\sum_{y=0}^{R-1}\left\{P(y)-P(R-1)\right\},$$
which simplifies to the desired RHS of the lemma.

Now observe that
$$\begin{align}\sum_{x=R}^{\infty}(x-R)p(x)&=\sum_{x=R}^{\infty}xp(x)-\sum_{x=R}^{\infty}Rp(x)\\
&=\left(\sum_{x=R}^{\infty}xp(x)+\color{red}{\sum_{x=0}^{R-1}xp(x)}\right)-
\left(\sum_{x=R}^{\infty}Rp(x)+\color{red}{\sum_{x=0}^{R-1}xp(x)}\right)\\
&=\left(\sum_{x=0}^\infty xp(x)\right)-\left(RP(R-1)+\sum_{x=0}^{R-1} xp(x)\right)\\
&=E[X]-\sum_{x=0}^{R-1}P(x).
\end{align}$$
where the last line exploits the lemma.
