# nearest integer function

• July 9th 2009, 08:10 PM
Random Variable
nearest integer function
Let x be a random real number from the interval (0, 1].

Let nint(x) be the nearest integer function of x.

What is the probability that nint(1/x) is even?

Nearest integer function - Wikipedia, the free encyclopedia

Moderator edit: Approved Challenge question.
• July 9th 2009, 09:58 PM
AlephZero
I will be the first fool to state that I think it should be 1/2, which I suppose is wrong, otherwise I don't see why you'd pose the question. So I'm curious.

However, I've seen "nearest integer" defined in different ways. By your definition, does nint(1/2)=0 or 1?
• July 9th 2009, 10:59 PM
Moo
As he gave the wikipedia link, I guess we should take 0.

But the probability of getting n/2 is 0, so it's not really important actually.
• July 10th 2009, 12:52 AM
NonCommAlg
Quote:

Originally Posted by Random Variable
Let x be a random real number from the interval (0, 1].

Let nint(x) be the nearest integer function of x.

What is the probability that nint(1/x) is even?

Nearest integer function - Wikipedia, the free encyclopedia

my guess would be:

Spoiler:
$2-\frac{\pi}{2}.$
• July 10th 2009, 02:36 AM
Random Variable
Quote:

Originally Posted by AlephZero
I will be the first fool to state that I think it should be 1/2, which I suppose is wrong, otherwise I don't see why you'd pose the question. So I'm curious.

However, I've seen "nearest integer" defined in different ways. By your definition, does nint(1/2)=0 or 1?

Since we're dealing with a continuous distribution, I don't think it matters.
• July 10th 2009, 02:41 AM
Random Variable
Quote:

Originally Posted by NonCommAlg
my guess would be:

Spoiler:
$2-\frac{\pi}{2}.$

Yep.
• July 10th 2009, 03:05 PM
Random Variable
Since NonCommAlg didn't explain how he did the problem, I'll give some hints for those still interested.

Hint 1 :

Spoiler:
If $\text{nint}\big(\frac{1}{x}\big) = 2n$ (where $n \in \mathbb{Z}$ ) , then $2n - \frac{1}{2} < \frac{1}{x} < 2n + \frac{1}{2}$. (Whether or not they should be strict inequalties does not effect the calculation of the probability.)

Hint 2 :

Spoiler:
Write out the terms of the series and use the fact that $1 - \frac {1}{3} + \frac{1}{5} - \frac {1}{7} + \frac {1}{9} + ... = \frac {\pi}{4}$
• June 10th 2010, 07:13 PM
chiph588@
Quote:

Originally Posted by Random Variable
Since NonCommAlg didn't explain how he did the problem, I'll give some hints for those still interested.

Hint 1 :

Spoiler:
If $\text{nint}\big(\frac{1}{x}\big) = 2n$ (where $n \in \mathbb{Z}$ ) , then $2n - \frac{1}{2} < \frac{1}{x} < 2n + \frac{1}{2}$. (Whether or not they should be strict inequalties does not effect the calculation of the probability.)

Hint 2 :

Spoiler:
Write out the terms of the series and use the fact that $1 - \frac {1}{3} + \frac{1}{5} - \frac {1}{7} + \frac {1}{9} + ... = \frac {\pi}{4}$

Care to elaborate? (Wink)
• June 10th 2010, 08:55 PM
simplependulum
Probably this technique is always used in nowadays MO contests .

Consider the function $f(x) = \frac{1}{x}$ then partition the y-axis : $1 \leq y = \frac{1}{x} < +\infty$ into such intervals : $[1,1.5) , [1.5,2.5) , [2.5,3.5) , [3.5,4.5) ...$ then consider the intervals which are mapped to the x-axis from them :

$( \frac{2}{3} ,1 ] , ( \frac{2}{5} , \frac{2}{3} ] , (\frac{2}{7} , \frac{2}{5} ], (\frac{2}{9} , \frac{2}{7} ]..$ Shade the intervals $(\frac{2}{5} , \frac{2}{3} ] , (\frac{2}{9} , \frac{2}{7} ]..$ and consider the total length of the shaded intervals which is :

$\frac{2}{3} - \frac{2}{5} + \frac{2}{7} - \frac{2}{9} + ...$

$= 2 \left[ \frac{1}{3} - \frac{1}{5} + \frac{1}{7} - \frac{1}{9} + ... \right] = 2 ( 1 - \frac{\pi}{4} ) = 2 - \frac{\pi}{2}$

The required probability is the ratio of it to the unit length , also $2 - \frac{\pi}{2}$

Remark : Intuitively , if the function is replaced with step function , the answer will be something like $\ln{2}$