See Our New JEE Book on Amazon
The potential energy of a spring of spring constant $k$ is given by \begin{align} U=\frac{1}{2}kx^2 \end{align} where $x$ is the elongation (or compression) of the spring from its natural position (equilibrium position). The potential energy of a spring increases as it is stretched or compressed from its equilibrium position.
Problem: A spring gun was designed to launch marble of mass $M$. A spring of spring constant $k$ is attached to a piston of mass $m$ (see figure). The piston and marble are pulled back a distance $l$ from the equilibrium position and released. The speed of the marble as it loses contact with the piston is? (neglect friction)
Solution: Let $x$ be the piston's displacement from the equilibrium position. The piston and the marble move together from the release point P to the equilibrium point O. The restoring force on the piston-marble system is $kx$ and its acceleration is, \begin{align} \frac{\mathrm{d}v}{\mathrm{d}t}=-\frac{k}{m+M}\;x.\nonumber \end{align}
Re-write above equation as, \begin{align} \frac{\mathrm{d}v}{\mathrm{d}x}\cdot\frac{\mathrm{d}x}{\mathrm{d}t} &=v\frac{\mathrm{d}v}{\mathrm{d}t} \\ &=-\frac{k}{m+M}\;x.\nonumber \end{align} Integrate, \begin{align} \int\! v\,\mathrm{d}v=-\frac{k}{m+M}\int\! x\,\mathrm{d}x,\nonumber \end{align} to get, \begin{align} \frac{v^2}{2}=-\frac{k}{m+M}\;\frac{x^2}{2}+C.\nonumber \end{align} Initially, $v=0$ at $x=-l$. Substitute in the above equation to get $C=\frac{kl^2}{2(m+M)}$ and the speed, \begin{align} v=\sqrt{\frac{k}{m+M} (l^2-x^2)}.\nonumber \end{align} The speed at the equilibrium point O is, \begin{align} v_0=\sqrt{\frac{k}{m+M}}\;l.\nonumber \end{align} As the piston moves to the right of O, spring force starts acting towards the left. The piston gets decelerated, and its speed reduces. However, the marble continues to move with speed $v_0$. The marble lose contact at the point O with speed \begin{align} v_0=\sqrt{\frac{k}{m+M}}\;l. \end{align}
Problem (JEE Mains 2012): If two springs $\mathrm{S_1}$ and $\mathrm{S_2}$ of force constants $k_1$ and $k_2$, respectively, are stretched by the same force, it is found that more work is done on spring $\mathrm{S_1}$ than on spring $\mathrm{S_2}$.
Statement 1 If stretched by the same amount, work done on $\mathrm{S_1}$, will be more than that on $\mathrm{S_2}$.
Statement 2 $k_1 < k_2$.
Solution: Let springs $\mathrm{S}_1$ and $\mathrm{S}_2$ are stretched by the same force $F$. The springs gets elongated by, \begin{align} x_1 & =F/k_1, \\ x_2 & =F/k_2.\nonumber \end{align} The work done on the spring is equal to its potential energy. The work done on the springs $\mathrm{S}_1$ and $\mathrm{S}_2$ when they are stretched by the same force is, \begin{align} W_1 & =\frac{1}{2}k_1 x_1^2 \\ &=\frac{F^2}{2k_1}, \\ W_2&=\frac{1}{2}k_2 x_2^2 \\ &=\frac{F^2}{2k_2}.\nonumber \end{align} The condition $W_1 > W_2$ gives $k_1 < k_2$.
The work done on springs $\mathrm{S}_1$ and $\mathrm{S}_2$ when they are stretched by the same amount (length) is, \begin{align} W_1^\prime & =\frac{1}{2}k_1 x^2,\\ W_2^\prime & =\frac{1}{2}k_2 x^2.\nonumber \end{align} The condition $k_1 < k_2$ gives $W_1^\prime < W_2^\prime$.