Let $n>1$ be a positive integer, and let $f:\mathbb{R} \rightarrow \mathbb{R}$ be continuously differentiable on the interval $[1,n]$. I want to calculate an integral of the form

$$ \int _1^n\lfloor u \rfloor f'(u) \mathrm d u $$

I realise that I can set upper and lower bounds on the integral by writing $\lfloor x \rfloor = x - \lbrace x \rbrace$. However, I am hoping to find a precise numerical solution. My approach has been to use integration by parts, writing

$$\int_1^n \lfloor u \rfloor f'(u) \mathrm d u = nf(n)-f(1)-\int_1^n f(v) \frac{\delta}{\delta v} \lfloor v \rfloor \mathrm d v$$

(whilst noting that $\lfloor n \rfloor=n$). Clearly, $\frac{\delta}{\delta v} \lfloor v\rfloor$ is undetermined or infinite at integer values of $v$. I have tried to get round this by observing that, for sufficiently small $\epsilon$,

$$ \begin{align} \int_1^n f(v) \frac{\delta }{\delta v} \lfloor v \rfloor \mathrm d v &= \sum_{i=2}^n \int_{i-1}^i f(v) \frac{\delta}{\delta v} \lfloor v \rfloor \mathrm d v \\ &= \lim_{\epsilon \rightarrow 0^+} \sum_{i=2}^n \int_{i-1}^{i-\epsilon} f(v) \frac{\delta}{\delta v}\lfloor v \rfloor \mathrm d v \end{align} $$

Since $\frac{\delta }{\delta v }\lfloor v\rfloor = 0$ over each closed interval $[i-1,i-\epsilon]$, it follows that

$$\int_1^n f(v) \frac{\delta}{\delta v} \lfloor v \rfloor \mathrm d v = 0$$

But this is wrong. As an example, set $f(x) := \sqrt{x}$, so that

$$ \begin{align} \int_1^n \lfloor u \rfloor f'(u) \mathrm d u &= \int_1^n \lfloor u \rfloor \frac{1}{2 \sqrt{u}} \mathrm d u \\ &= n \sqrt{n} - 1 - \int_1^n \sqrt{v} \frac{\delta}{\delta v} \lfloor v \rfloor \mathrm d v \\ &\overset{?}{=} n \sqrt{n} - 1 - 0 \end{align} $$

The output from Mathematica instantly disproves this last equality (assuming it is calculating the integral correctly). So:

  • What is wrong with this approach?
  • Any suggestions for how to calculate the original integral (i.e., with $f$ undefined)?

Or do I have to content myself with finding upper and lower limits?

  • $\begingroup$ Invalid application of integration by parts formula. Check if the hypothesis are satisfied. $\endgroup$ Feb 21 at 9:45
  • $\begingroup$ Split up the integral in integer segments and see if you can get a nice expression from there... $\endgroup$ Feb 21 at 9:49

2 Answers 2


$\int_1^{n} \lfloor u \rfloor f'(u)du=\sum\limits_{k=1}^{n-1}\int_k^{k+1} \lfloor u \rfloor f'(u)du=\sum\limits_{k=1}^{n-1}\int_k^{k+1} k f'(u)du=\sum\limits_{k=1}^{n-1}k[f(k+1)-f(k)]$.

This can also be written as $(n-1)f(n)-[f(1)+f(2)+\cdots+f(n-1)]$.


Just note that $$\lfloor u \rfloor f'(u) = \sum_{k = 1}^{n-1} k\mathbb 1_{[k, k+1)}(u)f'(u).$$ Therefore, splitting your integral \begin{align} \int_{1}^n \lfloor u \rfloor f'(u) du &= \sum_{k = 1}^{n-1} k\int_{k}^{k+1}f'(u)du\\ &= \sum_{k = 1}^{n-1} k(f(k+1) - f(k))\\ &= (n-1)f(n) - \sum_{k = 1}^{n-1} f(k). \end{align}

  • $\begingroup$ Two great answers. Many thanks. I have to award the first one the tick, purely on timing. But I am grateful to you both. $\endgroup$ Feb 21 at 10:50
  • $\begingroup$ Sounds fair. You are welcome. $\endgroup$
    – Falcon
    Feb 21 at 10:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .