3

Generalization of this question about ants bumping into each other on the real number line:

"There are n ants on a meter stick [real number line $\mathbb{R}^1$], each walking at $1cm/s$ in some direction. If two ants collide, they both reverse direction. Given the starting positions and directions of all the ants, how long will it take until the last ant falls off?" Also, the way the ants positions are initialized is: uniformly spaced, $1$ ant every $1$ cm. (So for example you will not have all ants on top of each other at the end of the stick for a finish time of $\sim0$ seconds)

  • the lower bound on the time will be $50$ seconds if the ants all face outward at the start and walk to the nearest edge.
  • the upper bound is described in the linked questions and is $100$ seconds.
  • so for any random instantiation of the ants, it will take between $50$ seconds to $100$ seconds to all exit

-So, my question is, over all $2^{100}$ possible initializations of ants [each of the $100$ ants can point in $1$ of $2$ directions] what is the expected time for the ants to all walk off the stick? Or more general, what is the probability distribution, for the completion time $t$, $p(t=T)$? Where the support of $t$ is nonzero only for $T=50$ seconds to $T=100$ seconds.


above question comes from $2$ places

Interesting Question on Ants

https://www.quora.com/There-are-n-ants-on-a-meter-stick-each-walking-at-1cm-s-in-some-direction-If-two-ants-collide-they-both-reverse-direction-Given-the-starting-positions-and-directions-of-all-the-ants-how-long-will-it-take-until-the-last-ant-falls-off

dektorpan
  • 189
  • To be clear, you mean that you've got a 100-cm stick on which ants are traveling at 1 cm/s? I don't see where the 30s possibility comes in. Also, are you aware of the "cute" solution to this classic problem? – Chris Nov 30 '17 at 02:31
  • I think you mean 1m per min speed. Do check. – Macavity Nov 30 '17 at 02:31
  • yeah, thanks, I was combining 2 slightly different questions. Numbers should make sense now. Yeah, aware of the reflection symmetry solution for the upper bound, but I want the expected value and if possible the actual distribution. – dektorpan Nov 30 '17 at 02:33
  • The question is still inconsistent and underspecified. You start off with a variable number $n$ of ants, which you then seem to fix at $n=100$. You don't specify the initial positions of the ants, only their distances from each other. Your upper and lower bounds seem to imply that you take the $100$ ants to be initially positioned at integer points from $0$ to $99$ or from $1$ to $100$, but it seems unlikely that you had this asymmetric arrangement in mind but didn't specify it. Please clarify. – joriki Mar 13 '23 at 07:14

1 Answers1

1

First, as the Quora answer makes clear, you can think of this problem simply as the ants moving without colliding at all, since whether they collide or not, the end effect is still having two ants moving in the two different directions.

Second, with $100$ ants spread out and having $1$ cm between them, the two outmost ants start $0.5$ cm from the ends, and so the upper bound is $99.5$ seconds, while the two most inside ants start $49.5$ cm from the ends, and so the lower bound is $49.5$ seconds.

Third, the probability distribution for the possible outcomes will be a geometric distribution. Indeed, the expected time will be very close to the upper bound.

To see this, consider: if at least one of the outer ants start by walking inward, it'll take $99.5$ seconds, and the chance of that is pretty good: $\frac{3}{4}$.

And even if both outside ants immediately walk off (with a chance of $\frac{1}{4}$), then there is a $\frac{3}{4}$ chance that at least one of the second to the most outer ants start walking inward, in which case it'll take $98.5$ seconds. So, there is a $\frac{3}{16}$ chance it will take $98.5$ seconds.

And we get exponentially smaller chances for that time to go down, e.g. there is a $\frac{3}{64}$ chance it will take $97.5$ seconds, a $\frac{3}{256}$ chance it will take $96.5$ seconds, etc. Like I said, you get a geometric distribution with smaller and smaller probabilities. As you found yourself, the probability of getting the lower bound is $1$ in $2^{100}$. ut even getting something below $90$ is highly improbable, as you'd need all of the $20$ outmost ants face the right way, so that only happens $1$ in $2^{20}$ times.

Finally, here is my rough calculation for the expected time ... someone who is better with series (especially partial sums) should be able to give a more precise answer ...

$$E = \sum_{i=0}^{49} (\frac{3}{4})\cdot (\frac{1}{4})^{i} \cdot (99.5-i) + (\frac{1}{4})^{50} \cdot 49.5 \approx$$

$$\sum_{i=0}^{\infty} (\frac{3}{4})\cdot (\frac{1}{4})^{i} \cdot (99.5-i) = $$

$$\frac{3}{4}\cdot \big(99.5 \cdot \sum_{i=0}^{\infty} (\frac{1}{4})^{i} -\sum_{i=0}^{\infty} (\frac{1}{4})^{i} \cdot i \big) = $$

$$\frac{3}{4}\cdot \big(99.5 \cdot \frac{1}{1-\frac{1}{4}} -\frac{1}{4} \cdot \sum_{i=1}^{\infty} (\frac{1}{4})^{i-1} \cdot i \big) = $$

$$\frac{3}{4}\cdot \big(99.5 \cdot \frac{1}{\frac{3}{4}} -\frac{1}{4} \cdot \frac{1}{(1-\frac{1}{4})^2}\big) = $$

$$\frac{3}{4}\cdot \big(99.5 \cdot \frac{4}{3} -\frac{1}{4} \cdot \frac{16}{9}\big) = $$

$$99.5 -\frac{3}{9} \approx 98.8333 $$

Note that if you use $101$ ants, so that the two outer ants are at the very end of the stick, and the middle ant is in the middle, you get an upper bound of $100$ seconds, a lower bound of $50$ seconds, and an expected time of a little over $99$ seconds.

Bram28
  • 103,721
  • @ryang Hmm. I see what you mean. Consider: I say: "If you study hard, you will pass the exam ... well, provided you actually show up for the exam of course!". In this use of 'provided', I am pointing out some necessary condition ... though not by itself sufficient .. so a fi, but not an if. Of course together with the earlier stated condition, it seems to become sufficient, or at least that's my intent, and now it becomes the iff that you feel. Well, with all use of English, I would take it on a cases by case basis. English is just too flexible and ambiguous for any hard rules like this. – Bram28 Jun 18 '24 at 14:44
  • Oh, for sure, especially in everyday conversation, insisting on the technical meaning of phrases like 'only if' (), 'unless' (if not) and 'provided that' is futile, not just because people are not rigorously logical, but because such phrases do tend to carry implicature. – ryang Jun 19 '24 at 07:39
  • Regarding your example: it actually sounds to me that the speaker's intended meaning of 'provided that' is 'if and only if': even though illogical, they do mean to say that show up for exam ⟺ (study hard ⟹ pass exam). $\quad$ I am okay to take instances of these phrases, even in mathematical writing, on a case-by-case basis, but it would be nice to have a more definitive closure about 'provided that' (as a baseline reference), like we have with 'only if' and 'unless'. – ryang Jun 19 '24 at 07:39
  • @ryang I take ‘only if’ and ‘unless’ on a case by case basis as well. I would interpret “You can take Calculus II only if you have taken Calculus I “ as a biconditional, and same for “You cannot take Caculus II unless you have taken Calculus I” – Bram28 Jun 19 '24 at 09:49
  • To me, 'only if' (= entails), 'unless' (= if not), '5 times bigger' (= 6 times as big) have clear technical meanings (okay the last one is admittedly quite a pipe dream) , which I don't necessarily parse The Washington Post with reference to. I'm curious whether, in the absence of context other than that the phrase is from, say, a text by Paul Halmos (so, disregarding how my next-door neighbour might casually use it), you think 'provided that' has (should have?) a clear technical meaning between 'if' and 'iff'? – ryang Jun 19 '24 at 16:36
  • @ryang I guess if there was no further context and was forced to pick something, I would translate 'P provided that Q' as P if Q. But no, I don't think there is a 'technical' meaning. Natural languages just aren't technical languages ... they're immensely powerful and efficient, but that comes at the price of vagueness and ambiguity. So that's why, if we do want precision and unambiguity (or at least less so) we have technical languages like math, logic, and scientific jargon as separate languages. – Bram28 Jun 19 '24 at 16:51
  • 1
    Okay, my current position: https://math.stackexchange.com/a/4936169/21813. Thanks for your input! – ryang Jun 22 '24 at 13:45