Measuring x from the unextended position of the string,
Potential Energy = (1/2)kx2 - Fx
For equilibrium
Principle of total minimum Potential Energy
Example 1:
A force F is applied at the free end of the spring.