The characteristic solution follows from solving the characteristic equation,
[tex]r^2+4=0\implies r=\pm2i[/tex]
so that
[tex]y_c=C_1\cos2x+C_2\sin2x[/tex]
A guess for the particular solution may be [tex]a\cos2x+b\sin2x[/tex], but this is already contained within the characteristic solution. We require a set of linearly independent solutions, so we can look to
[tex]y_p=ax\cos2x+bx\sin2x[/tex]
which has second derivative
[tex]{y_p}''=(-4ax+4b)\cos2x+(-4bx-4a)\sin2x[/tex]
Substituting into the ODE, you have
[tex]y''+4y=\cos2x+\sin2x[/tex]
[tex]\implies4b\cos2x-4a\sin2x=\cos2x+\sin2x[/tex]
[tex]\implies\begin{cases}4b=1\\-4a=1\end{cases}\implies a=-\dfrac14,b=\dfrac14[/tex]
Therefore the particular solution is
[tex]y_p=-\dfrac14x\cos2x+\dfrac14x\sin2x[/tex]
Note that you could have made a more precise guess of
[tex]y_p=(a_1x+a_0)\cos2x+(b_1x+b_0)\sin2x[/tex]
but, of course, any solution of the form [tex]a_0\cos2x+b_0\sin2x[/tex] is already accounted for within [tex]y_c[/tex].