The given problem is a harmonically excited single degree of freedom system. To solve such a problem we need to consider the differential equation. The complementary function (CF) of the given differential eq. gives the transient response and the particular integral ( PI) of the given differential eq. gives the steady-state response. Although for the case of (a) we have a pre-defined formula but for the case of (b) we will need to find the PI of the differential eq..