Integration with floor function I can't find the exact value of the following integral:
$$\int\limits_0^1 {[ax][bx]} dx$$
where $a$ and $b$ have as greatest common divisor 1.
(gcd(a,b)=1)
Thanks.
 A: As mentioned in the comments, we have
$$\int_0^1 \lfloor ax \rfloor \lfloor bx \rfloor \, dx = \frac{1}{ab} \sum_{n=0}^{ab-1} \lfloor n/a \rfloor \lfloor n/b \rfloor $$ 
We'll work with residues mod $a$ and $b$ instead of the floor function. We can write $\lfloor n/a \rfloor = n/a - \{n/a\}$, where $\{x\}$ denotes the fractional part of $x$, and this satisfies $\{n/a\} = (n \mbox{ mod } a)/a$ for $n, a \in \mathbb{Z}$, $a > 0$, so $\lfloor n/a \rfloor = (n - (n \mbox{ mod } a))/a$. Then our sum becomes
$$\frac{1}{a^2b^2} \sum_{n=0}^{ab-1} (n - (n \mbox{ mod } a)) (n - (n \mbox{ mod } b))$$
We can break this into four sums. First,
$$\sum_{n = 0}^{ab-1} n^2 = \frac{(ab-1)ab(2ab-1)}{6}$$
By the Chinese Remainder Theorem, each pair of a residue mod $a$ and a residue mod $b$ corresponds to a unique residue mod $ab$, so
$$\sum_{n=0}^{ab-1} (n \mbox{ mod } a)(n \mbox{ mod } b) = \left( \sum_{k=0}^{a-1} k \right) \left( \sum_{l=0}^{b-1} l \right) = \frac{ab(a-1)(b-1)}{4}$$
Now $n = a\lfloor n/a \rfloor + (n \mbox{ mod } a)$, so 
\begin{align*}
\sum_{n=0}^{ab-1} n (n \mbox{ mod } a) 
&= a \sum_{n=0}^{ab-1} \lfloor n/a \rfloor (n \mbox{ mod } a) + \sum_{n=0}^{ab-1} (n \mbox{ mod } a)^2 \\
&= a \left( \sum_{l=0}^{b-1} l \right) \left( \sum_{k=0}^{a-1} k \right) + b \sum_{k=0}^{a-1} k^2 \\
&= \frac{a^2 b (a-1)(b-1)}{4} + \frac{b(a-1)a(2a-1)}{6}
\end{align*}
and similarly $\sum_{n=0}^{ab-1} n (n \mbox{ mod } b) = \frac{ab^2 (a-1)(b-1)}{4} + \frac{a(b-1)b(2b-1)}{6}$, so our sum is 
$$\frac{1}{a^2b^2} \left( \frac{(ab-1)ab(2ab-1)}{6} + \frac{ab(a-1)(b-1)}{4} - \frac{a^2 b (a-1)(b-1)}{4} - \frac{b(a-1)a(2a-1)}{6} - \frac{ab^2 (a-1)(b-1)}{4} - \frac{a(b-1)b(2b-1)}{6}\right)$$ 
which simplifies to $\frac{1}{12ab}(4a^2 b^2 - 3ab(a+b-1) - a^2 - b^2 + 1)$.
