When light passes from one transparent medium into another it changes speed, and as a result it bends. This bending of light at the boundary of two media is called refraction. Light bends because its speed is different in different media. Going from a rarer medium (such as air) into a denser one (such as glass or water), light slows down and bends towards the normal; going from denser to rarer it speeds up and bends away from the normal. A ray striking the surface along the normal (at $0^\circ$) passes straight through without bending.
Refraction obeys two laws. The incident ray, the refracted ray and the normal at the point of incidence all lie in the same plane. The second law is Snell's law: for a given pair of media, the ratio of the sine of the angle of incidence to the sine of the angle of refraction is constant, $\frac{\sin i}{\sin r} = n$, where $n$ is the refractive index of the second medium with respect to the first. The refractive index can also be written in terms of speeds:
- $n = \frac{c}{v}$, where $c$ is the speed of light in vacuum (about $3 \times 10^8\,\text{m/s}$) and $v$ is the speed of light in the medium.
A lens is a piece of transparent material bounded by two curved surfaces. A convex (converging) lens is thicker in the middle and brings parallel rays to a real focus; a concave (diverging) lens is thinner in the middle and spreads parallel rays so they appear to come from a focus. Each lens has two foci, one on each side, and an optical centre O through which a ray passes undeviated.
The ray rules for lenses are straightforward. A ray parallel to the principal axis passes through the focus (convex) or appears to diverge from the focus (concave) after refraction; a ray through the optical centre goes straight on. Distances follow the same New Cartesian convention as for mirrors. The lens formula is $\frac{1}{v} - \frac{1}{u} = \frac{1}{f}$ — note the minus sign, unlike the mirror formula. Magnification for a lens is $m = \frac{h'}{h} = \frac{v}{u}$. A convex lens has a positive focal length and a concave lens a negative one. The power of a lens measures how strongly it converges or diverges light: $P = \frac{1}{f}$, where $f$ is in metres and the unit of power is the dioptre (D). A convex lens has positive power and a concave lens has negative power.