# How to show convergence of my generalized Fourier Series to the values I specify in the body of this question.

This question is related to another one I asked earlier here.

For reference, I asked for help writing a generalized Fourier Series for the function $f(x) = 1$ for $0<x<1$, in terms of the eigenfunctions $\displaystyle w_{n} = \cos \left[\left( n - \frac{1}{2}\right)\pi x \right]$, $n = 0,1,2, \cdots$ for the Sturm-Liouville problem:

$\begin{matrix} - w^{\prime\prime} (x) = \mu w(x) \\ w^{\prime}(0) = w(1) = 0. \end{matrix}$

With the help of the person who answered me, I was able to successfully show that $\displaystyle \tilde{f}(x) = \tilde{f}_{E}(x) \sim \frac{1}{2}a_{0} + \sum_{n=1}^{\infty}a_{n} \cos \left[ \left( n - \frac{1}{2}\right)\pi x \right] \\ \displaystyle = \frac{1}{2(1)}\int_{-1}^{1}1\, dx +\sum_{n=1}^{\infty}a_{n} \cos \left[ \left( n - \frac{1}{2}\right)\pi x \right] \\ \displaystyle = 1 + \sum_{n=1}^{\infty}a_{n} \cos \left[ \left( n - \frac{1}{2}\right)\pi x \right] \\ \displaystyle = 1 + \frac{4}{\pi}\sum_{n=1}^{\infty} (-1)^{n+1}(2n-1)^{-1}\cdot \cos \left[ \left( n - \frac{1}{2}\right) \pi x \right]$

is the generalized Fourier Series I sought.

Now, however, I am having trouble showing the convergence

According to the back of my book, this series should converge pointwise to

$\tilde{f}(x) = \begin{cases} 1 & \text{if}\, |x|<1 \\ 0 & \text{if}\, 1 < |x|<2 \end{cases}$

$\tilde{f}(x) = \tilde{f}(x+4)$ for all $x$.

Now, there's a theorem in my book that says that if $f$ and $f^{\prime}$ are both sectionally continuous on $(a,b)$, then the series converges pointwise to $\displaystyle \frac{1}{2}\left[f(x^{+}) + f(x^{-1}) \right]$ at each $x \in (a,b)$ (where $f(x^{+})$ is the limit of $f$ as we approach $x$ from the right, and $f(x^{-})$ is the limit of $f$ as we approach $x$ from the left)

Since $f(x) = 1$ on $0 < x < 1$, by this theorem, it makes sense that $\tilde{f}$ should converge pointwise to $\displaystyle \frac{1}{2}\left[ 1 + 1 \right] = \frac{1}{2}(2) = 1$ at each $x \in (0, 1)$.

But, where does the $|x|<1$ come into play? And also, why does $\tilde{f}$ converge pointwise to $0$ for $1 < |x| < 2$? Why did we start caring about what happens between $1$ and $2$? Does this have something to do with the $2L$-periodic extension (I suppose here, then, since $L = 1$, it would be the $2$-periodic extension), and if so, how?

Furthermore, where does the $\tilde{f} = \tilde{f} (x+4)$ come from?

I ask you to please be patient with me, and not get frustrated that I don't know these things, even if they are very basic to the study of Fourier Series. I'm just trying to learn and getting very confused in the process. By helping me get un-confused, you're doing a very good deed! Thank you.

• Did you only calculate $a_0$? What about the other coefficients $a_n$? Commented Nov 25, 2016 at 21:38
• @user159517 fixed! Thank you for bringing that to my attention; otherwise, I would never have been able to figure out why I wasn't getting any answers!
– user100463
Commented Nov 25, 2016 at 21:42
• And you need to look at the en.wikipedia.org/wiki/Summation_by_parts needed for proving the Dirichlet test Commented Nov 25, 2016 at 23:31
• @user1952009 I don't need to prove the Dirichlet test, I need to prove that my Fourier series specifically converges to $1$ for $|x|<1$ and to $0$ for $1<|x|<2$.
– user100463
Commented Nov 26, 2016 at 1:43
• @JessyCat Very funny. You need the Dirichlet test (or the summation by parts) for proving it converges. And this is very elemenary, so just prove it. Commented Nov 26, 2016 at 1:44

To show that the series $\sum_{n=1}^\infty \frac{(-1)^{n+1}\cos((n-1/2)\pi x)}{n}$ converges for $|x|<1$, we can simply apply Dircichlet's Test.

To do so, we need only show that there exists a number $L$ such that for any $N$, we have for any fixed $x_0 \in (0,1)$ (or $x_0\in (-1,0)$)

\begin{align} \left|\sum_{n=1}^N (-1)^{n+1}\cos((n-1/2)\pi x_0)\right|&=\left|\sec(\pi x_0/2)\sin^2\left(\frac{N\pi (x_0-1)}{2}\right)\right| \tag 1\\\\ &\le \sec(\pi x_0/2)\\\\ &=L \end{align}

To arrive at $(1)$, we use the sum angle formula $\cos(x)\cos(y)=\frac{\cos(x+y)+\cos(x-y)}{2}$ with $x=\pi x_0/2$ and $y=(n-1/2)\pi x_0$. Then, we can write

\begin{align} \cos(\pi x_0/2)\sum_{n=1}^N (-1)^{n+1}\cos((n-1/2)\pi x_0)&= \sum_{n=1}^N \frac{\left((-1)^{n+1}\cos(n\pi x_0)-(-1)^n\cos((n-1)\pi x_0)\right)}{2}\\\\ &=\frac12\left((-1)^{N+1}\cos(N\pi x_o)+1\right)\\\\ &=\frac12 \left(1-\cos(N\pi(x_0-1)) \right)\\\\ &=\sin^2\left(\frac{N\pi(x_0-1)}{2}\right) \end{align}

It was established in THIS ANSWER that the eigenfunctions $\cos((n-1/2)\pi x)$ form a complete orthogonal set on $(0,1)$, and that we can therefore represent the function $f(x)=1$ by the series

$$1\sim \frac4\pi \sum_{n=1}^\infty \frac{(-1)^{n+1}}{2n-1}\cos((n-1/2)\pi x)$$

for $x\in (0,1)$.

Now, note that $\cos((n-1/2)\pi x)$ has period $4$. To do this, we write

\begin{align} \cos((n-1/2)\pi (x+4))&=\cos((n-1/2)\pi x)\cos((n-1/2)4\pi)-\sin((n-1/2)\pi x)\sin((n-1/2)4\pi)\\\\ &=\color{blue}{\cos((n-1/2)\pi x)}\color{red}{\cos((2n-1)2\pi)}-\color{green}{\sin((n-1/2)\pi x)}\color{purple}{\sin((2n-1)2\pi)}\\\\ &=\color{blue}{\cos((n-1/2)\pi x)}\color{red}{1}-\color{green}{\sin((n-1/2)\pi x)}\color{purple}{0}\\\\ &=\cos((n-1/2)\pi x) \end{align}

Similarly, we see that $\cos((n-1/2)\pi x)=\cos((n-1/2)\pi (2-x-2))=-\cos((n-1/2)(2-x))$. Therefore, for $x\in (1,2)$,

\begin{align}1 & \sim \frac4\pi\sum_{n=1}^\infty \frac{(-1)^{n+1}}{2n-1}\cos((n-1/2)\pi (2-x))\\\\ &=-\frac4\pi\sum_{n=1}^\infty \frac{(-1)^{n+1}}{2n-1}\cos((n-1/2)\pi x) \end{align}

and hence for $x\in (1,2)$, we have

$$\frac4\pi\sum_{n=1}^\infty \frac{(-1)^{n+1}}{2n-1}\cos((n-1/2)\pi x) \sim -1$$

Putting it together, we see that

$$\frac4\pi\sum_{n=1}^\infty \frac{(-1)^{n+1}}{2n-1}\cos((n-1/2)\pi x)=\begin{cases}1&,0<x<1\\\\-1&,1<x<2\end{cases}$$

Finally, adding $1$ and dividing by $2$ yields

$$\frac12 +\frac2\pi\sum_{n=1}^\infty \frac{(-1)^{n+1}}{2n-1}\cos((n-1/2)\pi x)=\begin{cases}1&,0<x<1\\\\0&,1<x<2\end{cases}$$

• but what about for $1 < |x| < 2$?
– user100463
Commented Nov 25, 2016 at 21:47
• The same approach applies for $x\in (1,2)$ also. Commented Nov 25, 2016 at 21:49
• I'm also confused by how you know that $\displaystyle \left \vert \sum_{n=1}^{N}(-1)^{n+1}\cos(n-1/2)\pi x) \right \vert = \left \vert \sec(\pi x/2)\sin^{2}\left( \frac{N \pi (x-1)}{2}\right) \right \vert$...
– user100463
Commented Nov 25, 2016 at 21:49
• also, why do we care about what's going on on $(1,2)$? It seems like that just came up kind of randomly in the answer. Could you explain that a bit more?
– user100463
Commented Nov 25, 2016 at 21:50
• There are several ways we can show that equality. One way that is straightforward is to write $\cos(x)=\text{Re}(e^{ix})$. This amounts to summing the (finite) geometric progression. Commented Nov 25, 2016 at 21:51

I am sure @Dr. MV already answered your question, just want to add something to the discussion that may help. Consider the function

$$f(x)=\begin{cases} 1\quad \mbox{for}\quad |x| < 1 \\ 0\quad \mbox{for}\quad 1<|x|<2 \end{cases}$$

I would like to make a Fourier expansion of $f(x)$. Since the series is periodic in nature we need to make a periodic extension of $f$ and because $f$ is even in its domain, the natural choice for the extension $\tilde{f}$ is to make it even as well with period $L$

$$\tilde{f}(x + L)= \tilde{f}(x)$$

$L=4$ comes from the $\tilde{f}(x)$ has to be $f(x)$ for $|x|<2$

The Fourier series for $\tilde{f}$ is simply

$$\tilde{f}(x) = \frac{1}{2}a_0 + \sum_{n = 1}^{+\infty}a_n \cos \frac{2\pi n x}{L} + b_n \sin \frac{2\pi n x}{L} \tag{1}$$

where

$$a_0 = \frac{2}{L}\int_{-L/2}^{L/2}{\rm d}x\; \tilde{f}(x) = \frac{1}{2}\int_{-2}^{2}{\rm d}x\; f(x) = 1$$

$$a_n = \frac{2}{L}\int_{-L/2}^{L/2}{\rm d}x\; \tilde{f}(x) \cos\frac{2\pi n x}{L}= \frac{1}{2}\int_{-2}^{2}{\rm d}x\; f(x)\cos\frac{\pi n x}{2} = \frac{2}{n\pi}\sin\frac{n\pi}{2} \quad n =1,2,\cdots$$

and

$$b_n = \frac{2}{L}\int_{-L/2}^{L/2}{\rm d}x\; \tilde{f}(x) \sin\frac{2\pi n x}{L}= \frac{1}{2}\int_{-2}^{2}{\rm d}x\; f(x)\sin\frac{\pi n x}{2} = 0 \quad n =1,2,\cdots$$

Note that

$$a_{2k} = 0 \quad\mbox{and}\quad a_{2k - 1} = \frac{2}{(2k-1)\pi}(-1)^k \qquad k =1,2,\cdots$$

Eq. (1) then becomes

$$\tilde{f}(x) = \frac{1}{2} - \frac{2}{\pi}\sum_{k = 1}^{+\infty}\frac{(-1)^k}{2k-1}\cos \left((k - 1/2)\pi x\right) \tag{2}$$

Which is basically what you have before. The figure below shows $f(x)$ and $\tilde{f}(x)$ truncated with 20 terms in the sum

• @cavernac it's interesting - you showed convergence by working backwards? I suppose in that case, you'd have to know the convergence beforehand, but what if you didn't? Also, what if we had an even function like $f(x)=1$, but we had to write our Fourier Series in terms of odd eigenfunctions?
– user100463
Commented Nov 26, 2016 at 13:33
• @JessyCat Actually the convergence is ensured by the fact that a Fourier series will converge to the value of $f(x)$ if $f$ is continuos at $x$, and to the midpoint of the discontinuity otherwise. In the case you want to write $\tilde{f}$ in terms of odd eigenfunctions you just make an odd extension of $f(x) = 1$ as we did here Commented Nov 26, 2016 at 13:43