I am having trouble finding the complex Fourier series of $f(x) = x$ and using that complex series to find 1)the real Fourier series of $f(x)$ and 2) the complex and real Fourier series of $h(x) = x^2$.
$$
f(x) = x , -\pi < x < \pi
$$
$$
f(x) = \sum_{n = -\infty}^{\infty} C_n e^{-inx}
$$
where
$$
C_n = \frac{1}{2\pi}\int_{-\pi}^{\pi} f(x) e^{-inx} dx
$$
Attempt: for $n \neq 0$:
$$
C_n = \frac{1}{2\pi}\int_{-\pi}^{\pi} xe^{-inx} dx
$$
$$
C_n = \frac{1}{2\pi} \left[ -\frac{x}{in}e^{-inx} \right]_{-\pi}^{\pi} – \frac{1} {2\pi}\left[ \frac{1}{i^2 n^2} e^{-inx} \right]_{-\pi}^{\pi}
$$
$$
C_n = -\frac{1}{2in} \left( e^{-in\pi} + e^{in\pi} \right) + \frac{1}{2\pi n^2} \left( e^{-in\pi} – e^{in\pi} \right)
$$
$$
C_n = \frac{i}{n}(-1)^n – \frac{i}{\pi n^2 } \sin(n \pi )
$$
$$
\Rightarrow f = \sum_{n = -\infty}^{\infty} \left( \frac{i}{n}(-1)^n – \frac{i}{\pi n^2 } \sin(n \pi )\right)e^{-inx}
$$
Is this $f(x)$ correct? How would I get the real and complex series of $h(x)$ from this? I know to get the real series of f(x) we normally can break the sum into
$$
f = \sum_{n = 1}^{\infty} \left[ \left( \frac{i}{n}(-1)^n – \frac{i}{\pi n^2 } \sin(n \pi )\right)e^{-inx} + \left( \frac{i}{-n}(-1)^{-n} + \frac{i}{\pi n^2 } \sin(n \pi )\right)e^{inx} \right]
$$
which gives
$$
f(x) = -\frac{ 2\sin(nx) }{n}\left[ (-1)^n + \frac{\sin(n \pi)}{\pi n}\right]
$$
so the real series of $h(x)$ could possibly be computed by evaluating the lengthy $f^2$ expression but is this the only way? How do I then evaluate the complex Fourier series of $h$.
UPDATE :
$\sin(n \pi) = 0$ ( Don't know why I couldn't notice this before) so,
$$
f(x) = \sum_{n = 1}^{\infty} -\frac{2(-1)^n \sin(nx) }{n}
$$
notice that
$$
h(x) = 2 \int_0^x f(\gamma) d\gamma
$$
$$
h = 2 \int_0^x \sum_{n = 1}^{\infty} -\frac{2(-1)^{n} \sin(n \gamma) }{n} d\gamma
$$
$$
h = \int_0^x \sum_{n = 1}^{\infty} -\frac{4(-1)^{n} \sin(n \gamma) }{n} d\gamma
$$
$$
h = \sum_{n = 1}^{\infty} \frac{4(-1)^{n} ( \cos(nx) – 1 )}{n^2}
$$
Constant term is
$$
\sum_{n = 1}^{\infty} \frac{4(-1)^{n+1}}{n^2}
$$
Don't know how this can be shown to equaivalent to $\frac{\pi ^2}{3}$
Best Answer
Note that $\sin(n\pi)=0$, so your coefficients are simply $$C_n = \frac{i}{n}(-1)^n,\quad n\neq 0$$ which results in
$$f(x) = -2\sum_{n=1}^{\infty}\frac{(-1)^n}{n}\sin(nx)$$
Just a hint concerning the coefficients $D_n$ of $h(x)$: First, note that $D_0\neq 0$ because $h(x)\ge 0$. Second, note that $h(x)$ is even, so its series will only have cosine terms. The cosine coefficients will turn out to be
$$a_n = 4 \frac{(-1)^n}{n^2},\quad n=1,2,\ldots$$ Try to verify this result yourself.