Given,
Initial natural length,= Lo
There initial compression = L0/2
Energy stored in the spring, = 12K(Lo2 )2=18KL20
This it moves small distance X, say the velocity it has
is v and so
12K[L02−X]2+12mv2=18KL20
⇒12KX2−12K(LoX)+12mv2=0
⇒KX2−KLoX+mv2=0
v2=[LoX−X2]Km
v=
⎷K(LoX−X2) m
Hence, velocity and distance relation is ⎷K(LoX−X2) m