# How do greenhouse gases trap heat?

I am looking for a molecular-level understanding of the greenhouse effect.

What is it about the carbon-dioxide molecule (and methane, and water, etc) that is different from other gasses (particularly, N2 and O2) such that it works in the atmosphere to trap heat?

Is it, say, the distance between nuclei in the molecules relative to the wavelengths of infrared light? Dipolarity of the molecule? A combination of various factors?

-

To absorb infrared light, a stretching or bending vibration of the molecule must change the molecule's dipole moment. In $N_2$ and $O_2$ there is no dipole moment regardless of how you stretch the bond. On the other hand, O=C=O can change dipole moment by the C moving toward one O and away from the other O, or by bending with the C becoming a vertex of an obtuse angle. Water and methane molecules can also change dipole moment.