# If square waves are square integrable, why doesn't fourier expanding work?

If square waves are square integrable, then why does expanding on a fourier basis not recover the equation?

-
There is a nice discussion in Lanczos book . –  Felix Marin Mar 4 at 4:27

The Fourier Series converges in $L^2$ and pointwise except at the discontinuities, where it converges to the average of the limits from either side. Since the function to which the partial sums converge is not continuous, the convergence cannot be uniform. In fact, the Gibbs phenomenon guarantees an over shoot of about $8.95\%$ of the discontinuity on either side of the discontinuity

$\hspace{4mm}$

Since the Dirichlet kernel for the $n^\text{th}$ partial sum is $$\sum_{k=-n}^ne^{ikt}=\frac{\sin\left(\frac{2n+1}{2}t\right)}{\sin\left(\frac12t\right)}$$ The jump from minimum to maximum for an intended jump of $2\pi$ is $$\int_{-2\pi/(2n+1)}^{2\pi/(2n+1)}\frac{\sin\left(\frac{2n+1}{2}t\right)}{\sin\left(\frac12t\right)}\,\mathrm{d}t$$ As $n\to\infty$, the limit of the overshot divided by the jump is therefore \begin{align} &\lim_{n\to\infty}\frac1{4\pi}\left(\int_{-2\pi/(2n+1)}^{2\pi/(2n+1)}\frac{\sin\left(\frac{2n+1}{2}t\right)}{\sin\left(\frac12t\right)}\,\mathrm{d}t-2\pi\right)\\ &=\lim_{n\to\infty}\frac1{2\pi}\int_0^{2\pi/(2n+1)}\frac{\sin\left(\frac{2n+1}{2}t\right)}{\sin\left(\frac12t\right)}\,\mathrm{d}t-\frac12\\ &=\lim_{n\to\infty}\frac1{(2n+1)\pi}\int_0^\pi\frac{\sin(t)}{\sin\left(\frac1{2n+1}t\right)}\,\mathrm{d}t-\frac12\\ &=\frac1\pi\int_0^\pi\frac{\sin(t)}{t}\mathrm{d}t-\frac12\\[18pt] &\doteq0.089489872236 \end{align}

-

It does, except at the points of discontinuity. The coefficients are determined by integrals and we know that integrals are not changed if we alter the value of the integrand at isolated points. You can pick the value at the discontinuities any way you want. The Fourier series will converge to the average of the right and left limits at any point.

Added: Despite the Gibbs Phenomenon, the Fourier series converges pointwise to the original function except at discontinuities. The overshoot gets narrower and narrower (and taller and taller) as you incorporate more terms. For any given point, you need to go to a high enough order that the Gibbs peak is narrower than the distance to the discontinuity. The basic problem is that sine and cosine waves are very continuous-they are $C^\infty$. They don't fit discontinuities well. They get very disturbed by them. If you have discontinuities, the Fourier terms decrease as $\frac 1n$. If the function is continuous, they decrease as $\frac 1{n^2}$ If $k$ derivatives are continuous, the coefficients decrease as $\frac 1{n^{k+2}}$ This is a lesson in expanding in functions that look like what you are expanding.

-
My question was ill placed-If you take the infinite series it does converge, right? –  Anthony Mar 4 at 4:07
Yes, it does converge. At all the points where it is continuous, it converges to the value of the function. At the discontinuities, it converges to the point halfway between the top and bottom values. –  Ross Millikan Mar 4 at 4:10
Why does the spike from the Gibbs Phenomenon not get smaller, height wise? –  Anthony Mar 4 at 4:10
@Anonymous: I have added a computation of the Gibb's overshot at the end of my answer. –  robjohn Mar 4 at 13:59