(a) Trolley is an accelerating or non - inertial frame. So, a pseudo force `F = ma` has to be applied on the block towards left.
Here, `P` or natural length of the spring of the spring is not the mean position (of the block with respect to trolley).
Let mean position (where `F_(0)` is obentained after an extension of `x_(0)`. Then
`ma = kx_(0) rArr x_(0) = (ma)/(k)`
This `x_(0)` is also the amplitude of SHM of block with respect to trolley.
`:. A = x_(0) = (ma)/(k)`
Further, at `t = 0`, block is at `x = + A`
Therefore, `x - t` equation of block is, `x=Acos omega t`
(where, `omega = sqrt((k)/(m))`)
But in this equation `x` is measured from the mean position and we have to measure `S` from the starting point `( = + A)`
From the figure we can see that,
`S_(bt)` = displacement of block with respect to trolley.
` = - (A-x)`
` = - (A - Acos omega t)`
`S_(bt) = (A cos omega t - A)`
(b) Displacement of trolley at time 't' is
`S_(t) = (1)/(2) at^(2)`
Now `S_(bt) = S(b) - S(t)`
`:. S_(b) = S_(bt) + S(t)`
or `S_(b)` = displacement of block with respect to ground.
or `S_(b) = (A cos omega t - A) + 1/2 at^(2)`.