As the car collides with the spring, it does work against the force of friction and for compression in the spring. Let x0 be the maximum compression produced in the spring.
Work done for compression = 1/2k \(x^2_0\)
Work done against friction = (μmg)x0
By work energy theorem;
Change in KE = Work done in compressing spring + Work done against friction.
Using quadratic formula with a = k; b = 2 μmg and c = – mu2
On a smooth road,