(N/A) Consider an elastic spring,obeying Hooke's law with negligible mass,whose one end is tied rigidly to a wall as shown in the figure. At the other end of the spring,a block is attached,resting on a smooth horizontal surface.
We shall,for the sake of simplicity,restrict the motion of the block to the $X$-direction.
In the normal position of the spring,the position of the block is taken as $x=0$,as shown in figure $(a)$.
When the block is pulled and the length of the spring increases by $x$,a restoring force $F_{S}$ is produced in the spring which tries to bring the spring back to its normal position. The restoring force (spring force) is also produced when the spring is compressed. This is shown in figures $(b)$ and $(c)$. The restoring force is directly proportional to the change in the length of the spring and is in the direction opposite to the change in length. This law of force for the spring is called Hooke's law: $F_{S} = -kx$,where $k$ is the spring constant or force constant of the spring.
Spring constant $k = \frac{|F_{S}|}{|x|}$,its unit is $N/m$.
The spring is said to be stiff if $k$ is large and soft if $k$ is small.
Suppose the block is pulled outwards as in figure $(b)$. If the extension is $x_{m}$,the work done by the spring force is:
$W_{S} = \int_{0}^{x_{m}} F_{S} dx = \int_{0}^{x_{m}} (-kx) dx$
$W_{S} = -k \left[ \frac{x^{2}}{2} \right]_{0}^{x_{m}} = -\frac{1}{2} k x_{m}^{2}$
The potential energy $V(x)$ of the spring is defined as the work done by an external force to stretch or compress it,which is the negative of the work done by the spring force:
$V(x) = -W_{S} = \frac{1}{2} k x^{2}$