I don't think I've shown the derivation of the above formulas on this forum. If anyone was curious where they come from, it's a pretty neat application of radiation laws and geometry.
The temperature of a planet, or any object in thermal equilibrium with its environment, is determined by a balance of energy flowing into it and energy flowing out of it.
[left]

[/left]
If the majority of the energy received by a planet is from sunlight, then we can relate it to the solar luminosity,
L*. The sunlight is spread evenly over a sphere whose radius is the planet's orbital distance
a. The surface area of that sphere is 4πa
2.
The planet intersects some of the sunlight, with a cross sectional area of πRp2, and absorbs a fraction of it which is 1 minus the albedo, AB. So the energy flowing into the planet is
[left]

[/left]
By radiation laws, an object with temperature
T radiates thermally with a luminosity proportional to its surface area and its temperature to the 4th power. The proportionality constant is the Stefan-Boltzmann constant,
σSB. So the energy flowing out of the planet is
[left]

[/left]
There is also an "emissivity" factor,
ε, representing how efficiently it emits. (ε=1 for a blackbody, or between 0 and 1 for a "grey" body). For most materials, ε is between 0.9 and 1. It is much lower for metals (because they are good reflectors, and a good reflector is a poor absorber is a poor emitter).
Earth with its atmosphere is well approximated has having ε=0.61 due to the greenhouse effect (otherwise, as we will see shortly, Earth would be frozen!).
Finally, set these energy flows equal to each other and solve for the temperature T. After some algebra,
[center]

[/center]
We can also identify the flux
F (watts per square meter) of sunlight to be L/(4πa
2), in which case this simplifies to
[center]

[/center]
Setting a = 1AU = 1.5x10
11m
A
B = 0.3,
L* = 3.85x10
26W,
σ
SB = 5.67x10
-8 W/m
2/K
4,
and ε = 1,
then this predicts the Earth's equilibrium temperature if it were a perfect emitter to be 255 Kelvin, or -18C! Earth clearly cannot be a perfect emitter, or it would be an uninhabitable frozen wasteland. We owe our existence to the greenhouse effect.
The greenhouse effect warms the surface to about 288K, corresponding to ε=0.61. It also cools the upper atmosphere, both by reducing the outgoing thermal radiation (what we call E
out in this derivation) that reaches it, and also by making those layers radiate to space more efficiently (increasing ε). The greenhouse effect can essentially be thought of as a change in ε with respect to altitude in the atmosphere, decreasing the effectiveness by which the surface can cool by radiating to space, and increasing it at higher altitude.
Of course the actual details of radiation absorption and emission through an atmosphere are very complex, and this simple derivation just
treated it as a single layer that is doing the absorbing and emitting. Still, the simple derivation does provide the correct and useful intuitions for understanding, and even calculating, the temperature of a planet from first principles. The same formulas are used in astronomy and Space Engine. They can also be used to estimate the magnitude of the greenhouse effect on other planets (or anti-greenhouse in some cases like Titan).