First, find the complementary solution for the homogenous equation.

\(\displaystyle y'' + y = 0\)

then you need a particular solution which looks like

\(\displaystyle y_p = y_1 v_1 + y_2 v_2\)

where \(\displaystyle y_1 = \cos x\) and \(\displaystyle y_2 = \sin x\)

Calculate the Wronskian [ \(\displaystyle W(y_1,y_2)\) ] of \(\displaystyle y_1\) and \(\displaystyle y_2\)

then

\(\displaystyle v_1 = -\int \frac{y_2 \sin x \cos x}{W(y_1,y_2)} \ dx\)

And

\(\displaystyle v_2 = \int \frac{y_1 \sin x \cos x}{W(y_1,y_2)} \ dx\)

Finally

\(\displaystyle y = y_c + y_p\)