According to Hooke's law, the intensity of the force F required to elongate or compress a spring by a certain length x is proportional to that length. Mathematically, this law is written as F = -kx, where k is a characteristic constant of the spring called the "spring constant" and is expressed in N.m-1.
The force is zero when the elongation x is zero, meaning when the spring is at its uncompressed length l0.
Robert Hooke is the British physicist who studied this elastic restoring force (1678). The term "elastic" here means that after deformation, the spring returns to its initial resting position. This is indeed the meaning of the negative sign in the mathematical formula. It indicates that the restoring force F is always directed in the opposite direction of the displacement, specifically to cancel the distortion that generates the force. It should also be noted that this elasticity has limits. In reality, a spring never fully returns to its initial shape, and Hooke's law is a good approximation only for small displacements compared to the uncompressed length l0.