# How to solve differential equation $y''=y$ by Fourier series?

How can I solve differential equation $$y''=y$$ by Fourier series when $$y(0)=0$$ and $$y'(0)=-2$$?

First, I consider the Fourier series $$y=\frac{a_0}{2}+\sum_{n=1}^{\infty}(a_n \cos nx+\sin nx)$$, then I get $$y''=\sum_{n=1}^{\infty}(-n^2 a_n \sin nx -n^2 b_n \cos nx)$$. After that I have $$\frac{a_0}{2}+\sum_{n=1}^{\infty}(a_n \cos nx+\sin nx)=\sum_{n=1}^{\infty}(-n^2 a_n \sin nx -n^2 b_n \cos nx)$$.

But now I don't know what to do for obtaining $$a_n$$ and $$b_n$$.

• Are you sure the DE is $y''=y$. If it is $y''=-y$ then you can get a solution in terms of sine ans cosine functions. – Kavi Rama Murthy Oct 25 '19 at 5:30

This DE does not have a periodic solution valid on $$\mathbb R$$, so this method fails. The actual solutions is $$e^{-x}-e^{x}$$