Wrong calculation of work done on a spring, how is it wrong? So I would have thought that this would be how you derive the work on a spring: basically the same way you do with gravity and other contexts, use $$W=\vec{F}\cdot \vec{x}.$$ If you displace a spring by $x$, then it exerts a force $-k x$, so $F=-kx$, since the displacement is $x$. 
So $$W=-kx^2.\qquad \leftarrow\text{ (however, apparently wrong!)}$$
I've seen the correct derivation of work in a spring (with an extra half) and don't doubt that it's correct, but also don't see where my logic fails in this alternate derivation.
 A: Since the force is a function of distance, you need to integrate:
$$F = kx\\
W = \int F\ dx\\
W = \int k\ x\ dx\\
W = \frac12kx^2$$
Add signs as needed...
Your work considered the force to be constant - and that's not how springs work.
A: You may be imagining that if you push with constant force $F$, the spring will compress until the spring has such a resistive force.
But since the spring was not counteracting that force, your constant force $F$ was accelerating the mass.  Upon reaching the point where the spring has force $F$ as well, the mass does not stop but has a speed such that $KE = \frac{1} {2}  k x^2$.  So the work your hand does (when pushing with constant force) is correct, but half of the work is put into the spring potential energy and the other half is put in kinetic energy of the mass.
A: Actually the force which you are applying is not constant.
Let the force be $f$ and displacement be $d$, then when you draw a graph according to Hooke law (I.e. force is directly proportional to deflection, where $k$ (stiffness) is constant, it will look like a square, in that at any point you can find the amount of force require to get desired displacement or deflection.
Now, consider half of the square area I.e. a triangle  ( remember area=force time deflection), and in that total work done by the spring is converted into potential energy which is stored in the spring itself while half of the triangle shows the resistive force which is resisting the work done by you in compression and half of the same force is actually energy to regain its shape.
This is your answer where you have gone wrong. The work done on the spring  is  actually the work by you  and is k*x² , and the work done by the spring is 1/2 kx² ( this is the actual energy you transfer to spring ) so this is the work energy produced in the spring. Other half is wasted in recovering the shape
A: The factor $\frac{1}{2}$ is due to the integral.
The wrong sign of yours is due to the fact that you have to counter the force of the spring.
So the Force if the Spring is $-kx$, but you have to pull in the direction it is extended, so apply the force $kx$, therefore the energy is positive $W=\frac 1 2 k^2 x$
A: in w=F.X, x is displacement of center of mass of the body not the displacement of system.
here also force is 'kx' and displacement of c.o.m. is 0.5*x,so work done will be 0.5kx^2.
A: In school, generally you would do an experiment where you load a spring with weights one at a time. Then you use the weight times the change in height as the work done on the spring. You can use this because it is a closed system and the weight has lost potential energy of $mgh$. It doesn't matter that the force was also accelerating the weight, as this energy is then transferred to the spring. This energy would be equal to $kx^2/2$.
