The refractive index n = c/v measures how much a material slows light: the bigger n, the slower the wave and the shorter its wavelength inside the medium. Drag the sliders below to change n and the vacuum wavelength, then hit Fire pulses to race light through vacuum against your chosen material.

How to use the refractive index simulator

The two sliders drive two different parts of the picture. The refractive index n slider reshapes the whole race: nudge it up and the medium pulse immediately slows, the arrival-time gap between the two lanes widens, and the wavefronts in the medium lane squeeze closer together. The vacuum wavelength slider does something narrower — it re-spaces the wavefronts in both lanes and shifts the pulse colour, but it never touches the speed or the crossing times, because how fast light travels through a material depends on n, not on which colour you sent in.

Watch the readouts to see the equation prove itself. The speed panel updates v = c/n live as you drag, always landing between light's full vacuum speed and a little over a third of it. The two crossing times show the growing gap directly, and the closest material label maps wherever you leave the slider onto a real substance — 1.33 for water, 1.52 for crown glass, 2.42 for diamond — so an abstract number becomes something you can picture. To bend a ray between two of those media instead of racing through one, open the Snell's law calculator, and to see why each colour bends by a different amount, the dispersion of light guide picks up where this lab leaves off.

The physics the simulator is solving is short: v = c/n for the speed, the wavelength inside the medium equal to the vacuum wavelength divided by n, and t = nL/c for the time to cross the fixed one-metre path. For a single worked read, set n to 2.42 and the speed readout drops to about 1.24 × 108 m/s — that is diamond, where light crawls at barely 41% of its vacuum speed. Feed any of these numbers into the matching refractive index calculator to solve for n or the speed exactly, or read how the same slowing makes a ray reflect and refract at a boundary.

The classic misconception the lab corrects is the idea that light “changes colour” in glass. Keep an eye on the frequency: it never moves. Only the speed and the wavelength shrink together, in exact step, so the colour you see stays the same while the wavefronts crowd in. That is why a beam entering water or diamond looks the same colour going in as coming out, even though its wavelength inside is a good deal shorter.

Frequently asked questions

What does the n slider actually change?

The n slider sets the refractive index of the medium, which rescales the whole race. As you raise n the medium pulse slows to v = c/n, so it falls further behind the vacuum pulse and takes longer to cross the metre. The wavefronts in the medium lane also bunch closer together, because the wavelength inside the material is the vacuum value divided by n.

Why does the wavelength readout shrink but the colour stay the same?

Colour is set by frequency, and frequency does not change when light enters a material. The wave slows down, so in one cycle it covers less distance and the wavelength readout shrinks to the vacuum value divided by n. Your eye still registers the same frequency, so the light keeps the same colour even though its wavelength inside the glass is shorter.

How do I find the speed of light in glass with the simulator?

Set the n slider to the glass value (about 1.52 for crown glass) and read the speed panel, which shows v = c/n live. For n = 1.52 the readout gives roughly 1.97 x 108 m/s, just under two-thirds of the speed of light in vacuum. The closest-material label confirms the value maps onto real crown glass.

Why do both pulses arrive together when n = 1.00?

At n = 1.00 the medium is optically identical to vacuum, so v = c/n = c and both pulses travel at exactly the same speed. Their crossing times t = nL/c become equal, the race ends in a dead heat, and the closest-material label reads vacuum or air. Any n above 1.00 slows the medium pulse and opens a visible gap.

Can the simulator show a real material like diamond or water?

Yes. Slide n to 1.33 for water, 1.52 for crown glass or 2.42 for diamond, and the closest-material readout names the substance it matches. At diamond's n = 2.42 the speed drops to about 1.24 x 108 m/s, roughly 41% of c, which is why diamond bends and slows light so dramatically and sparkles the way it does.

References & formula source

  • Eugene Hecht — Optics, Chapter 4 (The Propagation of Light), index of refraction and dispersion.
  • Young & Freedman — University Physics with Modern Physics, §33.2 (Reflection and Refraction), index of refraction.
  • R. Nave — HyperPhysics, Georgia State University, "Refraction of Light" / index of refraction section.
  • Further reading: Refractive index — Wikipedia