This problem initially had two parts but now has three.

OK, let's start with this: let's assume that we have two, trains, 100 miles apart, each going with 20 mph to the other. A fly travels between them at 50 mph, zig-zagging just before getting smashed between the trains. Question: How far does the fly fly before meeting his ultimate demise?

Got the answer? Good. Now, let's modify the original problem a little: let's also assume that the wind blows with 10 mph from east, and the trains are going on a straight railway, oriented east-west. Relative to the ground, what is the total distance traveled by the fly this time?

Now the third part. Let's assume that the fly starts from a point between the two trains (let's say "x miles from the west train"). What would be the value of "x" if the total distance is the same no matter what is the initial direction of the fly?

[update: on the second part, let's assume that the fly starts from the train from the west. Also - each train has 20 mph ground speed. Finally, another update: I added a third part.]

Tags

1. Eric says:

1) It took 2.5 hours for the trains to collide, so the fly flyng at 50 mph travelled 125 miles.

2) Can’t say. You didn’t tell me where the fly began his flight from, and you didn’t say for sure that he again met his demise being smashed between the trains.

If we assume that he began flying from the point where he was to later be smashed between the trains, he travelled no distance. On the other hand, if he is a smart fly and started flying downwind (to the West) at 50 mph airspeed, his groundspeed in the 10 mph tailwind would be 60 mph. Since he wasn’t killed in the train wreck, he may still be flying today, and may be an exceptional fly that manages to live forever.

Bottom line for #2: Somewhere between 0 and infinity π

Part #2 is just the same as Part #1 with the addition of the wind.

Also, good correction about the starting point. Let’s assume that the fly starts from the train at west.

3. The fly’s initial position and direction should be irrelevant even with the wind.

4. Neil Cowburn says:

1) Since each travels at the speed with opposing velocity, they collide at the 50-mile marker. Each train takes 2.5 hours to travel the 50 miles to the collision point. A fly zig-zagging at 50mph would travel a total of 125 miles to reach the same collision point.

2) Assuming the easterly wind has no effect on the speed of the trains, they still take 2.5 hours to collide. With the fly starting at the western side of the course and flying into a 10mph easterly, it’s groundspeed will be 40mph. So, in 2.5 hours, the fly travels 100 miles.

5. Eric says:

OK, then as long as the fly really does meet his demise at the train crash, he travelled from his point of origin (the western train) to the point of train/train impact, which is a distance of 50 miles. The windspeed doesn’t matter since you have fixed the two endpoints.

This also assumes that you mean "total distance traveled" in the same way that we hang glider/sailplane pilots use that phrase: the great circle distance between the launch/release (origin) and landing (destination) points. In flight, we may zig-zag quite a bit in search of the next thermal, and drift in a variety of directions as we climb in a rowdy thermal, or go back and forth many times trying to stay aloft in weak ridge lift while we wait and pray for another thermal… but we don’t get credit for those "distances travelled"!

6. anonymous coward says:

You didn’t (precisely) specify that each train was traveling 10mph in opposite directions. You could have one stationary train and one approaching it at 20mph, in which case these problems are answered differently. Alternatively, you could have made the fly’s speed relative to the trains. As it is, they’re unanswerable.

I’m voting for #2’s answer being 100 miles, with the westbound train going 40mph upwind, and the fly starting on that train and therefore flying effectively still relative to the train. 100 miles later, squish.

To answer the earlier person: it does matter where the fly starts from – picture a funnel (that’s what the fly’s path looks like to me) – the top line, which is longest, is either going into the wind, or going against it, in which case more or less ground, respectively, will be covered.

7. anonymous coward says:

Sorry, meant 50 miles in that illustration… it’s late… but you get the point. π

OK – I added more precision to the text: the trains are going with 20 mph ground speed, which means that they are approachig each other with 40 mph relative speed.

Also: a hint. The fly has 50 mph constant speed relative to the air, not to the ground…

9. d = 110 miles

fly_e_to_w = 50 + 10 = 60

fly_w_to_e = 50 – 10 = 40

train_e_to_w = train_w_to_e = 20

d = fly_w_to_e * t0 + fly_e_to_w * t1 + fly_w_to_e * t2 + …

= fly_w_to_e * (t0 + t2 + t4 + …)

+ fly_e_to_w * (t1 + t3 + t5 + …)

where

t0 = 100 / (fly_w_to_e + train_e_to_w)

= 5/3

t1 = (fly_w_to_e – train_w_to_e) * t0 / (fly_e_to_w + train_w_to_e)

= 20 * t0 / 80

= 1/4 * t0

t2 = (fly_e_to_w – train_e_to_w) * t1 / (fly_w_to_e + train_w_to_e)

= 40 * t1 / 60

= 2/3 * t1

t3 = 1/4 * t2

t4 = 2/3 * t3

And…

t0 + t2 + t4 + …

= t0 + 2/3 * t1 + 2/3 * t3 + …

= t0 + 2/3 * 1/4 * t0 + ((2/3 * 1/4)^2) * t0+ ….

= t0 + 1/6 t0 + (1/6)^2 t0 + …

= t0 * ( 1 + 1/6 + (1/6)^2 + …)

= 1.2 t0

Also…

t1 + t3 + t5 + …

= 1/4 t0 + 1/4 * t2 + 1/4 * t4

= 1/4 * t0 * ( 1 + 1/6 + (1/6)^2 + … )

= 0.3 t0

Therefore

d = fly_w_to_e * (t0 + t2 + t4 + …)

+ fly_e_to_w * (t1 + t3 + t5 + …)

= 40 * 1.2 * t0

+ 60 * .3 * t0

= 110

10. Eric (the other Eric) says:

Damn…I thought I could use pen and paper for the second part! I cheated.

>> d = 110 miles […]

Excellent. The solution is actually correct but why did you used infinite series? There is a simpler way to find it π

12. Luc Geurts says:

Zigzagging is different from flying in a straight line. At what angles goes the zig and the zag?

Probably I’m just thinking to much.

13. The reason I said to consider the fly’s initial position/direction to be irrelevant is because it leads to an easier solution.

Assume the fly started right in the middle, facing either direction. It will fly a distance p, hit a train, and fly a distance p back to the middle.

One leg takes p/40 time and the other takes p/60 time. So the average speed of the fly for these trips is 2p / (p/40 + p/60) = 48 mph.

In other words, we now have exactly the same situation as the easy case but with a different speed for the fly.

Now, assume the fly starts anywhere in either direction. Figure out how long it takes the fly to get to the middle. Solve the easy problem with the new initial conditions and add the fly’s trip to the middle.

Starting from the west train, the fly will go 50 miles to the middle at 40 mph. So 1.25 hours gone and 1.25 hours left for the train trip.

Easy problem with 1.25 hours of time and 48 mph fly: 60 miles.

Fly’s trip to the middle: 50 miles.

Total trip: 110 miles.

>> Total trip: 110 miles.

Well – actually, you will have that distance only if the fly starts from the west train. If he starts from the middle you will get a different number.

I also added a third part to this problem, which is probably the most interesting result.

By the way, third part is the hardest one. You can use paper and pencil if you feel so π

16. What do you mean "the value of x"? x is clearly not unique.

>> By the way, third part is the hardest one. You can use paper and pencil if you feel so π

Please ignore this comment – I just found out a simple solution for the third part…

>>> What do you mean "the value of x"? x is clearly not unique.

OK – that’s part of the solution :-). So what are the possible values of x?

18. Ok, understood.

It should be true for every value of x.

Use the same technique as before: total travel is computed by reaching the middle and then solving the simpler ivp.

Suppose the fly is facing away from the nearest train. It will travel at M mph to the middle (A miles) then average 48 mph for the remaining trip (B miles).

Suppose the fly is facing towards the nearest train. It will travel to the train (C miles), travel back to its starting point (another C miles), travel at M mph to the middle (A miles), then average 48 mph for the remaining trip (D miles).

But one of those trips of C miles is at 40 mph and the other is at 60 mph so that’s just more travel at average of 48 mph.

So in both cases you travel at M mph for A miles then average 48 mph for the remaining trip. It doesn’t matter what M and A are.

> It should be true for every value of x. […]

That’s a very interesting proof, I haven’t thought of that. Yes, the result is correct – you get the same total distance if you start from a given "x", no matter what the direction is.

I approached the problem differently. If you calculate the total space, you get A miles when you start from the west train, and B miles when you start from the east train. (actually A = 110 miles and B = 130 miles, but it doesn’t matter what these values are).

Now, when you start at a point 0 <= X <= 100 between the trains, you get F(X) total miles if the fly starts going to the east, and G(X) if the fly start going to the west.

Next step – we can easily see that both F(X) and G(X) are linear functions in respect to X. This follows immediately if you take the traveled distance up to the first collision. For example F(X) = 3/4 * x + G(100) * (100 – 2 * 1/4 * x), etc.

The other thing is that F(0) = G(0) = A, and F(100) = G(100) = B. This is easy to see. For example if X = 0 and the fly goes west, it will then immediately switch to east since it collides with the west train.

Therefore F(X) = G(X) for every X.

20. The way I thought of the functions caused them to not be linear so that’s a new perspective for me.

I drew my coordinate system from -50 (west train) to 0 (middle) to +50 (east train).

Then, D(X)=|X|+48(2.5-|X|/(50+10X/|X|)) is the basic formula.

There is something wrong with your formula. The actual distance traveled (with respect to the initial position 0 <= X <= 100) is:

D(X) = 110 + 0.2 * X

Or, if you take -50 <= Y <= 50, then:

D(Y) = 120 + 0.2 * Y

22. I assure you the two formulas are entirely the same! π

D(X)=|X|+48(2.5-|X|/(50+10X/|X|))

D(X)=|X|+120-48|X|/(50+10X/|X|)

D(X)=120+(|X|(50+10X/|X|)-48|X|)/(50+10X/|X|)

D(X)=120+(50|X|+10X-48|X|)/(50+10X/|X|)

D(X)=120+(2|X|+10X)/(50+10X/|X|)

D(X)=120+0.2(2|X|+10X)/(10+2X/|X|)

D(X)=120+0.2(2|X|+10X)/(10+2|X|/X)

D(X)=120+0.2(2|X|+10X)/((1/X)(10X+2|X|))

D(X)=120+0.2(1/(1/X))(2|X|+10X)/(10X+2|X|)

D(X)=120+0.21/(1/X)

D(X)=120+0.2X

23. Steve says:

In you head? Maybe the first part…

OK, here is the solution:

Part 1. Already solved above. The trains have 40 mph relative speed. Since the fly flies with 50 mph, the total traveled distance will be 50/40 * 100 = 125 miles.

Part 2. This is also solved above by Eric (the otherEric) but with infinite series. The solution without infinite series is very similar, but with a twist.

The proof is actually pretty simple but here I am as verbose as possible – I don’t want to present a sketchy proof.

The fly will start going east. Since the wind has opposite direction, its speed will be (50-10) = 40 mph. Now, due to the fact that this is twice the speeed of the opposite train, it will travel twice as much until to the first "collision" which means 2/3 from the total distance (i.e. 2/3 * 100 miles), while the train traveling only 1/3 * 100 miles.

So at this moment the distance between trains is 100 – 2/3 * 100 = 1/3 * 100. Now the fly goes back with 60 mph ( = 50 + 10 mph). Since it goes three times as fast as the opposing train, it will travel three times more until the second "collision". This means 3/4 * 1/3 * 100 miles, while the opposite train 1/4 * 1/3 * 100 miles. Also, both trains will travel the same distance, so now the distance between them is 1/6 * 100 miles.

At this point, let’s step back a little and see the facts.

1) Now we are in the same configuration as in the beginning, just that the distance between trains is six times smaller.

3) The distance traveled by the fly is (2/3 + 3/4 * 1/3) * 100 = 11/12 * 100 miles.

So, the trains traveled until now (1 – 1/6) = 5/6 from their total distance until the collision. The fly did the same, so the total distance will be 6/5 * 11/12 * 100 miles = 110 miles. Done!

As an exercise, you can do the same calculations for the case when the fly starts from east. You will get 130 miles instead.

Part 3: already solved above in two different ways.