  We study the first law of thermodynamics utilizing a frequency modulated
quantum harmonic oscillator. For an adiabatic change in frequency, the
temperature of the oscillator is proportional to the frequency. Then, we
present a number representing the non-adiabaticity determined by the relation
between Ermakov-Lewis-Riesenfeld invariant and hamiltonian. We write the first
law of thermodynamics for the oscillator's quantum state having
non-adiabaticity and then find the temperature. The temperature gains a
non-negative non-adiabaticity correction to the adiabatic temperature. We
describe the thermalization process for the oscillator as a differential
equation. The equation deals with the evolution of the exponent of the density
operator. Finally, we write the first law of thermodynamics for thermalization
for the harmonic oscillator.
