A mass M = 5 kg moves with an initial speed v = 3 on a level frictionless air track. The mass is initially a distance D = 0.250 m away from a spring with k = 844 N/m, which is mounted rigidly at one end of the air track. The mass compresses the spring a maximum distance d, before reversing direction. After bouncing off the spring, the mass travels with the same speed v, but in the opposite direction.

(a) Determine the maximum distance that the spring is compressed.
I have this part..just need help with part b

(b) Find the total elapsed time until the mass returns to its starting point. (Hint: The mass undergoes a partial cycle of simple harmonic motion while in contact with the spring.)

2 answers

figure the period of the spring (see the spring harmonic oscillator equations). Then, the time on the spring is one quarter cycle (compressing it), then the spring accelerates the mass to some velocity and as the spring slows, the mass leaves. Max velocity occurs in the spring at the unstretched point, so in my mind, 1/2 cycle total.
The law of conservation of energy
KE (of the mass) = PE (of the spring)
mv^2/2 = kx^2/2
d=x = sqrt (mv^2/k)=sqrt(5•9/844)=0.23 m

T = 2•π•sqrt(m/k) =2•π•sqrt(5/844) = 0.484 s
The time of the mass motion with spring is T/2 =0.242 s.
The time of uniform motion before hitting the spring and after leaving thespring is
t =D/v =0.25/3=0.0833 s.

Therefore, the total time is 0.242 + 2•0.0833=0.409 s