Method of Undetermined Coefficients/Sine and Cosine

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 a linear combination of sine and cosine:
 * $\map R x = \alpha \sin b x + \beta \cos b x$

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:
 * $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$.

Let $\map R x = \alpha \sin b x + \beta \cos b x$.

Consider the auxiliary equation to $(1)$:
 * $(2): \quad m^2 + p m + q = 0$

There are two cases which may apply.

$i b$ is not Root of Auxiliary Equation
First we investigate the case where $i b$ is not a root of the auxiliary equation to $(1)$.

$i b$ is Root of Auxiliary Equation
Now suppose that $(1)$ is of the form $y'' + b^2 y = A \sin b x + B \cos b x$.

Thus one of the $i b$ is one of the roots of the auxiliary equation to $(1)$.

From Second Order ODE: $y'' + k^2 y = 0$ the general solution to $(2)$ is:
 * $y = C_1 \sin b x + C_2 \cos b x$

and it can be seen that an expression of the form $A \sin b x + B \cos b x$ is already a particular solution of $(2)$.

Thus we have:


 * $\paren {q - b^2}^2 + b^2 p^2 = 0$.

But using the Method of Undetermined Coefficients in the above manner, this would result in an attempt to calculate:


 * $\dfrac {\alpha \paren {q - b^2} + \beta b p} {\paren {q - b^2}^2 + b^2 p^2}$

and:
 * $\dfrac {\beta \paren {q - b^2} - \alpha b p} {\paren {q - b^2}^2 + b^2 p^2}$

both of which are are undefined.