Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How would you go about solving integral of a floor? The particular problem I have is:

$$\int \,\left\lfloor\frac{1}{x}\right\rfloor\, dx$$

share|cite|improve this question
A simple picture should help with this one: – JavaMan Apr 17 '11 at 21:37
If $\left\lfloor x\right\rfloor$ is constant on $[n,n+1)$, then $\left\lfloor\frac{1}{x}\right\rfloor$ is constanct on ... – Rasmus Apr 17 '11 at 21:56
up vote 12 down vote accepted

The function:


is equal to $n$ on the interval $(\frac{1}{n},\frac{1}{n+1})$,so if we try to determine the integral from $t>0$ to $1$, we can let $n=\left\lfloor\frac{1}{t}\right\rfloor$ and we have constant value $1$ on range $(\frac{1}{2},1)$, constant value $2$ on range $(\frac{1}{2},\frac{1}{3})$, etc. So since $t<\frac{1}{n}$, we get terms for each interval $(\frac{1}{k},\frac{1}{k+1})$ when $k<n.$ The length of the $k$th interval is $\frac{1}{k(k+1)}$ and the value of the function is $k$ on this interval, so the integral on this interval is $\frac{1}{k+1}$. So the integral from $\frac{1}{n}$ to $1$ is $1/2 + 1/3 + 1/4 + ... + 1/n$. Then then integral from $t$ to $\frac{1}{n}$ is the length of the interval times $n$, which is $n(\frac{1}{n} - t) = 1-nt$. So the total is:

$$\int_t^1 \,\left\lfloor\frac{1}{x}\right\rfloor\, dx = 1 - t{\left\lfloor\frac{1}{t}\right\rfloor} + \sum_{i=2}^{\left\lfloor\frac{1}{t}\right\rfloor}\frac{1}{i}$$

The indefinite integral, then, is the opposite of this:

$$x\left\lfloor\frac{1}{x}\right\rfloor - \sum_{i=2}^{\left\lfloor\frac{1}{x}\right\rfloor}\frac{1}{i} + C$$

share|cite|improve this answer
Ah I get it, so we basically interpret the floor function as a constant. Thanks for the detailed explanation. :) – Paul Manta Apr 19 '11 at 14:54

The integral is true for treating it as a constant. However, the series I obtained is $\frac 1n$ from $0$ to $[\frac 1x]$. It's important to realize that the lower boundary has to do with the definite integral. Also, I get an added series unlike the other answer here.

The final answer is:

$$ x[\frac 1x] + \sum^{[\frac 1x]}_{n=0} \frac 1n $$

share|cite|improve this answer
This answer does not make sense. Please clarify or delete the answer. – Rory Daulton Nov 27 '15 at 0:01
I'm not sure what you are saying isn't clear. – TheGreatDuck Nov 27 '15 at 23:19
Wait no. I got the jump series completely wrong! – TheGreatDuck Nov 29 '15 at 1:07
I see now that my answer is indeterminate as there is not a valid jump series for x[1/x] at this current point in time. However, my two-step algorithm for solving floor function based integrals is still valid as it is a simple question of how to remove the jumps from a broken graph. It just happens to be that the divergence surrounding x = 0 produces... Bad results. – TheGreatDuck Jan 14 at 18:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.