Sub topic 6
Snell's law: n1 sin θ1 = n2 sin θ2
What this chapter assumes
You should already know how to measure angles from the surface normal. You should also know the law of reflection, the definition of refractive index (n = c / v), and why light bends when its speed changes at a boundary. You need basic trigonometry: sine and inverse sine, and how to use a calculator or Python in degrees and radians.
This chapter turns the qualitative idea of bending into one equation. You will use it to compute refraction angles, handle the edge cases, and avoid the usual mistakes.
The law
When a ray crosses a flat boundary from a medium with index n1 into a medium with index n2, the angles measured from the normal satisfy:
n1 sin θ1 = n2 sin θ2
- θ1 is the angle of incidence, in the first medium.
- θ2 is the angle of refraction, in the second medium.
- Both angles are measured from the normal, never from the surface.
- The incident ray, the refracted ray, and the normal all lie in one plane, called the plane of incidence.
Solving for the unknown angle gives:
sin θ2 = (n1 / n2) sin θ1
Three consequences follow directly from this form.
- If n2 > n1, then sin θ2 < sin θ1, so the ray bends toward the normal. This happens when light enters a slower medium, such as air into glass.
- If n2 < n1, then sin θ2 > sin θ1, so the ray bends away from the normal. This happens when light enters a faster medium, such as glass into air.
- If θ1 = 0°, then sin θ2 = 0 and the ray goes straight through, whatever the indices are.
Where the law comes from
Snell's law follows from the speed change. A wavefront crossing the boundary at an angle has one end slow down before the other. The front pivots, and the ray, which is perpendicular to the wavefront, changes direction.
Because the frequency of the light stays the same across the boundary, the wavelength in the medium is λ = λ0 / n, where λ0 is the vacuum wavelength. The wavefronts must match up along the boundary. That matching condition gives:
(sin θ1) / v1 = (sin θ2) / v2
Substituting v = c / n produces n1 sin θ1 = n2 sin θ2. The law is therefore a statement that the wave's pattern along the boundary is continuous. It is not a separate rule about "bending".
A worked example
A ray in air (n1 = 1.00) strikes glass (n2 = 1.50) at θ1 = 30°.
- Compute sin 30° = 0.5.
- Multiply by the index ratio: sin θ2 = (1.00 / 1.50) × 0.5 = 0.3333.
- Take the inverse sine: θ2 = arcsin(0.3333) ≈ 19.47°.
The ray bends toward the normal, from 30° to about 19.47°. The function below does the same calculation. It returns None when the argument of the inverse sine would exceed 1, which is the case with no refracted ray (covered later in this chapter).
import math
def refraction_angle(n1, n2, theta1_deg):
"""Return the refraction angle in degrees, or None if total internal reflection occurs."""
s = n1 * math.sin(math.radians(theta1_deg)) / n2
if s > 1:
return None
return math.degrees(math.asin(s))
print(refraction_angle(1.0, 1.5, 30))The output is about 19.47.
Reversibility
Light paths are reversible. If a ray goes from air into glass at 30° and refracts to 19.47°, then a ray sent back along the refracted path leaves the glass at 19.47° and emerges into air at 30°. The equation shows this directly, because swapping the labels 1 and 2 leaves it unchanged.
You can use this to check your work. Compute θ2 from θ1, then feed θ2 back in with the indices swapped. You should recover θ1.
import math
def refraction_angle(n1, n2, theta1_deg):
s = n1 * math.sin(math.radians(theta1_deg)) / n2
if s > 1:
return None
return math.degrees(math.asin(s))
forward = refraction_angle(1.0, 1.5, 30)
back = refraction_angle(1.5, 1.0, forward)
print(round(forward, 2), round(back, 2))This prints 19.47 30.0.
Typical refractive indices
These values are for visible light near 589 nm (yellow). They vary slightly with wavelength, a point the dispersion chapter develops.
| Material | Approximate index n | Speed of light v = c / n (×10^8 m/s) |
|---|---|---|
| Vacuum | 1.0000 | 3.00 |
| Air (sea level) | 1.0003 | 3.00 |
| Water | 1.33 | 2.25 |
| Ordinary glass | 1.50 | 2.00 |
| Diamond | 2.42 | 1.24 |
Air is so close to 1 that you can treat it as vacuum in most problems. State this assumption when you make it.
Several layers
For a ray that crosses several parallel layers, apply the law at each boundary in turn. Suppose a ray goes from air through a flat glass plate and into water. At the first boundary, nair sin θair = nglass sin θglass. At the second, nglass sin θglass = nwater sin θwater. The glass terms are equal, so:
nair sin θair = nwater sin θwater
The middle layer cancels. For parallel boundaries, the final angle depends only on the first and last media. The glass only shifts the ray sideways.
This is also why a ray passing through a flat sheet of glass into air emerges parallel to its original direction. The first and last media are both air, so the exit angle equals the entry angle.
When there is no solution: total internal reflection
The inverse sine is defined only for arguments between −1 and 1. If light goes from a higher index to a lower index, the right-hand side of
sin θ2 = (n1 / n2) sin θ1
can exceed 1. No real θ2 exists, so no refracted ray exists. All the light is reflected back into the first medium. This is total internal reflection.
The threshold is the critical angle θc, where sin θ2 would be exactly 1, so the refracted ray would skim along the boundary at 90°:
sin θc = n2 / n1
This requires n1 > n2. For n1 ≤ n2, there is no critical angle, because n2 / n1 would be at least 1.
import math
def critical_angle(n1, n2):
"""Critical angle in degrees for light going from n1 into n2; requires n1 > n2."""
if n1 <= n2:
raise ValueError("Total internal reflection requires n1 > n2")
return math.degrees(math.asin(n2 / n1))
print(critical_angle(1.5, 1.0))This prints about 41.81 for glass into air. Any ray inside the glass that hits the boundary at more than 41.81° from the normal is totally reflected.
The case θ1 = θc exactly
At the critical angle, θ2 = 90° and the refracted ray travels along the boundary. In practice this is a limit case. Below θc, the refracted ray is real. Above it, there is none. Computations that land very close to θc can give a sine slightly above 1 because of floating-point rounding, which is why you should guard the asin call, as refraction_angle does.
Common errors
- Measuring from the surface. Snell's law uses angles from the normal. A ray that "meets the surface at 30°" in a diagram label may mean 30° from the surface, which is 60° from the normal. Convert before you calculate.
- Calculator in the wrong mode. Python's
math.sintakes radians. Convert withmath.radiansand convert the result back withmath.degrees. - Swapping n1 and n2. The incident medium is n1. If you swap them, a ray entering glass will appear to bend away from the normal. A quick check: the ray should bend toward the normal in the higher-index medium.
- Taking arcsin of a value above 1. This raises a
ValueErrorin Python. It signals total internal reflection, not a bug in your code, so handle it explicitly. - Applying the critical angle in the wrong direction. Air to glass has no critical angle. Only light going from a higher index to a lower one can be totally reflected.
- Using the small-angle shortcut at large angles. For small angles, sin θ ≈ θ (in radians), so n1 θ1 ≈ n2 θ2. The error is about 1% at 15° and grows quickly after that. Use the full sine form unless the problem says small angles.
What the law does not tell you
Snell's law gives only the direction of the refracted ray. It says nothing about how much light is refracted and how much is reflected. Even when refraction is allowed, part of the light always reflects at the boundary. At a glass surface seen head-on, about 4% of the light reflects. The fraction rises steeply near grazing incidence, and the Fresnel chapter describes this qualitatively.
The law also assumes the following.
- The boundary is flat on the scale of the wavelength, or at least locally flat where the ray hits.
- Both media are uniform (homogeneous) and have the same properties in every direction (isotropic). Crystals such as calcite are not isotropic and split a ray in two.
- The wavelength is fixed. Because n depends on wavelength, each color gets its own θ2.
In total internal reflection, the reflected ray still obeys the ordinary law of reflection, with the angle of reflection equal to the angle of incidence. You can compute its direction with the vector form from earlier in the tutorial:
def reflect(d, n):
"""Reflect direction vector d off a surface with unit normal n (2D tuples)."""
dot = d[0] * n[0] + d[1] * n[1]
return (d[0] - 2 * dot * n[0], d[1] - 2 * dot * n[1])
print(reflect((1, -1), (0, 1)))This prints (1, 1): a ray moving right and down leaves a horizontal mirror moving right and up.
Putting the pieces together in one function
A practical routine handles both outcomes. If the ray refracts, it returns the refraction angle. Otherwise it reports total internal reflection.
import math
def trace(n1, n2, theta1_deg):
"""Return ('refracted', angle) or ('total internal reflection', angle)."""
s = n1 * math.sin(math.radians(theta1_deg)) / n2
if s > 1:
return ("total internal reflection", theta1_deg)
return ("refracted", math.degrees(math.asin(s)))
for angle in (30, 41, 42, 60):
print(angle, trace(1.5, 1.0, angle))For glass into air, 30° and 41° refract (about 48.6° and 80.2°, since each is below the 41.81° critical angle). At 42° and 60°, the output reports total internal reflection, and the reflected angle equals the incident angle.
Notice how fast the refracted angle grows near the critical angle: 41° in glass becomes about 80° in air. This is why a small change in incident angle near θc has a large effect on the exiting ray.
Exercise
A ray in water (n = 1.33) hits the boundary with air (n = 1.00) at 40° from the normal. (a) Does it refract or totally reflect? (b) If it refracts, what is the refraction angle?
Show answer
First find the critical angle: sin θc = 1.00 / 1.33 = 0.752, so θc ≈ 48.8°. Since 40° < 48.8°, the ray refracts. Then sin θ2 = (1.33 / 1.00) × sin 40° = 1.33 × 0.6428 = 0.855, so θ2 ≈ 58.7°. The ray bends away from the normal, as expected when moving into the lower-index medium.
Exercise
A ray in air hits a flat glass plate (n = 1.50) at 50° from the normal. The plate sits on water (n = 1.33). What is the angle of the ray in the water? Does the glass thickness matter for this angle?
Show answer
The glass cancels out for parallel boundaries, so 1.00 × sin 50° = 1.33 × sin θ. sin 50° = 0.7660, so sin θ = 0.7660 / 1.33 = 0.576, and θ ≈ 35.2°. The glass thickness does not change the angle. It only shifts the ray sideways.
Exercise
A student calculates the refraction of a ray going from glass (n = 1.50) into air at 45° and gets a Python ValueError: math domain error. Explain what happened and what the physical result is.
Show answer
The value (1.50 / 1.00) × sin 45° = 1.50 × 0.7071 = 1.06 is greater than 1, so math.asin cannot compute it. The critical angle for glass to air is about 41.81°, and 45° exceeds it. The physical result is total internal reflection: no light is refracted, and the ray reflects back into the glass at 45° from the normal.