When light passes from one substance to another, it is bent or refracted. One way to see refraction is to put an object into a glass of water. Its shape will seem to change because the light rays will bend as they leave the water and enter the air. Early scientists realised that it was a precise effect and tried to devise a mathematical law to show how much bending occurred. The Egyptian geographer Ptolemy probably devised the first law of refraction which worked in some cases but was unreliable. The Arabic scientist Alhazen also investigated refraction but could not predict how far light would bend. The problem was solved by Dutch mathematician and astronomer Willebrord Snell in 1621. In Snell's experiment, a beam of light is bent as it enters and leaves a clear glass block. When the beam hits the block it turns more steeply toward it. When it leaves the block it is bent again in the opposite direction. The amount of bending is precise. If the beam enters the block head on it will not be bent at all. If it enters or leaves the block at any other angle, it will be bent and the bending increases as the beam gets further from the head on position. Snell found that there was a characteristic ratio between the beams angle of incidence - the angle before bending and its angle of refraction - its angle after bending. Snell's Law shows that every substance has a characteristic bending power, its refractive index. The more a substance bends light, the larger its refractive index.
Light can sometimes be bent without passing through a substance. In air, this happens when light travels through layers that are at different temperatures. Cold air is denser and heavier than warm air so it acts like a different substance.