method of undetermined coefficients
To find a particular solution of a nonhomogeneous constant-coefficient ODE, you do not need a general machine — for nice forcing terms you can simply guess the answer's shape, leaving the numbers blank, and let the equation fill them in. If the forcing is a polynomial, guess a polynomial; if it is e^(2x), guess A e^(2x); if it is cos x, guess A cos x + B sin x. Then plug in and solve for the unknown coefficients.
The method works because the derivatives of these particular functions stay within the same family. Differentiate a polynomial and you get a polynomial; differentiate e^(2x) and you get a multiple of itself; differentiate sines and cosines and you get sines and cosines. So a trial solution of the same family, with undetermined coefficients, must close up. You substitute the guess into L[y] = g, match the coefficients of like terms on both sides, and solve the resulting algebraic system. There is one crucial fix: if your guess already solves the homogeneous equation, multiply it by x (or x^2 for a double root) so it is not annihilated.
This is the fastest way to handle the routine forcings of engineering — constant or sinusoidal driving forces, exponential inputs, polynomial loads. Its limitation is honest and sharp: it only works when the forcing g(x) is a polynomial, exponential, sine/cosine, or product of these. For a forcing like tan x or 1/x, no finite family of guesses closes up, and you must fall back on variation of parameters, which works for any continuous g.
For y'' + y = e^(2x), guess y_p = A e^(2x). Then 4A + A = 1, so A = 1/5 and y_p = e^(2x)/5. (If the forcing were e^(i x) — already a homogeneous solution — you would instead try x times that form.)
Guess the family, substitute, match coefficients — and multiply by x if the guess overlaps a homogeneous solution.
Forgetting the 'multiply by x' rule when the trial solution coincides with a homogeneous solution is the single most common error; it leads to 0 = nonzero and no solvable coefficients.