Solution:
There are 12 steps in an octave, and going up one octave
doubles the frequency. All steps are the same ratio from one
another. This makes the ratio between each step be the twelfth
root of 2, or about 1.059. (You use the twelfth root of 2 so
that when you go 12 steps the frequency will have been
multiplied by 2.) A minor third is 3 steps. To go up 3 steps
(or \(1 \over 4\) of an octave) you apply the ratio three times, to get
about 1.19. (This is also the fourth root of two because it’s
\(1 \over 4\) of an octave.) So the ratio of the sound frequencies
before and after the train passed is about 1.19, which is all
you need. You don’t need the actual frequencies.
The equation for the Doppler effect for sound is:
$$Fl = Fs {1 + {Vl \over c}\over 1 - {Vs \over c}}$$
where \(Fl\) is the frequency that the
listener hears, \(Fs\) is the one the
sender sends, \(Vl\) is the velocity of
the listener relative to the air (towards the sender), \(Vs\) is the same for the sender (towards
the listener), and \(c\) is the speed of
sound (330 meters per second).
We assume that the trains are going the same speed, so
replace \(Vl\) and \(Vs\) with \(V\),
the speed of the trains. This value is positive when the
trains are going towards one another and negative when they’re
separating. We also assume that the air isn’t moving (no
significant wind).
We have two instances of the above equation: one for before
the train passes and one for after. \(Fs\) is the same in both, and we don’t
know it, but it doesn’t matter because it cancels out with
itself. The two \(Fl\)’s are different
by the ratio above (1.19), their actual values don’t matter.
\(V\) is positive in the first equation
(trains going towards one another) and negative in the second
(same magnitude).
$$Fs {1 + {V \over c} \over 1 - {V \over c}} =
1.19 Fs {1 - {V \over c} \over 1 + {V \over c}}$$
Solving for \(V\) gives you a
quadratic equation (\(A V^2 + B V + C = 0\)), which you can solve using the quadratic
formula:
$$V = {-B \pm \sqrt{{B^2} - 4 A C} \over 2 A}$$
The plus/minus (\(\pm\)) means that you get two values for
\(V\). If you choose minus you get about
32 MPH. If you choose plus you get 17,053 MPH.
The formula for Doppler for light is simpler because you
only need the relative velocities of the objects, not their
velocities compared to a fixed medium. The results are close
enough for speeds that are small compared to the speed of sound
or light. If the trains had been going faster (like the TGV in
France, about 200 MPH), it would have made a larger
difference.
One thing I find unsettling is this plus/minus thing at the
end. I was on the train yesterday morning when this happened,
so I know that I wasn’t going 17,053 MPH, but what if this
number wasn’t something that I could easily guess the answer
of, something more abstract? I might have no idea whether 32
or 17,053 is correct. Weird.
(Note added October 7, 2016: Junjiajia Long points out that
17,053 MPH is faster than the speed of sound, meaning that this speed
difference would make the Doppler-shifted frequency negative and
the train would leave behind a shock wave.)