Work Done in Compressing a Spring

Problem: A 2.4 kg mass sliding on a frictionless plane with an initial velocity of 3.6 m/s contacts a spring of force constant 450 N/m. By how much does it compress the spring?

Solution: The work-energy theorem states that the work done by the net force equals the change in the kinetic energy. Since we know the body's initial and final speeds (final is zero), we can find the change in the kinetic energy. And we have an expression for the work done in compressing a spring:

Equating these,

Comment about the signs: The force doing the net work acts opposite the displacement of the object, so a cosine of 180o results in a negative. As for the right side, a change in anything is defined to be "final - initial"; since the final kinetic energy is zero, the change is negative.