Second order linear non-homogenous differential equation My problem is the following: $y'' + 4y = 4\sin(2x)$
I tried making a particular solution to this by assuming that $y = A\sin(2x) + B\cos(2x)$
This gives me the derivate $y' = 2A\cos(2x) - 2B\sin(2x)$ and 
The second derivate $y'' = -4A\sin(2x) - 4B\cos(2x)$
If I plug the second derivate and 4 times the equation into the starting problem: 
I get: $-4A\sin(2x) - 4B\cos(2x) + 4[A\sin(2x) + B\cos(2x)] = 4\sin(2x) + 0cos(2x)$
As you can see, I get $0 = 4\sin(2x)$, which is impossible because $0$ is not $4$.
I can't find this problem anywhere, how do I go about solving this problem?
 A: I assume you first found your homogeneous solution.
$$y''+4y=0
\quad\implies\quad
y_h = A\sin 2x + B\cos 2x$$
Your non-homogeneous equation has a forcing term proportional to $\sin 2x$.
$$y''+4y=4\sin 2x$$
You know that guessing a particular solution of the form $y_p=y_h$ makes the LHS zero, which isn't helpful. But you need the $\sin2x$ to appear on the left. The next best thing would be to incorporate a polynomial factor and hope it gets derived away. i.e., your particular solution is anticipated to be
$$y_p = xy_h = x A\sin2x + x B\cos2x$$
Then,
\begin{align}
y_p' &= y_h +2x A\cos2x - 2x B\sin2x
\\
\\
y_p'' &= y_h' +2 A\cos2x - 2 B\sin2x  -4x A\sin2x - 4x B\cos2x
\\
&= 4A\cos2x- 4B\sin2x -4x A\sin2x - 4x B\cos2x
\\
&= 4(A\cos2x- B\sin2x) -4x y_h
\end{align}
Upon substituting the particular solution back into the differential equation,
\begin{align}
4(A\cos2x- B\sin2x) -4xy_h + 4xy_h = 4\sin 2x
\end{align}
we see that $A=0,B=-1$ in the particular solution. Thus $y_p = -x\cos2x$ and
$$y = c_1\sin2x+c_2\cos2x -x\cos2x$$
A: I would go the simple route in the following steps:
$$y''+\alpha y=\beta\sin(\gamma x)$$
$$(D^2+\alpha)y=\beta\sin\gamma x$$
$$(D+i\sqrt{\alpha})(D-i\sqrt{\alpha})y=\beta\sin\gamma x$$
$$y=(D-i\sqrt{\alpha})^{-1}(D+i\sqrt{\alpha})^{-1}\beta\sin\gamma x$$
noting that $$\int e^{ax}\sin(bx)dx=\frac{a\sin(bx)-b\cos(bx)}{a^2+b^2}e^{ax}+C.$$ Simplify the result and the solution is yours.
