Partial summation: integral version In a book about analytic number theory, I found two lemmas about partial summation. The first one is the discrete version of partial summation (See http://en.wikipedia.org/wiki/Summation_by_parts) which has a simple proof. However the book also mentioned an integral version of partial summation which states:
Let $h(x)$ be a continuously differentiable function. Let $A(x)=\sum_{n\leq x} a_n$. Then $$\sum_{n\leq x} a_n h(n) = A(x)h(x)-\int_1^xA(u)h'(u)du.$$
The proof of this theorem is left as an exercise but I really have no clue how to start.
 A: Hmm.. so $A$ is a step function which is constant on each interval $[n,n+1]$, you can just use the Fundamental Theorem on $h$, so that integral will give you a difference of $h$ at the two end-points times a constant. Then it really should resemble the summation by parts formula you already know. Also note the last interval is not the same length $[ \lfloor x \rfloor , x ]$.
A: Fix $ x > 0 $.
The equation rearranges to $$ \sum_{n \leq x} a_n (h(x)-h(n)) = \int_{1}^{x} A(u) h'(u) \, du $$ so we'll show this.

LHS is $$\begin{align} \sum_{n\leq x} a_n \left(\int_{n}^{x} h'(u) \, du \right) &= \sum_{n \leq x} \left(\int_{n}^{x} a_n h'(u) \, du \right) \\ &= \sum_{n \leq x} \left(\int_{1}^{x} g_n (u) \, du \right)  \end{align} $$ where $ g_n (u) $ is $ 0 $ when $ u < n $ and $ a_n h'(u) $ when $ u \geq n $.
This further becomes $\displaystyle \int_{1}^{x} \left( \sum_{n \leq x} g_n (u)\right) du $.
Now notice the integrand $ \displaystyle G (u) := \sum_{n \leq x} g_n (u) $ is just $$ \begin{align} \sum_{n \leq x} \mathbb{I}[u \geq n] \, a_n h'(u) &= \left(\sum_{n \leq x} \mathbb{I}[u \geq n] \, a_n \right)h'(u) \\ &= \left( \sum_{n \leq u} a_n\right)h'(u) \\ &= A(u) h'(u) \end{align} $$ as needed.
