The integral of the floor function and any power of the floor function

calculusceiling-and-floor-functionsintegration

What is the integral of the floor of x? Furthermore, what is the integral of a power of the floor of x? I saw in one of the answers here that:

$$
\int \;\lfloor x \rfloor dx = x\lfloor x \rfloor – \frac12 \lfloor x \rfloor(\lfloor x \rfloor + 1)\;
$$

But the person did not provide a proof. I do not quite understand how they arrived at that answer. I tried Googling it, but I can't seem to find a proof. Can anyone provide one please? Additionally, can you provide how you would take the integral of a power of the floor of x, such as:

$$
\int \;\lfloor x \rfloor^n dx
$$

where n is a natural number. I'd appreciate it.

Best Answer

If $F(b)$ is the antiderivative of $\lfloor b\rfloor$, then

$$F(b)-F(0)=\int_0^b\lfloor x\rfloor dx$$ $$=\sum_{n=0}^{\lfloor b\rfloor-1}\int_n^{n+1}\lfloor x\rfloor dx+\int_{\lfloor b\rfloor}^b\lfloor x\rfloor dx$$ $$=\sum_{n=0}^{\lfloor b\rfloor-1}n+\int_{\lfloor b\rfloor}^b\lfloor b\rfloor dx$$ $$=\frac{\lfloor b\rfloor(\lfloor b\rfloor-1)}2+\lfloor b\rfloor(b-\lfloor b\rfloor)$$ $$=\frac{\lfloor b\rfloor(\lfloor b\rfloor-1)+2\lfloor b\rfloor(b-\lfloor b\rfloor)}2$$ $$=\frac{\lfloor b\rfloor(2b-\lfloor b\rfloor-1)}2$$ $$=\lfloor b\rfloor b-\frac{\lfloor b\rfloor(\lfloor b\rfloor+1)}2$$

If we define $F(0)=0$, then we have $F(b)=\lfloor b\rfloor b-\frac{\lfloor b\rfloor(\lfloor b\rfloor+1)}2$.


Similarly, if $F(b)$ is the antiderivative of $\lfloor b\rfloor^n$, then:

$$F(b)-F(0)=\int_0^b\lfloor x\rfloor^n dx$$ $$=\sum_{i=0}^{\lfloor b\rfloor-1}\int_i^{i+1}\lfloor x\rfloor^n dx+\int_{\lfloor b\rfloor}^b\lfloor x\rfloor^n dx$$ $$=\sum_{i=0}^{\lfloor b\rfloor-1}i^n+\int_{\lfloor b\rfloor}^b\lfloor b\rfloor^n dx$$ $$=\sum_{i=0}^{\lfloor b\rfloor-1}i^n+(b-\lfloor b\rfloor)\lfloor b\rfloor^n$$

Using robjob's Hockey-Stick Identity: $$\newcommand{\stirtwo}[2]{\left\{#1\atop#2\right\}}$$ $$\sum_{i=0}^{\lfloor b\rfloor-1}i^n=\sum_{j=0}^n\binom{\lfloor b\rfloor}{j+1}\stirtwo{n}{j}j!$$

Where $\stirtwo{m}{j}$ are Stirling Numbers of the Second Kind.

Hence,

$$F(b)-F(0)=\sum_{j=0}^n\left[\binom{\lfloor b\rfloor}{j+1}\stirtwo{n}{j}j!\right]+(b-\lfloor b\rfloor)\lfloor b\rfloor^n$$

If $F(0)=0$, then

$$F(b)=\sum_{j=0}^n\left[\binom{\lfloor b\rfloor}{j+1}\stirtwo{n}{j}j!\right]+(b-\lfloor b\rfloor)\lfloor b\rfloor^n$$


Alternately, applying the more well-known but less compact Faulhaber's formula:

$$\sum_{i=0}^{\lfloor b\rfloor-1}i^n= \frac{(\lfloor b\rfloor-1)^{n+1}}{n+1}+\frac12(\lfloor b\rfloor-1)^n+\sum_{k=2}^n \frac{B_{k}}{k!}\frac{n!}{(n-k+1)!}(\lfloor b\rfloor-1)^{n-k+1}$$

Where $B_k$ is the $k$th Bernoulli number.

Hence,

$$F(b)-F(0)=\frac{(\lfloor b\rfloor-1)^{n+1}}{n+1}+\frac12(\lfloor b\rfloor-1)^n+\sum_{k=2}^n\left[\frac{B_{k}}{k!}\frac{n!}{(n-k+1)!}(\lfloor b\rfloor-1)^{n-k+1}\right]+(b-\lfloor b\rfloor)\lfloor b\rfloor^n$$

If we let $F(0)=0$, then

$$F(b)=\frac{(\lfloor b\rfloor-1)^{n+1}}{n+1}+\frac12(\lfloor b\rfloor-1)^n+\sum_{k=2}^n\left[\frac{B_{k}}{k!}\frac{n!}{(n-k+1)!}(\lfloor b\rfloor-1)^{n-k+1}\right]+(b-\lfloor b\rfloor)\lfloor b\rfloor^n$$

Related Question