The potential energy of a particle with displacement X is U(X). The motion is simple harmonic, when (K is a positive constant)
U=−KX22
U=KX2
U=K
U=KX
F=− kx ⇒dW=Fdx=− kxdx
So ∫ 0 WdW=∫ 0 x−kx dx ⇒W=U=−12kx2