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

integrationprobabilityreal-analysis

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.

Best Answer

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:

enter image description here