Second-Order Linear: Nonhomogeneous

the trial-solution guess

When you use undetermined coefficients, everything hinges on writing down the right shape to try. The trial solution is that educated first guess: a template for the particular solution that matches the forcing's form but leaves its constants unknown, ready to be solved for. A good trial solution is half the battle; a wrong-shaped one wastes all the algebra that follows.

The rule of thumb is to mirror g(x), but to include EVERYTHING that derivatives of g(x) can produce. For a polynomial of degree n, use a full polynomial of degree n (all lower terms included). For e^(kx), use A e^(kx). For cos(wx) or sin(wx), always include BOTH: A cos(wx) + B sin(wx), because differentiating one produces the other. For a product such as x e^(kx), use (A x + B) e^(kx); for e^(kx) cos(wx), use e^(kx) (A cos(wx) + B sin(wx)). In short, write down the family of functions that g and all its derivatives live in, with one undetermined coefficient per independent piece.

There is one mandatory safety check before you substitute: compare your trial solution against the complementary solution y_c. If any term of your guess is already a homogeneous solution, the trial solution as written cannot work — substituting it gives zero on the left, never matching g — and you must apply the modification rule (multiply the offending term by x, or x^2 for a repeated root) first. Make that check a habit and the method almost never surprises you.

For g(x) = x e^(2x) sin(x), the trial solution must cover the whole family the derivatives reach: y_p = e^(2x) [ (Ax + B) cos(x) + (Cx + D) sin(x) ], four undetermined coefficients A, B, C, D.

Match the forcing AND everything its derivatives can generate, one constant per piece.

A sine forcing still demands a cosine term in the guess (and vice versa); omitting the partner is the most frequent reason an otherwise correct method 'has no solution.'

Also called
trial functionansatzy_p guess試探解猜測解