When the spring is compressed, the total energy of the jack-in-the-box system is elastic potential energy stored in the spring:
[tex]E_i= \frac{1}{2} kx^2 [/tex]
where [tex]k=80.0 N/m[/tex] is the spring's constant and [tex]x=-8 cm=-0.08 m[/tex] is the displacement of the spring with respect its rest position.
When the spring is released and it reaches its relaxed position, its elastic energy becomes zero (because x=0), and so the total energy of the system will be the kinetic energy of the toy's head:
[tex]E_f= \frac{1}{2} mv^2 [/tex]
where [tex]m=50 g=0.05 kg[/tex] is the mass of the head and v its velocity.
For the law of conservation of energy, [tex]E_i = E_f[/tex]. Rewriting both terms, we can find v:
[tex] \frac{1}{2}kx^2 = \frac{1}{2}mv^2 [/tex]
[tex]v= \sqrt{ \frac{kx^2}{m} }=3.2 m/s [/tex]