Hooke's law is a law which states that the force, F, required to bend a spring (or some other elastic object) is directly proportional to the distance X by some constant k, known as the stiffness constant.
This is sometimes written as
In this case, F is equal to the force with which the spring pushes back.
Hooke's law is only an approximation, as all materials will deform past a certain point (called the elastic limit). In fact, many objects deviate from Hooke's law well before their elastic limits. However, for most cases, Hooke's law is fairly accurate.
If a weight is attached to a spring and the spring is stretched or compressed released, the motion can be described as
where A is the amplitude, or how far the spring is stretched, k is the stiffness constant, and m is the mass of the weight. By taking the first and second derivatives, the speed and acceleration can be found.
The total energy of the system is equal to