'Bee flying between two trains' problem

There is a famous arithmetic question :

Two trains $$150$$ miles apart are traveling toward each other along the same track. The first train goes $$60$$ miles per hour; the second train rushes along at 90 miles per hour. A fly is hovering just above the nose of the first train. It buzzes from the first train to the second train, turns around immediately, flies back to the first train, and turns around again. It goes on flying back and forth between the two trains until they collide. If the fly's speed is $$120$$ miles per hour, how far will it travel?

It is easy to determine the distance travelled by the bee.

But how to determine how many times it touches first/second train?

or

Which train it touches last?

• It's a hypothetical perfect situation. With instantaneous reversal and absolutely unvarying speeds and infintismal time instants and a bee the size of a perfect point and a universe without quantum mechanics, it's an infinite sum. The bee touches each train an infinite number of times. For any other answer somethings "gotta" give but it's utterly arbitrary what. May 30 '16 at 6:32
• See mathworld.wolfram.com/TwoTrainsPuzzle.html and the story about John von Neumann at the end.
– lhf
May 30 '16 at 9:51
• I don't understand. If the fly is going back and forth, how does that affect the distance traveled by the bee? May 30 '16 at 20:12
• Is it a bee or a fly? May 30 '16 at 21:46
• An infinite number of mathematicians enter a bar. The first says, "Pour me a beer". The second says, "Pour me a half a beer". The third says, "Pour me a fourth a beer", and on and on it goes. The bartender shaking his head, says, "Know your limits" and pours them two beers.
– Neil
May 31 '16 at 7:53

Here is some graphical intuition for understanding why the bee touches trains infinitely often.

The bee's trajectory in space-time is a zig-zag path which is self-similar; if you zoom in onto successive pairs of turnarounds, you get a copy of the original: So the bee touches both trains infinitely often, in a finite amount of time. The duration of time between successive touches gets shorter and shorter.

To make it obvious without needing to zoom, take a faster bee (or slower trains). Here is what happens for a bee 10 times as fast: EDIT. Given the discussion about bees of nonzero length, here's what happens to a 20 mile long bee going at 1200 mph: • This is a great answer with easy to understand visual cues. +1 May 30 '16 at 14:30
• 15 minutes later I see that my previous fix had moved the top edge of the smaller frame to the wrong spot. Now fixed (and hopefully my last edit).
– user332714
May 30 '16 at 14:59
• I was expecting something more like this for the final graph. May 31 '16 at 9:36
• Can your 20-mile long bee turn around instantly? May 31 '16 at 18:16
• @PaŭloEbermann Yes, it has sensors and a propulsion mechanism at both ends. It was also quite expensive.
– user332714
Jun 1 '16 at 8:39

We can prove that the bee touches both trains infinitely many times.

Suppose at some time the bee is at the nose of one train, and it flies to the other train. Then it will arrive at the other train earlier than the two train meets, since its speed is larger than any train.

The process repeats, and thus the bee will touch both trains infinitely many times.

• @Dhruv: No, comparing it to the speed of a single train is fine. Any time it leaves a train, it'll outrun that train and reach the other train first. May 30 '16 at 7:55
• @Dhruv: The sum of the lengths of the trips converges, but the questioner already knows that. The question isn't about the total travel distance. May 30 '16 at 7:56
• @Dhruv The bee only travels the distance between the trains minus the length of the bee, assuming it turns around exactly when it touches the other train. So, as the trains approach being one bee-length apart, the bee will make infinitely many journeys. (And only then will the bee meet an unfortunate end) May 30 '16 at 13:51
• @MaskedMan No, it has infinite acceleration at the turnaround, but the speed is never more than 120 mph.
– user332714
May 31 '16 at 14:41
• @MaskedMan: This is a mathematical problem. Why you try to get physics into it. I guess everyone here is aware of that: Newton invented his Laws to oppress this kind of super bees, which impede the travel of approaching trains. May 31 '16 at 14:43

The trains are approaching each other at $150$ miles per hour. Since they are $150$ miles apart, they meet in 1 hour. So the bee flies for 1 hour.

The speed of the bee is given to be $120$ miles an hour, so it travels a total of $120$ miles, because it gets 1 hour to fly before getting squashed.

Also, if the bee is assumed to be a point, it touches both the trains an infinite number of times. The distance travelled can also be calculated by the sum of the infinite series. This is of course assuming that the bee takes 0 time in turning around.

In a similar way, it is impossible to determine which train it last sits on, unless there is a specific amount of time taken in turning around.

• what trick? just sum the infinite series. also is a specific amount of time enough information to determine which final train? May 30 '16 at 7:28
• The question was: "It is easy to determine the distance travelled by the bee. But how to determine how many times it touches first/second train? or which train it touches last?" This answer seems to give only answers to the actual questions but I don't quite see how this answer explains the answers.
– JiK
May 30 '16 at 11:30

Okay. In 5/6 an hour the bee has flown 100 miles and the second train has traveled 50 miles. The bee has met the train. The bee has done the first half of the first jag.

The first train has gone 75 miles. The bee turns around to fly toward the train 25 miles away from it. In 25/210 = 5/42 of an hour the bee reaches the first train.

It had taken the bee 5/6 + 5/42 = 20/21 hours to do the first jag. The trains are now 150x1/21 miles apart.

The bee must repeat the jag but only go 1/21 the distance so it takes 1/21 the time. If we add up how long each of these jags were the bee flies from the first to the second train and back and how long it takes the total is

$20/21+20/21*1/21+20/21*(1/2)^2+20/21*(1/21)^3+....$

An infinite sum.

$20/21 (1+1/21+(1/21)^2+(1/21)^3+...)=$

$20/21 [\frac {1}{1-1/21}]=20/21 [\frac {1}{20/21}]=20/21*21/20=1$ hour.

So the bee flew for 1 hour. Did an infinite number of jags each taking an exponentially shorter period of time that add up to 1 hour and 120 miles.

That's how you do it with math and infinite sums and limits without doing the trick of figuring how long the trains take.

===

Okay. You are probably wondering how I did the infinite sum and got 21/20.

Well. IF the sum $1 + a+a^2+a^3+...$ does add up to something finite then:

$(1-a)(1+a+a^2+....)=$

$(1+a+a^2+...)-(a+a^2+a^3+...)=1$

So $(1+a+a^2+...)=\frac {1}{1-a}$

So $1+1/21+(1/21)^2+(1/21)^3+...=\frac {1}{1-1/21}=21/20$.

=====

Okay, I have to note first time I made a calculation error and thought the first train traveled 90 and not 75 miles in the first half jag. Oddly enough this didn't effect the outcome as the result was still that each jag is proportionally smaller by the factor it took to do the first jag. No matter how badly I do the math, the jags are proportionally smaller by the inverse of the first time, so the sum will always be an hour.

Likewise, I switched which train the bee started at. That likewise makes no difference.

• It might be easier to try this with easier numbers. The trains are 1 mile apart. They each go 1 mph. The bee goes 2 mph. In 1/3 an hour the bee and train meet at the 1/3 mile mark and the first train is at to 2/3 mile mark. The bee does the second in 1/3 the time. The total time it takes is 1/3+1/9+1/27.....= 1/2. May 30 '16 at 7:47
• It doesn't change the overall methodology, but you have the train speeds reversed relative to the OP question which changes the actual numbers. "The first train goes 60 miles per hour; the second train rushes along at 90 miles per hour...". So, correcting your first statement: "In 5/6 of an hour the bee has flown 100 miles and the second train has traveled ̶5̶0̶ 75 miles..." (note, this is more than the starting 150 miles so further results require recalculation with another fraction of an hour) ---> May 30 '16 at 19:49
• And your second statement: "The first train has gone ̶9̶0̶ 50 miles. The bee turns around to fly back to the first train ̶1̶0̶ 25 miles away from it (150-(75+50)). ### Using 5/7 (instead of 5/6): In 5/7 of an hour the bee has flown 85.7 miles and the second train has traveled 64.3 miles (total 150 miles). The first train has gone 42.85 miles. The bee is 42.85 miles (150-(64.3+42.85)) away from the first train. ... ... May 30 '16 at 20:05
• meh, .... the bee still does the first "full jag" in 37/42 of an hour and each jag is 5/42 as long, right? Lessee... dammit. I made an error in my post. The first train is at 75 mark not 90 so it takes 25/210 = 5/42 of an hour not 1/21 so the jag takes 5/6 + 5/42 = 20/21. Your jag also takes 20/21 of a jag so it doesn't really matter. What's interesting (maybe) is that even with my error the result is the same. But that's not actually surprising whatever time I got for the first jag every subsequent jag would be proportional so the sum would still be the same. May 30 '16 at 21:08

That would be infinite.
Both the number of times it touches the trains, and which train it touches last cannot be determined. Read about Zeno's paradox, specifically the tortoise and Achilles.

• How it can be infifnite?after a finite amount of time train crashes.then bee will not fly.So,it must be finite no. May 30 '16 at 5:43
• Well, read up xeno's paradox, and also read the story about Achilles and the tortoise. The bee's trip between the two trains keeps getting smaller but never reaches 0. Dichotomy paradox: mathworld.wolfram.com/ZenosParadoxes.html May 30 '16 at 5:46
• Read up on converging infinite series. An infinite sequence of infinitely decreasing amounts adding up to a finite amount is not in the least bit paradoxical or even unexpected. Take this for instant. Start with 0. We want to get to 1. So we always add half of what we need. 1/2+1/4+1/8+... as we add half of what we need we can always add so so we can do this infinitely. But we never add up to more than 1. May 30 '16 at 6:39
• It's a finite amount of time but the time each jag takes is proportionally small. The first jag takes $a$ of an hour. The second jag takes $a^2$ of an hour. The third $a^3$ of an hour. And $a +a^2+a^3+... =1$. That's not impossible. It can happen if $a=1/2$. In this case the actual math is $37/42 (5/42 + 5^2/42^2 +5^3/42^3+...)=1$ May 30 '16 at 7:05
• I was answering the question "how can it be infinite". It can because...infinite sums and so on. There's infinite values but they are exponentially smaller. That's how. May 30 '16 at 7:58

It will be infinite. You cannot apply the logic that the quantity will be finite as the trains collide in finite amount of time because that would be the case in real world where the bee cannot turn back in infinitesimally small amount of time.

Once you accept that the bee touches each train a countable infinity of times, it is important to realize that the question of which train it touches last does not make sense. The bee touches one train on the odd number touches and the other on even touches. You are asking whether the largest natural is odd or even, but there is no largest natural.

The whole sad matter ends with a catastrophic event for the fly, shortly followed by a catastrophic event for the trains.

At the point where the distance between the two trains is less than the length of a fly, the fly cannot turn around and fly back anymore. At the point where the distance is less than the space a fly needs to live, the fly is dead.

The exact time the fly goes in one direction depends on which train it is approaching; the speed the fly approaches that train is either 210 km/h or 180 km/h. So you can calculate what happens during two flights and that will turn into a simple geometric sequence. Which ends after very few iterations with a dead fly.

• The length of the bee doesn't matter. And the bee gets crushed either way. Whether the bee is infintisimally or a mile long the two trains will eventually cover 150 miles - bee length. The principal is the same and it will always be a finite time with a finite flight but never "a few" iterations. It will always be an infinite iteration. May 31 '16 at 4:34
• Not to mention, we should explore what happens when a bee slams a train an infinite number of times at 150 miles per hour. The effect compounds and you'd end up with the amount of energy you'd expect to see in a nuclear explosion.
– Neil
May 31 '16 at 8:34
• @Neil It's not a nuclear explosion, it's much much worse than that. It's an infinite amount of energy and will set off a wavefront of destruction, moving at the speed of light, that destroys the universe. Except that the same amount of energy was presumably already contained in the bee, so it should already have destroyed the universe. May 31 '16 at 11:15
• @MikeScott Well, the problem is being considered in the classical sense, so no quantum or relativistic effects. The speed of the bee is constant, so it's kinetic energy does not change either. If you are still worried, take the bee to be massless. The trains and bee ought to be ideal solids, able to withstand force of order $\delta(0)$ to allow instantaneous change of direction. Likely the trains will safely rebound off of each other elastically.
– user332714
May 31 '16 at 13:13
• @lastresort If the bee is massless then things get more worrying. Because if it has no rest mass then it's travelling at the speed of light, which implies that the speed of light is 150mph, and so the trains travelling at 60 and 90 miles per hour are at 0.4c and 0.6c and should be experiencing significant relativistic effects. May 31 '16 at 13:24

Here we derive some recurrence relations to determine position and times the bee meets one of the trains.

Scenario:

We consider the interval $[0,150]$ on the $x$-axis with train $A$ starting at time $t=0$ at position $x=0$ and train $B$ starting at the same time from $x=150$. Train A moves with $60$ mph towards B whereas train B moves with $90$ mph towards A.

The bee starts at time $t=0$ from $x=0$ towards $B$ with $120$ mph. It meets $B$ the first time at position $B_1$ after time $t_1$. At that time we denote the position of train $A$ with $A_1$. Then it turns around flies back to $A$ and meets $A$ at position $A_2$ after time $t_2$ while the train B is at position $B_2$ at that time. Then the bee turns around again and continues this dangerous game.

We denote the positions of the train A with $A_n$ and the positions of the train B with $B_n$, $n\geq 0$.

Note the bee meets the train $A$ at even positions $A_{2n}$ and it meets the train B at odd positions $B_{2n+1}$. The delta time between $A_{n}$ and $A_{n+1}$ is denoted with $t_{n+1}$ which is the same as the time between $B_{n}$ and $B_{n+1}$. We consider the following sequences

\begin{array}{rlllll} \text{Train A: }&A_0=0,&A_1,&A_2,&\ldots &A_{n},\ldots\\ \text{Train B: }&B_0=150,&B_1,&B_2,&\ldots &B_{n},\ldots\\ \text{Delta times: }&t_0=0,&t_1,&t_2,&\ldots &t_{n},\ldots\\ \text{Bee: }&A_0=0,&B_1,&A_2,&\ldots&B_{2n-1},A_{2n},B_{2n+1},\ldots \end{array}

We show the following is valid for $n\geq 0$

A first plausibility check shows \begin{align*} \lim_{n\rightarrow \infty}A_{2n}=\lim_{n\rightarrow \infty}A_{2n+1} =\lim_{n\rightarrow \infty}B_{2n}=\lim_{n\rightarrow \infty}B_{2n+1}=60 \end{align*} The trains will meet each other after one hour and since the speed of A is $60$ mph and it started from $x=0$ at $t=0$ its position is at $x=60$ after one hour. The same holds for $B$ since B moves with $90$ mph from $x=150$ and $150 - 90 = 60$.

Recurrence relations:

The bee meets the train A at delta time $t_{2n}$ at position $A_{2n}$ and then flies with $120$ mph towards the train B. We can calculate the next meeting point $B_{2n+1}$ with train B as \begin{align*} A_{2n}+120 t_{2n+1}&=B_{2n}-90 t_{2n+1}\\ t_{2n+1}&=\frac{1}{210}\left(B_{2n}-A_{2n}\right)\tag{1} \end{align*} The positions of A and B after delta time $t_{2n+1}$ are \begin{align*} A_{2n+1}=A_{2n}+60t_{2n+1}=\frac{5}{7}A_{2n}+\frac{2}{7}B_{2n}\tag{2}\\ B_{2n+1}=B_{2n}-90t_{2n+1}=\frac{3}{7}A_{2n}+\frac{4}{7}B_{2n}\tag{3} \end{align*} Similarly the bee meets the train B at odd indexed delta times $t_{2n+1}$ at position $B_{2n+1}$ and then flies with $120$ mph towards train A. We describe the next meeting position $A_{2n+2}$ with train A and obtain \begin{align*} B_{2n+1}-120 t_{2n+2}&=A_{2n+1}+60 t_{2n+2}\\ t_{2n+2}&=\frac{1}{180}\left(B_{2n+1}-A_{2n+1}\right) \end{align*} The positions of A and B after delta time $t_{2n+2}$ are \begin{align*} A_{2n+2}=A_{2n+1}+60t_{2n+2}=\frac{2}{3}A_{2n+1}+\frac{1}{3}B_{2n+1}\tag{4}\\ B_{2n+2}=B_{2n+1}-90t_{2n+2}=\frac{1}{2}A_{2n+1}+\frac{1}{2}B_{2n+1}\tag{5} \end{align*}

From these equation we derive recurrence relations for odd and even $A_n$ in terms of $A_{n-1}$ and $A_{n-2}$ and we do the same for $B_n$.

We obtain from (2) - (5) \begin{align*} A_{2n+2}&=\frac{2}{3}A_{2n+1}+\frac{1}{3}B_{2n+1}\\ &=\frac{2}{3}A_{2n+1}+\frac{1}{3}\left(\frac{3}{7}A_{2n}+\frac{4}{7}B_{2n}\right)\\ &=\frac{2}{3}A_{2n+1}+\frac{1}{7}A_{2n}+\frac{4}{21}\left(\frac{7}{2}A_{2n+1}-\frac{5}{2}A_{2n}\right)\\ &=\frac{4}{3}A_{2n+1}-\frac{1}{3}A_{2n} \end{align*} and \begin{align*} A_{2n+1}&=\frac{5}{7}A_{2n}+\frac{2}{7}B_{2n}=\frac{5}{7}A_{2n}+\frac{2}{7}\left(\frac{1}{2}A_{2n-1}+\frac{1}{2}B_{2n-1}\right)\\ &=\frac{5}{7}A_{2n}+\frac{1}{7}A_{2n-1}+\frac{1}{7}\left(3A_{2n}-2A_{2n-1}\right)\\ &=\frac{8}{7}A_{2n}-\frac{1}{7}A_{2n_1} \end{align*}

In the same way we derive for odd and even $n$ a representation of $B_n$ in terms of $B_{n-1}$ and $B_{n-2}$. \begin{align*} B_{2n+1}&=\frac{8}{7}B_{2n}-\frac{1}{7}B_{2n-1}\\ B_{2n+2}&=\frac{4}{3}B_{2n+1}-\frac{1}{3}B_{2n} \end{align*}

With the help of (1) and (2) we can calculate $A_1$ and obtain a fully specified recurrence relation for $A_n$:



Generating function for $A_{n}$:

We derive based upon the recurrence relation for $A_n$ a generating function $A(x)$ with \begin{align*} A(x)=\sum_{n= 0}^\infty A_nx^n \end{align*} Since we have according to (6) and (7) to respect even and odd part separately we do it in two steps and consider the even part $(A(x)+A(-x))/2$ and odd part $(A(x)-A(-x))/2$ of the generating function accordingly. We start from (7) and replace for convenience $n$ with $n-1$. We derive from \begin{align*} A_{2n}&=\frac{4}{3}A_{2n+1}-\frac{1}{3}A_{2n}\qquad\qquad n\geq 1\\ \end{align*} the generating function \begin{align*} \sum_{n= 1}^\infty A_{2n}x^{2n}&=\frac{4}{3}\sum_{n= 1}^\infty A_{2n-1}x^{2n}-\frac{1}{3}\sum_{n= 1}^\infty A_{2n-2}x^{2n}\\ \frac{A(x)+A(-x)}{2}-A_0&=\frac{4}{3}x\sum_{n= 0}^\infty A_{2n+1}x^{2n+1}-\frac{1}{3}x^2\sum_{n= 0}^\infty A_{2n}x^{2n}\\ &=\frac{4}{3}x\cdot\frac{A(x)-A(-x)}{2}-\frac{1}{3}x^2\cdot\frac{A(x)+A(-x)}{2} \end{align*} Noting that $A_0=0$ we obtain after some rearrangement \begin{align*} A(x)(x^2-4x+3)+A(-x)(x^2+4x+3)=0\tag{8} \end{align*} Now the odd part (6). We obtain \begin{align*} \sum_{n=1}^\infty A_{2n+1}x^{2n+1}&=\frac{8}{7}\sum_{n= 1}^\infty A_{2n}x^{2n+1}-\frac{1}{7}\sum_{n= 1}^\infty A_{2n-1}x^{2n+1}\\ \frac{A(x)-A(-x)}{2}-A_1x&=\frac{8}{7}x\cdot\frac{A(x)+A(-x)}{2}-\frac{1}{7}x^2\frac{A(x)-A(-x)}{2} \end{align*} with $A_1=\frac{300}{7}$ we obtain \begin{align*} A(x)(x^2-8x+7)-A(-x)(x^2+8x+7)=600x\tag{9} \end{align*}

Combining (8) and (9) we can eliminate $A(-x)$ and obtain after some simplifications and partial fraction decomposition \begin{align*} A(x)&=\frac{300x(x+3)}{(x-1)(x^2-21)}\\ &=\frac{60}{1-x}+180\frac{2x+7}{x^2-21}\\ &=\frac{60}{1-x}+180\left(\frac{2\sqrt{21}-7}{42\left(1+\frac{x}{\sqrt{21}}\right)} -\frac{2\sqrt{21}+7}{42\left(1-\frac{x}{\sqrt{21}}\right)}\right)\\ &=60\sum_{n= 0}^\infty x^n+\frac{30}{7}(2\sqrt{21}-7)\sum_{n= 0}^\infty \left(-\frac{1}{\sqrt{21}}\right)^nx^n\\ &\qquad\qquad\qquad-\frac{30}{7}(2\sqrt{21}+7)\sum_{n= 0}^\infty \left(\frac{1}{\sqrt{21}}\right)^nx^n\\ &=60\sum_{n= 0}^\infty x^n-\frac{60}{7}\sqrt{21}\sum_{n= 0}^\infty \frac{1-(-1)^n}{\left(\sqrt{21}\right)^n}x^n -30\sum_{n=0}^\infty \frac{1+(-1)^n}{\left(\sqrt{21}\right)^n}x^n\\ &=60\sum_{n= 0}^\infty x^n-\frac{120}{7}\sum_{n\geq 0}\frac{1}{21^n}x^{2n+1} -60\sum_{n=0}^\infty \frac{1}{21^n}x^{2n}\\ &=60\left(\sum_{n= 0}^\infty x^n-\sum_{n= 0}^\infty \frac{2}{3^n7^{n+1}}x^{2n+1} -\sum_{n= 0}^\infty \frac{1}{3^n7^n}x^{2n}\right)\tag{10} \end{align*}

We can now easily deduce the coefficients $A_n$ from (10). \begin{align*} A_{2n}&=60\left(1-\frac{1}{3^n7^n}\right)\\ A_{2n+1}&=60\left(1-\frac{2}{3^n7^{n+1}}\right) \end{align*} and the first part of the claim follows. According to (2) we obtain after some rearrangement \begin{align*} B_{2n}&=\frac{7}{2}A_{2n+1}-\frac{5}{2}A_{2n}\\ &=150-90\left(1-\frac{1}{3^n7^n}\right) \end{align*} and we get using (3) \begin{align*} B_{2n+1}&=\frac{3}{7}A_{2n}+\frac{4}{7}B_{2n}\\ &=\frac{3}{7}A_{2n}+2A_{2n+1}-\frac{10}{7}A_{2n}\\ &=2A_{2n+1}-A_{2n}\\ &=150-90\left(1-\frac{2}{3^n7^{n+1}}\right) \end{align*} which is the second part of the claim. Finally we obtain \begin{align*} t_{2n+1}&=\frac{1}{210}\left(B_{2n}-A_{2n}\right)=\frac{5}{3^n7^{n+1}}\tag{11}\\ t_{2n}&=\frac{1}{180}\left(B_{2n-1}-A_{2n-1}\right)=\frac{5}{3^{n}7^{n}} \end{align*} showing the last part of the claim is valid.

Epilogue: Of course we know the game is over after one hour and the distance travelled by the bee is $120$ miles. But we could also check it based upon the calculations above.

The total time the bee is flying is according to (11) \begin{align*} \sum_{n=0}^\infty\left(t_{2n+1}+t_{2n+2}\right) &=\sum_{n=0}^\infty\left(\frac{5}{3^n7^{n+1}}+\frac{5}{3^{n+1}7^{n+1}}\right)\\ &=\left(\frac{5}{7}+\frac{5}{21}\right)\sum_{n=0}^\infty\frac{1}{3^n7^n}\\ &=\frac{20}{21}\frac{1}{1-\frac{1}{21}}\\ &=\frac{20}{21}\cdot\frac{21}{20}\\ &=1 \end{align*} which is precisely one hour. The distance travelled by the bee is according to the last result \begin{align*} 120t_1+120t_2+120t_3+\cdots=120\sum_{n=0}^\infty\left(t_{2n+1}+t_{2n+2}\right)= 120 \end{align*} miles.

• As always, very good to learn from your work. Jun 17 '16 at 5:07
• @Leucippus: Thanks for your nice comment! :-) Jun 17 '16 at 6:24
• @Hailey: Thanks a lot for granting the bounty! :-) Jun 17 '16 at 7:04