how did "W= -kxdx" become "W=-kx2 /2"
where did that "/2" come from ??????
It comes from the formula of Integration - Integration of xn = xn+1 / n+1.
So, the integraton of -kxdx = -k(Integration of xdx) - k will come outside because the value of k is constant.
= -k(x1+1/1+1)
= -kx2/2.