In physics, the potential energy is the energy possessed by an object due to its position w.r.t to other objects. The main…