More on Degrees of Freedom
There are actually 6 degrees of freedom for a diatomic molecule: three for translation in 3 dimensions, two for rotation around two axes, and one for vibration along the axis between the two atoms. So why isn't the energy 3 kT instead of 5/2 kT? This was one of the great mysteries in physics in the late 1800's, and one of the early successes of quantum mechanics (see Feynman for example).
The two atoms in a diatomic molecule act as if they are connected by a spring, and form a harmonic oscillator with a resonant frequency f. According to quantum mechanics, energy comes in lumps of magnitude hf, where h is Planck's constant. The energy cannot be zero; the minimum energy, for the ground state, is hf/2. So the two atoms can be in the ground state, or vibrating with energy 3hf/2, 5hf/2, etc. The significant point is that it cannot vibrate with an energy between hf/2 and 3hf/2. The probability of finding a molecule in an excited state with energy E is proportional to exp(-E/kT), where k is Boltzmann's constant, and T is the temperature in degrees Kelvin. For nitrogen and oxygen the resonant frequency is quite high, the energy increment between the ground state and 1st excited state is large, and at room temperature the probability of a molecule being in the first excited state is very close to zero. Therefore for all practical purposes there is no coupling of energy into this degree of freedom.
To the physics contents