The Doppler effect is the change in the observed frequency of a source due to the motion of either the source or receiver or both. Only the component of motion along the line connecting the source and receiver contributes to the Doppler effect. Any arbitrary motion can be replaced by motion along the source-receiver axis with velocities consisting of the projections of the velocities along that axis. Therefore, without loss of generality, assume that the source and receiver move along the x-axis and that the receiver is positioned further out along the x-axis. The source emits a continuous tone of frequency, f0, equally in all directions. First examine two important cases. The first case is where the source is stationary and the receiver is moving toward or away from the source. A receiver moving away from the source will have positive velocity. A receiver moving toward the source will have negative velocity. If the receiver moves towards the source, it will encounter wave crests more frequently and the received frequency will increase according to
Frequency will increase because vr is negative. If the receiver is moving away from the source, the vr is positive and the frequency decreases. A similar situation occurs when the source is moving and the receiver is stationary. Then the frequency at the receiver is
The frequency increases when vs is positive as the source moves toward the receiver. When vs is negative, the frequency decreases. Both effects can be combined into
There is a difference in the Doppler formulas for sound versus electromagnetic waves. For sound, the Doppler shift depends on both the source and receiver velocities. For electromagnetic waves, the Doppler shift depends on the difference between the source and receiver velocities.
 Halliday, David, R. Resnick, and J. Walker, Fundamentals of Physics, 10th ed. Wiley, New York, 2013.