Second Order Inhomogeneous Differential Equation

Hey guys, I thought I had this question solved, wrote it out in final copy and everything and then I realised I'd made a big mistake. Was hoping someone here would be able to give me a few pointers.

**a) Solve the initial value problem:** $\displaystyle x'' + x = 2cos(\omega t) $

So first I solved homogeneous general solution: $\displaystyle \lambda^2 + 1 = 0 $

Therefore the solution looks like: $\displaystyle Ae^{it} + Be^{-it} $

But I only want real answers, so I use complex exponential to achieve:

$\displaystyle C_1cos(t) + C_2sin(t) $

Where C1 and C2 are real arbitrary constants.

Then I have to solve for inhomogeneous solution. My error was that the first time I did this I took the form to be $\displaystyle x = acos(\omega t) + bsin(\omega t) $

However it was pointed out to me that I can't use sine and cosine on their own because they are in the homogeneous general solution. So I think I have to change the form to: $\displaystyle x = atcos(\omega t) + btsin(\omega t) $

Then I differentiate twice to get $\displaystyle x'' = -2a\omega sin(\omega t) - at\omega^2 cos(\omega t) + 2b\omega cos(\omega t) - bt\omega^2 sin(\omega t) $

Subbing these in to $\displaystyle x'' + x = 2cos(\omega t) $

Gives me: $\displaystyle -2a\omega sin(\omega t) - at\omega^2 cos(\omega t) + 2b\omega cos(\omega t) $ $\displaystyle - bt\omega^2 sin(\omega t) + atcos(\omega t) + btsin(\omega t) = 2cos(\omega t) $

Then I equate the co-efficients and get:

$\displaystyle sin(\omega t) : -2a\omega = 0 $

$\displaystyle cos(\omega t) : 2b\omega = 2 $

$\displaystyle tsin(\omega t) : b - b\omega^2 = 0 $

$\displaystyle tcos(\omega t) : a - a\omega^2 = 0 $

By here I think I've done something drastically wrong. If anyone is able to see if I'm even on the right track it would be greatly appreciated. This is quite urgent, but anything will help! Thanks a lot in advance,

U-god