25

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.)

Gary
  • 31,845
HeyFan
  • 589

4 Answers4

25

Here is a slightly advanced solution: Define $X_1, X_2, \ldots$ on $[0, 1]$ by

$$ X_k (x) := [\text{$k$th digit in the binary expansion of $x$}] = \lfloor 2^k x\rfloor - 2 \lfloor2^{k-1}x\rfloor. $$

Then

\begin{align*} \sum_{n=0}^{\infty} \frac{\lfloor 2^n x \rfloor}{3^n} = \sum_{n=1}^{\infty} \frac{1}{3^n} \sum_{k=1}^{n} 2^{n-k}X_k = \sum_{k=1}^{\infty} \frac{X_k}{2^k} \sum_{n=k}^{\infty} \frac{2^n}{3^n} = \sum_{k=1}^{\infty} \frac{X_k}{3^{k-1}} . \end{align*}

Now by regarding $[0, 1]$ as a probability space with the probability measure $\mathrm{d}x$, we find that $X_1, X_2, \ldots$ are i.i.d. $\text{Bernoulli}(\frac{1}{2})$ variables. So,

\begin{align*} \int_{0}^{1} \left( \sum_{n=0}^{\infty} \frac{\lfloor 2^n x \rfloor}{3^n} \right)^2 \, \mathrm{d}x = \mathbf{E} \left[ \left( \sum_{k=1}^{\infty} \frac{X_k}{3^{k-1}} \right)^2 \right] = \sum_{j,k=1}^{\infty} \frac{1}{3^{j+k-2}} \mathbf{E}[X_j X_k]. \end{align*}

Using the independence, we get $\mathbf{E}[X_j X_k] = \frac{1}{4} + \frac{1}{4} \mathbf{1}_{\{j = k\}}$. Hence, the expectation reduces to

\begin{align*} \sum_{j,k=1}^{\infty} \frac{1}{3^{j+k-2}} \left( \frac{1}{4} + \frac{1}{4} \mathbf{1}_{\{j = k\}} \right) = \frac{1}{4} \left( \sum_{k=1}^{\infty} \frac{1}{3^{k-1}} \right)^2 + \frac{1}{4} \left( \sum_{k=1}^{\infty} \frac{1}{9^{k-1}} \right) = \boxed{\frac{27}{32}} \end{align*}

Sangchul Lee
  • 167,468
  • 1
    My solution is almost the same as yours! Since you post it first I don't have to type it. +1 anyway – Po1ynomial Feb 19 '23 at 16:22
  • What's the quick way to see that the $X_j,X_k$ are independent? I assume there must be some simple check or test that I haven't learnt, because the raw definition seems intimidating (to check $p(AB)=p(A)p(B)$ always...) – FShrike Feb 19 '23 at 16:28
  • 2
    @FShrike, I don't think it is a low-hanging fruit result, but the fastest way to see this is, surprisingly, to reverse the thought process: Let $Z_1, Z_2, \ldots$ be i.i.d. $\text{Bernoulli}(\frac{1}{2})$ variables. Assuming basic probability theory, it is easy to show that $$U=\sum_{n=1}^{\infty}\frac{Z_n}{2^n}$$ is uniformly distributed on $(0, 1)$. Furthermore, each $Z_n$ can be recovered from $U$ via the formula $Z_n=\lfloor 2^n U\rfloor-2\lfloor 2^{n-1} U\rfloor$ with probability one. So, ${Z_n}$ and ${X_n}$ have the same joint distribution and the desired result is established. – Sangchul Lee Feb 19 '23 at 16:35
  • @FShrike, So I guess that opening the gut of my answer and reducing everything into bare calculus level requires some brute-force computation comparable to what you did in your answer. – Sangchul Lee Feb 19 '23 at 16:37
  • 1
    @SangchulLee I think I see, thank you. It's important that U is uniformly distributed because then it coincides with the same probability measure that X is defined over, right? – FShrike Feb 19 '23 at 16:39
  • 1
    @FShrike, That's very true :) – Sangchul Lee Feb 19 '23 at 16:40
  • 1
    Thanks for the suggested solution even I can't fully understand it. From the official video of MIT Integration Bee 2023 Final, the winner also got the answer by writing $\frac{1}{4}(1+\frac{1}{3}+\frac{1}{3^2}+...)^2+\frac{1}{4}(1+\frac{1}{9}+\frac{1}{9^2}+...)$. – HeyFan Feb 20 '23 at 01:28
10

This answer uses the somewhat more advanced concept that, in Riemann integrals, any countable number of discontinuities (i.e., they have measure zero) can be ignored, such as in Thomae's function. First, define

$$f(x) = \sum_{n=0}^\infty\frac{\left\lfloor 2^nx\right\rfloor}{3^n}, \; \; g(y) = \int_{0}^{y}f^2(x)dx \tag{1}\label{eq1A}$$

Use the substitution $x = 2z \; \; \to \; \; dx = 2dz$ to get

$$g(1) = 2\int_{0}^{0.5}\left(\sum_{n=0}^\infty\frac{\left\lfloor 2^{n+1}z\right\rfloor}{3^n}\right)^2 dz \tag{2}\label{eq2A}$$

Next, for $0 \le z \le 0.5$, we have

$$\begin{equation}\begin{aligned} \sum_{n=0}^\infty\frac{\left\lfloor 2^{n+1}z\right\rfloor}{3^n} & = 3\sum_{n=0}^\infty\frac{\left\lfloor 2^{n+1}z\right\rfloor}{3^{n+1}} \\ & = 3\left(\sum_{n=0}^\infty\frac{\left\lfloor 2^{n}z\right\rfloor}{3^{n}} -\frac{\lfloor2^{0}z\rfloor}{3^{0}}\right) \\ & = 3\left(\sum_{n=0}^\infty\frac{\left\lfloor 2^{n}z\right\rfloor}{3^{n}}\right) \end{aligned}\end{equation}\tag{3}\label{eq3A}$$

Substituting this into \eqref{eq2A} gives

$$g(1) = 18g(0.5) \; \; \to \; \; g(0.5) = \frac{g(1)}{18} \tag{4}\label{eq4A}$$

From \eqref{eq1A}, using the substitution $x = 1 - z \; \; \to \; \; dx = -dz$ in the second integral on the right of the first line below, and that $\lfloor m - a \rfloor = m - 1 - \lfloor a \rfloor$ for all integers $m$ and non-integers $a$, we get

$$\begin{equation}\begin{aligned} g(1) & = \int_{0}^{0.5}f^2(x)dx + \int_{0.5}^{1}f^2(x)dx \\ & = g(0.5) - \int_{0.5}^{0}\left(\sum_{n=0}^\infty\frac{\left\lfloor 2^n(1-z) \right\rfloor}{3^{n}}\right)^2 dz \\ & = g(0.5) + \int_{0}^{0.5}\left(\sum_{n=0}^\infty\frac{2^n - 1}{3^n} - \sum_{n=0}^\infty\frac{\left\lfloor 2^{n}z \right\rfloor}{3^{n}}\right)^2 dz \\ & = g(0.5) + \int_{0}^{0.5}\left(\left(\frac{1}{1-\frac{2}{3}} - \frac{1}{1-\frac{1}{3}}\right) - \sum_{n=0}^\infty\frac{\left\lfloor 2^{n}z \right\rfloor}{3^{n}}\right)^2 dz \\ & = g(0.5) + \int_{0}^{0.5}\left(\frac{3}{2} - \sum_{n=0}^\infty\frac{\left\lfloor 2^{n}z \right\rfloor}{3^{n}}\right)^2 dz \\ & = g(0.5) + \int_{0}^{0.5}\left(\frac{9}{4} - 3\sum_{n=0}^\infty\frac{\left\lfloor 2^{n}z \right\rfloor}{3^{n}} + \left(\sum_{n=0}^\infty\frac{\left\lfloor 2^{n+1}z\right\rfloor}{3^n}\right)^2\right)dz \\ & = g(0.5) + \frac{9}{8} - 3\int_{0}^{0.5}f(x)dx + g(0.5) \end{aligned}\end{equation}\tag{5}\label{eq5A}$$

Next, using $x = 0.5 - z \; \; \to \; \; dx = -dz$, as well as $\lfloor 2^{0}(0.5 - z) \rfloor = \lfloor 2^{1}(0.5 - z) \rfloor = 0$ and $\lfloor 2^{0}z \rfloor = \lfloor 2^{1}z \rfloor = 0$ for $0 \lt z \le 0.25$, then

$$\begin{equation}\begin{aligned} \int_{0}^{0.5}f(x)dx & = \int_{0}^{0.25}f(x)dx + \int_{0.25}^{0.5}f(x)dx \\ & = \int_{0}^{0.25}f(x)dx - \int_{0.25}^{0}\sum_{n=0}^\infty\frac{\left\lfloor 2^n(0.5-z) \right\rfloor}{3^{n}}dz \\ & = \int_{0}^{0.25}f(x)dx + \int_{0}^{0.25}\left(\sum_{n=2}^\infty\frac{2^{n-1} - 1}{3^n} - \sum_{n=2}^\infty\frac{\left\lfloor 2^{n}z \right\rfloor}{3^{n}}\right)dz \\ & = \int_{0}^{0.25}f(x)dx + \int_{0}^{0.25}\left(\left(\frac{\frac{2}{9}}{1-\frac{2}{3}} - \frac{\frac{1}{9}}{1-\frac{1}{3}}\right) - \sum_{n=2}^\infty\frac{\left\lfloor 2^{n}z \right\rfloor}{3^{n}}\right)dz \\ & = \int_{0}^{0.25}f(x)dx + \int_{0}^{0.25}\left(\frac{1}{2} - \sum_{n=0}^\infty\frac{\left\lfloor 2^{n}z \right\rfloor}{3^{n}}\right)dz \\ & = \int_{0}^{0.25}f(x)dx + \frac{1}{8} - \int_{0}^{0.25}f(x)dx \\ & = \frac{1}{8} \end{aligned}\end{equation}\tag{6}\label{eq6A}$$

Substituting this into \eqref{eq5A}, and using \eqref{eq4A}, gives

$$\begin{equation}\begin{aligned} g(1) & = 2g(0.5) + \frac{9}{8} - 3\left(\frac{1}{8}\right) \\ g(1) & = \frac{g(1)}{9} + \frac{3}{4} \\ \frac{8g(1)}{9} & = \frac{3}{4} \\ g(1) & = \frac{27}{32} \end{aligned}\end{equation}\tag{7}\label{eq7A}$$

John Omielan
  • 47,976
7

$\newcommand{\d}{\,\mathrm{d}}$The first thing that jumps at me is that we should expand the squared series. Call this integral $I$. By expanding into odd and even terms, from $n\ge2$ (the corresponding $n=0,1$ summands is clearly zero by examining the floors) we have: $$\begin{align}I&=\sum_{n\ge2}3^{-n}\sum_{k=0}^n\int_0^1\lfloor2^kx\rfloor\lfloor2^{n-k}x\rfloor\d x\\&=\sum_{n\ge1}3^{-2n}\left(2\sum_{k=1}^{n-1}\int_0^1\lfloor2^kx\rfloor\lfloor2^{2n-k}\rfloor\d x+\int_0^1\lfloor2^nx\rfloor^2\d x\right)\\&+2\sum_{n\ge1}3^{-(2n+1)}\sum_{k=1}^n\int_0^1\lfloor2^kx\rfloor\lfloor2^{2n-k+1}x\rfloor\d x\end{align}$$

So we need to figure out how to evaluate $\int_0^1\lfloor2^ax\rfloor\lfloor2^bx\rfloor\d x$ where $a\le b$ are positive integers. To that end, we need to partition $(0,1)$ into fine subdivisions where each floor is constant: $$\begin{align}\int_0^1\lfloor2^ax\rfloor\lfloor2^bx\rfloor\d x&=\sum_{j=0}^{2^a-1}\sum_{i=0}^{2^{b-a}-1}\int_{(j2^{b-a}+i)\cdot2^{-b}}^{(j2^{b-a}+i+1)\cdot2^{-b}}\lfloor2^ax\rfloor\lfloor2^bx\rfloor\d x\\&=\sum_{j=0}^{2^a-1}\sum_{i=0}^{2^{b-a}-1}2^{-b}(j)(j2^{b-a}+i)\\&=\sum_{j=0}^{2^a-1}\sum_{i=0}^{2^{b-a}-1}j^22^{-a}+ij2^{-b}\\&=\sum_{j=0}^{2^a-1}(j^2\cdot2^{b-2a}+j\cdot(2^{b-2a-1}-2^{-a-1})\\&=\cdots\\&=\frac{1}{3}2^{b+a}-\frac{1}{4}(2^b+2^a)-\frac{1}{12}2^{b-a}+\frac{1}{4}\end{align}$$Using standard summation formulae.

We just insert $a,b$ into the above formula, then plug the result into the series expression for $I$. There are no longer any interesting details: it is just a tedious process of using the sum of a geometric series many many many many many times, and out pops the desired result.

This is a method. The high level of tedium associated to it makes me think this is not the fancy $4$-minute solution, but it is a solution that is reasonably easy to carry out reasonably quickly so long as you don't make mistakes with your algebra.

For example, I will demonstrate how to evaluate the subseries involving $\lfloor2^nx\rfloor^2$. We let $a=b=n$. $$\begin{align}\sum_{n\ge1}3^{-2n}\int_0^1\lfloor2^nx\rfloor^2\d x&=\sum_{n\ge1}3^{-2n}\frac{1}{3}2^{2n}-\sum_{n\ge1}3^{-2n}\frac{1}{4}2\cdot2^n-\sum_{n\ge1}3^{-2n}\left(\frac{1}{12}2^0+\frac{1}{4}\right)\\&=\frac{1}{3}\sum_{n\ge1}\left(\frac{4}{9}\right)^n-\frac{1}{2}\sum_{n\ge1}\left(\frac{2}{9}\right)^n+\frac{1}{6}\sum_{n\ge1}9^{-n}\\&=\frac{1}{3}\cdot\frac{4}{9}\cdot\frac{1}{1-\frac{4}{9}}-\frac{1}{2}\cdot\frac{2}{9}\cdot\frac{1}{1-\frac{2}{9}}+\frac{1}{6}\cdot\frac{1}{9}\cdot\frac{1}{1-\frac{1}{9}}\\&=\frac{4}{15}-\frac{1}{7}+\frac{1}{48}\end{align}$$It is probably sensible to leave these fractions expanded in case there are cancellations with the other series.

FShrike
  • 40,125
7

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}{4}\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} $$

Wood
  • 1,880
  • 1
    Minor inconsequential typo at the last line when you are computing the "easier" non-squared integral: it should be: $$ = \frac{1}{8} \cdot 2 - \frac{1}{4} \cdot \frac{1}{2} = \frac{1}{8} $$ – zenerino Mar 05 '23 at 17:26