Simple harmonic oscillator
A simple harmonic oscillator is a one degree of freedom system consisting of a spring and mass. One end of the spring is fixed, the other end is attached to the mass.

If we suppose that the system is orientated vertically, then in the equilibrium position of the system the spring will already be elongated because of the gravity force. The magnitude of the static deflection is calculated by the following equation:

Displacement x is positive downwards. As the dynamic response of the oscillator is not affected by the static deflection, we choose x to be equal to zero at the equilibrium position. The force balance in vertical direction equals:

If an external force like a step or an impulse function brings the system out of its equilibrium position, the mass will start to oscillate periodically. The frequency at which this happens is called the eigenfrequency or the natural frequency of the undamped simple harmonic oscillator:

Note that the dimension of ω is radians per second; if the frequency in Hertz is desired one should divide it by 2π.

Energy in simple harmonic motion
Energy stored in a dynamic system, like a harmonic oscillator, can be divided into two concepts, namely kinetic energy and potential energy. Kinetic energy is the energy contained by the mass because of its velocity. Potential energy is the energy stored in the spring caused by its elongation or compression.

Once an external force is applied to the mass, it undergoes a displacement. If the mass is pulled downwards before it is released the system is not in its equilibrium position, it will want to return to that position. The point where it is released is the maximum displacement, also called the amplitude.

In every oscillation cycle the mass is at rest at its maximum deflection point for an infinitely short amount of time, before it starts moving back again. At rest all the kinetic energy of the oscillation is converted to potential energy stored in the spring. The spring creates an upward force on the mass because of its elongation, which in turn causes the mass to start back moving again.

While moving upwards it crosses the equilibrium axis. At that point the spring does not contain any potential energy anymore because the displacement equals zero. All the potential energy stored in the spring at its maximum deflection point is then converted into kinetic energy.

As no damping is incorporated in this model, the periodic motion of a simple harmonic oscillator will continue forever.