Everything generalizes to nth order ODEs. An nth order linear ODE has the standard form Ly = r(x), where L is the linear differential operator
L = D^n + p1(x)D^{n-1} + ... + pn(x)I
There will be n linearly independent solutions to Ly = 0 (where {y1, ... yn} is "linearly independent" if the only linear combination a1 y1 + ... + an yn which gives 0 has a1 = ... = an = 0). Ly = r(x) has a solution yp, and for any choice of such yp, y1, ... yn, the general solution to Ly = r(x) is
yp + a1 y1 + ... + an yn.
Given x0, there is a unique solution with any given y(x0), y'(x0), ..., y^(n)(x0).
Suppose p1, ..., pn constants: L is a "constant coefficient LDO." Its "characteristic polynomial" is f(r) = r^n + p1 r^{n-1} + ... + pn, and L = f(D). The exponential solutions ("normal modes") of Ly = 0 are e^{sx} where s is a root of f(r).
We now study the inhomogeneous equation Ly = r(x).
If Ly = r(x) then L(ay) = ar(x). If L(y1) = r1(x) and L(y2) = r2(x), then L(y1 + y2) = r1(x) + r2(x). So we may deal with r(x) term by term.
First case: r(x) = x^m.
An example shows why: Ly = y" + 4y' + 4y = x^2 has a unique solution of the form ax^2 + bx + c :
L(x^2) = 2 + 8x + 4x^2 so L((x^2)/4) = 1/2 + 2x + x^2
Lx = 4 + 4x so L(-x/2) = -2 - 2x
L1 = 4 so L(3/8) = 3/2
sum L((x^2)/4 - x/2 + 3/8) = x^2.
More important: exponential driving terms (and so, using complex exponentials, periodic driving terms): Ly = e^{sx}. Remember: L(e^{sx}) = f(s) e^{sx}. So if s is not a root of the characteristic polynomial, then y = e^{sx}/f(s) works fine.
For example, with L = D^2 + 4D + 4I as above, a solution to Ly = e^{3x} is given by y = e^{3x}/25. To find a solution to Ly = sin(3x), first replace it by a different problem: Ly = e^{3ix}. The complex part of e^{3ix} is sin(3x), so the imaginary part of a solution to Ly = e^{3ix} will be a solution to Ly = sin(3x). Now
f(3i) = -9 + 12i + 4 = -13 + 12i,
1/f(3i) = (-13 - 12i)/(13^2 + 12^2) = -13/310 - 12i/310,
Im e^{3ix}/f(3i) = -(13/310)sin(3x) - (12/310)cos(3x).
This works just as well with things like r(x) = e^{-2x}cos(3x) as well.
If s is a root of the characteristic polynomial, then we have to combine these two cases, and we'll do this Wednesday.