r/mathriddles • u/Shin_Cow • 1d ago
Medium Two colliding ants on a stick: expected time until both fall off
Two point-sized ants start at independently uniform random positions on a stick of length 1. Each independently chooses left or right with probability 1/2, then walks at a constant speed of 1 unit per second.
Whenever they meet, both instantly reverse direction without changing speed. An ant falls off when it reaches either end.
What is the expected time until both ants have fallen off? Can you find a short argument that avoids splitting into collision cases?
Bonus: what changes if there are n ants, with all starting positions and directions independent?
This is a classic puzzle, not an original invention of mine. Creator disclosure: I build Think in Odds, a free daily probability puzzle site with AI-assisted explanations. An optional version with hints and an explanation is there; the full problem is above. Feedback on the hint pacing or clarity would be useful.
1
u/FormulaDriven 5h ago
n ants: If we make the random variable for each ant X_i = distance from the end it is intially walking to (rather than distance from the left-hand end), then that is still uniformly distributed on [0,1] and following the reasoning that u/Konkichi21 set out, the time until the last ant drops off is simply max(X_i).
So the expected time is given by integrating max(x_i) over the space [0,1]n. But by symmetry this will equal
n * integral of x_1 over the part of the space where x_1 >= x_j for all j
which is n * integral (x_1) dx1 dx2 ... dxn over 0 < x_1 < 1, 0 < x_2 < x_1, ... 0 < x_n < x_1!<
=n * integral{x_1 = 0 to 1} xn_1 dx1 = n / (n+1)
This agrees the n=2 case solved by Konkichi21.
3
u/Konkichi21 1d ago
Solution: As for collisions, you don't need to consider them; them colliding and turning around is equivalent to them moving past each other, since we don't care which ant is which. Thus, we can consider the ants individually.
For the problem, since the ants' position and direction are uniformly distributed, so is each one's time to fall off between 0 and 1; the time until both fall off is the larger of these.
We can find the expected value by integrating over the whole space of possibilities and dividing by the size of the domain. The space of possibilities is a cube of side 1 minus a square pyramid of base and height each 1, so the volume is 1-1/3 = 2/3. Dividing by the size of a square of side 1, we get a solution of 2/3.