Coefficient calculation on Fourier series !?

283 Views Asked by At

in a Fourier series for function $$f(x)=\begin{cases}-1&\text{for }-\pi<x<0\\\sin x&\text{for }0<x<\pi\end{cases}$$ with $f(x)=f(x+ 2 \pi)$, is $f(x)= \dfrac{a_0}{2}+ \sum\limits_{n=1}^{ \infty}(a_n \cos nx+b_n \sin nx) $. we have:

$a_n=0, n=2k+1; b_n=0, n=2k$

I get stuck in this problem. How this coefficient was calculated?‌ a bit more explanation was highly appreciated.

2

There are 2 best solutions below

1
On

Here's my attempt: I'm not sure I get those answers either - are you sure they are right?

The formula for $a_{n}, b_{n}$ are: $$a_{n} = \frac{1}{L} \int\limits_{-L}^L f(x)cos(\frac{n\pi x}{L})dx $$ $$b_{n} = \frac{1}{L} \int\limits_{-L}^L f(x)sin(\frac{n\pi x}{L})dx $$

Since L is half the period, L = $\pi$ in this example.

$$ f(x) = \begin{cases} -1 & \text{if } -\pi< x < 0 \\ sin(x) & \text{if } 0 < x < pi \end{cases} $$

Then

$$a_{n} = \frac{1}{\pi} (\int\limits_{-\pi}^{0}-1cos(nx)dx + \int\limits_{0}^{\pi}sin(x)cos(nx) dx) = \frac{1}{\pi} \int\limits_{0}^{\pi}sin(x)cos(nx) dx = \frac{1}{\pi} \frac{cos(n\pi)+1}{1-n^2}$$

$$b_{n} = \frac{1}{\pi} (\int\limits_{-\pi}^{0}-1sin(nx)dx + \int\limits_{0}^{\pi}sin(x)sin(nx) dx)=\frac{1}{\pi} (\frac{cos(nx)}{n}|_{-\pi}^{0} + \frac{\pi}{2}) = \frac{1}{\pi} (\frac{1-(-1)^n}{n}+\frac{\pi}{2}) $$

8
On

The function is defined on the interval $(- \pi, 0) \cup (0,\pi)$, which means that the length of the interval (which happens to be the period) is $\boxed{L = 2\pi}$. We know that: $$\displaystyle a_n= \dfrac 2L \cdot \int_{-\pi}^{\pi} f(x)\cdot \cos\left(\dfrac{2n\pi x} L\right) \,dx.$$


However,

$$\displaystyle \int_{-\pi}^0 -1\cdot \cos (nx)\,dx = -\dfrac{\sin(n\pi)}\pi=0, \quad \text{since $n$ is an integer}.$$

How to compute $$\displaystyle \int_0^\pi \sin x \cdot \cos (nx)\, dx.$$

Integrals of the form $$\displaystyle \int \sin (\alpha x)\cdot \cos (\beta x)\,dx$$ are evaluated using the formula: $$\boxed{2 \sin\alpha \cos \beta = \sin(\alpha+\beta) +\sin(\alpha - \beta)}.$$

Thus, we have:

$\displaystyle \int_0^\pi \sin x \cos(nx)\,dx = \dfrac 12 \int_0^\pi 2 \sin x \cos (nx)\,dx =\displaystyle\dfrac 12 \int_0^\pi \sin(x+nx) + \sin(x-nx) \, dx\\ =\displaystyle\dfrac 12 \int_0^\pi \sin[(n+1) x]\, dx + \dfrac 12 \int_0^\pi \sin[(1-n)x]\, dx\\ =-\displaystyle\dfrac 12 \cdot \left[\dfrac {\cos[(n+1)x]}{n+1}\right]_0^\pi -\dfrac 12 \cdot \left[\dfrac{\cos[(1-n)x]}{1-n}\right]_0^\pi\\ = \cdots\\ = \dfrac 12 \cdot \left(\dfrac{n-1}{n^2 -1} - \dfrac{(n-1) \cos[(n+1) \pi]}{n^2-1} - \dfrac{(n+1)\cos[(1-n)\pi]}{1-n^2} + \dfrac{n+1}{1-n^2}\right)\\ = \dfrac 12 \cdot \dfrac{2 + (n-1) \cos[(n+1)\pi] - (n+1) \cos[(n-1)\pi]}{1-n^2}\\ =\dfrac 12 \cdot \dfrac {2 - 2\cos[(n+1)\pi]}{1-n^2}, \quad\text{because $\cos[(n+1)\pi] = \cos[(n-1)\pi]$, for $n\geqslant 1$}\\ = \dfrac 12 \cdot \dfrac{1 - \cos[(n+1) \pi]} {1-n^2}\\ = \dfrac {1+\cos(n\pi)}{1-n^2}, \quad \text{because $\cos[(n+1)\pi] = -\cos(n\pi)$}. $

Also, I used the fact that $\cos[(n-1) \pi ] = \cos [(1-n)\pi]$.

Thus, $$a_n = \dfrac 2 {2\pi} \cdot \dfrac{1+\cos(n\pi)}{1-n^2}.$$

For $b_n$ you will need to evaluate $\displaystyle \int \sin x \sin(nx)\, dx$. Thus, you will need to use the identity $$\boxed{2 \sin\alpha \sin \beta = \cos(\alpha - \beta) - \cos(\alpha +\beta)}.$$

P.S. I cannot do all the math, since the answer is going to be too long!