Introduction about rainbows.

Rainbows are always fascinating to see, and since we have a lot of rain in Scotland I don't usually have to wait to long for one to appear. However, when a colleague asked me why they come in different sizes, and at different times of day, I had no idea, so decided to do a bit of investigation.

The science behind a rainbow is fairly straightforward - sunlight bounces back off raindrops in the sky, creating a pattern of light in the sky. Because different colours of light travel through water at differing speeds, the sunlight is split into different colours, which bounce back in a slightly different direction depending on the colour wavelength. That's all you need to generate the rainbow pattern, because it means that you will see raindrops as a different colour, depending on where they are in the sky.

The light is refracted (bent slightly) as it enters the raindrop, some reflects (bounces back) from the back of the raindrop, and is then refracted again as it leaves the raindrop. Each raindrop will only reflect a small amount of light, but because there are lot of raindrops you can see the result. The intensity of the rainbow will depend on the amount of sunlight, but more importantly on the number of raindrops, and size of the raindrops.

Light reflected by a raindrop

Depending on the angle between a ray of light from you to the raindrop, and from the raindrop to the sun, the colour that the raindrop appears to you will be different. If the angle is about 40.6degrees it will appear to be violet, while if the angle is 42.2degrees it will appear to be red. In between these angles you'll get a range of different wavelengths.

This means that if you look directly away from the sun, there will be a cone of raindrops which you see as coloured, distributed at an angle around the axis of the suns rays. Because you are more than likely standing on the Earth, half or more of the cone will be hidden (since it would be underground.) That's why rainbows look like a half-circle. If you were in an aeroplane, you might be able to see the full circle, while on Earth you may see much less than a half circle if the sun is high in the sky.

So, the size and shape of the rainbow depends of the height of the sun in the sky.

As you may have guessed, I'm quite a techy guy so I decided to simulate this with a 3-D model written in CSharp, using the WPF framework