I calculated $\int{\lfloor{x}\rfloor}dx$ and i got this result: $$\int{\lfloor{x}\rfloor}dx = \frac{x^2-x}{2}+\sum_{k=1}^{\infty}\left(\frac{\sin(k\pi x)}{k\pi}\right)^2+c$$ Do you know if this series have a closed form?

We found a nice identity!

$$\int{\lfloor{x}\rfloor}dx = \frac{\pi^2\left(x^2-x\right)+\Re\left[ \mathrm{Li_2}\left(e^{i2\pi x}\right)\right]}{2\pi^2}+c$$


$$\int_0^x{\lfloor{t}\rfloor}dt = \frac{\pi^2\left(x^2-x\right)+\Re\left[ \mathrm{Li_2}\left(e^{i2\pi x}\right)\right]}{2\pi^2}+\frac{1}{12}$$

Also, using $$\Re\left[ \mathrm{Li_2}\left(e^{ix}\right)\right] =\sum_{k\ge1}\frac{\cos(kx)}{k}=\frac{x^2}{4}+\frac{\pi x}{2}+\frac{\pi^2}{6}, \forall x\in\left[0,2\pi\right]$$

We get

$$\forall x\in\left[0,1\right] \forall \alpha\in\mathbb{Z},\ \ \ \ \ \Re\left[ \mathrm{Li_2}\left(e^{i2\pi x}\right)\right] =\pi^2\left((x-\alpha)^2-(x-\alpha)+\frac{1}{6}\right)$$


I don't know if your expansion is valid. But this infinite sum can be worked with,$$\sum_{k=1}^\infty \left(\frac{\sin(k\pi x)}{k\pi}\right)^2 = \sum_{k=1}^\infty \frac{1-\cos (2k\pi x)}{2k^2\pi^2} = \frac1{2\pi^2}\sum_{k=1}^\infty \frac1{k^2} -\frac1{2\pi^2} \Re \sum_{k=1}^\infty \frac{\exp (i2\pi x)^k}{k^2} $$ The first term is $\frac1{12}$ from the Basel problem. The second term involves the dilogarithm $\operatorname{Li}_2(z) = \sum_{k=1}^\infty \frac{z^k}{k^2} $, $$-\frac1{2\pi^2} \Re \sum_{k=1}^\infty \frac{\exp (i2\pi x)^k}{k^2} = -\frac1{2\pi^2} \Re \operatorname{Li}_2(e^{2\pi i x}) $$


Interpret the integral as a Riemann-Stieltjes integral, you can integrate it by part.

For $y > 0$, you get something like

$$\begin{align}\int_0^y \lfloor x \rfloor dx &= \int_{0-}^{y+} \lfloor x \rfloor dx = y \lfloor y \rfloor - \int_{0-}^{y+} x d\lfloor x \rfloor\\ &= y \lfloor y \rfloor - \sum_{k=0}^{\lfloor y\rfloor} k = y \lfloor y \rfloor - \frac12 \lfloor y \rfloor(\lfloor y \rfloor + 1)\\ &= \frac12y(y-1) + \frac12 \{y\}(1-\{y\}) \end{align} $$ where $\{y\} = y - \lfloor y \rfloor$ is fractional part of $y$. This suggests $$\sum_{k=1}^{\infty}\left(\frac{\sin(k\pi x)}{k\pi}\right)^2 = \frac12 \{x\} (1-\{x\})$$

One can verify this by computing the Fourier series of the periodic function on RHS.

Notice $$\begin{align} a_0 &= \frac12\int_0^1 x(1-x) dx = \frac{1}{12} = \frac{1}{2\pi^2}\frac{\pi^2}{6}\\&= \frac{1}{2\pi^2}\sum_{k=1}^\infty \frac{1}{k^2}\\ a_k &= \frac12\int_0^1 x(1-x)\cos(2\pi k x)dx = \frac{1}{4\pi k}\int_0^1 x(1-x) d\sin(2\pi k x)\\ &= \frac{1}{4\pi k}\left\{ \left[x(1-x) \sin(2\pi k x)\right]_0^1 + \int_0^1 (2x-1)\sin(2\pi k x) dx \right\}\\ &= -\frac{1}{8\pi^2 k^2}\int_0^1 (2x-1)d\cos(2\pi k x)\\ &= -\frac{1}{8\pi^2 k^2} \left\{ \left[(2x-1)\cos(2\pi k x)\right]_0^1 - 2\int_0^1 \cos(2\pi k x) dx \right\}\\ &= -\frac{1}{4\pi^2k^2} \end{align}$$

and by symmetry, $\displaystyle\;b_k = \frac12\int_0^1 x (1-x) \sin(2\pi k x)dx = 0$ for all $k$. This leads to

$$\begin{align}\frac12\{x\}(1 - \{x\}) &= a_0 + 2\sum_{k=1}^\infty (a_k \cos(2\pi k x) + b_k\sin(2\pi kx))\\ &= \frac{1}{2\pi^2}\sum_{k=1}^\infty \frac{1 - \cos(2\pi k x)}{k^2}\\ &= \sum_{k=1}^\infty \left(\frac{\sin(\pi k x)}{k \pi}\right)^2\end{align}$$

  • $\begingroup$ The first line. What is that? That's like exactly or possibly the exact same way I've always done step function integrals. Is there an actual name for this algorithm?!? I thought it was just a weird thing I did. $\endgroup$ – user64742 Nov 26 '18 at 0:14
  • 1
    $\begingroup$ @TheGreatDuck It is integration by part. When one interpret an integral as RS-integral, integration by part continue to work for integrand containing jump discontinuity. It is possible the integration limit hit the jump discontinuity. So I change the limit from $[0,y]$ to $[0-,y+]$ to make sure which discontinuity we are going to include in the finite sum. The first is justified because the integrand is $0$ at $y = 0$, the second is justified because the floor function is right continuous. $\endgroup$ – achille hui Nov 26 '18 at 0:22
  • $\begingroup$ Not exactly what I was thinking then. There's a method whereby you substitute a step function with a constant sort of like u-substitution to integrate and then you correct the result by subtracting whatever step function cancels the resulting jump discontinuities. Unless that is what you are doing just phrased differently. Regardless this answer is quite interesting. I'm going to need to look into this... $\endgroup$ – user64742 Nov 26 '18 at 0:27
  • $\begingroup$ @TheGreatDuck The end result is probably the same. The advantage of this is I remember one less thing. I only need to remember integration by part works for this sort of integrand. $\endgroup$ – achille hui Nov 26 '18 at 0:31
  • $\begingroup$ The end result is certainly the same given that both compute the integral. $\endgroup$ – user64742 Nov 26 '18 at 0:33

You don't need a series (but if you really want this series, the following can also be used to find the value of the series up to a constant term you can determine).

Let $f(x)=\int_0^x \lfloor{u}\rfloor\mathrm du$.

For a given $x\ge0$, let $n=\lfloor{x}\rfloor\ge0$. Then

$$f(x)=\int_0^n \lfloor{u}\rfloor\mathrm du+\int_n^x \lfloor{u}\rfloor\mathrm du$$

With the convention that the sum is zero if $n=0$,

$$f(x)=\sum_{k=0}^{n-1}\int_k^{k+1} \lfloor{u}\rfloor\mathrm du+\int_n^x \lfloor{u}\rfloor\mathrm du$$

On $[k,k+1[$, $\lfloor{u}\rfloor=k$, and on $[n,x[$, $\lfloor{u}\rfloor=n$, so

$$f(x)=\sum_{k=0}^{n-1}\int_k^{k+1} k\mathrm du+\int_n^x n\mathrm du$$

$$f(x)=\sum_{k=0}^{n-1}k+n(x-n)=\frac{n(n-1)}{2}+n(x-n)=\frac n2(n-1+2x-2n)=\frac n2(2x-n-1)$$


Now let $x<0$, then

$$f(x)=\int_0^x \lfloor{u}\rfloor\mathrm du=-\int_x^0 \lfloor{u}\rfloor\mathrm du$$

Let $n=\lfloor{x}\rfloor<0$:

$$f(x)=-\int_x^n \lfloor{u}\rfloor\mathrm du-\int_n^0 \lfloor{u}\rfloor\mathrm du$$

$$f(x)=-\sum_{k=n}^{-1}\int_k^{k+1} \lfloor{u}\rfloor\mathrm du+\int_n^x \lfloor{u}\rfloor\mathrm du$$

$$f(x)=-\sum_{k=n}^{-1}\int_k^{k+1} k\mathrm du+\int_n^x n\mathrm du$$

$$f(x)=-\sum_{k=n}^{-1}k+ n(x-n)=\frac{-n(1-n)}2+n(x-n)$$

$$f(x)=\frac n2(2x-n-1)$$


Therefore, a primitive on $\Bbb R$ is given by

$$\int \lfloor{x}\rfloor\mathrm dx=\frac{\lfloor{x}\rfloor}{2}(2x-\lfloor{x}\rfloor-1)+C$$

Now, the series, assuming your primitive is correct.

$$f(x)-\frac{x^2-x}2=\frac{2x\lfloor{x}\rfloor}2-\frac{\lfloor{x}\rfloor^2}2-\frac{x^2}{2}+\frac x2-\frac{\lfloor{x}\rfloor}{2}$$


That is


[Note that since the integrand is piecewise constant, $f(x)$ is piecewise linear and continuous, and the previous equality means that it interpolates the parabola $\frac{x^2-x}{2}$ at integer points. Furthermore, the difference between the parabola and the interpolation is never more than $\frac18$.]

The previous equality also means that there is a constant $c$ such that the following holds for all $x$:

$$\sum_{k=1}^{\infty}\left(\frac{\sin(k\pi x)}{k\pi}\right)^2+c=\frac12\{x\}(1-\{x\})$$

Now let $x=0$, then $c=0$.


The antiderivative of a step function is a piecewise linear, continuous function, made of segments of increasing slope. If we define it as the definite integral from zero to $x$, the integer part of $x$ yields a triangular number (sum of integers), while the fractional part brings a linear contribution.


$$\int_0^x\lfloor x\rfloor dx=\frac{(\lfloor x\rfloor-1)\lfloor x\rfloor}2+\lfloor x\rfloor\{x\}=\frac{(2x-\lfloor x\rfloor-1)\lfloor x\rfloor}2.$$

As it turns out, the formula is also valid in the negatives.

enter image description here

It is interpolated at integer points by the parabola $\dfrac{x(x-1)}2$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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