Moving body is collided with a spring system.Why there is a difference in maximum compressed distance for different observers? Suppose a body of mass m moving with velocity collides with a spring system.The event is being observed by two observers, one at rest and one moving with a velocity v opposite direction to that of the mass(observed velocity of mass, 2v and that of the spring system v).Max compression occurs when there is no relative velocity between the mass and the spring.The maximum compression is greater for the second case(for calculations check the attached image).But distance,unlike velocity is independent of velocity transformations,shouldn't both the observers see the same compression for the same event?
 A: Your derivation of the difference in compression between the two frames is incorrect;  after all, in Galilean relativity, spatial distances between points at a given time are the same between all frames.  The error is that (perhaps surprisingly) we should not expect mechanical energy to be constant in the moving frame, and so applying the conservation equation in that frame is incorrect.
Let's consider our system to be the mass, the platform, and the spring (the latter two assumed to have negligible mass.)  In the "rest frame", the wall must exert a time-dependent force on the system, since its momentum is not constant.  It is not too hard to see that this force will always act to the right.  Of course, in the "rest frame" the wall is stationary and so no work is done.  Mathematically, $d\vec{x}$ of the wall is zero and so $\vec{F} \cdot d\vec{x} = 0$.
But the force is invariant between frames, so this same time-dependent force on the system will act in the "moving frame".  And in the moving frame, the application point is also moving to the right, so the wall does work on the system ($\vec{F} \cdot d\vec{x} \geq 0$ at all times) and we should not expect the system to have a constant mechanical energy.
If you do want to salvage conservation of energy, you would need to include the wall in your system.  In that case, you can treat the wall as a very massive object with mass $M$.  But by momentum conservation, this would mean that the velocity of $M$ would change during the collision, which means that its KE would change during the collision as well.  Taking this change in energy into account would then allow you to see how energy is actually conserved.
