The potential energy in an elastic string of force constant k, which has an extension…