Finding particular solution of an ODE What is the particular solution of the following ODE:
$$y''(t)+y(t)=-\sin{t}|\sin{t}|$$
My idea is to take a Fourier expansion of $|\sin{t}|$ which makes the right side to be
$$-\sin{t}\left[{2\over\pi}-{4\over\pi}\sum_{k=1}^\infty{\cos(2k t)\over 4k^2-1}\right]$$
If so far it's correct, then what to do next?
 A: Not sure that you need to use the Fourier series for this ODE.
For $t \in [0,\pi]$ the equation writes as
$$y^{\prime \prime}(t)+y(t)=-\sin^2{t} = \frac{\cos 2t -1}{2}$$ and a particular solution is
$$y_0(t) = -\frac{1}{2}\left(1 + \frac{1}{3} \cos 2t\right)$$ that you can find using ODE methods by finding a solution that writes as $a \cos 2t +b$.
And the general solution on $[0,\pi]$ is
$$y(t) = A\cos t + B \sin t + y_0(t).$$
You can follow on doing similar things on $[-\pi,0]$ to get global solutions.
A: The right side is odd-symmetric, so that there exists an odd-symmetric solution. To get $y(0)=0$ as required for that symmetry use a term of the general solution so that on $[0,\pi]$
$$\begin{align}
y(t)&=-\frac12\left(1+\frac13\cos(2t)-\frac43\cos(t)\right)
=-\frac12\left(\frac43(1-\cos(t))+\frac13(\cos(2t)-1)\right)
\\
&=-\frac12\left(\frac43\frac{\sin^2(t)}{1+\cos(t)}-\frac23\sin^2(t)\right)
\end{align}$$
Now it is easy to change the sign like the sign of $\sin(t)$
$$
y(t)=-\frac13\sin(t)|\sin(t)|·\frac{1-\cos(t)}{1+\cos(t)}
$$
Note that the roots of the denomitor cancel against the roots of the sine terms, one could also transform that back to
$$
y(t)=-\frac13{\rm sign}(\sin t)·(1-\cos(t))^2
$$
