Let me preface this question by saying that I am not exactly sure it counts as research level. It is crossposted on mathstackexchange: https://math.stackexchange.com/questions/1519724/integrating-a-series-expansion-of-x-lfloor-x-rfloor-coming-from-fourier-se
Receiving very little traffic, I decided to post here because I would really like to know the answer.
Originally, I ran into this problem on some basic math puzzle site (where it was asked to find the definite integral for some specific integer values), but I decided to try and find the indefinite integral.
Let $f(x)= \mbox{frac}(x)$ be the fractional part of $x$. The question is essentially about finding the integral $\int_{0}^{t}f(x)\lfloor x \rfloor dx$ for any $t\in \mathbb{R}$. Note that the curve $f(x)\lfloor x\rfloor$ looks like teeth of a saw whose height increases by one at each step. The fractional part function (or saw tooth function) $f(x)$ has a Fourier series expansion given by
$$f(x) = \frac{1}{2} - \sum_{k=1}^{\infty} \frac{\sin(2k\pi x)}{k}, $$
which will give a series expansion (not a Fourier series of course) of $f(x)\lfloor x\rfloor$ by
$$f(x)\lfloor x \rfloor = \frac{x}{2} - \frac{1}{4} - \frac{(x-1)}{\pi}\sum_{k=1}^{\infty} \frac{\sin(2k\pi x)}{k} - \frac{1}{\pi^2}\sum_{k=1}^{\infty} \frac{\sin^2(2k\pi x)}{k^2} - \quad \quad -\frac{2}{\pi^2}\sum_{k>m} \frac{\sin(2k\pi x)\sin(2m\pi x)}{k^2}. \ (1)$$
When I formally integrate this term by term, I obtain
$$\frac{x^2}{4} - \frac{x}{4} + \frac{(x-1)}{2\pi^2}\sum_{k=1}^{\infty} \frac{\cos(2k\pi x)}{k^2}-\frac{1}{4\pi^3}\sum_{k=1}^{\infty}\frac{\sin(2k\pi x)}{k^3} - \frac{x}{2\pi^2}\sum_{k=1}^{\infty}\frac{1}{k^2} + \quad \quad + \frac{1}{8\pi^3}\sum_{k=1}^{\infty} \frac{\sin(4\pi k x)}{k^2} - \frac{2}{\pi^2}\sum_{k>m} g_{k,m}(x), \ (2) $$
where $$ g_{k,m}(x) = \frac{\sin(2\pi(k-m)x)}{4\pi(k-m)km} + \frac{\sin(2\pi(k+m)x)}{4\pi(k+m)km}. $$
Now, I am well aware that we need, in $(1)$, uniform convergence in order for this term by term integration to be the integral, but I figure that since by general theory the Fourier expansion of $f(x)$ has this property that $(1)$ will also have this property (i.e., I haven't yet checked uniform convergence of $(1)$). I guess my first question is whether or not formally plugging in $t$ into (2) is indeed the integral $\int_{0}^{t}f(x)\lfloor x \rfloor$ for $t\in \mathbb{R}\setminus \mathbb{Z}. $ If this is not the case, then my next question does not have much meaning.
One may calculate the integral $\int_{0}^{t}f(x)\lfloor x \rfloor dx$ for $t\in\mathbb{Z}$ in a very straightforward way to obtain $\frac{t^2}{4} - \frac{t}{4}$. Given that we know the Fourier series at discontinuities will be the average of left and right limits of the original function, it is natural to wonder about the value of $(2)$ at integer values and their relationship to the integral just calculated. For integer values $t$, $(2)$ becomes
$$\frac{t^2}{4}-\frac{t}{4} - \frac{\zeta(2)}{2\pi^2} = \frac{t^2}{4}-\frac{t}{4} - \frac{1}{12}.$$
So, my second question (hopefully there are no errors in calculation and uniform convergence is given) is how does one make sense of this discrepancy term of $-\frac{1}{12}$? Is there some way to understand how this "almost" Fourier series transforms under integration at discontinuities vis-a-vis the integral of the original function?
My feeling is that such an explanation should be possible and that it would be roughly equivalent to showing that $\zeta(2) = \frac{\pi^2}{6}$. This is related to Gibbs phenomenon, but I am unsure exactly what the relation is in this case.