# Fourier Series of $f(x) = x$

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}$

-
Regardless of whether this is right or not, you might want to pay some attention to the value of $\sin n\pi$ when $n$ is an integer, and also be a little more careful about what happens when $n=0$ – Mark Bennet Apr 27 '13 at 10:27
Regarding your last sentence see my edit. – Américo Tavares Apr 28 '13 at 21:49

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.

-
+1 Concise and focused answer. – Américo Tavares Apr 27 '13 at 11:26
Managed to find a_n, but how do I find the constant term of the h(x) expression? – KillaKem Apr 27 '13 at 11:56
$D_0 = \frac{1}{2\pi}\int_{-\pi}^{\pi}h(x)dx=\frac{1}{\pi}\int_{0}^{\pi}x^2 dx=\frac{\pi^2}{3}$. – Matt L. Apr 27 '13 at 12:03
The value will be $D_0 = \sum_{n = 1}^{\infty} \frac{4(-1)^{n+1}}{n^2}$ but is there a way to continue from there to evaluate the actual constant? – KillaKem Apr 27 '13 at 12:12
Thank you! I don't know why I didn't think of that – KillaKem Apr 27 '13 at 12:14

An alternative approach.

1. Since the Fourier trigonometric series expansion is given by $$\begin{eqnarray*} f(x) &=&\frac{a_{0}}{2}+\sum_{n=1}^{\infty }\left( a_{n}\cos nx+b_{n}\sin nx\right) \\ a_{n} &=&\frac{1}{\pi }\int_{-\pi }^{\pi }f(x)\cos nx,\qquad n=0,1,2,\ldots \\ b_{n} &=&\frac{1}{\pi }\int_{-\pi }^{\pi }f(x)\sin nx,\qquad n=1,2,\ldots, \end{eqnarray*}\tag{1}$$ we conclude that for $f(x)=x$, $-\pi < x < \pi$, we have $a_{n}=0$ and $$\begin{equation*} b_{n}=\frac{1}{\pi }\int_{-\pi }^{\pi }x\sin nxdx=2\frac{\sin \pi n-\pi n\cos \pi n}{\pi n^{2}}. \end{equation*}\tag{2}$$ So for $x\in]-\pi,\pi[$ $$\begin{equation*} f(x)=x=2\sum_{n=1}^{\infty }\frac{\sin \pi n-\pi n\cos \pi n}{\pi n^{2}}\sin nx =\dots \end{equation*}\tag{3}$$ For $x=\pm\pi$ the series $(3)$ converges to $0$.
2. For $h(x)=x^{2}$ a similar computation in this MSE answer (or in this blog post of mine, in Portuguese) yields $$\begin{equation*} f(x)=x^{2}=\frac{\pi ^{2}}{3}+4\sum_{n=1}^{\infty }\left( (-1)^{n}\frac{1}{n^{2}} \cos nx\right) ,\qquad x\in \left[ -\pi ,\pi \right]. \tag{4} \end{equation*}$$

Constant term is $$\sum_{n = 1}^{\infty} \frac{4(-1)^{n+1}}{n^2}$$

Don't know how this can be shown to equivalent to $\frac{\pi ^2}{3}$

Dirichlet eta function (alternating zeta function) $\eta (s)=\sum_{n=1}^{\infty }\frac{(-1)^{n-1}}{n^{s}}$ can be expressed in terms of the Riemann zeta function $\zeta (s)=\sum_{n=1}^{\infty }\frac{1}{n^{s}}$ $$\begin{equation*} \eta (s)=(1-2^{1-s})\zeta (s) \end{equation*}$$

Since $\zeta (2)=\dfrac{\pi ^{2}}{6}$, we have that $\eta (2)=\dfrac{1}{2} \zeta (2)=\dfrac{\pi ^{2}}{12}$ and

$$4\sum_{n=1}^{\infty }\frac{(-1)^{n+1}}{n^{2}}=4\eta (2)=\frac{\pi ^{2}}{3}.$$

-
I think you missed a factor 4 before the sum in (4). – Matt L. Apr 27 '13 at 11:09
@Matt Thanks! Fixed. – Américo Tavares Apr 27 '13 at 11:12
I was looking to compute h(x) = x^2 from f(x) and not directly, but thanks for giving me the final solution, it gives me something to work towards. – KillaKem Apr 27 '13 at 11:52
@KillaKem OK. You can verify that every function $f$ of the form $f(x)=x^{2p}$, $p=1,2,\dots$ can be extended into a trigonometric series, which can be used to evaluate $\zeta(2p)=\sum_{n=1}^\infty 1/n^{2p}$. – Américo Tavares Apr 27 '13 at 13:09