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

Solution 1:

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}$enter image description here

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


Subsequent peak-to-peak amplitude differences in terms of the jump discontinuity are $$ \begin{array}{l} \text{first drop: }&-0.138078205446&=\frac1\pi\int_\pi^{2\pi}\frac{\sin(t)}{t}\mathrm{d}t\\ \text{second rise: }&\hphantom{-}0.081681570828&=\frac1\pi\int_{2\pi}^{3\pi}\frac{\sin(t)}{t}\mathrm{d}t\\ \text{second drop: }&-0.058123567735&=\frac1\pi\int_{3\pi}^{4\pi}\frac{\sin(t)}{t}\mathrm{d}t\\ \text{third rise: }&\hphantom{-}0.045137494308&=\frac1\pi\int_{4\pi}^{5\pi}\frac{\sin(t)}{t}\mathrm{d}t\\ \text{third drop: }&-0.036901946694&=\frac1\pi\int_{5\pi}^{6\pi}\frac{\sin(t)}{t}\mathrm{d}t \end{array} $$

Solution 2:

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.