Source

I got this problem from Rustan Leino, who got it from Alex Pintilie.

I solved it and wrote up my solution.

Problem

Each of two witches makes a nightly visit to an all-night coffee shop. Each arrives at a random time between 0:00 and 1:00. Each one of them stays for exactly 15 minutes. On any given night, what's the probability that the witches will meet at the coffee shop?

Solution
Reveal

$7/16,$ by the following reasoning.

Call the witches Alice and Beatrice. Let $A$ and $B$ be the time, in hours after midnight, that Alice and Beatrice arrive, respectively. So, each of these is a uniformly random variable in the range $[0, 1].$ We want to compute $P(|A-B| \leq 1/4).$

We can compute this as the integral $\int_0^1 P(|A-B| \leq 1/4 \mid A = a)\;da.$ Rewriting, this is $\int_0^1 P(|a-B| \leq 1/4)\;da.$ Now, \[ P(|a-B| \leq 1/4) = \left\{ \begin{array}{ll} a + 1/4 & \mbox{if } 0 \leq a \leq 1/4 \\ 1/2 & \mbox{if } 1/4 \leq a \leq 3/4 \\ 5/4 - a & \mbox{if } 3/4 \leq a \leq 1. \\ \end{array} \right. \] So, the quantity we want is \[ \int_0^{1/4} (a+1/4)\;da + \int_{1/4}^{3/4} (1/2)\;da + \int_{3/4}^1 (5/4-a)\;da. \]

We could apply calculus at this point, but it's easier to just visualize what this quantity looks like. It's the area under the curve that starts at $(0, 1/4),$ goes up linearly to $(1/4, 1/2),$ proceeds horizontally to $(3/4, 1/2),$ then goes down linearly to $(1, 1/4).$ This area is a rectangle with two triangles cut out of the top left and top right. The rectangle has area $1 \times 1/2 = 1/2$ and each triangle has area $1/2 \times 1/4 \times 1/4 = 1/32.$ So the quantity we want is $1/2 - (2)(1/32) = 7/16.$