According to Hooke's law, the force needed to be applied to a spring in order to pull or compress it by a distance of (from its equilibrium position) is directly proportional to .
The mathematical expression from Hooke's law is . Here, is the proportionality constant which is known as the spring constant.
The spring constant depends on the material and overall structure of the spring.