2
$\begingroup$

Both $A$ and $B$ are a random number from the $\left [ 0;1 \right ]$ interval.

I don't know how to calculate it, so i've made an estimation with excel and 1 million test, and i've got $0.214633$. But i would need the exact number.

  • 1
    Perhaps I misunderstand: Suppose I just ask that the closest whole number is $0$, an even number. That means we want $\frac AB<\frac 12$, yes? But that's the same as $2A$.25$ probability. – 2017-02-16
  • 0
    Note: I assumed you meant that $A,B$ were uniformly distributed on $[0,1]$, obviously the answer depends on the distribution.2017-02-16
  • 0
    Both $A$ and $B$ are rational, and the [0;1] interval contains both number. I can't tell it vocational sadly.2017-02-16
  • 0
    The distribution is continuous.2017-02-16

2 Answers 2

5

You can use the fact that the distribution of the ratio of two independent uniform $[0,1]$'s is $$ f_Z(z) = \left\{\begin{array}{ll}1/2& 0 < z < 1 \\\frac{1}{2z^2} & z >1 \end{array}\right.$$

Then you can calculate the probability that the closest integer is $i$: $$\int_{i-1/2}^{i+1/2} p_Z(z)dz. $$

For $i\ge2,$ we get $$ \int_{i-1/2}^{i+1/2} \frac{1}{2z^2}dz = \frac{1}{2i-1}-\frac{1}{2i+1}.$$

The probability that $0$ is the closest integer is $$ \int_0^{1/2}p_Z(z)dz = 1/4.$$

So the total probability that even numbers are closest is $$ 1/4 + \sum_{j = 1}^\infty \frac{1}{4j-1} - \frac{1}{4j+1} = 1/4 + 1-\pi/4.$$

The numerical answer you gave is close to $1-\pi/4$ so I guess you weren't counting zero amongst the even integers.

  • 0
    Thanks! Yes, i've counted 0 neither odd nor even.2017-02-16
  • 0
    @user145014 You should've counted it as even, because 0 is an even number.2017-02-17
4

This is Problem 1993-B3 from the 54th Putnam exam.

The solution becomes obvious if we look at a graph of $(B,A)$ in the Cartesian unit square $[0,1]^2$. Then the value $A/B$ is the slope of the line segment joining $(B,A)$ to the origin. Define $[x]$ to indicate the nearest whole number to $x$. Then clearly, when $A < B$, we must have $[A/B] = 0$, which occurs for points in the triangle with vertices $\{(0,0), (1,0), (1,1/2)\}$. This triangle has area $1/4$.

For points with $A > B$, we have an infinite series of triangles with variable base along the edge joining $(0,1)$ and $(1,1)$, and common height $1$. For a point $(x,1)$ along this edge, the rounded slope is $[1/x]$, and we require this to be an even integer; i.e., $$2k - 1/2 < 1/x < 2k + 1/2, \quad k \in \mathbb Z^+$$ or equivalently $$\frac{2}{4k+1} < x < \frac{2}{4k-1}.$$ Consequently the total area of these triangles is simply $$\frac{1}{2} \sum_{k=1}^\infty \frac{2}{4k-1} - \frac{2}{4k+1} = \sum_{m=1}^\infty \frac{(-1)^{m+1}}{2m+1} = 1 - \frac{\pi}{4}.$$ Adding in the value for the case $[A/B] = 0$, we get $$\frac{5-\pi}{4} \approx 0.46460183660255169038.$$ Your answer corresponds to the case where $[A/B]$ is a positive even integer.

enter image description here

  • 0
    Thanks! Yes, i've counted 0 neither odd nor even.2017-02-16
  • 1
    @user145014 It is worth mentioning that $0$ is divisible by $2$, since $2 \cdot 0 = 0$, thus $0$ is even. (We say an integer $x$ is divisible by an integer $y$ if there exists an integer $m$ such that $my = x$.)2017-02-16
  • 0
    It's a little bit strange (for me atleast) to call the 0 even. $2*0=0$, but $2!=\frac{0}{0}$ (!= means not equals with)2017-02-16
  • 2
    Not sure why you think even means 2 = k/someother rather than even means k = 2*someother. I've been using 0 is even because 0 = 2*0 my entire life and it seems utterly natural. whereas making an exception to k is even if k = 2m except m = 0 or k is even iff and only iff k + 2 is even unless one of them is 0 seems utterly perverse and unnecessary to me. Just my opinion.2017-02-16
  • 1
    @user145014 See [this question](http://math.stackexchange.com/questions/15556/is-zero-odd-or-even) about whether or not zero is considered even.2017-02-16