Asymptotic of a sum: $\sum_{k=n}^{\infty}{f(k)} = \int_{n}^{\infty}{f(t)dt} +\frac{f(n)}{2}+\mathcal{O}(f'(n))$ Someone told me that the following formula holds for $f$ differentiable and decreasing, with $\lim_{x\rightarrow +\infty}{f(x)}=0$.

$$\sum_{k=n}^{\infty}{f(k)} = \int_{n}^{\infty}{f(t)dt} +\frac{f(n)}{2}+\mathcal{O}(f'(n))$$

But I managed to prove only if the function is convex, with the help of the formula
$$f(x+h)=f(x)+hf'(x)+\int_{0}^{1}{h\left[ f'(x+ht)-f'(x) \right]dt}$$
Which give us integrating it
$$\int_{0}^{1}{f(x+\theta)d\theta}=f(x)+\frac{f'(x)}{2}+\int_{0}^{1}{\int_{0}^{1}{\theta\left[ f'(x+\theta t)-f'(x) \right]dt}d\theta}$$
And then
$$\begin{align}
\int_{0}^{1}{f(x+\theta)d\theta}
&=\frac{f(x+1)+f(x)}{2}\\&\qquad+\int_{0}^{1}{\left[\left(\int_{0}^{1}{\theta(f'(x+\theta t)-f'(x))dt}\right) -\frac{(f'(x+\theta)-f'(x))}{2}\right]d\theta}\\
&=\frac{f(x+1)+f(x)}{2}+\int_{0}^{1}{\left[\left(\int_{0}^{1}{\theta f'(x+\theta t)dt}\right)-\frac{f'(x+\theta)}{2}\right]d\theta}
\end{align}$$
If we assume that the function is convex, then the term inside the integral is positive, because $f'(x+\theta t)\geq f'(x+\theta)$, and also holds that, as $f'(x+\theta t)\leq f'(x)$ and $f'(x+\theta)\geq f'(x+1)$
$$\begin{align}\int_{0}^{1}{\left[\left(\int_{0}^{1}{\theta f'(x+\theta t)dt}\right)-\frac{f'(x+\theta)}{2}\right]d\theta}
&\leq \frac{1}{2}\int_{0}^{1}{(f'(x)-f'(x+1))d \theta}\\&=\frac{f'(x)-f'(x+1)}{2}
\end{align}$$ 
Summing the expression and using these last inequalities, the result follows.
Can someone help me to prove this for only differentiable functions, not necessarily convex?
 A: Counterexample: The key idea is that it's easy to arrange for each $f'(n)$ to be $0.$ That implies $O(f'(n))$ is just the zero function for large $n.$ Then you're left with no wiggle room at all and a counterexample can be found.
For $k=0,1,\cdots$ let $g_k:\mathbb R\to [0,\infty)$ be continuous with support in $[k,k+1],$ satisfying
$$\tag 1 \int_k^{k+1}g_k = \frac{3}{4^{k+1}}.$$
Set $g = \sum_{k=0}^{\infty}g_k.$ Then $g$ is continuous and nonnegative on $\mathbb R,$ with $g(k)=0$ for all $k.$ From $(1)$ we see
$$\tag 2 \int_0^n g = \sum_{k=0}^{n-1}\frac{3}{4^{k+1}} =1-\frac{1}{4^n}.$$
Now define $f(x) = 1 - \int_0^x g(t)\,dt.$ Because the integral is increasing, $f$ is decreasing. By $(2),$ $\lim_{x\to \infty} f(x) = 0.$ From the FTC, we see $f'(x) = -g(x)$ everywhere. In particular, $f'(k)=0,k=0,1,\dots.$
By $(2)$ we see $f(n) = 1/4^n$ for all $n.$ Thus for any $n$
$$\sum_{k=n}^{\infty}f(k) - \int_n^\infty g = \sum_{k=n}^{\infty}\frac{1}{4^k} - \sum_{k=n}^{\infty}\frac{3}{4^{k+1}}= \frac{1}{3}\cdot \frac{1}{4^n}=\frac{1}{3}f(n).$$
Because $f'(n) = 0$ for all $n,$ we have a counterexample.
A: I believe a proof can go as follows. Let us for the moment use $M$ as upper limit for the series and the integral. We are looking for a bound on the difference between the series and the integral.
$$\begin{align}\sum_{k=n}^{M} f(k) - \int_{n}^{M} f(x)\mathrm{d}x &= \frac{1}{2}[f(M) +  f(n)] + \sum_{j=n}^{M-1} \left( \frac{1}{2} [f(j+1)+f(j)] -\int_{j}^{j+1}f(x)\mathrm{d}x \right) \\
&=
\frac{1}{2}[f(M) +  f(n)] + \sum_{j=n}^{M-1} \left( \frac{1}{2} [f(j+1) +f(j)]  -xf(x) \bigg\rvert_{j}^{j+1} + \int_{j}^{j+1}x f'(x)\mathrm{d}x\right) \\
&=
\frac{1}{2}[f(M) +  f(n)] + \sum_{j=n}^{M-1} \left( -(j+\frac{1}{2}) [f(j+1)-f(j)] +\int_{j}^{j+1} xf'(x) \mathrm{d}x\right)   \\
&=
\frac{1}{2}[f(M) +  f(n)] + \sum_{j=n}^{M-1} \left(-(j+\frac{1}{2}) [\int_{j}^{j+1} f'(x)\mathrm{d}x] + \int_{j}^{j+1}xf'(x) \mathrm{d}x \right)   \\
&=
\frac{1}{2}[f(M) +  f(n)] + \sum_{j=n}^{M-1} \left( \int_{j}^{j+1} (x – j - \frac{1}{2}) f'(x) \mathrm{d}x \right)\end{align}$$
where the second line makes use of an identity, exploiting integration by parts, I saw used in a proof of the Euler-MacLaurin formula.
In the limit $M \to \infty$, $f(M) \to 0$.
 Moreover on the interval $ [j, j+1] $ $$\int_{j}^{j+1} [x – j - \frac{1}{2}] f'(x) \mathrm{d}x   \leq C \lvert f'(j) \rvert     $$ as $f$ is decreasing with $C$ a suitably chosen constant, so that 
$$ \sum_{j=n}^{M-1}  \int_{j}^{j+1} (x – j - \frac{1}{2}) f'(x) \mathrm{d}x \leq C´ \vert f´(n) \rvert    $$
 And I wonder if  this is sufficient to prove the provided statement.
I apologise for the poor editing, due to a ridicolosuly small screen, will be checking in due course.
