In general the total energy of a harmonic oscillator having of two parts, potential energy (P.E) and kinetic energy (K.E.), the former being because of its displacement from the mean position and latter due to its velocity. As the position and velocity of the harmonic oscillator are continuously changing, P.E. and K.E. also change but their sum i.e., the total energy (T.E) must have the similar value at all times.