There is also a Doppler effect for light, that is partly responsible for the red shifts (and corresponding blue shifts) that astronomers observe in distant objects moving away from us (and moving toward us). The Doppler effect for sound varies when it is the source, observer, or both are moving, apparently violating the principle of relativity, which states that the only thing that should count is the relative motion between the source and the observer. However, because sound waves only occur in a material medium like air or water, this material medium serves as a frame of reference against which the absolute motion of the source and observer can be measured. For light however, once theories of a luminiferous ether were discarded, no such medium could be involved and so the Doppler effect for light must be very different from that for sound.

The equations governing the Doppler effect for light may be easily derived by special relativity. We can think of a light source with frequency f as a clock that ticks f times every second and emits a wave of light every time it ticks. There are three cases we need to consider: (1) when the observer is moving perpendicular to the light source, (2) when the observer is receding from the light source, and (3) when the observer is approaching the light source.

1. For the perpendicular case, the proper time is t0 = 1/f between one tick and the next. However, time dilation causes, from the point of view of the observer, the time between ticks to increase, and hence causes the frequency to decrease to: f' = f*sqrt(1- v2/c2), where v is the velocity of the observer, and c is the speed of light.

2. For the receeding case, the observer moves a distance vt away from the source between ticks, meaning that a light wave takes vt/c more time to reach the observer than the previous wave did. Hence, the actual time between the arrival of successive waves becomes:

T = t + vt/c = t0(1 + v/c)/sqrt(1 - v2/c2) = t0*sqrt((1+v/c)/(1-v/c))

and the frequency the observer sees thus becomes:

f' = 1/T = f*sqrt((1 - v/c)/(1 + v/c))

The observed frequency f' is thus smaller than the original frequency f, producing a red shift.

3. When the observer is approaching the source, each light wave takes vt/c less time than the previous wave, so following a similar derivation as for the receding case, we have the following formula:

f' = f*sqrt((1 + v/c)/(1 - v/c))

This results in a higher frequency than that emitted, or a blue shift.

Note that, unlike the Doppler effect for sound, it makes no difference in any case as to whether it is the observer that is moving and the light source is stationary or the light source moving and the observer stationary. All that matters is the relative motion between source and observer. Verification of this fact is left as an exercise for the reader.

This phenomenon occurs for all forms of electromagnetic radiation, including radar and radio waves, and is used in Doppler radar sets such as those used by the police to catch speeders, and Doppler shifts in radio waves transmitted from a constellation of satellites forms the basis for some satellite navigation systems like the old Transit marine navigation system. As previously mentioned, it is also partially responsible for the red/blue shifts observed in astronomy, but at cosmological distances, more accurate formulae based on general relativity should really be used (thanks to tdent for pointing this last one out). See here for the proper derivation of the cosmological redshift.