# Two numbers are chosen at random over the interval $[0,1]$

Two real numbers, $x$ and $y$ are chosen at random over the interval $[0,1]$. What is the probability that the closest integer to $\frac{x}{y}$ will be even? Floor functions don't play nicely with integrals and I'm fairly certain that's the wrong way to be going about this. Looking for some rigor in the answer, if possible.

• Integration, or more precisely finding the sum of the areas of certain triangles, should do it. Commented Apr 18, 2015 at 17:13
• How diabolical =D Commented Apr 18, 2015 at 17:14

Selecting two points $$x$$ and $$y$$ from the interval $$[0, 1]$$ is identical to selecting a single point from the unit square. For the sake of clarity, let us calculate the probability that $$y/x$$ is closest to an even integer, because that's just the slope. By symmetry, that is equal to the corresponding probability for the ratio $$x/y$$.

Divide the unit square into two portions, one below the line $$y = x$$, and one above it. In the bottom portion, points that qualify are below the line $$y = x/2$$; this section has area $$A_l = 1/4$$.

In the upper portion, points that qualify are in successively smaller (inverted) triangles with apex at the origin, and bases along the segment from $$(0, 1)$$ to $$(1, 1)$$. These bases run from $$2/3$$ down to $$2/5$$, then $$2/7$$ down to $$2/9$$, then $$2/11$$ down to $$2/13$$, etc. Their collective area is therefore

$$A_u = \frac{1}{2} \Bigl( \frac{2}{3}-\frac{2}{5}+\frac{2}{7}-\frac{2}{9}+\cdots \Bigr) = \frac{1}{3}-\frac{1}{5}+\frac{1}{7}-\frac{1}{9}+\cdots = 1-\frac{\pi}{4}$$

using this well-known series.

The combined area is therefore $$A_l+A_u = (5-\pi)/4 \doteq 0.46460$$. Here's a diagram of the configuration:

• Cool neat problem! Commented Apr 18, 2015 at 17:54
• Which book contains this type of problems? Commented Dec 24, 2018 at 5:01
• @ChinnapparajR: You might consider looking at Fifty Challenging Problems in Probability with Solutions, by Robert Mosteller. Here's the Amazon link, but it's available elsewhere too. (I am not affiliated with Amazon.) Commented Dec 25, 2018 at 18:12
• Thank you so much ! Commented Dec 26, 2018 at 1:45
• It's Frederick Mosteller, by the way; I messed that up. Commented Dec 31, 2018 at 18:06