Finding an integral in terms of a series involving $e^{-k}$ 
Given $$f(x) = \sum_{k = 0}^\infty \frac{x + k}{\mathrm{e}^k}$$ find the integral 
  $$\int_0^2 f(x) \mathrm{e}^{-x} \,\mathrm{d}x.$$

I have found the sum can be rewritten in terms of $\mathrm{e}$ to the $-k$ power plus a constant (sum of $\dfrac k{\mathrm{e}^k}$). Then, after plugging in $f(x)$ and using $u$-substitution, I was able to get as far as the integral in terms of $k$. Maybe someone can validate?
 A: Note that $$f(x) = \sum_{k = 0}^\infty \frac{x + k}{e^k}=\left(\sum_{k=0}^\infty\left(\frac1e\right)^k\right)x+\sum_{k=0}^\infty ke^{-k}=Ax+B$$ so you are essentially doing $$A\int_0^2 xe^{-x}\,dx+B\int_0^2e^{-x}\,dx$$ and integrating by parts gives $$A[-xe^{-x}]_0^2+(A+B)\int_0^2 e^{-x}\,dx=\boxed{-\frac{2A}{e^2}+(A+B)\left(1-\frac1{e^2}\right)}$$
A: You can write this out as a telescoping sum:
$$\begin{align}\sum_{k=0}^{\infty}\frac{x+k}{e^k}&=\sum_{k=-}^{\infty}\left\{\frac{(k+1)e^{-k-1}-ke^{-k}}{e^{-1}-1}-\frac{e^{-1}\left(e^{-k-1}-e^{-k}\right)}{\left(e^{-1}-1\right)^2}+\frac{x\left(e^{-k-1}-e^{-k}\right)}{e^{-1}-1}\right\}\\
&=\frac{e^{-1}}{\left(e^{-1}-1\right)^2}-\frac x{e^{-1}-1}\end{align}$$
So
$$\begin{align}\int_0^2\sum_{k=0}^{\infty}\frac{x+k}{e^k}e^{-x}dx&=\frac{e^{-1}}{\left(e^{-1}-1\right)^2}\left[-e^{-x}\right]_0^2-\frac 1{e^{-1}-1}\left[(-x-1)e^{-x}\right]_0^2\\
&=\frac{e^{-1}}{\left(e^{-1}-1\right)^2}\left[-e^{-2}+1\right]-\frac 1{e^{-1}-1}\left[-3e^{-2}+1\right]\\
&=\frac{-e^{-3}+e^{-1}+3e^{-3}-3e^{-2}-e^{-1}+1}{\left(1-e^{-1}\right)^2}\\
&=\frac{2e^{-3}-3e^{-2}+1}{\left(1-e^{-1}\right)^2}=\frac{1+e^{-1}-2e^{-2}}{1-e^{-1}}\\
&=2e^{-1}+1\end{align}$$
If all went well :)
