# EM wavelength in different medium

Considering a light wave traveling from the vacuum to air, I am trying to find what will happen to its wavelength.

At first, using optics, we know that:

$$n=\frac{c}{v}$$

where $$n$$ represents the refractive index. As $$n_{vac}=1$$:

$$n_{air}= \frac{\lambda_{vac}}{\lambda_{air}} \iff \lambda_{air} = \frac{\lambda_{vac}}{n_{air}}$$

So the wavelength will decrease in air.

But when using Compton Scattering:

The wave will lose energy after colliding with an air particle and its wavelength will increase.

Why is there a difference? Which is right?

Optical refraction is a relatively low-energy (non-ionizing) effect which does not exchange energy with the medium. The atoms have electromagnetic fields which interact with that of the photon, increasing the electrical permittivity $$\epsilon$$ of the medium over that of free space, $$\epsilon_0$$ (I am not sure if the same happens for magnetic permeability $$\mu$$, I don't see why not). According to Maxwell's equations for electromagnetism, this reduces the speed of propagation. It is this speed change at different points along the wave front which is responsible for the shortened wavelength and for refraction.
But Compton scattering is different. The photon energy is much higher and it physically collides with an individual atom, imparting energy to it and causing it to recoil, typically knocking an electron away and ionizing it. The photon loses that energy so, according to $$\lambda=hc/e$$, its wavelength must increase.