Solution (source code)

= Solution

The <homogeneous solution> is $A\cos2x+B\sin2x$. A trial $C\cos x$ gives the <particular solution> $\cos x/3$. The two initial conditions set $A=-1/3$, $B=0$, giving
$$
\boxed{y(x)=\frac{\cos x-\cos2x}{3}.}
$$