[Math] Expanding Fourier Series of $f(x)=\pi-x$ where $0

fourier seriesfunctionssignal processingspecial functions

Please help me solve this Fourier series and correct my solution if it is wrong. it's a non-periodic function which we need to write its Fourier series (even and odd) :

$
f(x)=\pi – x
$
;
$
0<x<\pi
$

I have reached cosine extension(even) as follows:

$
\phi(x)= \begin{cases} \text{$\pi-x$ ; $0<x<\pi$},\\ \text{$x-\pi$ ; $-\pi<x<0$} \end{cases}
$

My result was $a_{0}=\pi$ and

$
a_{n}= \begin{cases} \text{$\dfrac{-4}{\pi n^2}$ ; if $n$ is even}\\\text{0 ; if $n$ is odd} \end{cases}
$

and I have found follows for sinus extension(odd) :

$
\phi(x)= \begin{cases} \text{$\pi-x$ where : $0<x<\pi$},\\ \text{$-\pi-x$ where : $-\pi<x<0$} \end{cases}
$

$a_{0}=0$ and $b_{n}=\dfrac{-2}{n}$ .

I would appreciate if put your solution as "answer".

Best Answer

$a_0=\frac{4}{T}\int_{0}^\frac{T}{2}f(x)=\frac{4}{2\pi}\int_{0}^\pi \pi-x=\pi x-\frac{x^2}{2}|_0^\pi=\pi$

$$a_n=\frac{4}{T}\int_{0}^\frac{T}{2}f(x)\cos\frac{2\pi nt}{T} =\frac{4}{2\pi}\int_{0}^\pi (\pi-x)\cos nx=\frac{2}{\pi}(\frac{\pi}{n}\sin nt-\frac{x}{n}\sin nt+\frac{1}{n^2}\cos nt)|_0^\pi=\frac{2}{n^2\pi}((-1)^n-1)$$ so $a_n=\dfrac{-4}{\pi n^2}$ for even $n$ and $0$ for odd $n$.

for $\sin$

$$b_n=\frac{4}{T}\int_{0}^\frac{T}{2}f(x)\sin\frac{2\pi nt}{T} =\frac{2}{n}$$

Related Question