First things first, he calculated an estimate of the ***power*** output of the sun. That part’s pretty simple, power is just energy over time, so the power that went into heating the water was simply the energy that went into heating the water divided by however long the water was heated.
The second part is to realize that the sun’s radiation expands outwards like the surface area of a sphere (in other words, in all directions). In particular, the surface area of a sphere is 4*pi*r^(2) for a radius of length r. What this means is that when a sphere doubles its radius, the surface area increases by a factor of 2^(2) = 4 and in general if the radius increases by a factor of k, the surface area increases by a factor of k^(2).
Kepler and Newton had already established the equations that could be solved for to determine the distance between the sun and the earth. In addition, basic geometry allowed for the calculation of the sun’s size (radius) from a known distance (just mentioned from Kepler and Newton) and how big the sun appears in the sky.
From there, it is just scaling the power received (a) up to account for the distance to the sun and then (b) up again to account for the entire surface area of the sun.
To show the actual math:
* Herschel’s observed power was ~ 1 kilowatt per square meter.
* The mean sun-earth distance is ~149,600,000 km and the sun’s radius is ~696,300 km (they would have used different units, but these would be available to Herschel as discussed above).
* Therefore, the increased radius factor from the distance to the sun is 149,600,000 / 696,300 = 214.84. Therefore, the power received per square meter on earth is 1/(214.84)^(2) of what is emitted by the sun. The reduction comes because the sunlight “spreads out” as it goes through space and the same emitted power has to cover a larger area.
Therefore, a square meter of the sun emits 1 kilowatt x 214.84^(2) = 46.16 MW = 4.616 x 10^(7) W.
* And there are 6.09 x 10^(18) of those square meters (can be calculated using the 4*pi*r^(2) mentioned above for surface area of a sphere).
* Therefore, the total power of the sun is 4.616 x 10^(7) W/m^(2) x 6.09 x 10^(18) m^(2) = 2.81 x 10^(26) W.
There are a few other adjustments I glossed over for ELI5 purposes (examples: the 1 kW/m^(2) is not perfectly exact; the atmosphere absorbs some of the sun’s energy, so you need to multiply up by that; and possibly others too).
Latest Answers