Solve this nonhomegenous ode $y''+4y = \cos(2x)$ Solve the given nonhomogenous linear ODE by variation of parameters or undetermined coefficients $y'' + 4y = \cos(2x)$.
A general solution is $y_1 = \cos(2x), y_2 = \sin(2x)$, and the Wronksin determinant is equal to 2.
Plugging this into the equation for the method of variation of parameters, I get
$$-\cos(2x)\int\frac{\sin(2x)\cos(2x)}{2}dx + \sin(2x)\int\frac{\cos^2(2x)}{2}dx$$
The integrals cancel out to $0$. How can I approach this correctly with the method proposed?
 A: As $2i$ is a simple root of the characteristic equation of the l.h.s., a particular solution of the non-homogeneous equation has the form
$$y_0(x)=Ax\cos 2x+Bx\sin 2x$$
whence
\begin{align}
y'_0(x)&=A\cos 2x-2Ax\sin 2x+B\sin 2x+2Bx\cos 2x \\
&= (A+2Bx)\cos 2x+(B-2Ax)\sin 2x,\\
y''_0(x)&=4(B-A)\cos 2x-4(A+Bx)\sin 2x.
\end{align}
Can you proceed?
A: Then by variation of parameters we have the particular solution is given by
$$y_p=\cos(2x)u_{1}+\sin(2x)u_{2}$$
where
$$u_{1}=-\frac{1}{2}\int \cos(2x)\sin(2x){\rm d}x=\frac{1}{16}\cos(4x)$$
and
$$u_{2}=\frac{1}{2}\int \cos(2x)\cos(2x){\rm d}x=\frac{x}{4}+\frac{\sin(4x)}{16}.$$
Simplify, we have the general solution
$$y=c_{1}\cos(2x)+c_{2}\sin(2x)+\frac{1}{4}x\sin(2x). $$
A: Null space solution
$m^2 +4 =0$
$\implies m=\pm 2i$
Hence,  $ y_N = C_1 \sin 2x + C_2 \cos 2x$.
Since, $\cos2x$ already in null space solution, take particular integral as $$y_p =x(A \sin 2x +B \cos 2x) $$
Then, \begin{align}  y'_p &{=A \sin 2x +B \cos 2x +2x(A \cos 2x -B \sin 2x )}\\ ​\end{align}
$y''_p =4A \cos 2x -4B \sin 2x -4x(A\sin 2x + B \cos 2x )$
$$y''_p +4y'_p = \cos 2x$$
\begin{align} {4A\cos 2x -4B\sin 2x -4x(A\sin 2x + B\cos 2x )+4x(A \sin 2x +B \cos 2x) =\cos 2x } \end{align}
$4A\cos 2x -4B\sin 2x= \cos 2x$
$4A=1$ , $4B=0$
$A=1/4$ , $B=0$
Hence, $y_p = \frac {1}{4}{x\sin 2x }$
So, $$y_\text{complete} =y_N + y_p$$
$$y_\text{complete}=C_1\sin 2x + C_2\cos 2x +  \frac {1}{4}{x \sin 2x }$$
A: $$y''+4y = \cos(2x)$$
Since $\cos (2x)$ is even you need $y_p$ to be even too, so you only need:
$$y_p=Ax \sin (2x)$$
