Section 2.8 Forced Oscillations.

my” + cy’ + ky = r(t) 
y” + (c/m) y’ + (k/m) y = r(t)/m
if r(t) = F0 cos(wt)
y” + (c/m) y’ + (Subscript[ω, 0])2 y = (F0/m) cos (ωt)

eqn=y''[t]+(c/m) y'[t]+w0^2  y[t]==(F0/m) Cos[w t]

DSolve[eqn,y[t],t]

Simplify[%]

The first two terms are the solutions of the homogeneous equation. So the particular solution is:

yp[t_]:=((F0 (-m ((w^2)-(w0^2)) Cos[t w]+c w Sin[t w]))/((c^2) (w^2)+(m^2) ((((w^2)-(w0^2)))^2)))

In case c = 0 (undamped), the partocular solution becomes:

ypu[t_]:=((F0 (- Cos[t w]))/(m((w^2)-(w0^2))))

So, the solution is a superposition of two cosine functions. For example, if the yh = cos (w0 t) and F0/m = 5, w0 = 2, w = 3, y(t) = cos (2t) + cos(3t)

f[t_]:=Cos[ 2t] + Cos[3 t]

Plot[{f[t],Cos[2 t], Cos[3 t]},{t,0,20}, PlotLegends->"Expressions"]

Resonance (w = w0, c = 0)
y” + (Subscript[ω, 0])2 y = (F0/m) cos (ωt)

eqn = y''[t]+w0^2 y[t]==(F0/m) Cos[w0 t]

sol=DSolve[eqn,y[t],t]

Simplify[sol,{t>0,w0 >0}]

ypr[t_] = ((F0 t  Sin[t w0])/(2 m w0))

F0=1;m=1;w0=1;
Plot[{ypr[t],0.5t,-0.5t},{t,0,20}]

Beats(w -> w0, c = 0)
Consider the particular solution:
[F0/m(w0-w)] [cos w t -cos w0 t]

ypb[t_]:=F0 / (m(w0^2-w^2)) (Cos[ w t]-Cos [w0 t])

F0=1; m =1; w0 =440 *2Pi; w=410 *2Pi;

Plot[ypb[t],{t,0,0.2}]

w=430 *2Pi;

Plot[ypb[t],{t,0,0.2}]

Damped Forced Oscillation

m =1; k = 1; F0 = 1; c=0.1;w = 2; w0=1;

eqn=y''[t]+(c/m) y'[t]+w0^2  y[t]==(F0/m) Cos[w t]

sol=DSolve[{eqn,y[0]==0,y'[0]==0},y,t]

g[t_]:= y[t]  /.sol

Plot[{g[t], 0.1Cos[w t]},{t,0,60}, PlotLegends->"Expressions"]