Consider the spring in Example 2. If it has already been compressed a distance meters, let F be the force required to compress it further, and W the work required to compress it a (tiny) distance.