Let us take wedge+spring+block, as a system. The forces responsible for performing work are spring force `kx(larr)` and the external force `F(rarr)`.
Applying `W-E` theorem for block+spring+plank relative to ground:
We have `W_(ext)+W_(sp)=DeltaK`,
Where `W_(sp)` the total work done by the spring on wedge and block `=-1/2kx^2` and `DeltaK` is the change in KE of the block (because the plank does not change its kinetic energy).
Then, `W_(ext)=1/2kx^2+DeltaK`
As the block was initially stationary, it will acquire a velocity `v_0` equal to that of the plank at the time of maximum compression of the spring. The change in kinetic energy of the block relative to ground is
`DeltaK=1/2mv_0^2`
Substituting `DeltaK` in the above equation, we have
`W_(ext)=1/2kx^2+1/2mv_0^2`
Applying `W-E` theorem for block+spring+plank relative to the plank:
Now we need to find x. For this, let us climb onto the plank. Since the plank moves with constant velocity, there is no pseudo force acting on the block. Then the net work done on the system (block+plank) is due to the spring, can be given as
`W_(sp)=-1/2kx^2`
As the relative velocity between the observer (plank) and block decrease from `v_0` to zero at the time of maximum compression of the spring, the change in kinetic energy of the block is
`DeltaK=-1/2mv_0^2`. Applying work-energy theorem, we have
`W=DeltaK`, where `W=-1/2kx^2` and `DeltaK=-1/2mv_0^2`
This gives `1/2kx^2=1/2mv_0^2`
Substituting `1/2kx^2=1/2mv_0^2` from Eq. (ii) and Eq. (i), we have
`W_(ext)=mv_0^2`