# Easy Fourier series example: where is my mistake?

I'm doing exercise 15 on page 255 in Kreyszig:

1. To illustrate that a Fourier series of a function $f$ may converge even at a point where $f$ is discontinuous, find the Fourier series of

$$f(x) = \begin{cases} 0 & x \in [-\pi, 0) \\ 1 & x \in [0, \pi) \end{cases}$$

My solution:

(i) For the $n$-th character, $n \in \mathbb N$, we compute the $n$-th coefficient as follows: $$\hat{f}(e^{inx}) = \langle f, e^{inx} \rangle = \int_0^\pi e^{-inx} dx = \frac{i}{n}(e^{in \pi} - 1)$$

(ii) For the $-n$-th character we compute $$\hat{f}(e^{inx}) = \langle f, e^{-inx} \rangle = \frac{-i}{n}(e^{in \pi}-1)$$

(iii) For the $0$-character $e^{i0x} = 1$ we compute $$\hat{f}(e^{i0x}) = \langle f, e^{-i0x} \rangle = \int_0^\pi 1 dx = \pi$$

So that the Fourier series of $f$ is $$F(f(x)) = \pi , \hspace{1cm} x \in [-\pi, \pi)$$

Which is clearly wrong. What did I do wrong? Thanks for your help.

-
Doesn't Kreyszig normalize the integral with a factor? – t.b. Jul 30 '12 at 6:45
I certainly didn't discuss that (I said I couldn't follow) I only said that you can reduce to a pure sine wave by subtracting $1/2$. See also: Gibbs phenomenon – t.b. Jul 30 '12 at 6:59
@MattN.: The zero coefficient is the average of the function and is definitely not zero here... – copper.hat Jul 30 '12 at 7:03
There is definitely overshooting in this example! The Gibbs phenomenon applies to finite sums, not the limit. – copper.hat Jul 30 '12 at 7:43
Yeah right :) They also perpetuate such blatant falsehoods as the uncountability of the reals... Come on: a page on a phenomenon that is specifically about this effect might have some $\varepsilon$'s off but won't be completely wrong. – t.b. Jul 30 '12 at 8:12

@AD. gave the usual formula for the Fourier series.

The Fourier coefficients are $\hat{f}_0 = \frac{1}{2}$, and $\hat{f}_n = - \frac{1}{2 i \pi n} (e^{-in \pi} -1) = \frac{1}{2 i \pi n} (1-(-1)^n)$, for $n \neq 0$. So, for $n\neq 0$, only the odd coefficients are non zero.

Now let $\phi(x) = f_0 + \sum_{n>0} f_n e^{inx} + f_{-n} e^{-inx} = \frac{1}{2} + \sum_{n>0,\, n\ \mathbb{odd}} \frac{2}{2 i \pi n}(e^{inx}-e^{-inx})$. Continuing gives $\phi(x) = \frac{1}{2} + \frac{2}{\pi} \sum_{n>0,\, n\ \mathbb{odd}} \frac{\sin nx}{n}$. This is the Fourier series of the periodic step function, and converges to $f(x)$ at all points except for $x=0,\pi$, where it converges to the average of the right and left limits of $f$ (inasmuch as left and right make sense in a periodic setting!).

-

I think you missed some point in the definition.

The definition of the Fourier coefficient of a function $f$ defined on $[-\pi,\pi]$ with respect to $x\mapsto e^{inx}$ where $n\in\mathbb{Z}$ is given by $$\hat{f}(n)=\frac{1}{2\pi}\int_{-\pi}^\pi f(x)e^{-inx}dx$$ and the Fourier series of $f$ is then given by $$f(x) \sim\sum_{n\in\mathbb{Z}} \hat{f}(n)e^{inx}.$$ The normalizing constant $\frac{1}{2\pi}$ is needed in order for $n\mapsto e^{inx}$ to be an ON-basis (otherwise they will not have norm 1).

-
Thank you, yes I will do that. – Rudy the Reindeer Jul 31 '12 at 4:55
I re-computed everything. But I think there is still a mistake in it. – Rudy the Reindeer Aug 20 '12 at 14:32
@Matt At this very moment, I do not have time to answer. So if I don't get back - please notify me again and I will! Three comments: (1) Try to factorize your formula before computing it; (2) You lost a factor 2 in the formula for $n\ne0$; (3) It is (fairly) common to say that the Fourier series is the limit of the symmetric sum $$S_N[f](x)=\sum_{n=-N}^N \hat{f}(n)e^{inx}$$ which you may use to find the sine formula by gathering the coefficients of $e^{-kx}$ and $e^{ikx}$. – AD. Aug 20 '12 at 19:40
Thanks a lot for your comment! – Rudy the Reindeer Aug 20 '12 at 19:41
Also, a useful formula for the $N$-th partial sum is given by $$(D_N * f)(x)$$ where $D_N$ is the Dirichlet kernel that is $$D_n(x)=\sum_{k=-N}^Ne^{ikx}$$ This sum is computable using a geometric sum - or if you wish you may Google the name. Moreover, the sum is not absolutely convergent - in the usual meaning. – AD. Aug 20 '12 at 19:43

I re-computed the Fourier series:

$$a_0 = \langle f, e^{-i0} \rangle = \frac{1}{2 \pi} \int_0^\pi 1 dx = \frac12$$

$$a_n = \frac{1}{2 \pi} \int_0^\pi e^{-inx} dx = \frac{1}{2 \pi} \left [ \frac{i}{n} e^{-inx} \right ]_0^\pi$$

If $n$ is even: $a_n = \frac{1}{2 \pi}(\frac{i}{n} - \frac{i}{n}) = 0$

If $n$ is odd: $a_n = \frac{1}{2 \pi}(\frac{i}{n}(-1) - \frac{i}{n}) = \frac{-i}{2 \pi n}$

So that

$$f(x) = \sum_{k=-\infty}^\infty \frac{-i}{2 \pi (2k + 1)} e^{(2k + 1)ix}$$

and hence

$$|f(x)| \leq \frac{1}{2 \pi } \sum_{k=-\infty}^\infty \frac{1}{ (2k + 1)} = 0$$

So that the Fourier series converges at $0$ absolutely.

-
Now I'd need to see how to get $e^{(2k + 1)ix} = \frac{\sin ((2k + 1)x)}{2k + 1}$. – Rudy the Reindeer Aug 20 '12 at 14:30