$y'' + w^2 y = \cos{(wt)}$ I'm supposing that it has a solution of the type $y = A \cos{(wt)} + B\sin{(wt)}$ but I'm getting this:
$y'' + w^2 y = \cos{(wt)} = (-A w^2\cos{(wt)} - B w^2\sin{(wt)}) + w^2(A \cos{(wt)} + B\sin{(wt)}) = 0$
So I can't compare the coefficients because the expression is zero. What is the problem here?
Yet I can't solve by variation of parameters because I'm getting too much complicated expressions.
The frequency of the inhomogenous term matches the natural frequency of the differential operator, so you need additional terms of the form $C t\cos(wt) + Dt\sin(wt)$.