A curiosity journal of math, physics, programming, astronomy, and more.

Sunlight and air density

A previous post found that the distance sunlight travels through the atmosphere changes more or less linearly through the afternoon, unlike the color of sunlight, meaning a simple distance model is inadequate. We need to factor in air density in the lower atmosphere.

To see how air density might impact the curve, let's divide the amosphere into two halves by height:

RRRhHH/2dn
The distance between an observer and the middle and top of the atmosphere.

Before, we found d + n using a double application of the Pythagorean theorem, and we can do the same to find d, using H/2 instead of H:

StartLayout 1st Row 1st Column d 2nd Column equals StartRoot left-parenthesis upper R plus h right-parenthesis squared minus upper R squared EndRoot plus StartRoot left-parenthesis upper R plus StartFraction upper H Over 2 EndFraction right-parenthesis squared minus upper R squared EndRoot 2nd Row 1st Column Blank 2nd Column equals StartRoot 2 upper R h plus h squared EndRoot plus StartRoot upper R upper H plus StartFraction upper H squared Over 4 EndFraction EndRoot EndLayout

When the sun is directly overhead, sunlight travels the same distance through the upper half of the atmosphere as through the lower half, but at sunset, an observer six feet above sea level sees sunlight that has passed 2.4 times further through the lower atmosphere than the upper atmosphere. Since the density of Earth's atmosphere decreases exponentially with height, how much lower atmosphere sunlight passes through makes a big difference in how much air it passes through and can be scattered by, turning it red.

To get a sense of how this ratio changes through as the afternoon, we have to do some more work. We can still find the distance between an observer and the top of the atmosphere using the law of cosines, but to find where the line intersects the middle of the atmosphere, we have to recognize that we know the outer triangle and are looking for a line of specific length from one vertex of the triangle to the opposite edge. Such a line is called a "cevian", and the relationship of its length to the lengths of the triangle's edges is described by Stewart's theorem:

StartLayout 1st Row 1st Column b squared m plus c squared n 2nd Column equals a left-parenthesis s squared plus m n right-parenthesis EndLayout

where, referring to the above diagram, a = d + n, b = R + H, c = R + h, and s = R + H/2. We know a and need to solve for m or n. Let's substitute n = a − m and group terms by powers of m:

StartLayout 1st Row 1st Column b squared m plus c squared left-parenthesis a minus m right-parenthesis 2nd Column equals a left-parenthesis s squared plus m left-parenthesis a minus m right-parenthesis right-parenthesis 2nd Row 1st Column b squared m plus a c squared plus c squared m 2nd Column equals a s squared plus a squared m minus a m squared 3rd Row 1st Column 0 2nd Column equals a m squared plus left-parenthesis b squared minus a squared minus c squared right-parenthesis m plus a c squared minus a s squared EndLayout

From here we can use the quadratic equation to solve for m, then substitute in our values for a, b, c, and s.

Let's plot the distance sunlight travels through the upper and lower halves of the atmosphere as the sun moves from directly overhead to the horizon (upper atmosphere in light blue):

As the sun moves from overhead to the horizon, sunlight passes further through the lower atmosphere than the upper atmosphere.

While the distance through the lower atmosphere increases faster, the distance through the upper atmosphere levels off.

To plot how this impacts the color of sunlight, we have to combine the distances in a way that weighs the higher density of the lower atmosphere more heavily. Since the density of the atmosphere decreases exponentially with height, we can suppose that the upper half of the atmosphere has a density of e ≈ 0.6 that of the lower atmosphere.

Weighing the density of the upper and lower halves of the atmosphere differently suggests a slightly different rate of color change.

That bends the earlier curve (shown faded) in the right direction, flattening the lower end and suggesting more blue midday light. But the change is slight. The overall curve still suggests a gradual transition of the color of sunlight through the afternoon, rather than a mostly flat curve that spikes near sunset. This is still a simplistic model, with only two layers of atmosphere, so let's do the calculation with ten layers:

Factoring in relative air densities of one, two, and ten layers of atmosphere.

That moves the graph the right direction, flatter at the bottom and therefore bluer, but not by much, and running the calculation with 500 layers doesn't push the curve much further. More seems to be going on than either distance or air density fully account for. If you have suggestions, email me.