Determining the Fourier Series and its convergence Let $ƒ$ denote the function with period 2π, in the range $0≤x≤2π$. The function is given as,
$$f(x)=\begin{cases} x,\quad \mbox{for}\quad 0<x<π \\ 0\quad \mbox{for}\quad π<x<2π \end{cases}$$
I) Determine the fourier series for the given function.
II) Does fourier series converges for all $x\in\mathbb{R}$? And if so, what does it converges towards? 
My Approach
So I have almost solved the first part. I used the following complex method formula to determine the fourierseries. 
$$ \sum _{ n=-\infty  }^{ \infty  }{ c_{ n }\cdot e^{ inx } } $$
Where I found the fourier coefficient using the following equation,
$$c_{ n }=\frac { 1 }{ 2π } \cdot \int _{ -π }^{ π }{ f(x)·e^{ -inx }dx }$$
And I have come to the following expression for the fourier series,
$$f(x)=\sum _{ n=-\infty  }^{ \infty  }{ \left( \frac { \left( -1 \right) ^{ n }i }{ n }  \right)  } ·e^{inx} $$
But I cannot go any further to get the correct real fourier series. Because I have tried using the following method.
$$f(x)=\sum _{ n=-\infty  }^{ \infty  }{ \left( \frac { \left( -1 \right) ^{ n }i }{ n }  \right)  } ·(\cos(nx)+i\sin(nx)) $$
$$f(x)=\sum _{ n=-\infty  }^{ \infty  }{ \left( \frac { \left( -1 \right) ^{ n }i }{ n }  \right) \cdot \cos(nx)  + \left( \frac { \left( -1 \right) ^{ n }i }{ n }  \right) \cdot i\sin(nx)} $$
$$f(x)=\sum _{ n=-\infty  }^{ \infty  }{ \left( \frac { \left( -1 \right) ^{ n }i }{ n }  \right) \cdot \cos(nx)  - \left( \frac { \left( -1 \right) ^{ n } }{ n }  \right) \cdot \sin(nx)} $$
Because I want the real so I removed the $\cos(nx)$ and ended up with the following,
$$f(x)=\sum _{ n=-\infty  }^{ \infty  }{ - \left( \frac { \left( -1 \right) ^{ n } }{ n }  \right) \cdot \sin(nx)} $$
I have no clue what I am doing wrong and I have no clue how I can bring a 2 into the equation. Any help on this will be great.
For II, I can not come up with a method to find the convergence. Any hint on that will be great. Thank you.
 A: I will start with your second question:

Suppose $f$ is a piecewise function in the interval $(-L, L)$. The Fourier series of $f$ will converge to:
  
  
*
  
*The periodic extension of $f$ if the periodic extension is continuous
  
*The average of the two one-sided limits
  if the periodic extension has a jump discontinuity at $x_0$
  $$
\frac{1}{2}\left[f(x_0^+) + f(x_0^-)\right] = \frac{1}{2}\lim_{x\to x_0^+}f(x) + \frac{1}{2}\lim_{x\to x_0^-}f(x) 
$$

Now the first question. There are basically two ways you can periodically extend $f$, you can make it either even or odd.

ODD PERIODIC EXTENSION

Let us define
$$
f_{\rm odd}(x)=\begin{cases} 0\quad \mbox{for}\quad -2\pi < x < -\pi \\ x\quad \mbox{for}\quad -\pi<x<\pi \\ 0\quad \mbox{for}\quad \pi< x <2\pi \end{cases}
$$
Note that $f(x) = f_{\rm odd}(x)$ for $0<x<2\pi$ which is actually the region you care about. Now we calculate the Fourier coefficients, it is important to realize that the period of the function $f_{\rm odd}$ is $4\pi$
$$
b_n = \frac{1}{2\pi}\int_{-2\pi}^{2\pi}dx\; f_{\rm odd}(x) \sin nx/2 = \frac{4 \sin n\pi/2-2 \pi  n \cos n\pi/2}{\pi  n^2}
$$
so that
$$
f_{\rm odd}(x) = \sum_{n=1}^{+\infty}b_n\sin nx/2
$$


EVEN PERIODIC EXTENSION

For this case 
$$
f_{\rm even}(x)=\begin{cases} 0\quad \mbox{for}\quad -2\pi < x < -\pi \\ |x|\quad \mbox{for}\quad -\pi<x<\pi \\ 0\quad \mbox{for}\quad \pi< x <2\pi \end{cases}
$$
and the coefficients are
$$
a_n = \frac{1}{2\pi}\int_{-2\pi}^{2\pi}dx\; f_{\rm even}(x) \cos nx/2 = \begin{cases} 2-4/\pi \quad \mbox{for}\quad n = 0 \\ 2 (\pi  n \sin n\pi/2+2 \cos n\pi/2-2)/(\pi  n^2) \quad \mbox{for}\quad n > 0\end{cases} 
$$
And then
$$
f_{\rm even}(x) = a_0 + \sum_{n=1}^{+\infty}a_n\cos nx/2
$$

