In equilibrium state the potential energy of a body is minimum or zero. But when external force is applied on a body then the internal reactive force is produced in the body; which “resists the positional change. The work done opposite to the internal reactive force by the external force increases the potential energy of the body. This energy is known in the form of elastic energy.
When we stretch any wire (string) then we do some work stored opposite to the interatomic force; which is stored in the string in the form of elastic potential energy. Suppose, by applying a force F on a string of length L its length increases by l. Initially the internal force in the string was zero, but as the length increases the internal force increases from zero and becomes equal to the applied force F. In this way the average internal force for increasing the length of the string to l;
If the initial length of the wire is L and transverse or lateral cross sectional area is A; then again writing the above equation;