So I am learning how to do Fourier series expansions by writing the function expression from given graphs:
- To find the series, we calculate $A_{0}, A_{n}$ and $B_{n}$ and plug those values in the main Fourier series formula and get a few trigonometric components expansions.
- However, the problem I am facing is both my $A_{n}$ and $B_{n}$ come to $0$ after doing the integration which is unusual.
- I have written the function below with the limits I am using in the math and also attached a photo of the figure. $$ \operatorname{f}\left(x\right) = \left\{\begin{array}{lcl} {\displaystyle x + \pi} & \mbox{if} & {\displaystyle -\pi < x < 0} \\[1mm] {\displaystyle \pi - x} & \mbox{if} & {\displaystyle \phantom{-}0 < x < \pi} \end{array}\right. $$ I would really appreciate it if anyone solve this math/tell me what am I doing wrong. Thank you.
You are mostly likely doing the integration wrong. Don't rush it because its a easy integral. Notice its a even function, so its Fourier series is a cosine series, and its enough to calculate over $(0,\pi)$, i.e. $$a_n=\frac{1}{\pi} \int_{-\pi}^{\pi} f(x)\cos(nx) dx = \frac{2}{\pi} \int_{0}^{\pi} f(x)\cos(nx) dx$$
and this integral is not zero.