Convert binary to decimal

Calculus Level 5

Given a real number x [ 0 ; 1 ) x\in[0; 1) with binary expansion x = ( 0. a 1 a 2 a 3 ) 2 x=(0.a_1a_2a_3\ldots)_2 , let f ( x ) = ( 0. a 1 a 2 a 3 ) 10 f(x)=(0.a_1a_2a_3\ldots)_{10} be the number obtained when interpreting the binary expansion of x x as a decimal expansion.

For example, f ( 1 2 ) = f ( ( 0.100 ) 2 ) = ( 0.100 ) 10 = 1 10 f\left(\dfrac{1}{2}\right)=f((0.100\ldots)_2)=(0.100\ldots)_{10}=\dfrac{1}{10} .

Given that: I = 0 1 f ( x ) d x = m n \displaystyle I=\int\limits_0^1 f(x)dx=\dfrac{m}{n} , where m , n m,n are coprime positive integers.

Find the value of m + n m+n .


The answer is 19.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

We split this integral at x = 1 2 x=\dfrac{1}{2} to get: I = 0 1 2 f ( x ) d x + 0 1 2 f ( 1 2 + x ) d x \displaystyle I=\int\limits_0^{\frac{1}{2}} f(x)dx+\int\limits_0^{\frac{1}{2}} f\left(\dfrac{1}{2}+x\right)dx

Now, if 0 x < 1 2 0\le x<\dfrac{1}{2} then x x has the form x = ( 0.0 a 2 a 3 ) 2 x=(0.0a_2a_3\ldots)_2 , and

f ( x ) = ( 0.0 a 2 a 3 ) 10 = 1 10 ( 0. a 2 a 3 ) 10 \qquad\;\;\, f(x)=(0.0a_2a_3\ldots)_{10}=\dfrac{1}{10}(0.a_2a_3\ldots)_{10}

= 1 10 f ( ( 0. a 2 a 3 ) 2 ) = 1 10 f ( 2 x ) \qquad\qquad\quad=\dfrac{1}{10}f((0.a_2a_3\ldots)_2)=\dfrac{1}{10}f(2x)

f ( 1 2 + x ) = ( 0.1 a 2 a 3 ) 10 = 1 10 + 1 10 ( 0. a 2 a 3 ) 10 f\left(\dfrac{1}{2}+x\right)=(0.1a_2a_3\ldots)_{10}=\dfrac{1}{10}+\dfrac{1}{10}(0.a_2a_3\ldots)_{10}

= 1 10 + 1 10 f ( ( 0. a 2 a 3 ) 2 ) = 1 10 + 1 10 f ( 2 x ) \qquad\qquad\quad=\dfrac{1}{10}+\dfrac{1}{10}f((0.a_2a_3\ldots)_2)=\dfrac{1}{10}+\dfrac{1}{10}f(2x)

Hence,

I = 1 10 0 1 2 ( f ( 2 x ) + 1 + f ( 2 x ) ) d x = 1 20 0 1 ( 1 + 2 f ( y ) ) d y = 1 20 + I 10 \displaystyle I=\dfrac{1}{10}\int\limits_0^{\frac{1}{2}}\left(f(2x)+1+f(2x)\right)dx=\dfrac{1}{20}\int\limits_0^1\left(1+2f(y)\right)dy=\dfrac{1}{20}+\dfrac{I}{10}

Thus, I = 1 18 I=\dfrac{1}{18} .

So, m + n = 19 m+n=\boxed{19} .

How would you prove that the integral exists?

Ivan Koswara - 5 years, 10 months ago

Log in to reply

You would just need to show that f is increasing and bounded on (0, 1).

D G - 5 years, 10 months ago
Kartik Sharma
Aug 15, 2015

Nice problem!

Let's see what f ( x ) f(x) is - Converting to binary involves running it through 2 k {2}^{k} s and seeing where it becomes 1 1 or 0 0 and then dividing each term by its corresponding 10 k {10}^{-k} s

So, we can write

f ( x ) = k = 1 2 k x m o d 2 10 k \displaystyle f(x) = \sum_{k=1}^{\infty}{\frac{\left \lfloor {2}^{k} x \right \rfloor mod 2}{{10}^{k}}}

Now, we need to integrate

0 1 k = 1 2 k x m o d 2 10 k d x \displaystyle \int_{0}^{1}{\sum_{k=1}^{\infty}{\frac{\left \lfloor {2}^{k} x \right \rfloor mod 2}{{10}^{k}}} dx}

k = 1 1 10 k 0 1 2 k x m o d 2 d x \displaystyle \sum_{k=1}^{\infty}{\frac{1}{{10}^{k}} \int_{0}^{1}{\left \lfloor {2}^{k} x \right \rfloor mod 2 \quad dx}}

Claim : 0 1 a k x m o d a d x = a 1 2 \displaystyle \quad \int_{0}^{1}{\left \lfloor {a}^{k} x \right \rfloor mod a \quad dx} = \frac{a-1}{2} where a a is a positive integer.

Proof :

1 a k 0 a k u m o d a d u \displaystyle \frac{1}{{a}^{k}} \int_{0}^{{a}^{k}}{\left \lfloor u \right \rfloor mod a \quad du}

The integral can be done with the help of graph.

Graph for u \left \lfloor u \right \rfloor is simple to draw. An increasing graph with critical points at integers. Now, graph for u m o d a \left \lfloor u \right \rfloor mod a is a periodic one with period a a .

Hence, the area under such a graph for the interval ( 0 , a k ) (0, {a}^{k}) would be -

Area for (0,a) a k 1 \text{Area for (0,a)}*{a}^{k-1} and as in the given interval, there are a a rectangles with width = 1 = 1 and length = 0 , 1 , 2 , , a 1 = 0, 1, 2, \cdots, a-1 .

= a k 1 m = 0 a 1 m 1 = a k ( a 1 ) 2 \displaystyle = {a}^{k-1} \sum_{m=0}^{a-1}{m*1} = \frac{{a}^{k}(a-1)}{2}

And there is a factor we've not considered, putting it back -

a 1 2 \displaystyle \frac{a-1}{2}

Back to the integral, we apply this and get -

k = 1 1 10 k 1 2 \displaystyle \sum_{k=1}^{\infty}{\frac{1}{{10}^{k}} \frac{1}{2}}

1 18 \displaystyle \boxed{\frac{1}{18}}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...