Answer
$y_p(x)=A \cos 4x +B \sin 4x+x(C \cos 2x+D \sin 2x)$
Work Step by Step
We are give that $y''+4y=\cos 4x +\cos 2x$
Consider $G(x)=e^{\alpha x} A(x) \sin mx $ or $G(x)=e^{\beta x} A(x) \cos mx $
The trial solution for the method of undetermined coefficients is defined as:
$y_p(x)=e^{\alpha x} B(x) \sin mx +e^{\beta x} C(x) \cos mx$
Here, we have $m=4, k=2$
Thus, the trial solution for the method of undetermined coefficients is:
$y_{p_1}(x)=A \cos 4x +B \sin 4x; y_{p_2}(x)=C \cos 2x+D \sin 2x$
Hence, $y_p(x)=A \cos 4x +B \sin 4x+x(C \cos 2x+D \sin 2x)$