# Integral and derivative of $\lfloor x\rfloor$ and $x - \lfloor x\rfloor$

I've always assumed by graphical inspection that

$\int (x - \lfloor x\rfloor)\mathrm dx = \dfrac{(x - \lfloor x\rfloor)^2 + \lfloor x\rfloor}{2}$ (W|A) and

$\int \lfloor x\rfloor\mathrm dx = x\lfloor x\rfloor - \dfrac{\lfloor x\rfloor(\lfloor x\rfloor + 1)}{2}$ (W|A)

Why does Wolfram|Alpha say for each integral, "no result found in terms of standard mathematical functions"?

I also assumed that $\frac{\mathrm d}{\mathrm dx} \lfloor x \rfloor = 0$, yet according to Wolfram|Alpha $\frac{\mathrm d}{\mathrm dx} \lfloor x \rfloor = \mathop {\rm floor}'(x)$—which is not not explained, but the graph looks very strange. What is going on here?

-
Because, there are some functions which are difficult to integrate. For example take $f(x)=\sqrt{\sin{x}}$ you can't find an anti-derivative for this function. The best you can do is to approximate this function by using $\text{Simpson's 1/3 rule}$ but for using that you need your integral to be a definite integral. –  user9413 Sep 10 '11 at 13:39
@Chandr: actually, there is a closed form for the integral of $\sqrt{\sin\,x}$, but I won't get into that here. But properly integrating the floor and fractional part functions is not so straightforward, I agree. –  Guess who it is. Sep 10 '11 at 13:42
Here is an apropos thread. –  Guess who it is. Sep 10 '11 at 13:49

## 1 Answer

Let me start with the last question. $\lfloor x\rfloor$ is a piece-wise constant. It's is not differentiable at $x \in \mathbb{Z}$, which is why W|A gives Floor'[x] for an answer. Floor'[x] is a short form for Derivative[1][Floor][x], i.e. derivative remains unevaluated in agreement with Mathematica's evaluation principles.

When W|A says integral can not expressed in terms of known function, it means that Integrate could not provide a solution for your integral.

The expressions you wrote are correct for a definite integral, i.e. $$\int_0^x \left( y - \lfloor y \rfloor \right) \mathrm{d} y = \frac{1}{2} \left( \left( x - \lfloor x \rfloor \right)^2 + \lfloor x \rfloor \right)$$ in doing so you completely fixed an additive piece-wise constant, ortherwise you should write $\int \left( x - \lfloor x \rfloor \right) \mathrm{d} x = \frac{x^2}{2} - x \lfloor x \rfloor + C$.

-
Also: Floor'[x] may mean a certain distribution, which is zero except at integers, and has delta-function properties at the integers. We need this to recover Floor[x] by integrating it. –  GEdgar Sep 10 '11 at 14:56