- Find the Fourier coefficients of $ f(x)= \begin{cases} \cos x, \pi >x\geq 0\\ -\cos x, -\pi<x<0 \\ \end{cases} $
When $x\in (-\pi,\pi)$
What is the value of the series at $x=0$
does the series of coefficients absolute convergent?
So we have
$a_0=\frac{1}{\pi}\int _{-\pi}^{\pi}f(x)dx$
$a_n=\frac{1}{\pi}\int _{-\pi}^{\pi}f(x)\cos(nx)dx$
$b_n=\frac{1}{\pi}\int _{-\pi}^{\pi}f(x)\sin(nx)dx$
We have that for $-\pi<x<0$ the function $f(x)$ is odd, while for $0<x<\pi$ the function $f(x)$ is even.
$a_0=\frac{1}{\pi}\int _{-\pi}^{\pi}f(x)dx=\frac{1}{\pi}\int _{-\pi}^{0}-\cos xdx+\frac{1}{\pi}\int _{0}^{\pi}\cos xdx=\frac{1}{\pi}(-sinx|^{0}_{-\pi}+\sin x|^{\pi}_0)=\\=\frac{1}{\pi}(-0+0+0-0)=0$
$a_n=\frac{1}{\pi}\int _{-\pi}^{\pi}f(x)\cos(nx)dx=\frac{1}{\pi}\int _{-\pi}^{0}-\cos x\cos(nx)dx+\frac{1}{\pi}\int _{0}^{\pi}\cos x\cos(nx)dx$
Using $\cos \alpha*\cos \beta=\frac{1}{2}(cos(\alpha+\beta)+\cos(\alpha-\beta))$ we get
$$\frac{1}{\pi}\int _{-\pi}^{0}-\cos x\cos(nx)dx+\frac{1}{\pi}\int _{0}^{\pi}\cos x\cos(nx)dx=\\=-\frac{1}{2\pi}\int _{-\pi}^{0}\cos((n+1)x)+\cos((n-1)x)dx+\frac{1}{2\pi}\int _{0}^{\pi}\cos((n+1)x)+\cos((n-1)x)dx=\\=-\frac{1}{2\pi}[\frac{sin ((n-1)x)}{n-1}+\frac{sin ((n+1)x)}{n+1}]_{-\pi}^{0}+\frac{1}{2\pi}[\frac{sin ((n-1)x)}{n-1}+\frac{sin ((n+1)x)}{n+1}]_{0}^{\pi}$$
But $\sin(0)=\sin(k\pi)=0$ for all $k\in \mathbb{N}$
So $a_n=0$
$$b_n=\frac{1}{\pi}\int _{-\pi}^{0}-\cos x\sin(nx)dx+\frac{1}{\pi}\int _{0}^{\pi}\cos x\sin(nx)dx=\\=-\frac{1}{\pi}\int _{-\pi}^{0}\cos x\sin(nx)dx+\frac{1}{\pi}\int _{0}^{\pi}\cos x\sin(nx)dx$$
Using $\sin (\alpha)*\cos (\beta)=\frac{1}{2}(\sin(\alpha+\beta)+\sin(\alpha-\beta))$
$$=-\frac{1}{\pi}\int _{-\pi}^{0}\cos x\sin(nx)dx+\frac{1}{\pi}\int _{0}^{\pi}\cos x\sin(nx)dx=\\=-\frac{1}{2 \pi}\int _{-\pi}^{0}\sin((n+1)x)+\sin((n-1)x)dx+\frac{1}{2 \pi}\int _{0}^{\pi}\sin((n+1)x)+\sin((n-1)x)dx=\\=\frac{1}{2 \pi}[\frac{\cos((n+1)x)}{n+1}+\frac{\cos((n-1)x)}{n-1}]_{-\pi}^0-\frac{1}{2 \pi}[\frac{\cos((n+1)x)}{n+1}+\frac{\cos((n-1)x)}{n-1}]_{0}^{\pi}=\\= \frac{1}{2\pi}(\frac{1}{n+1}+\frac{1}{n-1}-(\frac{(-1)^n}{n+1}+\frac{(-1)^n}{n-1}))-\frac{1}{2\pi}(\frac{(-1)^n}{n+1}+\frac{(-1)^n}{n-1}-\frac{1}{n+1}-\frac{1}{n-1})=\frac{2n}{\pi(n^2-1)}-\frac{2n(-1)^n}{\pi(n^2-1)}$$
Because we are left only with $f(x)~b_n\ sin(nx)$ at $x=0$ we have $f(x)~0$
Can we say that
$$\mid\sum\frac{2n}{\pi(n^2-1)}-\frac{2n(-1)^n}{\pi(n^2-1)}\mid\sim\sum\frac{2}{n}$$ which does not converge
Are the answers corrects? can we do the calculations shorter?
There seems to be a minor mistake as $[\cos((n+1)x]_0^\pi=(-1)^{n{ \color{red}{+1}}}-1$ (and the same for $n-1$). But the rest of the calculation seems correct.
You can do the calculation shorter by noticing that $\tilde{f}$ is odd (as a remark being odd or even is a global property of a function, a function cannot be odd on an interval), where $\tilde{f}(x)=f(x)$ for $x \neq 0$ and $\tilde{f}(0)0$.
As $\tilde{f}=f$ almost everywhere these two functions have the same Fourier coeeficients so $a_n=0$, $\forall n \geq 0$.
And using once again the fact that $\tilde{f}$ is odd you have $$b_n= 2 \frac{1}{\pi} \int_0^\pi \cos(x) \sin(nx) dx = \frac{2}{\pi} \frac{n(1+(-1)^n)}{n^2-1}$$
The points 2 and 3 are also corrects.