# Second-order nonhomogeneous diff-eq

Hey guys. It's been a few years since I've taken diff-eq and I can't remember how to solve second-order problems like this one:

Find the general solution of
u'' + a^2*u = cos(bx)

I know that if it were homogeneous, I would solve for r^2 + a^2 = 0, and get u = ce^(rx). But for the life of me I can't remember what to do with that cosine on the right side of the equation. Can anyone help?

tiny-tim
Homework Helper
Welcome to PF!

Hi BucketOfFish! Welcome to PF! (try using the X2 icon just above the Reply box )

You need to find a particular solution (ie any solution to the equation), which you can then add to the general solution to the homogeneous equation.

In this case, try a combination of cos(bx) and sin(bx). (if b = ±a, that doesn't work, and you'll need xcos(bx) and xsin(bx))

Thanks a lot; that really helped!

I bet you could also use the function:

u''+a2u' = eibx and split the real and imaginary portions with Euler's formula.

I find e easier to work with than sin and cos.

tiny-tim
hi evad1089! even when cos is already on the RHS? 