# Fourier periodic extensions of piecewise continuous functions

## Branko Ćurgus

Definitions

• Let $a$ and $b$ be real numbers such that $a \lt b$. A function $f:[a,b] \to \mathbb R$ is said to be piecewise continuous on $[a,b]$ if the following conditions are satisfied:
• there exists a finite set $\{x_1,\ldots,x_n\} \subset (a,b)$ such that $x_1 \lt \cdots \lt x_n$ and $f$ is continuous on each interval $(a,x_1), \quad (x_k,x_{k+1}), \ k=1,\ldots,n-1, \quad (x_n,b);$
• all the following one-sided limits exist $\lim_{x\downarrow a} f(x), \quad \lim_{x\uparrow x_k} f(x), \quad \lim_{x\downarrow x_k} f(x), \ k=1,\ldots,n, \quad \lim_{x\uparrow b} f(x).$
• A function $f:{\mathbb R} \to \mathbb R$ is piecewise continuous on $\mathbb R$ if it is piecewise continuous on every finite subinterval of $\mathbb R$.
• Let $a$ and $b$ be real numbers such that $a \lt b$. A function $f:[a,b] \to \mathbb R$ is said to be piecewise smooth on $[a,b]$ if the following conditions are satisfied:
• there exists a finite set $\{x_1,\ldots,x_n\} \subset (a,b)$ such that $x_1 \lt \cdots \lt x_n$ and $f$ is continuous and it has a continuous derivative $f'$ on each interval $(a,x_1), \quad (x_k,x_{k+1}), \ k=1,\ldots,n-1, \quad (x_n,b);$
• all the following one-sided limits exist $\lim_{x\downarrow a} f(x), \quad \lim_{x\uparrow x_k} f(x), \quad \lim_{x\downarrow x_k} f(x), \ k=1,\ldots,n, \quad \lim_{x\uparrow b} f(x);$
• all the following one-sided limits exist $\lim_{x\downarrow a} f'(x), \quad \lim_{x\uparrow x_k} f'(x), \quad \lim_{x\downarrow x_k} f'(x), \ k=1,\cdots,n, \quad \lim_{x\uparrow b} f'(x).$
• A function $f:{\mathbb R} \to \mathbb R$ is piecewise smooth on $\mathbb R$ if it is piecewise smooth on every finite subinterval of $\mathbb R$.
• Let $a$ and $b$ be real numbers such that $a \lt b$ and let $f:(a,b] \to \mathbb R$ be a function. The function $\tilde{f}: {\mathbb R} \to {\mathbb R}$ defined by $\tilde{f}(x) = f\left(\!x- \bigl(\bigl\lceil\!\tfrac{x-a}{b-a}\! \bigr\rceil -1 \bigr)(b-a)\!\right), \quad x \in {\mathbb R}.$ is called the periodic extension of $f$.
• Let $a$ and $b$ be real numbers such that $a \lt b$ and let $f:(a,b] \to \mathbb R$ be a piecewise continuous function. Let $\tilde{f}:{\mathbb R} \to {\mathbb R}$ be the periodic extension of $f$. The Fourier periodic extension of $f$ is the following function $\tilde{f}_{\!\!\rm Fourier}(x) = \begin{cases} \tilde{f}(x) & \text{if \tilde{f} is continuous at x} \\[10pt] \tfrac{1}{2}\!\! \bigl(\tilde{f}(x+)+\tilde{f}(x-)\bigr) & \text{if \tilde{f} is not continuous at x} \end{cases}, \qquad x\in\mathbb R.$

Examples of Fourier periodic extensions

In each example below we start with a function on defined on an interval, plotted in blue; then we present the periodic extension of this function, plotted in red; then we present the Fourier extension of this function, plotted in green. The last figure in each example shows in one plot the Fourier extension and the approximation with the partial sum with 20 terms of the corresponding Fourier series.
• The function below is $x \mapsto {\rm sgn}\, x$ (check Wikipedia for the definition) restricted to $(-1,1]$:

• The function below is $x \mapsto x$ restricted to $(-1,1]$:

• The function below is $x \mapsto {(\rm sgn}\, x)-x$ restricted to $(-1,1]$:

• The function below is $x \mapsto {\rm us}\, x$ restricted to $(-1,1]$. Here I use a patriotic (which is unusual) abbreviation for the function which is usually called the unit step function or Heaviside step function. You will notice that Wikipedia's definition assigns the value $1/2$ at $0$. Here we use the definition of the unit step function from Mathematica.

• The function below is $x \mapsto |x|$ restricted to $(-1,1]$.

• The function below is $x \mapsto 1-|x|$ restricted to $(-2,2]$.

• The function below is $x \mapsto \cos x$ restricted to $(0,\pi]$.

• The function below is $x \mapsto \sin x$ restricted to $(0,\pi]$.

• The function below is $x \mapsto x^2$ restricted to $(-1,1]$.

• The function below is $x \mapsto \lfloor x \rfloor$ restricted to $(-2,2]$.

• Here is the Mathematica notebook which I used to produce these figures.

Convergence of Fourier series

• Let $L \gt 0$ and let $f:[-L, L] \to \mathbb R$ be a piecewise continuous function. The series $a_0 + \sum_{k=1}^{+\infty} \biggl( a_k \cos\Bigl(\!\tfrac{k \pi}{L} x\!\Bigr) + b_k \sin\Bigl(\!\tfrac{k \pi}{L} x\!\Bigr) \biggr)$ where $a_0 = \frac{1}{2L} \int_{-L}^L f(\xi) d\xi$ and, for $k \in {\mathbb N}$, $a_k = \frac{1}{L}\int_{-L}^L f(\xi) \cos\Bigl(\!\tfrac{k \pi}{L} \xi\!\Bigr) d\xi, \quad b_k = \frac{1}{L}\int_{-L}^L f(\xi) \sin\Bigl(\!\tfrac{k \pi}{L} \xi\!\Bigr) d\xi,$ is called the Fourier series of $f$.
• For $n \in {\mathbb N}$, the $n$th partial sum of the Fourier series of $f$ is $S_n^f(x) = a_0 + \sum_{k=1}^{n} \biggl( a_k \cos\Bigl(\!\tfrac{k \pi}{L} x\!\Bigr) + b_k \sin\Bigl(\!\tfrac{k \pi}{L} x\!\Bigr) \biggr)$
• Pointwise Convergence Theorem. If $f$ is piecewise smooth on $[-L,L]$, then for every $x \in {\mathbb R}$ we have $\lim_{n \to +\infty} S_n^f(x) = \tilde{f}_{\!\!\rm Fourier}(x).$
Loosely speaking, the Fourier series of $f$ converges pointwise to the Fourier periodic extension of $f$.
• Notice that if the periodic extension of $f$ is a continuous function, then the Fourier periodic extension of $f$ coincides with the periodic extension of $f$. In other words, if $\tilde{f}$ is a continuous function, then $\tilde{f}_{\!\!\rm Fourier} = \tilde{f}$.
• Uniform Convergence Theorem. If $f$ is piecewise smooth and the periodic extension of $f$ is continuous, then the sequence of functions $\bigl\{S_n^f\bigr\}_{n=1}^{+\infty}$ converges uniformly on ${\mathbb R}$ to $\tilde{f}$.

This means that for every $\varepsilon > 0$ there exists $N_\epsilon$ such that for all $n \gt N_\varepsilon$ and for all $x \in {\mathbb R}$ we have $\bigl|S_n^f(x) - \tilde{f}(x) \bigr| < \varepsilon.$