Integration and differentiation of Fourier series I am interested in the properties of Fourier series under integration and differentiation, and I've noticed a "strange" phenomenon.
Suppose I have a Fourier series which I Integrate, and suppose that I can integrate it term by term.
$$f(x)=a_0+\sum_{n=1}^\infty a_n \cos(nx)+\sum_{n=1}^\infty b_n \sin(nx)$$
$$\int f(x)dx=C+a_0 x+\sum_{n=1}^\infty \frac{a_n}{n} \sin(nx)-\sum_{n=1}^\infty \frac{b_n}{n} \cos(nx) $$
Now because I want the integral to be represented as a Fourier series as well, I use the Fourier series for $x$:
$$x=\sum_{n=1}^\infty \frac{2}{\pi}\frac{(-1)^{n+1}}{n}\sin(nx)$$
So I have:
$$\int f(x)dx=C+\sum_{n=1}^\infty \left(\frac{2a_0}{\pi}\frac{(-1)^{n+1}}{n}+\frac{a_n}{n}\right)\sin(nx)+\sum_{n=1}^\infty \frac{b_n}{n}\cos(nx)$$
My problem is that upon differentiation (term by term), this series does not appear to give back the original Fourier series, as the constant term has been shifted into the cosine terms.
I think my mistake is the step I take converting the $x$ to a Fourier series, because it can't then be differentiated term by term (see this question).
Am I correct? And does this mean the integral of a Fourier series cannot be another Fourier series?
 A: Fourier series (as with infinite series in general) cannot always be term-by-term differentiated. For general series we have the following theorem

Theorem: Term-by-term differentiation: If a series $\sum f_k(x_0)$ converges at some point $x_0\in [a,b]$ and the series of derivatives $g(x) = \sum f_k'(x)$ converges uniformly on $[a,b]$ then the series $f(x) = \sum f_k(x)$ converges uniformly for all $x\in[a,b]$ and $f(x)$ is differentiable with $f'(x) = g(x)$.

Your example fails this theorem dramatically as the derivative of the Fourier series of $x$ do not converge anywhere.
We also have some more specific results. The following theorem gives conditions for which this can be done for Fourier series:

Theorem (Term-by-term differentiation of Fourier series): If $f$ is a piecewise smooth function and if $f$ is also continuous on $[-L,L]$, then the Fourier series of $f$ can be term-by-term differentiated if $f(-L) = f(L)$.

The last condition is not satisfied when the Fourier series has a jump-discontinuity as $x=L$ so we in general we don't expect to be able to term-by-term differentiate a Fourier series that has a jump-discontinuity (thought the theorem does not rule it out). For your example of the Fourier series of $f(x) = x$ the first condition are satisfyed as $f$ is both smooth and continuous on $[-1,1]$ however $f(-1) \not= f(1)$ so the theorem does not apply.
For integration of Fourier series we have the following theorem

Theorem (Term-by-term integration of Fourier series): The Fourier series of a piecewise smooth function $f$ can always be term-by-term integrated to give a convergent series that always
  converges to the integral of $f$ for $x\in[-L,L]$.

Note that the resulting series does not have to be a Fourier series. For example if we have a Fourier series $f(x) = a_0 + \ldots$ with $a_0\not= 0$ then $\int f(x){\rm d}x = a_0x+ \ldots$ and the presence of the $a_0x$ term makes this not be a Fourier series (though for this example one can probably expand $x$ in a Fourier series to get such a series).
The proofs of the theorems above can be found in any good textbook on Fourier series. You can also find them in the following course notes (by P. Laval).
