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


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


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

  • $\begingroup$ 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$ $\endgroup$ Apr 27, 2013 at 10:27
  • $\begingroup$ Regarding your last sentence see my edit. $\endgroup$ Apr 28, 2013 at 21:49

2 Answers 2


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.

  • $\begingroup$ Managed to find a_n, but how do I find the constant term of the h(x) expression? $\endgroup$
    – KillaKem
    Apr 27, 2013 at 11:56
  • $\begingroup$ $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}$. $\endgroup$
    – Matt L.
    Apr 27, 2013 at 12:03
  • $\begingroup$ 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? $\endgroup$
    – KillaKem
    Apr 27, 2013 at 12:12
  • $\begingroup$ Thank you! I don't know why I didn't think of that $\endgroup$
    – KillaKem
    Apr 27, 2013 at 12:14
  • $\begingroup$ The best way is to equate this sum with the integral in my previous comment. If you want to try to directly evaluate the sum, check the Basel Problem: en.wikipedia.org/wiki/Basel_problem $\endgroup$
    – Matt L.
    Apr 27, 2013 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*} $$

ADDED: Answer to

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

  • 1
    $\begingroup$ I think you missed a factor 4 before the sum in (4). $\endgroup$
    – Matt L.
    Apr 27, 2013 at 11:09
  • $\begingroup$ @Matt Thanks! Fixed. $\endgroup$ Apr 27, 2013 at 11:12
  • 1
    $\begingroup$ 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. $\endgroup$
    – KillaKem
    Apr 27, 2013 at 11:52
  • $\begingroup$ @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}$. $\endgroup$ Apr 27, 2013 at 13:09
  • $\begingroup$ I am a bit confused about when we use $ f(x)= \text{series}$ and $ f(x)\text{near equal to series}$. If $ f(x)=x$ needs to be expressed in its fourier series in $ [-\pi,\pi]$, what do we write? $ f(x)=\text{series}$ or $ f(x) \text{near equal to series}$ $\endgroup$
    – Manjoy Das
    May 12, 2020 at 11:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .