Two equal masses are attached to the two ends of a spring of spring constant k. The masses are pulled out symmetrically to stretch the spring by a length x over its natural length. The work done by the spring on each mass is

Work done by the object is the increase of the potential energy< therefore work done by the spring will be the negative of the work done on the objects (work done in increasing the potential energy) Work done by the spring on the masses= Work done by the spring on each mass=

1