Source: High school physics (Chinese)
Problem
An object is attached to a vertical spring. When lowered slowly, it reaches an equilibrium position where the spring is extended by a length $d$.
First, at the equilibrium position, the net force is zero. The spring force equals the gravitational force:
$$kd = mg$$Next, consider the case where the mass is dropped. We use conservation of energy from the release point (unstretched spring, $y=0$) to the point of maximum extension $x_{max}$ (velocity is zero). Let the gravitational potential energy be zero at the point of maximum extension. The initial energy is purely gravitational, and the final energy is purely elastic.
$$E_{initial} = E_{final}$$ $$U_{g,i} = U_{el,f}$$ $$mgx_{max} = \frac{1}{2}kx_{max}^2$$Since $x_{max} eq 0$, we can simplify to $mg = \frac{1}{2}kx_{max}$. Substituting $mg=kd$ from the equilibrium condition:
$$kd = \frac{1}{2}kx_{max}$$ $$x_{max} = 2d$$