Fourier series expansion - An and Bn both coming to 0

1k Views Asked by At

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.

Graph:

2

There are 2 best solutions below

1
On

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.

3
On

$$ \operatorname{f}\left(x\right) = a_{0} + \sum_{n = 1}^{\infty}a_{n}\cos\left(nx\right) $$


\begin{align} &\overbrace{% \int_{-\pi}^{\pi}\operatorname{f}\left(x\right)\,\mathrm{d}x} ^{\displaystyle \pi^{2}}\ =\ a_{0}\ \overbrace{\int_{-\pi}^{\pi}\mathrm{d}x}^{\displaystyle 2\pi}\ +\ \overbrace{\int_{-\pi}^{\pi}\sum_{n = 1}^{\infty}a_{n}\cos\left(nx\right)\,\mathrm{d}x} ^{\displaystyle 0} \\ &\ \implies \bbox[10px,border:1px ridge navy]{a_{0} = {\pi \over 2}} \\ & \end{align}
\begin{align} &\overbrace{% {1 \over \pi} \int_{\pi}^{\pi}\operatorname{f}\left(x\right) \cos\left(nx\right)\,\mathrm{d}x} ^{\displaystyle {2 \over \pi}{1 - \left(-1\right)^{n} \over n^{2}}} = a_{0}\,{1 \over \pi}\ \overbrace{\int_{\pi}^{\pi} \cos\left(nx\right)\,\mathrm{d}x}^{\displaystyle 0}\ \\ + &\ \overbrace{{1 \over \pi}\int_{-\pi}^{\pi}\cos\left(nx\right)\sum_{m = 1}^{\infty}a_{m}\cos\left(mx\right)\,\mathrm{d}x} ^{\displaystyle a_{n}} \\[5mm] &\ \implies \bbox[10px,border:1px ridge navy]{\left. \vphantom{\Large A}a_{n}\,\right\vert_{n\ \geq\ 1} = {2 \over \pi}{1 - \left(-1\right)^{n} \over n^{2}}} \\ & \end{align}
$$ \bbox[10px,border:1px ridge navy]{\operatorname{f}\left(x\right) = {\pi \over 2} + {4 \over \pi}\sum_{n = 0}^{\infty} {\cos\left(\left[2n + 1\right]x\right) \over \left(2n + 1\right)^{2}}} \\ $$