Kinetic Energy of a single molecule in gas is given by
$KE= \frac {1}{2}v_x^2 + \frac {1}{2}v_y^2 + \frac {1}{2}v_z^2$
For a gas in thermal equilibrium at temperature T the average value of energy denoted by
$\left \langle KE \right \rangle= \left \langle \frac {1}{2}v_x^2 \right \rangle + \left \langle \frac {1}{2}v_y^2 \right \rangle + \left \langle \frac {1}{2}v_z^2 \right \rangle$
According to the principle of equipartition of energy, each velocity component has, on the average, an associated Kinetic energy (1/2)KT.
So,
$\left \langle \frac {1}{2}v_x^2 \right \rangle= \frac {1}{2}KT$
$\left \langle \frac {1}{2}v_y^2 \right \rangle= \frac {1}{2}KT$
$\left \langle \frac {1}{2}v_z^2 \right \rangle= \frac {1}{2}KT$
So far , we just considered the translational kinetic energy, but this is true for Rotational and vibrational kinetic energy also.
The number of velocity components needs to describe the motion of a molecule completely is called the number of degrees of freedom.
How to determine Degrees of Freedom
A molecule free to move in space needs three coordinates to specify its location.Molecule velocity component will be three,so it has three degrees of freedom
If it is constrained to move in a plane it needs two and its velocity has two components, so it has two degrees of freedom
if constrained to move along a line, it needs just one coordinate to locate it.and its velocity has one component, so it has one degrees of freedom .
Thus, a molecule free to move in space has three translational degrees of freedom. We have already seen above, each components kinetic energy is $\frac {1}{2}KT$
A mono-atomic molecule like Argon just have three translational degrees of freedom.
A diatomic molecule also have these three translational degrees of freedom but there molecules can rotate freely about its Center of mass. The rotation can happen in two perpendicular axis. So diatomic molecule will have 5 degree of freedom
We have assumed that diatomic molecules are rigid rotator i,e molecule does not vibrate. Some diatomic molecule do show vibration around inter-atomic axis also like a single dimensional oscillator.So it also add some degree of freedom. Unlike Translational and rotational components,each vibration energy contribute $2 \frac {1}{2}KT$ as it has both kinetic energy and potential energy
So finally we can say that law of equipartition of energy states that in equilibrium, the total energy is equally distributed in all possible energy modes, with each mode having an average energy equal to $\frac {1}{2}KT$. Accordingly, each translational and rotational degree of freedom of a molecule contributes $\frac {1}{2}KT$ to the energy while each vibrational frequency contributes $2 \times \frac {1}{2}KT = KT$ , since a vibrational mode has both kinetic and Potential Energy modes.