# Solving $y'' + 4y = 3 \sin 2x$ using undetermined coefficients

In this example from the book, it was assumed a particular solution was $y_p = A \cos 3x + B \sin 3x.$

The problem I want to solve is $\bf y'' + 4y = 3 \ \bf sin 2x$.

Solving the associated homogeneous equation $y'' + 4y = 0$, I get $y_c = c_1 \cos 2x + c_2 \sin 2x$.

Now for the $3 \sin 2x$ part, I followed the example and assumed $y_p = A \cos 2x + B \sin 2x$. I then worked out $y_p'' + 4y_p = 3 \sin 2x$ and got $y_p = -\frac{3}{4} \sin 2x$.

So my solution was $y = y_c + y_p = c_1 \cos 2x + c_2 \sin 2x -\frac{3}{4} \sin 2x$.

But the book has $y = c_1 \cos 2x + c_2 \sin 2x -\frac{3}{4} x \cos 2x$, because they assumed $y_p = A x \cos 2x + B x \sin 2x$.

How is it decided to use $y_p = A x \cos 2x + B x \sin 2x$ instead of $y_p = A \cos 2x + B \sin 2x$?

• It is a standard trick when the frequency on the right-hand side is the same as the "natural frequency" of the homogeneous equation. Your calculation of the particular solution is incorrect. Probably a minor error, but when plugged in ant $A\cos 2x+B\sin 2x$ will give $0$, can't match right-hand side. – André Nicolas Mar 19 '13 at 21:34

Since you have a homogeneous solution depenendent on $\sin (3x)$ and $\cos(3x)$ already, any linear combination of those plugged into the left-hand side of the ODE will produce $0$. (Because they are solutions of the homogeneous equation.)

So the trick is to scale the homogeneneous solution by a factor of $x$ and assume we are looking for solutions of the form $Ax \sin(3x) + Bx \cos(3x)$ as is in your book.

Let us not worry with the solutions of the homogeneous equation associated to the given ode (this part is the easy one). The main problem is to find a particular solution of the given ode.

This task can be carried out much easier if we look for a particular solution of the ode $$z'' + 4z = 3e^{2xi},$$ where $z:\mathbb R \to \mathbb C$ is a complex function. Notice that the imaginary part of $z$, the function $y= \textrm{Im}\,z$, is a real solution of the given real ode. To find $z$, it is well-known that there is a solution of the type $$z(x)=f(x)e^{2xi},$$ where $f(x)$ is a polynomial. Noticing that the characteristic polynomial associated to the ode is $$p(\lambda)=\lambda^2 + 4=(\lambda -2i)(\lambda +2i),$$ I recommend that you Read/Study/use/cite/Understand the formula [recently proved in more general form in O. R. B. de Oliveira, A formula substituting the undetermined coefficients and the annihilator methods'', Int. J. Math. Educ. Sci. Technol. 44(3), 2013, pp. 462-468, http://dx.doi.org/10.1080/0020739X.2012.714496] $$z''+4z=\left[\frac{p''(2i)}{2!}f'' + \frac{p'(2i)}{1!}f' +\frac{p(2i)}{0!}f\right]e^{2xi}.$$ With it, and using that $p(2i)=0$, $p''(x)=2$ for every $x$, and $p'(2i)= 4i$ you can see that the problem boils down to find any polynomial $f=f(x)$ that solves the ode $$f'' + 4if' =3.$$ Clearly, we can pick $f'=\frac{3}{4i}=-\frac{3i}{4}$. So, $f(x)= -\frac{3xi}{4}$ is enough for us. Hence, we arrive at $$z(x)= - \frac{3xi}{4}e^{2xi}.$$ Finally, we take the particular solution $$y(x)=\textrm{Im}\,z = -\frac{3x\cos 2x}{4}\,\blacksquare$$

Best wishes,

Oswaldo R. B. de Oliveira

$$y_p=\frac{1}{D^2+4}3\sin 2x=3\frac{1}{D^2+4}\sin 2x=3x\frac{1}{\frac{d}{dD}(D^2+4)}\sin 2x=3x\frac{1}{2D}\sin 2x$$ $$=\frac{3x}{2}\int\sin 2xdx=\frac{3x}{2}\frac{1}{2}(-\cos 2x)=-\frac{3x}{4}\cos 2x$$