# Generalizing $\sum_{n=1}^{N}f(n)=\int_{a}^{b}f(x)dx+\int_{a}^{b}f'(x)\langle x\rangle dx+f(a)\langle a\rangle-f(b)\langle b\rangle$

This might be an insanely dumb question but I just spent about four hours figuring out how to show that for $0<a<1$ and $N\leq b<N+1$, the following holds

$$\sum_{n=1}^{N}f(n)=\int_{a}^{b}f(x)dx+\int_{a}^{b}f'(x)\langle x\rangle dx+f(a)\langle a\rangle-f(b)\langle b\rangle$$ where $\langle x\rangle$ is the fractional part of $x$. My proof goes like this:

Let $$E=\sum_{n=1}^{N}f(n)-\int_{a}^{b}f(x)dx$$ so that $$\sum_{n=1}^{N}f(n)=\int_{a}^{b}f(x)dx+E$$ Skipping over some details, we can write $E=\int_{a}^{b}f(x)d\alpha-\int_{a}^{b}f(x)dx$ where $\alpha(x)=\sum_{a<n\leq b}H(x-n)$ where $H$ is the Heaviside step function. It just so happens that when we are summing over 1 to N this is the floor function, so after some rearranging and integrating by parts I get $$E = -\left(f(b)(b-\lfloor b\rfloor)-f(a)(a-\lfloor a\rfloor)-\int_{a}^{b}f'(x)(x-\lfloor x\rfloor)dx\right) = -\left(f(b)\langle b\rangle-f(a)\langle a\rangle-\int_{a}^{b}f'(x)\langle x\rangle dx\right) = \int_{a}^{b}f'(x)\langle x\rangle dx+f(a)\langle a\rangle-f(b)\langle b\rangle$$ and the result follows.

Unfortunately my homework is to show that $$\sum_{a<n\leq b}f(n)=\int_{a}^{b}f(x)dx+\int_{a}^{b}f'(x)\langle x\rangle dx+f(a)\langle a\rangle-f(b)\langle b\rangle$$Is there a nice way to show that the first implies the second without rewriting the entire proof? The issue is the bold part of the proof—if we're not summing from 1 to n but rather, say, m to n then $\alpha$ doesn't turn into the floor function. I can't think of a simple way to generalize this—maybe I'm just not seeing something obvious.

-
$\displaystyle\sum_{a < n \leq b} f(n) = \sum_{n = 1}^{b} f(n) - \sum_{n = 1}^{a} f(n)$ ? – Pedro Jan 31 '13 at 23:12
@Pedro ugh yes I just thought of that. I had been trying to do something much more complicated involving defining a new function which was a horizontal translation of $f$ and it wasn't working. – crf Jan 31 '13 at 23:13

For the sake of completeness, here is the answer to my own question. Letting $m$ be the least integer greater than $a$ and $M$ be the greatest integer less than or equal to $b$ and recalling that $$\sum_{a<n\leq b}f(n)=\sum_{n=1}^{M}f(n)-\sum_{n=1}^{m-1}f(n)$$ we obtain $$\sum_{a<n\leq b}f(n) = \sum_{n=1}^{M}f(n)-\sum_{n=1}^{m-1}f(n) = \int_{1}^{b}f(x)dx+\int_{1}^{b}f'(x)\langle x\rangle dx+f(1)-f(b)\langle b\rangle - \int_{1}^{a}f(x)dx-\int_{1}^{a}f'(x)\langle x\rangle dx-f(1)+f(a)\langle a\rangle = \int_{a}^{b}f(x)dx+\int_{a}^{b}f(x)\langle x\rangle dx+f(a)\langle a\rangle-f(b)\langle b\rangle$$