Fourier series for $f(x)=(\pi -x)/2$

I need to find the Fourier series for $$f(x)=\frac{\pi -x}{2}, 0<x<2\pi$$

Since the interval isn't symmetric over $0$, I guess I need to consider $f$'s periodic extension to $\mathbb R$. let's call it $g$. Then $$g(x)=\begin{cases}\frac{\pi -x}{2}, \text{ if } 0<x<\pi\\ \frac{-\pi -x}{2}, \text{ if }{-\pi <x<0}\end{cases}$$

Due to $g$ being odd, the fourier coefficients $a_n$ are all $0$.

And $$b_n=\frac{2}{\pi}\int _0^\pi g(x)\sin(nx)dx=\frac{1}{\pi}\int _0^\pi (x-\pi)\sin (nx)dx$$ According to wolfram alpha $b_n=1/n$ so the Fourier series is $$\sum _{n=1}^{+\infty}\frac{\sin(kx)}{n}$$

But when I check the result of $x=1/2$ I get this which seems to diverge. It also fails for $x=\pi /2$ and a few other $x$'s.

What am I doing wrong?

I just saw this question. it looks like my answer is correct. am I doing anything wrong in my verification?

EDIT: I realised I forgot to divide by $\pi$. I fixed that but it still doesn't work. I also updated the links.

-

You forgot to divide by $\pi$. WolramAlpha's result is correct, but the coefficients $b_n$ are given by $$b_n=\frac{1}{n}$$

Your second formula for the series in WolframAlpha is wrong, you should divide by $k$, not multiply. Then everything should be fine: WolframAlpha

-
sorry for the trouble. thank you –  anonymous May 29 '13 at 8:17
Should work now. You series definition in WolframAlpha is wrong (see answer above). –  Matt L. May 29 '13 at 8:19
thank you very much –  anonymous May 29 '13 at 8:23
@anonymous: if the answer appeared to be helpful, don't forget to upvote it - that is to click on the upgoing double arrow to the left of the answer's body. –  Ilya May 29 '13 at 8:48

First of all, you should not extend $f$ if you want the result to have period $2\pi$, which is equal to the domain on which the function definition is given. There is no reason why you would want $f$ to be symmetric over $0$.

What you did to obtain $g$ was not extension. An extension should make the domain bigger while staying unchanged in the given domain.

Edit: I realize there's nothing seriously wrong with the computation. It was the terminology that confused me. The computation just had a minor error, and that was pointed out by Matt in the other answer.

Anyway, integrals in the formulas for coefficients of Fourier series do not need to be symmetric. The domain of integration can start anywhere, as long as it covers one period.

-
In my notes it only makes sense to find the fourier series if the domain is symmetric. and how come I got the same series as the other question? I'll address the other points after I think about them –  anonymous May 29 '13 at 8:15
I just did a drawing of the graphs and I think $g$ is a $2\pi$-period extension of $f$ and that they are equal in $]\pi, 2\pi[$. –  anonymous May 29 '13 at 8:20
I guess I read it wrong. It was the term "extension" that triggered my mind that something was fishy. –  Tunococ May 29 '13 at 8:24
thank you for your effort –  anonymous May 29 '13 at 8:25
regarding the domain of integration, I can understand that. thank you. it's just that in my notes it always is symmetric so I should keep up with that –  anonymous May 29 '13 at 8:27