# Undetermined coefficients for the equation $y''+9y=\sin 3x$

In solving the differential equation $y''+9y=\sin 3x$, first of all find the general integral of the corresponding homogeneous equation. One easily finds the general solution $$y=c_1\cos 3x+c_2\sin 3x.$$

Now, look for a particular solution $\psi$ of the equation. If I try with the form $$\psi=a\cos 3x+b\sin 3x$$

with $a, b$ constants, this doesn't work beacuse the coefficient 9 in the equation screws it up. I understand that a better choice would be

$$\psi=(A+Bx)\cos 3x+(C+Dx)\sin 3x$$

which allows to find that a particular solution is $\psi=-1/6x\cos3x$. My question is, why? How can I guess from the form of the equation that this should be the correct form of the particular solution?

Also, I should add that I am following Coddington's book on ODEs, but he does not exaplain the method of undetermined coefficients but only the more general variation of the constants method. Do you have some nice reference about the undetermined coefficients method?

Now, look for a particular solution $\psi$ of the equation. If I try with the form $$\psi=a\cos 3x+b\sin 3x$$

This would be the standard choice for a right-hand side of the form $\sin 3x$ but you can know in advance that this won't work since this suggestion is already a solution of the homogeneous equation; hence substitution into the differential equation will yield $0$ and not $\sin 3x$.

The trick, which can be proven to work, is to suggest a solution of the form: $$\psi=x^m\left( a\cos 3x+b\sin 3x \right)$$ where you take $m$ sufficiently large so that it is no longer a solution to the homogeneous equation. In your case $m=1$ will do, you so suggest: $$\psi= ax\cos 3x+bx\sin 3x$$ This method is explained in most texts and proven in some.

An online reference: Paul's Online Math Notes: Differential equations - Undetermined Coefficients.

Example

The solution of the homogeneous differential equation associated with $y''-4y'+4y=e^{2x}$ is $$y_h = c_1e^{2x}+c_2xe^{2x}$$ Based on the right-hand side $e^{2x}$, the standard suggestion for a particular solution would be of the form $y_p = ae^{2x}$ but that won't work since it's already a part of the homogeneous solution. Even with an extra factor $x$, $y_p = axe^{2x}$, you get the same problem. You need a solution of the form: $$y_p = a x^2 e^{2x}$$ And some calculations will lead to $a = 1/2$.

The functions that work for Undetermined Coefficients above have "annihilators", which are differential operators that wipe them out. For instance, the annihilator for $e^{3x}$ is $D-3I$, where $D$ is the derivative operator and $I$ is the identity operator. Then $(D-3I)(e^{3x}) = 3e^{3x}-3(e^{3x}) = 0.$ Similarly, $D^2+I$ is the annihilator for $\sin x$, (because $D^2$ means take the 2nd derivative.)

So if you have the DE $y''-3y'+2y = e^x$, we can write is as

$$(D^2-3D+2I)(y) = e^x.$$

Now hit both sides with the annihilator for $e^x$:

$$(D-I)(D^2-3D+2I)(y) = (D-I)(e^x) = 0.$$

These linear operators act like polynomials, so

$$(D^3-4D^2+5D-2I)(y)=0$$

which is equivalent to

$$y'''-4y''+5y'-2y =0$$.

We've transformed the non-homogeneous equation into a homogeneous one. Attack it in the usual way and the characteristic equation is:

$$r^3-4r^2+5r-2 =0$$

or

$$(r-1)^2(r-2) = 0$$ with roots

$$r=1, 1, 2.$$

This gives us the solutions $e^x$ and $e^{2x}$, but this is a 3rd-order equation and we need a 3rd, linearly independent solution. To get this, we use the method of reduction of order. Assume $y_3 = v(x)e^x$ and it turns out that $v(x) = x.$

For your equation, the annihilator for $\sin 3x$ is $D^2+9I$. The new, 4th-order homogeneous equation is $(D^2+9)(D^2+9)=0$. So again you have double roots $r=3i, 3i, -3i, -3i$. So you use reduction of order to find more solutions, and again the $v(x)$ turns out to be $x$. In a linear, constant coefficient equation, the $v(x)$ always turns out to be $x$. That's why we multiply by $x$.

• Very interesting indeed, can you suggest a book where all this is developed? Thanks. – RandomGuy Jul 13 '17 at 15:30
• The DE books I know have it only piecemeal. If you google "annihilator method", there are a number of sites with nice discussions. – B. Goddard Jul 13 '17 at 15:45
• I generally always do prefer books to internet forums – RandomGuy Jul 13 '17 at 17:42

Hint. With $\sin(3x)$ on the right side. If $3i$ solves the characteristic equation with multiplicity $r$ then you can take $$\psi(x)=x^r(A\cos(3x)+B\sin(3x)).$$ Here $r=1$.

Moreover note that the form $(A+Bx)\cos(3x)+(C+Dx)\sin(3x)$ is not wrong but $A$ and $C$ are useless because $A\cos(3x)+C\sin(3x)$ solves the homogeneous equation $y''+9y=0$.

The equation can be written as $$(D+3i)(D-3i)y(x) = \sin(3x) = \frac{1}{2i}(e^{3ix}-e^{-3ix})$$ where $D$ is the derivation operator, $Df = f'$.

To get rid of some distracting parts, we set $u = (D-3i)y$. Thus we currently have the equation $$(D+3i)u(x) = \frac{1}{2i}(e^{3ix}-e^{-3ix})$$

Multiplying this with the integrating factor $e^{3ix}$ we get $$e^{3ix} (D+3i)u(x) = \frac{1}{2i}(e^{6ix}-1)$$

Now the left hand side can be written as a derivative: $$e^{3ix} (D+3i)u(x) = e^{3ix} u'(x) + 3i e^{3ix} u(x) = (e^{3ix} u)'(x)$$

Thus the differential equation can be written $$(e^{3ix} u)'(x) = \frac{1}{2i}(e^{6ix}-1)$$

Taking the antiderivative gives $$e^{3ix} u(x) = \frac{1}{2i} \left( \frac{1}{6i} e^{6ix} - x \right) + A$$ for some constant $A$.

Multiplying with $e^{-3ix}$ and substituting back $u = (D-3i)y$ we have $$(D-3i)y(x) = \frac{1}{2i} \left( \frac{1}{6i} e^{3ix} - x e^{-3ix} \right) + A e^{-3ix}$$

Again we multiply with the integrating factor, this time $e^{-3ix}$, and rewrite the left hand side as a derivative. $$(e^{-3ix}y)'(x) = \frac{1}{2i} \left( \frac{1}{6i} - x e^{-6ix} \right) + A e^{-6ix}$$

Taking the antiderivative gives $$e^{-3ix}y(x) = \frac{1}{2i} \left( \frac{1}{6i} x - \left(-x \frac{1}{-6i} e^{-6ix} - \frac{1}{(-6i)^2} e^{-6ix}\right) \right) + A \frac{1}{-6i} e^{-6ix} + B$$ for some constant $B$.

Thus, $$y(x) = \frac{1}{2i} \left( \frac{1}{6i} x e^{3ix} - \left(-x \frac{1}{-6i} e^{-3ix} - \frac{1}{(-6i)^2} e^{-3ix}\right) \right) + A \frac{1}{-6i} e^{-3ix} + B e^{3ix} \\ = \frac{1}{6i} x \sin(3x) + A' e^{-3ix} + B e^{3ix}$$ where we have collected some terms and factors into $A'$.

We see that the $x$ factor (no pun intended!) comes from the antiderivative of a constant term, which occurs because the integrating factor cancels out a factor coinciding with the integrating factor in the right hand side.