Solution (source code)

= Solution

Let an isothermal non-scattering atmospheric layer of <temperature> $T_a$ lie above an optically thick continuum source with <brightness temperature> $T_b$. Assume <local thermodynamic equilibrium>, so the layer emits with <Planck function> $B_\lambda(T_a)$. Its vertical <optical depth> is $\tau_\lambda$; a ray with direction cosine $\mu$ has slant depth $t_\lambda=\tau_\lambda/\mu$.

The <formal solution of the radiative transfer equation> gives
$$
\boxed{I_\lambda=B_\lambda(T_b)e^{-t_\lambda}
+B_\lambda(T_a)(1-e^{-t_\lambda}).}
$$
The two terms are attenuated background and layer emission. Compare a line and nearby continuum at the same wavelength to adequate approximation, with $t_{\rm line}>t_{\rm cont}$. The <one-layer spectral contrast> is
$$
I_{\rm line}-I_{\rm cont}
=[B_\lambda(T_a)-B_\lambda(T_b)]
[e^{-t_{\rm cont}}-e^{-t_{\rm line}}].
$$
The second bracket is positive, and $B_\lambda(T)$ increases with <temperature>. Therefore a cooler upper layer produces absorption, a hotter upper layer produces emission, and an isothermal source-plus-layer produces no line contrast:
$$
\boxed{T_a<T_b:\ \text{absorption};\quad
T_a>T_b:\ \text{emission};\quad T_a=T_b:\ \text{no contrast}.}
$$
This is why higher <opacity> sampling a cooler altitude creates absorption in an outward-cooling atmosphere, whereas an <atmospheric thermal inversion> can create emission. If both line and continuum are very optically thick in the same layer, their contrast tends to vanish even with a different deeper <temperature>. Scattering, non-LTE excitation, and nonuniform layers require a more general <radiative transfer> treatment.