# Speed of light in different mediums with different frequencies

As I know the speed of the light doesn't change while it travels through a vacuum. But while it travels through a prism, it shows different deviation angles to different frequencies.

So according to the $$n = \frac {sin (A+D)/2}{sin (A/2)}$$ formula $$n$$ is different with the frequency of the light, when $$n$$ is different the velocity should be different through the medium.

Why does the velocity change with the frequency of the light while it travels through a medium but not in vacuum?