Hint: The oscillation of the block starts from the extreme position.
Step 1: Find the amplitude and angular frequency of the block.
Consider the diagram of the spring block system. It is an SHM with an amplitude of 5 cm about the mean position shown.
Given, spring constant, k=50 N/m
m = mass attached =2 kg
∴ Angular frequency, ω=√km=√502=√25=5 rad/s
Step 2: Find the equation of motion of oscillations.
Assuming the displacement function,
y(t)=Asin(ωt+ϕ)
where, ϕ=initial phase
But given at t=0, y(t) =+A
y(0)=+A=Asin(ω×0+ϕ)
or sinϕ=1⇒ϕ=π2
∴ The desired equation is y(t)=Asin(ωt+π2)=Acosωt
Putting A=5 cm, ω=5 rad/s
we get, y(t)=5sin5t
where, t is in second and y is in centimetre.