The Doppler effect does affect light, but it is important to note that the behavior of light is fundamentally different from that of sound. The Doppler effect describes the change in frequency or wavelength of a wave as perceived by an observer when there is relative motion between the source of the wave and the observer.
In the case of sound waves, they are mechanical waves that require a medium (such as air, water, or solid materials) to propagate. Sound waves are composed of oscillating particles in the medium, and their motion causes the compression and rarefaction of the medium, leading to the perception of sound.
On the other hand, light is an electromagnetic wave and does not require a medium to propagate. It can travel through a vacuum, unlike sound waves. Light is composed of oscillating electric and magnetic fields, and its behavior is described by Maxwell's equations in classical physics or by quantum electrodynamics in the quantum realm.
The Doppler effect for light occurs due to the relative motion between the source of light (such as a star or a moving object) and the observer. This motion causes a shift in the observed frequency or wavelength of the light. This effect is commonly observed as redshift or blueshift in astronomy, where the light from distant objects appears shifted towards longer (red) or shorter (blue) wavelengths, respectively, due to the expansion or contraction of the universe.
In summary, while the Doppler effect does affect both sound and light, the underlying nature of these phenomena is different. Sound is a mechanical wave that requires a medium, while light is an electromagnetic wave that can propagate through a vacuum.