Suppose we have \(u''(t)+u'(t)+u(t)=3 \cos (2 t)\) and we wanted to find a particula solution by replacing \(u\) in the differential equation by some guess for a particular solution. Then do
ode = Derivative[2][u][t] + Derivative[1][u][t] + u[t] == 3*Cos[2*t]; ode /. u -> (c1*Cos[#1] + c2*Sin[#1] & ) Out[2]= c2*Cos[t] - c1*Sin[t] == 3*Cos[2*t]