Refraction is the bending of light when it passes from one medium into another. This occurs because light travels at different speeds in different media. The change in speed causes the light ray to change direction.
The amount of bending depends on the angle at which the light enters the new medium and the refractive index of the two media involved. The refractive index is a measure of how much the speed of light is reduced inside the medium.
For example, when light passes from air (a less dense medium) into water (a denser medium), the light slows down and bends towards the normal (the perpendicular line to the surface). Conversely, when light moves from water to air, it speeds up and bends away from the normal.
This phenomenon is described by Snell's Law, which mathematically relates the angles of incidence and refraction to the refractive indices of the two media.
Refraction is responsible for many optical phenomena, such as the formation of rainbows, the apparent bending of objects underwater, and the focusing of light in lenses.