# Fourier Series of $f$ on the given interval

my goal is to find the Fourier series of f on the given interval:

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

I know there aren't any $\sin(nx)$ in the series but i'm having trouble with the $\cos(nx)$. this is my integral:

$$\frac1\pi\int_0^\pi \sin(x)\cos(nx)=\frac{\cos(nx)+1}{\pi(1-n^2)}=\frac{(-1)^n+1}{\pi(1-n^2)}$$

normaly i simply take the result and put it in the formula yet i don't know how to bring the result to this form:

$$\sum_{i=2}^\infty (\text{something}) \cos(nx)$$

please not it starts from 2 (i never encountered a task which it starts from 2).... any ideas what shall i do next?

• You should edit your first question instead of creating a new essentially identical one. – mrf Aug 14 '13 at 21:54
• i tagged the first to be deleted... why is that important...? i could also reconnect with proxy and new account and you wouldnt know its me. i just need some help i'm not here to stay... if you aren't willing to help it's oki... – jack Aug 14 '13 at 21:57
• How does a person learn to construct arrays in TeX without learning that one can write $\le$ instead of $<=$? ${}\qquad{}$ – Michael Hardy Aug 14 '13 at 21:59
• it took me a lot of time to find the article that explain how to use the tags correctly.. unfortunately <= was not explained there. sorry guys but this site isn't really newbie friendly.. anyhow can we stay focus on the question and laugh on my writing skills later...? – jack Aug 14 '13 at 22:04
• again many thanks... i just wish that math books authors would simply explain the materiel with full detail examples instead of just focusing on theory. i don't know why there are so many exercises that are "left for the reader"... as the author says.. – jack Aug 14 '13 at 22:58

If: $$f(x)=\begin{cases} 0, & \text{if } -\pi < x < 0 \\ \sin(x), & \text{if } 0 \le x < \pi \end{cases}$$ then we find the coefficients as follows \begin{aligned} a_n&=\frac{1}{\pi}\int_{-\pi}^{\pi}\left(\begin{cases} 0, & \text{if } -\pi < x < 0 \\ \sin(x), & \text{if } 0 \le x < \pi \end{cases}\right)\cos(nx){dx},\\ &=\frac{1}{\pi}\int_{0}^{\pi}\sin(x)\cos(nx){dx},\\ &=-{\frac {\cos \left( \pi \,n \right) +1}{\pi \, \left( {n}^{2}-1 \right) }}=-{\frac {(-1)^n +1}{\pi \, \left( {n}^{2}-1 \right) }},\\ =&\begin{cases} 0,& \text{if } n \text{ is odd} \\ {-\frac {2}{\pi \, \left( n^2-1\right) }}, & \text{if } n \text{ is even} \end{cases} \end{aligned} if $n=1$ in the second from last line we would take the limit and see that it is zero; alternatively we could plug $n=1$ in the integral and see that that is zero, but either way we don't need any odd $n$ they are all zero.

Now we check the $b_n$: \begin{aligned} b_n&=\frac{1}{\pi}\int_{-\pi}^{\pi}\left(\begin{cases} 0, & \text{if } -\pi < x < 0 \\ \sin(x), & \text{if } 0 \le x < \pi \end{cases}\right)\sin(nx){dx},\\ &=\frac{1}{\pi}\int_{0}^{\pi}\sin(x)\sin(nx){dx},\\ &=-{\frac {\sin \left( \pi \,n \right) }{\pi \, \left( {n}^{2}-1 \right) }},\\ =&\begin{cases} 0,& \text{if } n\ne 1 \\ -1/2 & \text{if } n=1 \end{cases} \end{aligned} so we have to be careful there, we either take the limit when $n\rightarrow1$ or put $n=1$ in the integral but we do need one of the $sin$ terms. We then have: \begin{aligned} f(x)&=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n \cos(nx)+b_n\sin(nx),\\ &=\frac{1}{\pi}+\frac{\sin(x)}{2}-\sum_{n=1}^{\infty}{\frac {2}{\pi \, \left( 4n^2-1\right) }} \cos(2nx). \end{aligned}