Classically, the kinetic energy of rotation is
:where
:: is the angular momentum
:: is the moment of inertia of the molecule
For microscopic, atomic-level systems like a molecule, angular momentum can only have specific discrete values given by
:where  is a non-negative integer and  is the reduced Planck constant.
Also, for a diatomic molecule the moment of inertia is
:where
:: is the reduced mass of the molecule and
:: is the average distance between the centers of the two atoms in the molecule.
So, substituting the angular momentum and moment of inertia into E, the rotational energy levels of a diatomic molecule are given by: