Show that total energy of particle executing simple harmonic motion is constant.

Total energy of particle executing simple harmonic motion at any point is equal to the sum of kinetic energy and potential energy.
That is,
Total energy, E = K.E + P.E
Let at any instant, the particle be at P at a distance y from mean position.
Let, v be the velocity of particle at P.
Kinetic energy:
Kinetic energy of particle executing simple harmonic oscillation at any instant is given by,
The velocity of particle at a distance y from the mean position is,
Potential energy:
Potential energy stored in the particle is equal to the work done in displacing the particle from mean position to y.
Let the particle be displaced through a distance x from mean position.
The restoring force F acting on particle is,
Therefore, when the particle is moved through a distance x, work done against the restoring force is given by,
Therefore, total work done by restoring force in displacing the particle from mean position to P is,
The potential energy stored in the body is equal in magnitude and opposite in sign of the work done by restoring force. Thus
Total energy is,
E = K + U
From the above equation, total energy is independent of the position of particle during its motion.
Thus, total energy is constant.
Hence proved.