Kinetic and potential energy of the oscillating object

During the oscillation of a simple harmonic oscillator, the kinetic and potential energies of the object oscillating are continually changing. 
Relationships (1) - (3 ) below show how both the potential, kinetic and total energy of the object oscillating depends on time.

Kinetic energy depends on the mass of the object and the velocity at time t

KE = ½ mv2

The velocity at time t is given by:  v = – Xω sin ωt

The kinetic energy at time t therefore:  KE = ½ mX2ω2 sin2 ωt
Substituting the relationship:  ω =  k 
m

The kinetic energy at time t is therefore:  KE = ½ kX2 sin2 ωt (1)
Potential energy depends on the force constant and the displacement. 

PE = ½ kx2

The displacement at time t is given by:  x = X cos (ωt)

The potential energy at time t is given by:  PE = ½kX2 cos2 ωt (2)
The total energy at any time is equal to the sum of the potential and kinetic energy.

Total energy = PE + KE
Total energy = ½ kX2 sin2 ωt +  ½kX2 cos2 ωt
Total energy =  ½kX2(sin2 ωt + cos2 ωt)
Recall the trigonometric identity: sin2 ωt + cos2 ωt = 1

Thus the total energy at time t is given by:  Total energy = ½kX2 (3)