Sub topic 10
The Doppler Formula and Its Sign Conventions
Prerequisites and scope
This chapter assumes you know the qualitative Doppler picture from the previous chapter: a source moving toward you compresses the wavefronts and raises the pitch, and a source moving away stretches them and lowers it. It also assumes you can use v = f λ, handle basic algebra, and think about relative motion in one dimension. Here you derive the quantitative formula, fix its sign conventions, and learn the errors that most often go wrong when people use it.
The setup
Work in the frame of the still air (the medium). All speeds are measured relative to the air along the line joining the source and the observer.
- v is the speed of sound in the medium, about 343 m/s in air at 20 °C.
- f is the frequency the source emits.
- f′ is the frequency the observer hears.
- v_s is the speed of the source relative to the air.
- v_o is the speed of the observer relative to the air.
The key fact is that the speed of sound is set by the medium, not by the motion of the source or the observer. Once a wave leaves the source, it moves at v through the air no matter how fast the source was moving when it emitted it. This one fact explains why the source and observer cases come out differently.
Case 1: moving source, stationary observer
Let the source emit a wave crest every period T = 1/f. In one period, the crest just emitted travels a distance vT. If the source is moving toward the observer at speed vs, it also travels a distance vs T in that time. The next crest is therefore emitted from a point closer to the observer by v_s T. The spacing between the two crests, which is the new wavelength, is
λ′ = vT − vs T = (v − vs) / f
The observer is stationary, so the crests pass at speed v. The observed frequency is
f′ = v / λ′ = f · v / (v − v_s)
The source's motion changes the wavelength in the air. If the source moves away, the spacing grows to (v + vs)T and the formula becomes f · v / (v + vs).
Case 2: moving observer, stationary source
Now the source is fixed, so the wavelength in the air stays at λ = v/f. The observer moves toward the source at speed vo. Relative to the observer, the crests approach at speed v + vo. The observed frequency is the rate at which crests pass:
f′ = (v + vo) / λ = f · (v + vo) / v
The observer's motion changes the rate at which crests are met. It does not change the wavelength in the air. If the observer moves away, the relative speed is v − vo, and the formula becomes f · (v − vo) / v.
The general formula
Combining the two cases gives one expression for a moving source and a moving observer, both moving along the line between them:
f′ = f · (v + vo) / (v − vs)
Here the sign conventions are:
- vo > 0 when the observer moves toward the source, and vo < 0 when the observer moves away.
- vs > 0 when the source moves toward the observer, and vs < 0 when the source moves away.
This matches the code convention in the example below, where both speeds are positive for approach.
A common memory aid: the numerator concerns the observer, and the denominator concerns the source. Whichever motion brings the two closer should push the frequency up. A positive vo makes the numerator larger. A positive vs makes the denominator smaller. Both raise f′.
Computing it
The function below implements the formula, with the sign conventions in the docstring. It also includes a helper for the temperature dependence of the speed of sound.
def speed_of_sound_air(temp_c):
"""Approximate speed of sound in dry air, in m/s (good near everyday temperatures)."""
return 331.3 + 0.606 * temp_c
def doppler(f_source, v_sound=343.0, v_observer=0.0, v_source=0.0):
"""Observed frequency in still air.
v_observer > 0: observer moves toward the source.
v_source > 0: source moves toward the observer.
"""
return f_source * (v_sound + v_observer) / (v_sound - v_source)
print(doppler(440, v_source=30)) # about 482.2 Hz, source approaching
print(doppler(440, v_source=-30)) # about 404.6 Hz, source receding
print(doppler(440, v_observer=30)) # about 478.5 Hz, observer approachingThe source and observer cases give different answers for the same speed. A 30 m/s source gives 482.2 Hz, while a 30 m/s observer gives 478.5 Hz. The difference is small at low speed and grows as the speed approaches the speed of sound.
Why the two cases differ
The asymmetry exists because the air is a special frame. A moving source changes the wavelength the air carries. A moving observer leaves the wavelength alone and only changes how fast crests are met.
Light has no medium, so its Doppler effect depends only on the relative speed. For sound, you must always ask who is moving relative to the air. If the air itself moves, for example in a wind, add the wind velocity to the speeds (see the wind section below).
For small speeds, the two formulas agree to first order. Expanding f · v/(v − vs) gives approximately f(1 + vs/v), and f(v + vo)/v is exactly f(1 + vo/v). So when vs and vo are both much smaller than v, the shift is approximately
Δf / f ≈ (vo + vs) / v
Only the sum of the speeds matters in this approximation. The difference between the exact results appears at second order.
Worked example: a passing siren
An ambulance siren emits 700 Hz. The ambulance travels at 25 m/s past a stationary listener, and the air temperature is 20 °C, so v = 343 m/s.
Approaching:
f′ = 700 · 343 / (343 − 25) = 700 · 343 / 318 ≈ 755 Hz
Receding:
f′ = 700 · 343 / (343 + 25) = 700 · 343 / 368 ≈ 652 Hz
The listener hears the pitch drop from about 755 Hz to about 652 Hz as the ambulance passes, a change of about 103 Hz. That is roughly a whole tone and a half in musical terms, which is why the effect is easy to notice.
Worked example: both moving
A train horn emits 500 Hz. The train moves at 20 m/s toward a car that moves at 15 m/s toward the train. Use v = 343 m/s.
Both approach, so vs = +20 and vo = +15:
f′ = 500 · (343 + 15) / (343 − 20) = 500 · 358 / 323 ≈ 554 Hz
If the car instead drives away from the train at 15 m/s, then v_o = −15:
f′ = 500 · (343 − 15) / (343 − 20) = 500 · 328 / 323 ≈ 508 Hz
The train still approaches, so the shift is still upward, but the car's retreat cancels most of it.
Using the correct speed of sound
The formula depends on v, and v depends on temperature. The function speed_of_sound_air gives 343.4 m/s at 20 °C and about 331.3 m/s at 0 °C. For precise work, calculate v from the actual temperature and do not use 343 m/s by default. A 20 °C difference changes v by about 12 m/s, which is a 3.5% change. That shifts the Doppler result by an amount you can see when measuring accurately.
Sources of error
The most common errors fall into a few groups.
| Error | Effect | Fix |
|---|---|---|
| Swapping the signs of v_s and v_o | Pitch moves the wrong way | Check that approach raises f′ |
| Putting v_o in the denominator or v_s in the numerator | Wrong magnitude, right direction | Remember: observer on top, source on bottom |
| Using v_s ≥ v | Division by zero or a negative frequency | Subsonic only; see the Mach cone chapter |
| Using the observer's speed relative to the source instead of the air | Wrong answer when both move | Measure both speeds relative to the air |
| Assuming a fixed 343 m/s at all temperatures | Small systematic error | Compute v from temperature |
The formula also assumes motion along the line joining the source and observer. If the motion is at an angle, use only the component of velocity along that line, v cos θ. This applies to the real case of a vehicle passing a roadside listener. The pitch does not jump suddenly from high to low. It glides, because the line-of-sight component changes smoothly from nearly full speed toward the listener to nearly full speed away. At the moment of closest approach the component is zero and the listener hears the true frequency f.
Effect of wind
If the air moves with velocity w along the line from source to observer, the medium itself carries the sound. Measure all velocities relative to the air: replace vs with vs − w and vo with vo − w, taking positive as the direction of travel from source to observer. A source and observer at rest in a steady wind then hear no shift at all, because both are stationary relative to the air in the sense that matters for the relative setup. The wavelength-spacing argument still holds in the air's frame, and the sound simply moves at v + w relative to the ground. For most everyday problems you can ignore wind, but a problem that states a wind speed needs this correction.
A diagram of the relationships
Check your understanding
Exercise
A 1000 Hz source is stationary. An observer walks toward it at 2.0 m/s in air where v = 343 m/s. What frequency does the observer hear? Then repeat the calculation for the same speed with the observer stationary and the source moving toward the observer.
Show answer
Moving observer: f′ = 1000 · (343 + 2.0) / 343 ≈ 1005.8 Hz. Moving source: f′ = 1000 · 343 / (343 − 2.0) ≈ 1005.9 Hz. The results differ by about 0.1 Hz because the source and observer cases are different at second order, but at low speeds they agree closely.
Exercise
A car horn emits 400 Hz. The car moves away from a stationary listener at 20 m/s, with v = 343 m/s. Which sign should v_s have, and what frequency does the listener hear?
Show answer
The source moves away from the observer, so v_s = −20 m/s. Then f′ = 400 · 343 / (343 − (−20)) = 400 · 343 / 363 ≈ 378 Hz. The result is lower than 400 Hz, as expected for separation.
Exercise
Why does the Doppler formula for sound treat a moving source and a moving observer differently, while the two cases agree at first order for small speeds?
Show answer
Sound travels through a medium at a speed v fixed by that medium. A moving source changes the wavelength in the air, so the observed frequency is v divided by the new wavelength. A moving observer leaves the wavelength unchanged and only changes the rate at which crests are encountered. Expanding both formulas for speeds much smaller than v gives the same first-order shift, Δf/f ≈ v_rel/v, and they differ only at second order.