3

The random ant question is asked in this post. I reproduce it below for completeness.

Question: $500$ ants are randomly put on a 1-foot string (independent uniform distribution for each ant between 0 and 1). Each ant randomly moves toward on end of the string (equal probability to the left or the right) at constant speed of 1 foot/minute until it falls of a t one end of the string. Also assume that the size of the ant is infinitely small. When two ants collide head-on, they both immediately change directions and keep on moving at 1 foot/min. What is the expected time for all ants to fall off the string?

The question above is equivalent to asking the expected value of the maximum of $500$ IID random variables with uniform distribution between $0$ and $1$.

We know that the expected value of $\max(X_1,...,X_{500})$ where $X_1,...,X_{500}$ are IID, is $\frac{500}{501}$, as shown in another post.

However, the answer given to the random ant question is $\frac{499}{500},$ which I fail to decipher.

Idonknow
  • 16,493
  • 1
    On a rather unrelated tangent that may be interesting or completely coincidental, a problem on the silver level USACO (USA Computing Olympiad) competition of December 2019 had a very similar problem if the solution to the problem could be of any help: http://usaco.org/index.php?page=viewproblem2&cpid=967 – Soham Konar Jan 01 '20 at 03:11
  • http://www.physics.montana.edu/avorontsov/teaching/problemoftheweek/documents/problem_Math004.pdf is also concluding $N/(N+1)$ as mentioned mean time when initially there were $N$ ants. – dan_fulea Jan 01 '20 at 03:27
  • Could you please point out where exactly the answer $\frac{499}{500}$ is given? I could find it neither in the post you linked to, nor in the one that it links to. – joriki Jan 01 '20 at 04:20
  • Actually the answer that I posted above comes from 'A practical guide to quantitative finance interview'. The book has exactly the same question above and the answer that it gives is $\frac{499}{500}.$ – Idonknow Jan 01 '20 at 04:27

2 Answers2

5

The guide that gives $\frac{499}{500}$ as an answer is wrong. You're right that it should be $\frac{500}{501}$.

joriki
  • 242,601
  • What if the ants were moving at a different speed. Instead of $1 foot/min$, what if they were moving at $x foot/min$? Would the answer simply be $\frac{500}{501}x$? – David May 06 '20 at 13:31
  • Also, what if the ants don't start out with equal probability of moving to the right or left. What if there was bias towards one direction? Based on symmetry, it seems that this would not affect the answer? – David May 06 '20 at 13:34
  • Can't edit my first comment anymore, but I think it's wrong. It should be $\frac{\frac{500}{501}}{x}$ – David May 06 '20 at 13:38
  • @David: Yes to both your questions (with the correction). – joriki May 06 '20 at 14:14
  • Can you explain why the probability of moving to the right or left does not matter? When comparing the original case with the case where all ants move in the same direction, wouldn't the answer for the former be shorter? I think for each configuration of ants on the string, there is a non-zero probability that the time needed is less than max(X_n, 1-X_1) in the former case but this is not true for the latter case. Thanks! – anrokhshan Jan 04 '24 at 07:09
  • @anrokhshan: No. As has been explained elsewhere, the ants swapping directions when they meet can be ignored since we don't care about the identities of the ants. So we just have $500$ ants being put in uniformly random places and moving in a uniformly random direction until they fall off the stick. An ant that goes left from $x$ takes the same time as an ant that goes right from $1-x$, and $x$ and $1-x$ are equiprobable, so it doesn't matter how the directions are distributed; the time each ant takes is always uniformly distributed on $[0,1]$ and independent of the others. – joriki Jan 04 '24 at 14:24
0

A Monte Carlo simulation in python:

import numpy as np
from scipy.stats import uniform 
from scipy.stats import bernoulli

N = 1000000 # number of samples ant = 500 X = uniform.rvs(0, 1, size=(N,ant)) # ant position end_point = bernoulli.rvs(p=0.5, size=(N,ant)) # is 0 or 1 distance = np.abs(X - end_point) np.mean( np.max(distance, axis=1) )

Cantaro
  • 48
  • 5