<s>[INST] Question from MIT integration Bee 2023 final: Evaluate $\int^1_0 (\sum^\infty_{n=0}\frac{\left\lfloor 2^nx\right\rfloor}{3^n})^2{\rm d}x$ I am trying to evaluate the last question from MIT integration Bee 2023 Final.
$$\int^1_0 \left (\sum^\infty_{n=0}\frac{\left\lfloor 2^nx\right\rfloor}{3^n} \right )^2{\rm d}x$$
My approach is to divide $(0,1)$ into $1/2^n$ intervals and write the general term of the $y$-value. E.g. For $x \in (k/2^n, (k+1)/2^n)$,
$$f(x)=\left (\sum^{n-1}_{k=0}\frac{\left\lfloor k/2^k\right\rfloor}{3^{n-k}}\right)^2$$
I know that the final integral is just summing up the areas of all the infinite rectangles but I can't solve it. Please help. Thank you.
(The final answer of this question is $27/32$. Candidates were allowed to solve it within 4 minutes.)
 [/INST] Here's an elementary solution:
Define
$$
I_b = \int_0^b \left(\sum_{n=1}^\infty \frac{\lfloor 2^nx\rfloor}{3^n}\right)^2\,dx
$$
The idea is to write $I_1$ in terms of $I_{1/2}$ in two different ways: one using the substitution $x \rightarrow 2x$, the other by splitting the integral range into two and writing both parts in terms of $I_{1/2}$. Then we solve the system of equations for $I_1$.
The substitution is straightforward, you just have to note that $\lfloor 2^1x\rfloor = 0$ for $0\le x<1/2$:
$$
\begin{align*}
I_1 &= 2\int_0^{1/2} \left(\sum_{n=1}^\infty \frac{\lfloor 2^{n+1}x\rfloor}{3^n}\right)^2\,dx = 2\int_0^{1/2} \left(\sum_{n=\color{red}{2}}^\infty \frac{\lfloor 2^nx\rfloor}{3^{n-1}}\right)^2\,dx \\
&= 2\int_0^{1/2} \left(3\sum_{n=\color{red}{1}}^\infty \frac{\lfloor 2^nx\rfloor}{3^n}\right)^2\,dx = 18\,I_{1/2}
\end{align*}
$$
The other way to write $I_1$ is as follows:
$$
\begin{align*}
I_1 &= \int_0^{1/2} \left(\sum_{n=1}^\infty \frac{\lfloor 2^nx\rfloor}{3^n}\right)^2\,dx + \int_{1/2}^1 \left(\sum_{n=1}^\infty \frac{\lfloor 2^nx\rfloor}{3^n}\right)^2\,dx \\
&= I_{1/2} + \int_0^{1/2} \left(\sum_{n=1}^\infty \frac{\lfloor 2^n(x+1/2)\rfloor}{3^n}\right)^2\,dx \\
&= I_{1/2} + \int_0^{1/2} \left(\sum_{n=1}^\infty \frac{\lfloor 2^nx\rfloor}{3^n} + \underbrace{\sum_{n=1}^\infty \frac{2^{n-1}}{3^n}}_{=1}\right)^2\,dx \\
&= 2\,I_{1/2} + 2\int_0^{1/2} \sum_{n=1}^\infty \frac{\lfloor 2^nx\rfloor}{3^n}\,dx + \frac{1}{2}
\end{align*}
$$
Now the integral without the square is much easier to solve:
$$
\begin{align*}
\int_0^{1/2} \sum_{n=1}^\infty \frac{\lfloor 2^nx\rfloor}{3^n}\,dx &= \sum_{n=1}^\infty \frac{1}{3^n} \int_0^{1/2} \lfloor 2^nx\rfloor\,dx \\
&= \sum_{n=1}^\infty \frac{1}{3^n}\cdot\frac{1}{2^n} \int_0^{2^{n-1}} \lfloor x\rfloor\,dx \\
&= \sum_{n=1}^\infty \frac{1}{3^n}\cdot\frac{1}{2^n} \sum_{k=1}^{2^{n-1}-1} k \\
&= \sum_{n=1}^\infty \frac{1}{3^n}\cdot\frac{1}{2^n}\cdot\frac{1}{2}2^{n-1}\left(2^{n-1}-1\right) \\
&= \frac{1}{8}\sum_{n=1}^\infty \left(\frac{2}{3}\right)^n - \frac{1}{4}\sum_{n=1}^\infty \left(\frac{1}{3}\right)^n \\
&= \frac{1}{8}\cdot 2 - \frac{1}{8}\cdot\frac{1}{2} = \frac{1}{8}
\end{align*}
$$
Recalling that $I_{1/2} = I_1/18$, substitute the values and solve for $I_1$:
$$
I_1 = 2\cdot\frac{1}{18}\,I_1 + 2\cdot\frac{1}{8} + \frac{1}{2} \\
\Rightarrow\frac{8}{9}\,I_1 = \frac{3}{4} \\
\Rightarrow I_1 = \frac{27}{32}
$$
</s>