How to solve this equation by Fourier series? $$  y''+3y=\sin ^4 x ,\quad y=\frac{1}{8} +\frac{\cos2x}{2}-\frac{\cos4x}{104}.$$
Now the text book states the solution, but I don't know the process of solving this equation. I need  your help!
 A: To go along with @RonGordon's solution, we can:


*

*Solve for the homogeneous solution

*Solve using Fourier Series for the particular solution

*Write $y = y_h + y_p$


For 1., we have:
$$m^2 + 3  = 0 \rightarrow m_{1,2} = \pm i \sqrt{3}$$
For 2., we can write the Fourier Series of $(\sin x)^4$ as:
$$\displaystyle (\sin x)^4 = \frac{3}{8} -\frac{1}{4} e^{-2 i x}-\frac{1}{4} e^{2 i x} +\frac{1}{16} e^{-4 i x}+ \frac{1}{16} e^{4 i x}$$
What you would do now, is to solve three particular solution problems (you just can easily see the forms of the exponentials):


*

*$\displaystyle y''+3y = \frac{3}{8}$

*$\displaystyle y''+3y = -\frac{1}{4} e^{-2 i x}-\frac{1}{4} e^{2 i x} = -\frac{1}{2} \cos 2x$

*$\displaystyle y''+3y = -\frac{1}{16} e^{-4 i x}-\frac{1}{16} e^{4 i x} = \frac{1}{8} \cos 4x$


Of course, this leads to Ron's solution for $y_p$.
For 3., we write:
$$y(x) = c_2 \sin \sqrt 3x + c_1 \cos \sqrt 3 x+\frac{1}{2} \cos 2 x - \frac{1}{104} \cos 4 x + \frac{1}{8}$$
A: The first thing you should do is express $\sin^4{x}$ in terms of cosines:
$$\begin{align}\sin^4{x} &= \left ( \frac{1-\cos{2 x}}{2} \right )^2\\ &= \frac{1}{4} - \frac{1}{2} \cos{2 x} + \frac{1}{4} \cos^2{2 x}\\ &= \frac{1}{4} - \frac{1}{2} \cos{2 x} + \frac{1}{4} \left (\frac{1+\cos{4 x}}{2} \right )\\ &= \frac38 - \frac{1}{2} \cos{2 x} + \frac18 \cos{4 x}\end{align}$$
Because $y'' + 3 y$ is a linear differential expression, it follows that the solution to the above equation must be a linear combination of $1$, $\cos{2 x}$, and $\cos{4 x}$:
$$y(x) = a_0 + a_2 \cos{2 x} + a_4 \cos{4 x}$$
Plug this into the differential expression:
$$y'' + 3 y = 3 a_0 - a_2 \cos{2 x} - 13 a_4 \cos{4 x} = \frac38 - \frac{1}{2} \cos{2 x} + \frac18 \cos{4 x}$$
Equating the coefficients of $1$, $\cos{2 x}$, and $\cos{4 x}$, we get the stated result.
