$\renewcommand{\Re}{\operatorname{Re}}$ $\renewcommand{\Im}{\operatorname{Im}}$ $\newcommand{\erf}{\operatorname{erf}}$ $\newcommand{\dag}{\dagger}$ $\newcommand{\const}{\mathrm{const}}$ $\newcommand{\arcsinh}{\operatorname{arcsinh}}$
Consider trigonometric system of functions \begin{equation} \Bigl\{\frac{1}{2},\qquad \cos (\frac{\pi nx}{l}), \qquad \sin (\frac{\pi nx}{l}) \quad n=1,\ldots\Bigr\} \label{eq-4.4.1} \end{equation} on interval $J:= [x_0,x_1]$ with $(x_1-x_0)=2l$.
These are \emph{eigenfunctions of $X''+\lambda X=0$ with periodic boundary conditions} $X(x_0)=X(x_1)$, $X'(x_0)=X'(x_1)$.
Let us first establish this is \emph{orthogonal system}.
Proposition 4.4.1
\begin{align*} & \int_J \cos (\frac{\pi mx}{l})\cos (\frac{\pi nx}{l})\,dx = l \delta_{mn},\\ & \int_J \sin (\frac{\pi mx}{l})\sin (\frac{\pi nx}{l})\,dx = l \delta_{mn},\\ & \int_J \cos (\frac{\pi mx}{l})\sin (\frac{\pi nx}{l})\,dx = 0, \end{align*} and \begin{align*} & \int_J \cos (\frac{\pi mx}{l})\,dx =0,\qquad & \int_J \sin (\frac{\pi mx}{l})\,dx=0,\qquad & \int_J \,dx =2l \end{align*} for all $m,n=1,2,\ldots$.
Proof. Easy; use formulae \begin{gather*} 2\cos (\alpha)\cos(\beta)=\cos(\alpha-\beta)+\cos(\alpha+\beta),\\ 2\sin (\alpha)\sin(\beta)=\cos(\alpha-\beta)-\cos(\alpha+\beta),\\ 2\sin (\alpha)\cos(\beta)=\sin(\alpha-\beta)+\sin(\alpha+\beta). \end{gather*}
Therefore according to the previous Section 4.3 we arrive to decomposition \begin{equation} f(x)= \frac{1}{2}a_0 + \sum_{n=1}^\infty \bigl( a_n\cos (\frac{\pi nx}{l})+b_n \sin (\frac{\pi nx}{l}) \bigr) \label{eq-4.4.2} \end{equation} with coefficients calculated according to (4.3.7) \begin{align} a_n=& \frac{1}{l}\int_J f(x)\cos (\frac{\pi nx}{l})\,dx \qquad n=0,1,2,\ldots, \label{eq-4.4.3}\\ b_n= & \frac{1}{l}\int_J f(x)\sin (\frac{\pi nx}{l})\,dx \qquad n=1,2,\ldots, \label{eq-4.4.4} \end{align} and satisfying Parseval's equality \begin{equation} \frac{l}{2}|a_0|^2 +\sum_{n=1}^\infty l\bigl( |a_n|^2+|b_n |^2 \bigr) =\int_J |f(x)|^2\,dx. \label{eq-4.4.5} \end{equation}
Exercise 4.4.1
So far this is an optional result: provided we can decompose function $f(x)$.
Now our goal is to prove that any function $f(x)$ on $J$ could be decomposed into Fourier series \begin{equation*} f(x)= \frac{1}{2}a_0 + \sum_{n=1}^\infty \bigl( a_n\cos (\frac{\pi nx}{l})+b_n \sin (\frac{\pi nx}{l}) \bigr) \tag{2} \end{equation*}
First we need
Definition 4.4.1
Lemma 4.4.2
Let $f(x)$ be a piecewise-continuous function on $J$. Then \begin{equation} \int_J f(x)\cos(\omega x)\,dx\to 0\qquad \text{as } \omega \to \infty \label{eq-4.4.6} \end{equation} and the same is true for $\cos(\omega x)$ replaced by $\sin(\omega x)$.
Proof.
Assume first that $f(x)$ is continuously differentiable on $J$. Then integrating by parts \begin{multline*} \int_J f(x)\cos(\omega x)\,dx = \omega^{-1}f(x)\sin(\omega x)\Bigr|_{x_0}^{x_1} - \omega^{-1}\int_J f'(x)\sin(\omega x)\,dx=O(\omega^{-1}). \end{multline*}
Assume now only that $f(x)$ is continuous on $J$. Then it could be uniformly approximated by continuous functions (proof is not difficult but we skip it anyway): \begin{gather*} \forall \varepsilon>0\ \exists f_\varepsilon \in C^1(J)\colon \forall x\in J |f(x)-f_\varepsilon (x)|\le \varepsilon. \end{gather*}
Then obviously the difference between integrals (\ref{eq-4.4.6}) for $f$ and for $f_\varepsilon$ does not exceed $2l\varepsilon$; so choosing $\varepsilon =\varepsilon(\delta)= \delta/(4l)$ we make it $<\delta/2$. After $\varepsilon $ is chosen and $f_\varepsilon$ fixed we can choose $\omega_\varepsilon$ s.t. for $\omega>\omega_\varepsilon$ integral (\ref{eq-4.4.6}) for $f_\varepsilon$ does not exceed $\delta/2$ in virtue of (a). Then the absolute value of integral (\ref{eq-4.4.6}) for $f$ does not exceed $\delta$.
Now calculate coefficients according to (\ref{eq-4.4.3})-(\ref{eq-4.4.4}) (albeit plug $y$ instead of $x$) \begin{align*} a_n=& \frac{1}{l}\int_J f(y)\cos (\frac{\pi ny}{l})\,dy \qquad n=0,1,2,\ldots, \tag{3}\\ b_n= & \frac{1}{l}\int_J f(y)\sin (\frac{\pi ny}{l})\,dy \qquad n=1,2,\ldots, \tag{4} \end{align*} and plug into partial sum: \begin{multline} S_N (x)=\frac{1}{2}a_0 + \sum_{n=1}^N \Bigl( a_n\cos (\frac{\pi nx}{l})+b_n \sin (\frac{\pi nx}{l}) \Bigr)= \frac{1}{l}\int_J K_N(x,y)f(y)\,dy, \label{eq-4.4.7} \end{multline}
\begin{multline} K_N(x,y)=\frac{1}{2}+ \sum_{n=1}^N \Bigl( \cos (\frac{\pi ny}{l}) \cos (\frac{\pi nx}{l})+ \sin (\frac{\pi ny}{l}) \sin (\frac{\pi nx}{l}) \Bigr)\\ =\frac{1}{2} + \sum_{n=1}^N \cos (\frac{\pi n(y-x)}{l}). \label{eq-4.4.8} \end{multline}
Note that \begin{multline*} \sum_{n=1}^N 2\sin (\frac{z}{2})\cos (nz)= \sum_{n=1}^N \Bigl(\sin \bigl((n+\frac{1}{2})z\bigr)- \sin \bigl((n-\frac{1}{2})z\bigr)\Bigr) =\\ \sin \bigl((N+\frac{1}{2})z\bigr)-\sin \bigl(\frac{1}{2}z\bigr) \end{multline*} and therefore \begin{equation} K_N(x,y)=\frac{\sin (k (N+\frac{1}{2})(x-y))}{2\sin(\frac{1}{2}k(x-y))},\qquad k=\frac{\pi}{l}. \label{eq-4.4.9} \end{equation} Therefore \begin{equation} S_N (x) = \frac{1}{2l}\int_J \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))}f(y)\,dy \label{eq-4.4.10} \end{equation} However, we cannot apply Lemma 4.4.2 to this integral immediately because of the denominator: \begin{equation} S_N (x) = \frac{1}{2l}\int_J \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))}f(y)\,dy \label{eq-4.4.11} \end{equation}
Assume that $x$ is internal point of $J$. Note that denominator vanishes on $J$ only as $y=x$. Indeed, $\frac{\pi}{2l}(x-y)< \pi$. Also note that derivative of denominator does not vanish as $y=x$. Then $\frac{f(y)}{\sin(\frac{1}{2}k(x-y))}$ is a piecewise continuous function of $y$ provided all three conditions below are fulfilled:
In this case we can apply Lemma 4.4.2 and we conclude that $S_N(x)\to 0$ as $N\to \infty$. So, *If $f$ satisfies (1)-(3) then $S_N(x)\to f(x)$ as $N\to \infty$}.
Let us drop condition $f(x)=0$. Then we can decompose \begin{multline} S_N (x)= \frac{1}{2l}\int_J \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))}\bigl(f(y)-f(x)\bigr)\,dy+\\ \frac{1}{2l} \int_J \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))}f(x)\,dy \label{eq-4.4.12} \end{multline} and the first integral tends to $0$ due to Lemma 4.4.2. We claim that the second integral is identically equal $f(x)$. Indeed, we can move $f(x)$ out of integral and consider \begin{multline} \frac{1}{2l}\int_J \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))}\,dy= \frac{1}{l}\int_J \Bigl(\frac{1}{2}+\sum_{n=1}^N \cos (\frac{\pi n(y-x)}{l})\Bigr)\,dy \qquad\label{eq-4.4.13} \end{multline} where integral of the first term equals $l$ and integral of all other terms vanish.
Therefore we arrive to
Theorem 4.4.3
Let $x$ be internal point of $J$ (i.e. $x_0< x< x_1$) and let
Then the Fourier series converges to $f(x)$ at $x$.
Assume now that there is a jump at $x$. Then we need to be more subtle. First, we can replace $f(x)$ by its $2l$-periodic continuation from $J$ to $\mathbb{R}$. Then we can take \emph{any interval of the length $2l$} and result will be the same.
So we take $[x-l,x+l]$. Now \begin{align*} S_N (x)=& \frac{1}{2l}\int_{J^-} \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))} \bigl(f(y)-f(x^-)\bigr)\,dy\\ +&\frac{1}{2l}\int_{J^+} \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))} \bigl(f(y)-f(x^+)\bigr)\,dy\\ +&\frac{1}{2l} \int_{J^-} \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))}f(x^-)\,dy\ +&\frac{1}{2l} \int_{J^+} \end{align*} with $f(x^\pm):= \lim _{y\to x^\pm} f(y)$ and $J^-=(x-l,l)$, $J^+=(x,x+l)$.
According to Lemma 4.4.2 again the first two integrals tend to $0$ and we need to consider two integrals \begin{align*} &\frac{1}{2l} \int_{J^-} \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))}\,dy,\ &\frac{1}{2l} \int_{J^+} \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))}\,dy. \end{align*} Using back transformation like in (\ref{eq-4.4.12}) : \begin{multline*} \frac{1}{2l}\int_{J^\pm} \frac{\sin (k (N+\frac{1}{2})(x-y))}{\sin(\frac{1}{2}k(x-y))}\,dy= \frac{1}{l}\int_{J^\pm} \Bigl(\frac{1}{2}+\sum_{n=1}^N \cos (\frac{\pi n(y-x)}{l})\Bigr)\,dy \end{multline*} we conclude that both these integrals are equal to $\frac{1}{2}$.
Therefore we proved
Theorem 4.4.4
Let $f$ be a piecewise continuously differentiable function. Then the Fourier series converges to
The last two statements are called Gibbs phenomenon. Below are partial sums of sin-Fourier decomposition of $u(x)=\left\{\begin{aligned} &1 &-&\pi<x<0,\\ -&1 &&0<x<\pi.\end{aligned}\right.$
Remark 4.4.2
Recall from Calculus I that $f_N(x)\to f(x)$ uniformly, if \begin{gather*} \forall \varepsilon\; \exists N=N(\varepsilon)\colon |f_N(x)-f(x)|<\varepsilon \; \forall x\; \forall N>N(\varepsilon). \end{gather*}