A block of mass 'm' is attached to one end of a string and a floor-fixed spring with spring constant 'k' is attached to the other. The string goes over a frictionless pulley. Initially, the spring is unstretched when the system is released from rest. Find the maximum elongation of the spring.
I tried to solve the problem with two different approaches:
Conservation of energy: Let's assume, initially, the block has potential energy which is equal to $mgx$ and the spring has no potential energy as it is not elongated, then the system is released and the block reaches 'x' unit distance down so that the spring stretches to 'x' unit. As a result, spring gains P.E. = $\frac{1}{2} kx^2$ According to conservation of energy this follows $\frac{1}{2} kx^2$ = $mgx$ therefore, elongation is $x = \frac{2mg}{k}$ so far so good.
Newton's Second Law: First the block accelerates and then stops when it has reached $x$ unit down we conclude that the gravity on the box equals the tension produced by the spring in the string so that $kx = mg$ which gives us $x = \frac{mg}{k}$
Huh? Why is that? Two distinct approaches provide us with two different answers!