Solving the Rainbow

The rainbow is undoubtedly one of the most spectacular light shows on earth. It’s hard to miss, cutting across the sky as an arc of seemingly unnatural light. Although a bit more complex than other optical phenomena such as sunrises and sunsets, the common rainbow is still a simple little thing.

What makes a rainbow?

A rainbow is a result of two types of events, refraction and reflection. Refraction occurs when a propagating wave (light in this case) moves from one medium to another. Most people have probably experienced refraction in one form or another. If you place a straw in a glass of water, it appears bent due to some light refracting before it reaches your eyes. In the case of the rainbow, refraction occurs when sunlight interacts with drops of water in the air.

This of course does not happen before our very eyes, and raindrops in the air aren’t melon-sized. Instead, it occurs high up in the sky with very small droplets of water.

Don’t be fooled by the diagram though. I assure you that looking up at the sky when raindrops are present will not redirect the full strength of the sun into your eyes. In addition to light energy being absorbed by the atmosphere, the first diagram only pictured the rays responsible for the rainbow phenomenon we humans see down here. In actuality, some light waves reflect and others continue through. Most of these rays do not generate anything that is visible from where we stand; only the first one pictured hits our eyes in the form of the typical rainbow.

What about the different colors?

When we consider a source of light that produces many different wavelengths of light, such as the sun, a single beam of light is split up into its constituent wavelengths due to dispersion. Meaning when light passes between air and water, the refraction angle is different depending on its color.

Breaking it down

To get a good understanding of how refraction actually works, we need to understand Snell’s law. When waves change mediums in which their speed differs, Snell’s law relates the angle of incidence (the angle at which the light strikes the rainbow compared to the normal) to the angle of refraction (the angle the light goes after refraction, still compared to the normal). In the case of a raindrop, we have a light wave moving from air to water, and the normal line is really like an extended radius since the normal is defined as being perpendicular to the tangent.

The law tells us that the ratio of the sines of the two angles (, the angle of incidence, and , the angle of refraction) is equal to the ratio of the phase velocities, and , of light in the respective media:

Instead of using the velocities of light as our variables, however, we’d like to describe this relationship using the refractive indices of the mediums: the ratio of the speed of light in a vacuum, , to the speed of light in the specified medium,

With a little math magic we see that the ratio of the two sines is equal to the inverse of the ratio of the two refractive indices.

We’d like to solve for , so we rewrite it as:

Luckily, for our purposes, we can make some simplifications before we go further. The refractive index of light in air at standard temperature and pressure is about 1.00029, but when it comes to refractive indices, we’ll find out later that we only have sufficient data for four significant figures, so we can just use 1.000 instead. We can also rename our refractive index of light in water as :

Solving for , we find that

Where the colors separate

The key to the separation of colors is the phenomenon of optical dispersion, which states that the phase velocity of a wave is dependent on its frequency. In light-specific terms, dispersion tells us that the phase velocity of a light wave is dependent on its color , which means our refraction angle is ultimately a function of color!

We can test out this relationship with an example graph. Plotting the refraction angle as a function of between and for a 45° angle of incidence we see the refraction angle change:

In this particular case, we see that the refraction angle changes an entire 0.42 radians, or about 24°, effectively as a function of color. However, we haven’t truly related color to refraction angle, we’ve only related refractive index to refraction angle. We haven’t actually found a way to transitively relate refraction angle, , to color, . We know that the relationship exists, but what are the details?

In other words, we know that

but we need to understand because we want to know

For now, we are just worried about wavelength. We won’t worry about angle of incidence until the end.

Modeling n as a function of λ

Finding a relationship between the refractive index and the wavelength of light for many optical materials is a topic that has been of interest to scientists for hundreds of years. Augustin-Louis Cauchy defined an empirical equation in 1836 relating the two:

where B, C, D and so on were empirically derived coefficients for different media. However, this model was only good for representing the visible spectrum. It became more inaccurate for infrared and ultraviolet waves. Wilhelm Sellmeier improved upon the errors of this equation in 1871, introducing a new equation more components and coefficients:

But this experiment is for wavelengths of 0.2–200 micrometers. We only plan on modeling 0.390 to 0.700 µm, so we don’t have to try and model an equation for this funky graph.

Instead, the relevant data points could be downloaded as a raw comma-seperated value file:

Wavelength (nm)

Refractive Index

375

1.341

400

1.339

425

1.338

450

1.337

475

1.336

500

1.335

525

1.334

550

1.333

575

1.333

600

1.332

625

1.332

650

1.331

675

1.331

700

1.331

These numbers all are noticeably very close. In fact, because there are only 4 significant digits, the refractive index from 650 to 700 nanometers does not “change” at all. However, we only need a reasonable estimate of how the index changes for this simulation, so we don’t need to worry much about misrepresenting the precision we actually know. Using a second degree polynomial fit, a good function to approximately model our in the range of 390–700 nanometers would be:

Finally we can properly make use of our function for :

Relating r and i to the geometry of the event

Ultimately, the rainbow is going to be comprised of a countless number of light waves of different wavelengths hitting the raindrop at different angles of incidence . The outputted rays of light will be quantified as rays of wavelength/color at angle .

Drawing auxiliary lines onto our original diagram will help solve this geometry problem:

We already know much about the situation from a small amount of information. We also already know as a function of and . We have enough information geometrically to represent every angle on the diagram, so we can fill out the important ones:

Because opposite angles are equal, has to be equal to .

Because all radii in a circle are congruent, we know that the triangles created by two of them are isosceles.

The first half of the reflection angle is because the two base angles of an isosceles triangle are equal.

The second half of the reflection angle is because the definition of a specular reflection is that the incident ray and the reflected ray make the same angle with respect to the normal (the radius).

Again, the refraction angle of the second refraction event is because it must be equal to the other base angle of the isosceles triangle.

Ultimately, because this is the same wavelength ray changing mediums in the same way, it is undergoing the same refraction event, so therefore the other angle must be like the first one.

After solving for these angles, the total deflection angle can simply be found by adding up 3 three net deflections, as animated below:

Simplified, the total deflection angle as a function of and would be

Since we already know the reflection angle as a function of and , we can substitute to find as a function of and .

Analyzing this angle as a function of two variables

So far, we’ve only seen these events while ignoring the variability of the angle of incidence, . In reality, rays will strike the raindrop from all angles between –90° and 90°. However, for the angles of incidence less than zero (on the bottom half), the ray will end up refracting another way, basically doing the same thing but mirrored over the x axis. For now, we’ll only worry about the angles from 0° to 90°. Let’s see how affects the graph of when is held constant at 1.333:

As you go over all the angles of incidence on the raindrop, there is a certain minimum output angle. Because the graph of flattens our near this minimum point, the rays cluster up and form a caustic. So in this case, when = 1.333, there will be a caustic of rays of wavelength at angle 137.9°. For different wavelengths, there are different values, different local minima, and different deflection angles where the specific wavelength is most clustered.

Some examples using some values from our empirically-derived function.

Wavelength (nm)

Refractive Index

Deflection Angle

390

1.33989098927173

138.91°

500

1.334919231025

138.20°

600

1.3321071431079998

137.79°

700

1.330921428817

137.62°

Simulating the rainbow

After doing a few more calculations for things such as coordinate points on the raindrop, the slope of the rays, and the color perceived by the human eye, we can run a simulation to test out this multivariate situation. This simulation will:

Have rays of sunlight strike the raindrop in the northern hemisphere.

Have each ray be made up of many different wavelengths of light equally spread throughout the visible spectrum.

I created the simulation using my own JavaSim framework. For more info on the simulation itself or to run it on your own computer, see the Raindrop Rainbow main page.

The simulation yields a beautiful cluster of rays:

Most importantly, at the bottom you can see where the small differences in deflection angle start to form different caustics for different wavelengths. The rainbow truly comes to life. A stretched image of some of the bottommost pixels gives us a sample of the rainbow we’ve created:

Locating the newly-defined rainbow

These reflection angles for the minimum and maximum visible wavelengths tell us where the rainbow begins and where it ends! To locate the rainbow now, we need to make a small modification to our old diagram:

The sun is first of all, not right above you. In this diagram, the sun would actually be setting on the horizon because the rays in question are all completely parallel to the ground. We need to consider the position of the sun in the sky and how it changes where the rainbow ends up. If we redraw the diagram with a variable angle of depression and now include our shadow, we get what seems to be a more complex situation:

Therefore the true angle of the rainbow also depends on the height of the observer (specifically, the location of the eyes). Fortunately, since the rays that shine down from the sun to strike the raindrop are parallel to the rays that strike down on your back to make your shadow, we can view the problem from a different angle, literally:

This diagram is the same as before, except instead of being relative to the ground, it is relative to the line from your eyes to the head of your shadow is (or more specifically, where your shadow’s “eyes” are). This point on the shadow directly opposite the sun is consequently named the antisolar point. Some small geometry fill ins reveal that the angle made between here and the ray of angle is the supplement of . For the two ends of the visible spectrum, we wish to calculate these supplements.

Wavelength (nm)

Deflection Angle

Angle From Antisolar Point

390

138.91°

41.09°

700

137.62°

42.38°

Before we walk outside and look up 41.5° and wonder where the rainbow is, we need to remember the preconditions. First and foremost, water droplets must be present, whether from rain, mist, or a garden hose. Also, the sun cannot be high in the sky. It must be either the beginning or the end of the day, with few exceptions. In an area of completely flat ground, during the middle of the day, let’s just say you would need some… underground raindrops in order to see a rainbow: So the full rainbow-hunter’s checklist would go something like:

Choose a rainy, misty day or environment.

Choose a time early or late in the day (late tends to have better weather).

Locate the head of your shadow on the ground.

Look up about 41°.

With any meteorological luck, you should see the world-renowned bow!

Extras: variations and unusual cases

Of course, when it comes to something as funky as a rainbow, there will be some more funky things that come along with it. Behold!

The “underground” rainbow

When the sun is too high in the sky, the diagrams tell us that raindrops would theoretically have to be underground for us to actually be able to see the phenomenon, but from the edge of a cliff, we can effectively make this happen:

A great example of the “underground” rainbow taken midday at the Grand Canyon:

The secondary rainbow

Commonly referred to as a double rainbow, a secondary rainbow is not all that different from a typical rainbow. It is a result of the same processes with two key differences: the rays in question strike the southern hemisphere of the raindrops and there are two reflection events instead of one. The rays striking in the southern hemisphere cause the color order to be reversed and the extra reflection event causes more light to be lost.

This sister phenomenon is more difficult to see due to another event in which more light is lost. The double rainbow is often seen in conjunction with already-spectaular rainbows because it already needs good conditions to be clearly visible.

An example of a secondary rainbow taken by myself in Stone Harbor, New Jersey on an August afternoon after a rainstorm:

Acknowledgments

Special thanks to Professor Halpin-Healy for a great lecture on rainbow physics that covered most of the content in this post and inspired me to learn and experiment more.

Thanks to Marvelous Marv for providing the great Grand Canyon rainbow photo and his wife for taking it.