Hooke's law Physics

Job ID: 37530569

Budget: ₹100 – ₹400 INR

I need help to understand the Hooke's law which has formula

-F = Kx

I have two options to derive the formula using integration. One case using cos 180 degree gives 1/2 kx square

and the other case using cos 0 degree gives answer 1/2 kx square but in negative direction.

Please contact me to check the existing derivation done.