$y'' + 4y = \sin^3(2x)$ Continuation of question I have to find the solution for $y'' + 4y = \sin^3 (2x)$.
We can use an identity to transform our equation to: $y'' + 4y = (3/4)\sin(2x) - (1/4) \sin(6x)$.  Our guess for the particular solution would then be: $y_p = A\sin(2x) + B\sin(6x)$.
I am, however, having trouble solving for A and B.
$y_p = A\sin(2x) + B\sin(6x)4$
$y^{(1)}_p = 2A\cos(2x) + 6B\cos(6x)$
$y^{(2)}_p = -4(A\sin(2x) + 9B\sin(6x))$
So then we plug these back into our non-homogeneous differential equation, $y'' + 4y = sin^3(2x)$, and we get:
$-4(A\sin(2x) + 9B\sin(6x)) + 4(A\sin(2x) + B\sin(6x)) = (3/4)\sin(2x) - (1/4)\sin(6x)$
Simplifying we will find that the sines with the A coefficient cancel out. How do we then find what A is if they always cancel out? This is a continuation of: Undetermined Coefficients trouble
Is my particular solution guess correct?
 A: So there are two issues here.
The first is that, when the right hand side has a trig function, in general you need an undetermined coefficient for sine AND cosine. So your guess would be:
$$A_1sin(2x) + A_2cos(2x) + B_1sin(6x) + B_2cos(6x)$$
But this is wrong as well, because there's a trick to the undetermined coefficients rule where you have to add 'x' to functions that 'match' the solutions to the homogeneous equation:
$$y'' + 4y = 0$$
This has solutions $Csin(2x) + Dcos(2x)$, so in your undetermined coefficients guess you need to add a factor of $x$ to the terms involving $sin(2x)$, $cos(2x)$. The correct guess is:
$$A_1xsin(2x) + A_2xcos(2x) + B_1sin(6x) + B_2cos(6x)$$
The reason for this rule is exactly what you noticed: If you don't include the extra $x$ then terms cancel out and you can't get it to work.
A: Old question, but the Community demands a better answer, so here goes. We have the equation
$$y^{\prime\prime}+4y=f(x)\tag{1}\label{a}$$
We can use symmetry to reduce our choices of candidate functions. Let $x=-u$. Then $u=-x$ and
$$\begin{align}y^{\prime\prime}(x)&=\frac d{dx}\left[\frac d{dx}y(-u)\right]=\frac d{dx}\left[\frac d{du}y(-u)\frac{du}{dx}\right]\\
&=\frac d{dx}\left[-\frac d{du}y(-u)\right]=\frac d{du}\left[\frac d{du}y(-u)\right]=\frac{d^2}{du^2}y(-u)\end{align}$$
So
$$\frac{d^2}{du^2}y(-u)+y(-u)=f(-u)=-f(u)$$
Relabeling the variable,
$$\frac{d^2}{dx^2}y(-x)+y(-x)=-f(x)\tag{2}\label{b}$$
Adding eqs $(\ref{a})$ and $(\ref{b})$ and dividing by $2$,
$$\frac{d^2}{dx^2}\frac{y(x)+y(-x)}2+4\frac{y(x)+y(-x)}2=y_e^{\prime\prime}+4y_e=0$$
Where $y_e(x)=\left(y(x)+y(-x)\right)/2$ is an even function of $x$. Similarly, subtracting eq $(\ref{b})$ from eq $(\ref{a})$ and dividing by $2$,
$$\frac{d^2}{dx^2}\frac{y(x)-y(-x)}2+4\frac{y(x)-y(-x)}2=y_o^{\prime\prime}+4y_o=f(x)$$
Where $y_o(x)=\left(y(x)-y(-x)\right)/2$ is an odd function of $x$, and we can write $y(x)=y_e(x)+y_o(x)$ as a linear combination of an odd and an even function of $x$. The definite parity of the differential operator and the driving function means that here we need only consider odd functions of $x$ in our particular solution.  
Also it was not written out in the answers how to simplify $\sin^3(2x)$:
$$\begin{align}\sin(n+1)x&=\sin nx\cos x+\cos nx\sin x\\
\sin(n-1)x&=\sin nx\cos x-\cos nx\sin x\\\hline
\sin(n+1)x+\sin(n-1)x&=2\sin nx\cos x\end{align}$$
So we have the identity $\sin(n+1)x=2\sin nx=\cos x-\sin(n-1)x$. Then
$$\begin{align}\sin2x&=2\sin1x\cos1x-\sin0x=2\sin x\cos x\\
\sin3x&=2(2\sin x\cos x)\cos x-\sin x=3\sin x-4\sin^3x\end{align}$$
So now
$$\sin^32x=\frac34\sin2x-\frac14\sin6x$$
Now we want to solve
$$y_{p1}^{\prime\prime}+4y_{p1}=\frac34\sin2x$$
But since the characteristic equation of differential equation $(\ref{a})$ is $r^2+4=0$ has the root $r=2i$ implying the solution to the homogeneous equation $y_h^{\prime\prime}+4y_h=0$ is $y_h=c_1\cos2x+c_2\sin2x$ we need to multiply the homogeneous solution by a polynomial of degree equal to the sum of that of the polynomial that multiplies $\sin2x$ in the driving function $[=0]$ and the order of the root $r$ of the characteristic equation $[=1]$, thus a first-degreee polynomial in $x$. So that would imply that
$$y_{p1}(x)=Ax\cos2x+Bx\sin2x+C\cos x+D\sin x$$
But $C$ and $D$ don't do anything because they are the coefficients of terms that are solutions to the homogeneous equation and we know that $B=0$ because our previous analysis showed that we need an odd function of $x$. Thus
$$\begin{align}y_{p1}(x)&=Ax\cos2x\\
y_{p1}^{\prime}(x)&=A\cos2x-2Ax\sin2x\\
y_{p1}^{\prime\prime}(x)&=-4A\sin2x-4Ax\cos2x\\\hline
y_{p1}^{\prime\prime}+4y_{p1}&=-4A\sin2x=\frac34\sin2x\end{align}$$
So $A=-\frac3{16}$. Then we solve
$$y_{p2}^{\prime\prime}+4y_{p2}=-\frac14\sin6x$$
This time the naive guess would be $y_{p2}=E\cos6x+F\sin6x$, but again we need an odd function of $x$, so $E=0$ and $y_{p2}^{\prime\prime}+4y_{p2}=-35F\sin6x=-(1/4)\sin6x$ so $F=1/140$ and the general solution is
$$y(x)=y_h(x)+y_{p1}(x)+y_{p2}(x)=c_1\cos2x+c_2\sin2x-\frac3{16}x\cos2x+\frac1{140}\sin6x$$
Notice how using the symmetry of the problem and decomposing the driving function into manageable components made the task of finding the undetermined coefficients much more palatable.
