Method of Undetermined Coefficients/Product of Polynomial and Exponential

Proof Technique
Consider the nonhomogeneous linear second order ODE with constant coefficients:
 * $(1): \quad y'' + p y' + q y = \map R x$

Let $\map R x$ be of the form:
 * $\map R x = e^{a x} \paren {\map f x}$

where $\map f x$ is a real polynomial function.

The Method of Undetermined Coefficients can be used to solve $(1)$ in the following manner.

Method and Proof
Let $\map {y_g} x$ be the general solution to:
 * $(2): \quad y'' + p y' + q y = 0$

From Solution of Constant Coefficient Homogeneous LSOODE, $\map {y_g} x$ can be found systematically.

Let $\map {y_p} x$ be a particular solution to $(1)$.

Then from General Solution of Linear 2nd Order ODE from Homogeneous 2nd Order ODE and Particular Solution:
 * $\map {y_g} x + \map {y_p} x$

is the general solution to $(1)$.

It remains to find $\map {y_p} x$.

Substitute a trial solution of similar form:


 * $e^{a x} \paren {\map g x}$

where $\map g x$ is a real polynomial function with undetermined coefficients of as high a degree as $f$.

Then:
 * differentiate twice $x$
 * establish a set of simultaneous equations by equating powers
 * solve these equations for the coefficients.

If $e^{a x} \paren {\map g x}$ appears in the general solution to $(2)$, then add a further degree to $g$.

The last step may need to be repeated if that last polynomial also appears as a general solution to $(2)$.