system
Given the following post, respond as if you're commenting on Reddit:
human
Do all wavelengths of the electromagnetic spectrum travel at the same speed?

I keep hearing speed of 'light'. This made me wonder if it is visible light that is being referred to or just any type of electromagnetic radiation?
gpt
Many of the answers so far correctly state that the speed of light *through vacuum* does not depend on wavelength.  In materials, however, this is not the case.  In matter, different EM wavelengths will propagate at different speeds, this effect is called dispersion.

The two parameters that govern the speed of light are the electric permittivity (epsilon) and magnetic permeability (mu) of the medium the light is traveling through.  *You can loosely think of these two parameters as describing how much the medium resists changes in the EM field*.  The vacuum permittivity and vacuum permeability are not dependent on wavelength, and so the speed of light *in vacuum* is also not dependent on wavelength, and so all colors of light travel the same speed in vacuum.

**However**, when light travels through a material, the speed of light *does* depend on wavelength (though we should really be thinking in terms of frequency, with the understanding that wavelength and frequency describe loosely the same attribute of the optical wave).  Materials are made up of charged particles which can interact with the optical wave that is traveling through the medium.  Remember, electrically charged particles have their own electric field and will be pushed around by the electric field of the optical wave, this impacts the electric permittivity and magnetic permeability of the material, so the speed of light in a material will be different than the speed of light in vacuum (since there are charges that the EM wave can push around as it travels through the material).  You can think of each electron as being attached to springs - the incoming EM field can then interact with the electrons, pushing them back and forth.  Continuing with this analogy, the speed of the EM wave depends on how 'stiff' the 'springs' are.  In reality, the 'stiffness' is simply the electric permittivity and permeably of the material.  These two parameters depend on the material, as well as the frequency of light - that is, a low frequency wave will drive the electrons back and slowly while a high frequency wave will try to drive the electrons back and forth faster (sometimes so fast the electron's don't follow the EM field very well).

The index of refraction of a material is related to the permittivity and permeability of that particular material.  More commonly, we use the index of refraction to describe how fast light travels in a material.  The phenomenon you describe in your question is called *dispersion*, which is essentially wavelength dependent index of refraction.  All materials have a dispersion curve which shows the index of refraction as a function of wavelength for that particular material.

**Edit**: if you treat each electron as a harmonic oscillator being driven by an external force, you see that the motion of the oscillator depends on the frequency of the driving EM field. Since the electrons are being driven by the incident wave, they themselves create an EM wave. In fact, using this model, the incident wave is absorbed and the wave that propagates through the medium is a result of how the electrons move - which is frequency dependent (it's also dependent on the shape of the potential well the electrons find themselves in due to their neighbors).