What happens when a photon changes speed between mediums?

Check out these past threads.

We know light exhibit both particle- and wave-like properties, so we can approach this from both ways.

In the wave model, light is a propagation of electromagnetic wave. Maxwell's equations describe this. The speed at which this wave travels depends on the permittivity and permeability of the medium. In free space, this leads to c, the speed of light; in a medium, the phase velocity is smaller than c. The permeability and permittivity describes the effect of other sources of electromagnetic field - i.e., the medium - and their effect on the overall propagation of the wave.

When dealing with the particle model, we should look at what the particle actually described. Basically, it makes sense to talk about a photon in the absence of a medium. Once light enters a medium, you can't really visualize it as just a photon any more. Likewise, you can't say that it changes speed because the concept of the photon cease to exist (at least, not very cleanly) once light begins to interact with other objects.

As mentioned before, in a medium, there are other sources of electromagnetic field. You could view that atoms themselves will absorb an incident photon, and emit their own photons to neighbouring atoms after some time, and so forth as the excitation propagates through the material (much like a race-car travelling at full speed and taking pit stops will lead to an overall velocity slower than its full speed). However, there are many problems with this - for one, for this to occur, the process must be different from proper atomic and molecular absorption emission, which occurs at distinct energy levels. Now you can still talk about absorption into virtual states (as the electromagnetic interaction between atoms involve virtual photons anyways), but this quickly devolves into a complex mess of trying to force a particular model in a situation it's not meant to address: you're trying to fit photons - an excitation of the electromagnetic field in free space - in a medium, which is anything but free space.

So in short, a photon doesn't accelerate. It always travel at c - because it describes the excitation of an electromagnetic field in free space.

The next part reaches the limits of my knowledge, so a physicist can chime in:

If you want to look at an excitation of the combined electromagnetic field in a medium - just like how altering the permittivity and permeability allows for the wave model to address the change in phase velocity - you can look at quasiparticles like plasmons, an excitation of an electron gas. These can couple with photons to form other quasiparticles, which I have little experience in describing, but would be a much more accurate particle model than photons in describing electromagnetic radiation through a medium.

/r/askscience Thread