I was given this problem recently in a job interview in which I did not succeed, however I found the problem itself very interesting, and have been trying to solve it since.
Given matchstick of length 1, and an infinite grid of similar matchsticks (i.e. an infinite grid of 1x1 squares), if you toss the matchstick randomly onto the grid, what is the probability that the matchstick lands overlapping at least one of the matchsticks in the grid?
I decided to first define 3 variables:
- $x =$ horizontal distance between lower end of landing matchstick and nearest grid matchstick to the left
- $y =$ vertical distance between lower end of landing matchstick and nearest grid matchstick below
- $\theta$ = landing angle of matchstick with grid horizontal
- $x, y$ ~ $U(0, 1)$
- $\theta$ ~ $U(0, \pi)$
- $x, y, \theta$ are all independent of each other
I then split the events of overlapping the horizontal and the vertical matchsticks in the grid, such that:
$$ P(Overlap) = P(OverlapsVertical) + P(OverlapsHorizontal) - P(OverlapsVertical \bigcup OverlapsHorizontal) $$
- $P(OverlapsVertical) = P(y + sin(\theta) >= 1)$
- $P(OverlapsHorizontal) = P(x + cos(\theta) >= 1)$
For overlapping vertical, because both y and theta are uniformly distributed, I could calcluate $P(OverlapsVertical)$ by:
- Constructing the rectangle of possible values for $y$ and $\theta$
- Integrating to find the proportion of area of this rectangle that satisfied the condition $y + sin(\theta) >= 1$
Doing the same for the horizontal case, I found that $P(OverlapsVertical) = P(OverlapsHorizontal) = 2/\pi$.
However, I realised that the events $OverlapsVertical$ and $OverlapsHorizontal$ are not independent, because they are both dependent on $\theta$, specifically $sin(\theta)$ and $cos(\theta)$ which are inversely related, and therefore:
- $P(OverlapsVertical \bigcup OverlapsHorizontal) \not= P(OverlapsVertical) * P(OverlapsHorizontal)$
I then became stuck, and wondered if my approach to the entire problem was wrong. Is there a better way to solve this problem? Any input greatly appreciated. Thanks!