Suppose \((a_n)_{n \geq 1}\) is a sequence of complex numbers and \(f: [y,x] \to \bbR\) has a continuous derivative on the interval \([y,x]\text{,}\) where \(0 \lt y \lt x\text{.}\) For each \(x \gt 0\text{,}\) let \(A(x) = \sum_{n \leq x} a_n\text{.}\) Then
\begin{equation}
\sum_{y \lt n \leq x} a_n f(n)
= \left. Af \right|_y^x - \int_y^x A(t)f'(t) dt\text{.}\tag{4.5.1}
\end{equation}
Proof.
The function \(A\) is a step function, with jumps at each integer given by the sequence \(a_n\text{.}\) Therefore the Riemann-Stieltjes integral gives
\begin{equation}
\sum_{y \lt n \leq x} a_n f(n) = \int_y^x f dA\text{.}\tag{4.5.2}
\end{equation}
By integration by parts,
\begin{equation}
\int_y^x f dA = \left. Af \right|_y^x - \int_y^x A df\text{.}\tag{4.5.3}
\end{equation}
Since \(f\) has a continuous derivative on the interval, the last integral is equal to \(\int_y^x Af' dt\text{.}\)