Oddly Enough

Calculus Level 5

Two real numbers a a and b b are randomly chosen from the range ( 0 , 1 ) . (0,1). The probability that a b \frac{a}{b} rounded to the nearest integer is odd is equal to P . P. What is 1000 P ? \lfloor1000P\rfloor?


The answer is 535.

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.

5 solutions

Jatin Yadav
Mar 27, 2014

First we show that the value of S = r = 0 ( 1 ) r 2 r + 1 S = \displaystyle \sum_{r=0}^{\infty} \frac{(-1)^r}{2r+1} is π 4 \frac{\pi}{4} . I have two methods here for the proof:

Method-1:

Clearly S = r = 0 ( 1 ) r 0 1 x 2 r d x S = \displaystyle \sum_{r=0}^{\infty}(-1)^r \int_{0}^{1} x^{2r} dx

= 0 1 ( r = 0 ( 1 ) r x 2 r ) d x \displaystyle \int_{0}^{1} \bigg(\sum_{r=0}^{\infty} (-1)^r x^{2r} \bigg)dx

= 0 1 1 1 + x 2 d x = π 4 \displaystyle \int_{0}^{1} \frac{1}{1+x^2} dx = \boxed{\frac{\pi}{4}}

Method-2:

By series expansion of ln ( 1 + i ) \ln(1+i) , we see that S S is its imaginary part. Hence, S = Im ( ln ( 2 e i π 4 ) ) = Im ( ln ( 2 ) + i π 4 ) = π 4 S = \text{Im}\bigg(\ln\bigg(\sqrt{2} e^{i \frac{\pi}{4}}\bigg)\bigg) = \text{Im}\big(\ln(\sqrt{2}) + i \frac{\pi}{4}\big)= \boxed{\frac{\pi}{4}}

Now, let us come to the problem. Let me use y y in place of a a and x x in place of b b .

Clearly, as the integer nearest to y x \frac{y}{x} is odd, hence,

y x ( 1 / 2 , 3 / 2 ) ( 5 / 2 , 7 / 2 ) ( 9 / 2 , 11 / 2 ) \frac{y}{x} \in \big(1/2,3/2\big) \cup \big(5/2,7/2\big) \cup \big(9/2,11/2\big) \cup \dots

Now, as x , y ( 0 , 1 ) x,y \in (0,1) , area of sample space is 1 1 .

Given below is a graph, showing triangles 1 , 2 , 3 , 4 , 5 , 1,2,3,4,5,\dots

Clearly, area of favorable region = Ar(1)+Ar(2)+Ar(4)+Ar(6)+Ar(8)+ \text{Ar(1)+Ar(2)+Ar(4)+Ar(6)+Ar(8)+}\dots

Now, altitude of each of these triangles is 1 1

Hence, area of favorable region = 1 2 × 1 × ( 1 1 / 2 + 1 2 / 3 + 2 / 5 2 / 7 + 2 / 9 2 / 11 + 2 / 13 2 / 15 ) \frac{1}{2} \times 1 \times \bigg(1 - 1/2 + 1-2/3 + 2/5-2/7 + 2/9-2/11 + 2/13-2/15 \dots\bigg)

= 1 2 ( 2 S 1 2 ) \frac{1}{2}\big(2S - \frac{1}{2}\big)

= π 1 4 0.5354 \frac{\pi - 1}{4} \approx 0.5354

This is the required probability as area of sample space is 1 1 . Hence, answer is 535 \boxed{535}

Really well written solution Jatin :)

Karthik Kannan - 7 years, 2 months ago

NICE!!!!!!

Sung Moo Hong - 7 years, 2 months ago
Nam Diện Lĩnh
Jun 8, 2014

One can use Monte Carlo method with computer with this code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
var n=10000000;
var c=0;
for(var i=0;i<n;i++)
{
    var a=Math.random();
    var b=Math.random();
    if(Math.round(a/b)%2)
        c++;
}

var prob=c/n

I did the same thing. The best thing for solving probability problems really just seems to be to test it ten million times and see what happens.

Python:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from random import random
from math import floor
odd = 0
trials = 10000000
for trial in xrange(trials):
    a = random()
    b = random()
    if round(a/b) % 2 != 0:
        odd += 1.0
print "Answer:", floor(1000*odd/trials)

Brock Brown - 6 years, 3 months ago

Log in to reply

I always like to simulate probability problems first as well, but ... convergence is usually very slow, and in the end, it's not exact.

Borut Levart - 3 years, 8 months ago

What about floor(100000000000000*P)?

Borut Levart - 3 years, 8 months ago
Bill Bell
Oct 29, 2015

Although Monte-Carlo would have been easy I decided against it after I made this diagram, on the grounds that such results might be subject to considerable variation. On the other hand, I have a congenital disinclination for reducing infinite series.

I decided to proceed by summing areas. Since the region corresponding to the first odd integer is miserable to work with I decided to sum the even-numbered regions instead. The boundaries of these are obviously equations like y=x/1.5 and y=x/2.5, y=x/3.5 and y=x/4.5, and so on. The probability of the region where x/y rounds to 0 is 0.25. To avoid round-off errors I made the summation using fractions.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from fractions import Fraction

upper=Fraction(5,2)
lower=Fraction(3,2)

total=0
for i in range(5000):
    term=1/lower-1/upper
    total+=term
    if i%100==0:
        print 0.5*total
    upper+=2
    lower+=2

Convergence was slow (reminding me of one of Euler's calculatiosn). The final value here was 0.214576334205 giving a probability of 1-(.25+0.214576334205) or 0.535423665795.

Consider the problem geometrically. We have points ( a , b ) (a,b) confined within a unit square with its bottom left vertex at the origin.

Let [ a b ] \left [\dfrac{a}{b}\right ] be a b \dfrac{a}{b} rounded to the nearest integer.

We have

[ a b ] = 1 1 2 a b < 3 2 b 2 a < 3 b \left [\dfrac{a}{b}\right ]=1\iff \dfrac{1}{2}\leq \dfrac{a}{b}<\dfrac{3}{2}\iff b\leq 2a<3b

[ a b ] = 3 5 2 a b < 7 2 5 b 2 a < 7 b \left [\dfrac{a}{b}\right ]=3\iff \dfrac{5}{2}\leq \dfrac{a}{b}<\dfrac{7}{2}\iff 5b\leq 2a<7b

And so on. We can interpret these regions in the following diagram.

[https://www.desmos.com/calculator/p1nf8wndrs](https://www.desmos.com/calculator/p1nf8wndrs) https://www.desmos.com/calculator/p1nf8wndrs

Where the shaded regions are those where [ a b ] \left [\dfrac{a}{b}\right ] is odd.

To avoid dealing with the larger, non-triangular region differently, just subtract the non-shaded area from 1.

Pr ( [ a b ] is even ) = 1 2 1 ( 1 2 + ( 2 3 2 5 ) + ( 2 7 2 9 ) + ( 2 11 2 13 ) + . . . ) = 1 4 + 1 3 1 5 + 1 7 1 9 + . . . = 1 4 + 1 ( 1 1 3 + 1 5 1 7 + . . . ) = 5 4 π 4 by the Leibniz formula for π = 5 π 4 \begin{aligned}\textnormal{Pr}\left (\left [\dfrac{a}{b}\right ]\textnormal{ is even}\right )&=\frac{1}{2}\cdot 1\cdot \left (\frac{1}{2}+\left (\frac{2}{3}-\frac{2}{5}\right )+\left (\frac{2}{7}-\frac{2}{9}\right )+\left (\frac{2}{11}-\frac{2}{13}\right )+...\right )\\&=\frac{1}{4}+\frac{1}{3}-\frac{1}{5}+\frac{1}{7}-\frac{1}{9}+...\\&=\frac{1}{4}+1-\left (1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+...\right )\\&=\frac{5}{4}-\frac{\pi}{4}\href{https://brilliant.org/wiki/pi/#exactly-defining-pi-as-an-infinite-series}{\textnormal{ by the Leibniz formula for }\pi}\\&=\frac{5-\pi}{4}\end{aligned}

We then have that Pr ( [ a b ] is odd ) = 1 5 π 4 = π 1 4 \textnormal{Pr}\left (\left [\dfrac{a}{b}\right ]\textnormal{ is odd}\right )=1-\dfrac{5-\pi}{4}=\dfrac{\pi -1}{4} .

1000 π 1 4 = 535 \left \lfloor 1000\cdot\dfrac{\pi-1}{4}\right \rfloor=\color{#20A900}{\boxed{535}}

Extra Information

  • To prove that 1 1 3 + 1 5 1 7 + . . . 1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+... , we have that arctan θ = θ θ 3 3 + θ 5 5 \arctan \theta=\theta-\dfrac{\theta^3}{3}+\dfrac{\theta^5}{5} from its Maclaurin series. Substituting θ = 1 \theta=1 gives the result.
  • A similar problem was covered by 3Blue1Brown, from where I learnt this method.
Michael Mendrin
Apr 1, 2014

Wow, this was fun and kind of unexpected. What's interesting is that if the Floor of a/b was used instead of Round of a/b, we'd end up with (1/2)Log(2) instead of something involving π. How about that?

It would have been simpler if that was floor of a/b. Infact, at once, I interpreted it as floor of a/b and got answer as 1 2 ln 2 \frac{1}{2} \ln 2 . Also, this was really unexpected, as it never seems to be a calculus problem in first look.

jatin yadav - 7 years, 2 months ago

Log in to reply

That's exactly what happened to me, I have a bad habit of trying to solve problems before I fully understand the question, and I came up with the answer (1/2)Log(2) first. Now that π has entered into the picture, I'm really fascinated with this problem. A "must remember" problem.

Michael Mendrin - 7 years, 2 months ago

This is best suited for a comment, not a solution. But that's a good problem. If you want to submit it yourself, go ahead.

Trevor B. - 7 years, 2 months ago

Log in to reply

Oh, right, I see where I should have replied. But Yadav's method is more or less the way I did it, so if I can, I'd like to try finding another solution that illustrates why π is involved. I'll have to think on that first.

Michael Mendrin - 7 years, 2 months ago

Log in to reply

Good luck with that! My intended \textit{intended} solution is what Jatin did with the triangles in the square to get the series.

Trevor B. - 7 years, 2 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...