Expand the given function in an appropriate cosine or sine series. (Fourier series)

1.7k Views Asked by At

$$f(x) = \begin{cases} x-1, \quad& -\pi < x <0 \\ x+1, & 0 \leq x \leq \pi \end{cases}$$

This is odd so we expand with an odd series

$$b_n = \frac{2}{\pi} \int_{0}^{\pi} (x+1) \sin(nx) \,\mathrm{d}x.$$

Question: Isn't $L = \pi$ so where does the $2$ come from? Also how do I know whether to use $x+1$ or $x-1$?

2

There are 2 best solutions below

0
On BEST ANSWER

If your function $f$ is odd, then the formula is $$b_n = \frac{\color{blue}{2}}{L}\int_0^L f(x)\sin\left(\frac{n\pi x}{L}\right)\, dx,$$ so this is why there is $2$.

The reason this formula has a $2$ is that the integrand is even when $f$ is odd, so the usual formula $b_n = \frac{1}{L}\int_{-L}^L f(x)\sin\left(\frac{n\pi x}{L}\right)\, dx$ gives us the above one. (Remember that $\int_{-a}^a g(x)\, dx = 2\int_0^a g(x)\, dx $ if the integrand is even.)

In this formula, you are integrating on the interval $[0,L]$, so you use the formula for $f(x)$ that is valid on $[0,L]$. In your case (with $L=\pi$), this means you use $f(x)=x+1$ for the integral.

0
On

You have that

$$\begin{align}b_n :=&\frac1{\pi} \int_{-\pi}^{\pi} f(x) \sin(nx) dx\\=&\frac1{\pi} \int_{-\pi}^0 f(x) \sin(nx) dx+\frac1{\pi} \int_0^{\pi} f(x) \sin(nx) dx\\ =&-\frac1{\pi} \int_{0}^{-\pi} f(x) \sin(nx) dx +\frac1{\pi} \int_{0}^{\pi} f(x) \sin(nx) dx\end{align}$$

Now in your case note that $f$ is odd, that is $f(-x)=-f(x)$, and also that $\sin(-nx)=-\sin(nx)$. Then with the change of variable $x=-t$ on the first integral you get

$$-\frac1{\pi} \int_{0}^{-\pi} f(x) \sin(nx) dx=-\frac1{\pi} \int_{0}^{\pi} f(-t) \sin(-nt)(- dt)=\frac1{\pi} \int_{0}^{\pi} f(t) \sin(nt) dt$$