# Math for Non-Geeks/ Uniform continuity

Uniform continuity is a stronger form of continuity. It is derived from the epsilon-delta criterion of continuity and particularly important for approximating functions.

## Motivation
### Recap: Epsilon-delta criterion

The definition of uniform continuity is built upon that one of the epsilon-delta criterion for continuity. We will therefore recap the epsilon-delta definition:
That is, if we choose an epsilon-tube around $f(x_{0})$ , no matter how small it is, all function values in a sufficiently small environment of $x_{0}$ will lie in it. An epsilon-tube is an interval from $f(x_{0})-\epsilon$ to $f(x_{0})+\epsilon$ with $\epsilon >0$ around$f(x_{0})$:
A function $f:D\to \mathbb {R}$ is continuous at $x_{0}\in D$ if and only if for every epsilon-tube, there is a $\delta >0$ , such that all function values of $f$ when evaluated between $x_{0}-\delta$ and $x_{0}+\delta$ fit inside the epsilon-tube:
This $\delta$ may depend on the given function $f$, the given tube size $\epsilon$and from the point $x_{0}$ . The following diagram shows an example, where a $\delta$-value is sufficiently small for $x_{0}$ , but too large for $x_{1}$ :
Hence, we must choose the $\delta$ at $x_{1}$ smaller. As both $\delta$-values at $x_{0}$ and $x_{1}$ are different, we will label them correspondingly by $\delta _{0}$ and $\delta _{1}$. This shows, that the $\delta$ within the definition of continuity may depend on the considered position $x$. The following diagram illustrates this:

### Derivation of uniform continuity

The epsilon-delta criterion guarantees that any continuous function $f:D\to \mathbb {R}$ can be approximated. For every maximal error $\epsilon >0$ and around every ${\tilde {x}}$ we can find a $\delta _{\tilde {x}}>0$, such that the function value $f(x)$ at every $x$ inside the delta-interval $({\tilde {x}}-\delta ,{\tilde {x}}+\delta )$ around $f({\tilde {x}})$ maximally deviates from $f({\tilde {x}})$ by $\epsilon >0$. So for all of those $x$ with ${\tilde {x}}-\delta <x<{\tilde {x}}+\delta$ we can consider $f({\tilde {x}})$ as an approximation of $f(x)$ with a maximal error of $\epsilon$ . The following diagram illustrates this approximation at several points $x_{i}$:
However, the $\delta _{\tilde {x}}$-values depend on the considered position ${\tilde {x}}$ . This is why the rectangles in the above diagram have different sizes. For a more uniform approximation, we could impose additionally that all rectangles have to be of equal size, That means, the $\delta _{\tilde {x}}$-value shall be equally suitable for any ${\tilde {x}}$ . The above diagram would then look as follows:
This is the core idea of uniform continuity. For any given $\epsilon >0$ , there is a global $\delta >0$, such that no matter which point ${\tilde {x}}\in D$ is chosen, every function value $f(x)$ picked from the delta-interval $({\tilde {x}}-\delta ,{\tilde {x}}+\delta )$ will be closer than $\epsilon$ to $f({\tilde {x}})$ . This leads us to the following definition of uniform continuity for a function $f:D\to \mathbb {R}$, which will allow us for uniform approximations:

## Definition
### Definition of uniform continuity

The formal definition of uniform continuity hence reads as follows:
Definition (Uniform continuity)
A function $f:D\to \mathbb {R}$ is uniform continuous on D, if for every $\epsilon >0$ a $\delta >0$ exists, such that at all positions ${\tilde {x}}\in D$ and for all arguments $x\in D$ with a distance smaller than $\delta$ to ${\tilde {x}}$ the function values $f(x)$ and $f({\tilde {x}})$ deviate from each other by less than $\epsilon$ . In quantifier notation, the definition of uniform continuity reads:
$\forall \epsilon >0\,\exists \delta >0\,\forall {\tilde {x}}\in D\,\forall x\in D:|x-{\tilde {x}}|<\delta \implies |f(x)-f({\tilde {x}})|<\epsilon$
In different words, for each $\epsilon >0$ there is a $\delta >0$ , such that all pairs $x,{\tilde {x}}\in D$ with $|x-{\tilde {x}}|<\delta$ satisfy the inequality $|f(x)-f({\tilde {x}})|<\epsilon$ .

### Quantifier notation

The commented version of the quantifier notation reads:
${\begin{aligned}&\underbrace {{\underset}\forall \epsilon >0} _{{\text{for all }}\epsilon >0}\underbrace {{\underset}\exists \delta >0} _{{\text{ there is a }}\delta >0}\underbrace {{\underset}\forall {\tilde {x}}\in D} _{{\text{, such that at all positions }}{\tilde {x}}\in D}\underbrace {{\underset}\forall x\in D} _{{\text{ and for all arguments }}x\in D}\\[0.5em]&\qquad \underbrace {{\underset}|x-{\tilde {x}}|<\delta } _{{\text{ with distance to }}{\tilde {x}}{\text{ smaller }}\delta }\underbrace {{\underset}\implies } _{\text{ there is}}\underbrace {{\underset}|f(x)-f({\tilde {x}})|<\epsilon } _{{\text{, that the distance from }}f(x){\text{ to }}f({\tilde {x}}){\text{ is smaller than }}\epsilon }\end{aligned}}$
Comparing the epsilon-delta definition of uniform continuity and continuity in the quantifier notation, we notide that only two quantifiers have been permuted:
${\begin{aligned}{\begin{array}{ll}{\text{Continuity: }}&\forall \epsilon >0\,{\color {OliveGreen}\forall {\tilde {x}}\in D}\,{\color {Blue}\exists \delta >0}\,\forall x\in D:\\[0.3em]&\quad |x-{\tilde {x}}|<\delta \implies |f(x)-f({\tilde {x}})|<\epsilon \\[0.5em]{\text{Uniform Continuity: }}&\forall \epsilon >0\,{\color {Blue}\exists \delta >0}\,{\color {OliveGreen}\forall {\tilde {x}}\in D}\,\forall x\in D:\\[0.3em]&\quad |x-{\tilde {x}}|<\delta \implies |f(x)-f({\tilde {x}})|<\epsilon \end{array}}\end{aligned}}$
The reason is that the $\delta$ used for uniform continuity is a global one, i.e. it does not depend on the position ${\tilde {x}}\in D$ . In order to express this independence, the existence quantifier „$\exists \delta >0$“ must appear in front of the all quantifier „$\forall {\tilde {x}}\in D$“ .

### Deriving the negation of uniform continuity

The quantifier notation is a handy tool for inverting definitions - like for uniform continuity. It basically works by step-wise replacing existence and all quantifiers by the respective other expression:
${\begin{aligned}{\begin{array}{rrrrrcr}&\neg {\Big\forall \epsilon >0\,&\exists \delta >0\,&\forall {\tilde {x}},x\in D:&|x-{\tilde {x}}|<\delta &\implies &|f(x)-f({\tilde {x}})|<\epsilon {\Big )}\\[0.5em]\iff &\exists \epsilon >0\,&\neg {\Big\exists \delta >0\,&\forall {\tilde {x}},x\in D:&|x-{\tilde {x}}|<\delta &\implies &|f(x)-f({\tilde {x}})|<\epsilon {\Big )}\\[0.5em]\iff &\exists \epsilon >0\,&\forall \delta >0\,&\neg {\Big\forall {\tilde {x}},x\in D:&|x-{\tilde {x}}|<\delta &\implies &|f(x)-f({\tilde {x}})|<\epsilon {\Big )}\\[0.5em]\iff &\exists \epsilon >0\,&\forall \delta >0\,&\exists {\tilde {x}},x\in D:&\neg {\Big|x-{\tilde {x}}|<\delta &\implies &|f(x)-f({\tilde {x}})|<\epsilon {\Big )}\\[0.5em]\iff &\exists \epsilon >0\,&\forall \delta >0\,&\exists {\tilde {x}},x\in D:&|x-{\tilde {x}}|<\delta &\land &\neg {\Big|f(x)-f({\tilde {x}})|<\epsilon {\Big )}\\[0.5em]\iff &\exists \epsilon >0\,&\forall \delta >0\,&\exists {\tilde {x}},x\in D:&|x-{\tilde {x}}|<\delta &\land &|f(x)-f({\tilde {x}})|\geq \epsilon \end{array}}\end{aligned}}$
So:
$\exists \epsilon >0\,\forall \delta >0\,\exists {\tilde {x}},x\in D:|x-{\tilde {x}}|<\delta \land |f(x)-f({\tilde {x}})|\geq \epsilon$

### Negation of uniform continuity

Definition (Not uniformly continuous)
A function $f:D\to \mathbb {R}$ is called not uniformly continuous, if there is at least one $\epsilon >0$ , such that no matter how small $\delta >0$ is chosen, we can find at least two arguments ${\tilde {x}}$ and $x$ with distance smaller than $\delta$ , such that the function values $f(x)$ and $f({\tilde {x}})$ have a distance of at least $\epsilon$ .

### Uniform continuity is a global property

Uniform continuity is a global property of a function. That means, it makes only sense to consider uniform continuity of a whole function. By contrast, continuity is a local property. We can speak of a function being continuous at a certain position $x$. For uniform continuity, this is not possible. However, a function can be both be globally continuous (continuous at every $x\in D$) and (globally) uniformly continuous.
The globalness is just a consequence from the definition: For uniform continuity, we can find a global $\delta >0$, whose delta-interval around every argument is a sufficient approximation. It is no necessary to speak of a global delta at some certain argument $x$: we just need to find one delta for all arguments.

## Visualization
### Recap: visaulization of the epsilon-delta criterion

In order to visualize the epsilon-delta criterion, we will draw a rectangle centred at $(x_{0},f(x_{0}))$ with height $2\epsilon$ and width $2\delta$. In order to satisfy the epsilon-delta criterion, the graph must not lie above or below the rectangle, but completely inside:
Take, for instance the square function at arguments around $x_{0}=1$. No matter how small we impose $\epsilon$ , we can always find a $\delta$, such that the graph lies completely in the interior of the $2\epsilon$-$2\delta$-rectangle:
Conversely, if a function is not continuous, such as the sign function $\operatorname {sgn}(x)$ , we are able to find an $\epsilon >0$, whose graph always takes values above or below the rectangle - no matter how narrow we make it. Concerning the sign function at $x_{0}=0$ , this will for instance be the case if we choose $\epsilon ={\tfrac {1}{2}}$ :
* For $\epsilon ={\tfrac {1}{2}}$ and $\delta =1$ , the sign function has function values above and below the $2\epsilon$-$2\delta$-rectangle (marked in red).
* No matter how small we choose $\delta$ , there are always points on the graph above or below the $2\epsilon$-$2\delta$-rectangle.

### Visualization of uniform continuity

For uniform continuity, $\delta$ has to be the same at every $x$ . The graph has to fit inside the rectangle, no matter where we move it. That means: For every $\epsilon >0$ there must be a $\delta >0$ , such that the $2\epsilon$-$2\delta$-rectangle can be moved arbitrarily along the graph without having function values above or below it:
For a non-uniformly continuous function, this is not possible. Anoter counter-example is the square function. In fact, for any given $\epsilon >0$ (not just a specific one), we cannot find a $\delta >0$ , such that the graph does nowhere cross the upper or lower border of the $2\epsilon$-$2\delta$-rectangle. For $x$-values near zero, the square function is close to constant, so the graph will fit inside some $2\epsilon$-$2\delta$-rectangle, there. But the more we move it to the right, the steeper our function will get. And at some point, the function will break the upper and lower barriers of the $2\epsilon$-$2\delta$-rectangle. So the square function in a continuous but not uniformly continuous function:

## Scheme of proof
### Scheme of proof: Uniform continuity

In terms of quantifiers, the definition of uniform continuity reads:
${\color {Red}\forall \epsilon >0}\ {\color {RedOrange}\exists \delta >0}\ {\color {OliveGreen}\forall {\tilde {x}},x\in D\ {\big|x-{\tilde {x}}|<\delta }{\color {Blue}\implies |f(x)-f({\tilde {x}})|<\epsilon {\big )}}$
This can be used to derive a scheme of proof for uniform continuity:
${\begin{array}{l}{\color {Red}\underbrace {{\underset}{\text{Let }}\epsilon >0{\text{ be arbitrary.}}} _{\forall \epsilon >0}}\ {\color {RedOrange}\underbrace {{\underset}{\text{Choose }}\delta =\ldots {\text{ There is }}\delta {\text{, since}}\ldots } _{\exists \delta >0}}\\{\color {OliveGreen}\underbrace {{\underset}{\text{Let }}x,{\tilde {x}}\in D{\text{ with }}|x-{\tilde {x}}|<\delta {\text{ be arbitrary.}}} _{\forall {\tilde {x}},x\in D:|x-{\tilde {x}}|<\delta }}\ {\color {Blue}\underbrace {{\underset}{\text{there is: }}|f(x)-f(x_{0})|<\ldots <\epsilon } _{\implies |f(x)-f(x_{0})|<\epsilon }}\end{array}}$

### Scheme of proof: Not uniformly continuous

In terms of quantifiers, the definition of $f$ being not uniformly continuous reads:
${\color {Red}\exists \epsilon >0}\ {\color {RedOrange}\forall \delta >0}\ {\color {OliveGreen}\exists {\tilde {x}},x\in D}:{\color {DarkOrchid}|x-{\tilde {x}}|<\delta }\land {\color {Blue}|f(x)-f({\tilde {x}})|\geq \epsilon }$
This can be used to derive a scheme for disproving uniform continuity:
${\begin{array}{l}{\color {Red}\underbrace {{\underset}{\text{Choose an }}\epsilon =\ldots } _{\exists \epsilon >0}}\ {\color {RedOrange}\underbrace {{\underset}{\text{Let }}\delta >0{\text{ be arbitrary.}}} _{\forall \delta >0}}\\{\color {OliveGreen}\underbrace {{\underset}{\text{Choose }}{\tilde {x}}=\ldots {\text{ and }}x=\ldots {\text{ There is }}{\tilde {x}},x\in D{\text{, since }}\ldots } _{\exists {\tilde {x}},x\in D}}\\{\color {Black}{\text{There is:}}}\\[0.5em]\quad \quad {\color {DarkOrchid}{\text{Proof for }}|x-{\tilde {x}}|<\delta }\\[0.5em]\quad \quad {\color {Blue}{\text{Proof for }}|f(x)-f({\tilde {x}})|\geq \epsilon }\end{array}}$

## Uniform continuity as a stronger form of continuity

Uniform continuity is a stronger form of continuity. That means, every uniformly continuous function is also continuous. The converse does not hold. There are functions like the square function $f:\mathbb {R} \to \mathbb {R} :x\mapsto x^{2}$ being continuous, but not uniformly continuous:
${\begin{array}{c}{\text{uniform}}\\{\text{continuity}}\end{array}}{\begin{array}{c}\not \Longleftarrow \\\implies \end{array}}{\text{continuity}}$

### Every uniformly continuous function is also continuous

Theorem (uniform continuity implies continuity)
Every uniformly continuous function $f:D\to \mathbb {R}$ with $D\subseteq \mathbb {R}$ is continuous at each point $x_{0}\in D$ .
Proof (uniform continuity implies continuity)
We need to show that a uniformly continuous function $f:D\to \mathbb {R}$ is continuous at every point $x_{0}\in D$ . That means, we are given an arbitrary $\epsilon >0$ and $x_{0}\in D$ and we need to find a $\delta >0$ such that $|x-x_{0}|<\delta$ implies the inequality $|f(x)-f(x_{0})|<\epsilon$ . But now, we can just apply the definition of uniform continuity. This definition provides us with a $\delta >0$, such that at all $x,{\tilde {x}}\in D$ with $|x-{\tilde {x}}|<\delta$ , there is $|f(x)-f({\tilde {x}})|<\epsilon$. As this implication holds for all $x,{\tilde {x}}\in D$ , it particularly holds for $x$ and ${\tilde {x}}=x_{0}$. So the $\delta >0$ given by uniform continuity can also be used as the $\delta$ for ordinary continuity at $x_{0}\in D$.

### The square function is continuous but not uniformly continuous

As we have seen, every uniformly continuous function is also continuous. However, the converse does not hold. Let us consider again the square function as an example:${\begin{aligned}f:\mathbb {R} &\longrightarrow \mathbb {R} \\x&\longmapsto x^{2}\end{aligned}}$
As we have seen in the section visualization, if there is $\epsilon >0$ given, we cannot set a fixed $\delta >0$ , such that the graph is everywhere inside the $2\epsilon$-$2\delta$-rectangle , independent from where we place it. The further we move the rectangle to the right, the steeper the square function gets. And at some point, the graph starts crossing he upper and lower borders of the $2\epsilon$-$2\delta$-rectangle.
This can also be seen by checking the epsilon-delta definition of uniform continuity: $\forall \epsilon >0\,\exists \delta >0\,\forall {\tilde {x}}\in \mathbb {R} \,\forall x\in \mathbb {R} :|x-{\tilde {x}}|<\delta \implies |f(x)-f({\tilde {x}})|<\epsilon$. We want to prove the negation of this statement, i.e. $\exists \epsilon >0\,\forall \delta >0\,\exists {\tilde {x}}\in \mathbb {R} \,\exists x\in \mathbb {R} :|x-{\tilde {x}}|<\delta$ and $|f(x)-f({\tilde {x}})|\geq \epsilon$. Consider for instance $\epsilon =1$ and assume there was some $\delta >0$, such that $|x_{1}^{2}-x_{0}^{2}|<\epsilon$ for all real numbers $x_{0},x_{1}\in \mathbb {R}$ with $|x_{1}-x_{0}|<\delta$ . Now consider some $x_{0}(\delta )>0$ which we will determine later. We take the centre $x_{0}$ and some point $x_{1}:=x_{0}+{\frac {\delta }{2}}$ inside the $\delta$-interval. That means, $|x_{1}-x_{0}|={\frac {\delta }{2}}<\delta$.
Now, we want to show that $|x_{1}^{2}-x_{0}^{2}|\geq \epsilon$ holds.
$x_{1}^{2}=(x_{0}+{\frac {\delta }{2}})^{2}=x_{0}^{2}+x_{0}\delta +{\frac {1}{4}}\delta ^{2}\geq (x_{0}+{\frac {\delta }{2}})^{2}=x_{0}^{2}+x_{0}\delta$
Further,
$|x_{1}^{2}-x_{0}^{2}|=(x_{0}+{\frac {\delta }{2}})^{2}-x_{0}^{2}=x_{0}^{2}+\delta x_{0}+{\frac {\delta ^{2}}{4}}-x_{0}^{2}\geq \delta x_{0}.$
If we choose $x_{0}\geq {\frac {1}{\delta }}$ then it is guaranteed that $|x_{1}^{2}-x_{0}^{2}|\geq 1=\epsilon$. Hence, we have proven that
${\begin{aligned}f:\mathbb {R} &\longrightarrow \mathbb {R} \\x&\longmapsto x^{2}\end{aligned}}$
is not uniformly continuous.

## Example: uniformly continuous functions

* The identity function $f:D\to D$ is uniformly continuous, since for $|x-y|<\delta$ , we can show $|f(x)-f(y)|=|x-y|<\epsilon$ by choosing $\delta =\epsilon$ .
* Above, we have seen that the square function $f:\mathbb {R} \to \mathbb {R}$ is not uniformly continuous on the real numbers. However, when restricting to a compact interval, the function gets uniformly continuous. For example,
${\begin{aligned}f:[0,1]&\to \mathbb {R} \\x\mapsto x^{2}\end{aligned}}$ is uniformly continuous. We can prove this as follows: There is $|f(x)-f(y)|=|x^{2}-y^{2}|=|x+y||x-y|\leq 2|x-y|,$ because $x,y\in [0,1]$ . So we can choose $\delta :={\frac {\epsilon }{2}}$ and then for all $x,y\in D$ with $|x-y|<\delta$ the estimate $|f(x)-f(y)|<2|x-y|<2\delta =\epsilon$ will hold.
* The square root function is uniformly continuous on $\mathbb {R} _{0}^{+}$. Consider:
${\begin{aligned}f:\mathbb {R} _{0}^{+}&\to \mathbb {R} \\x&\mapsto {\sqrt {x}}\end{aligned}}$ Let $\epsilon >0$ be arbitrary. Then, $\delta =\epsilon ^{2}$ is a suitable choice: Let $x,y\in [0,\infty [$ with $|x-y|<\delta$.
Without any restrictions, we may choose $x\leq y$. Then, there is also ${\sqrt {x}}\leq {\sqrt {y}}$, and hence we get $|{\sqrt {x}}-{\sqrt {y}}|={\sqrt {y}}-{\sqrt {x}}$.
Now, we want to prove that $|f(x)-f(y)|=|{\sqrt {x}}-{\sqrt {y}}|={\sqrt {y}}-{\sqrt {x}}<\epsilon$ .
By assumption there is $0\leq x\leq y<x+\epsilon ^{2}$. And therefore:
$y<x+\epsilon ^{2}\leq x+2{\sqrt {x}}\epsilon +\epsilon ^{2}=({\sqrt {x}}+\epsilon )^{2}$
So $y<({\sqrt {x}}+\epsilon )^{2}$. Since by assumption $x,y\geq 0$ and also $\epsilon >0$ , we may take the square root of this equation and obtain ${\sqrt {y}}<{\sqrt {x}}+\epsilon$, i.e.${\sqrt {y}}-{\sqrt {x}}<\epsilon$, which is what we wanted to show. Hence, we have proven that $f$ is uniformly continuous.
* The following example is not uniformly continuous:
${\begin{aligned}f:(0,1]&\to \mathbb {R} \\x\mapsto \sin \left({\frac {1}{x}}\right),\end{aligned}}$ , which are sine waves oscillating faster and faster when approaching $x=0$. Assume that $f$ was uniformly continuous. Then we could find some global $\delta$ such that the epsilon-delta criterion holds everywhere. But now, for $x\to 0$ the frequency of $f$ gets arbitrarily high, so inside an interval close to $x\to 0$ , there will always be a full oscillation of the sine inside any $\delta$-ball. Since the peak-to-peak amplitude of the sine function is equal to $2$ , the condition $|f(x)-f(y)|<\epsilon$ will never hold everywhere for $\epsilon <2$ . We just have to move the rectangle close enough to 0, as illustrated by the subsequent figure:

## Properties

As we have seen, not every continuous function is also uniformly continuous. But if we restrict to a closed, compact interval $[a,b]$ , both continuity and uniform continuity will be equivalent:
Theorem (Heine-Cantor for $\mathbb {R}$)
Every function $f:[a,b]\to \mathbb {R}$ is uniformly continuous.
Proof (Heine-Cantor for $\mathbb {R}$)
We choose an indirect way of proof: suppose, the function $f:[a,b]\to \mathbb {R}$ was not uniformly continuous. That means, there is an $\varepsilon >0$ and for every $n\in \mathbb {N}$ there are two points $x_{n},x'_{n}\in [a,b]$, such that $|x_{n}-x'_{n}|<{\tfrac {1}{n}}$ but $|f(x_{n})-f(x'_{n})|\geq \varepsilon$.
The Bolzano Weierstraß theorem tells us (this is where compactness of $f:[a,b]\to \mathbb {R}$ comes into play) that the bounded sequence $(x_{n})_{n\in \mathbb {N} }$ must have a convergent subsequence $(x_{n_{k}})_{k\in \mathbb {N} }$, whose limit $x$ is inside the interval $[a,b]$ . Since $|x_{n_{k}}-x'_{n_{k}}|<{\tfrac {1}{n_{k}}}$ this is also the limit of the subsequence $(x'_{n_{k}})_{k\in \mathbb {N} }$.
Now, continuity of $f$ implies $f(x_{n_{k}})\to f(x)$ and $f(x'_{n_{k}})\to f(x)$. Therefor, there must be a $k_{0}$, such that $|f(x_{n_{k}})-f(x)|<{\tfrac {\varepsilon }{2}}$ and $|f(x'_{n_{k}})-f(x)|<{\tfrac {1}{n_{K}}}$ for all $k\geq k_{0}$. We proceed by splitting and bounding $|f(x_{n_{k}})-f(x'_{n_{k}})|=|(f(x_{n_{k}})-f(x))+(f(x)-f(x'_{n_{k}}))|\leq |(f(x_{n_{k}})-f(x))|+|(f(x)-f(x'_{n_{k}}))|<{\tfrac {\varepsilon }{2}}+{\tfrac {\varepsilon }{2}}=\varepsilon$ ,which holds for all $k\geq k_{0}$ . This contradicts our assumption $|f(x_{n_{k}})-f(x'_{n_{k}})|\geq \varepsilon$ for all $k$. The assumption of $f$ not being uniformly continuous must therefore have been wrong and we obtain uniform continuity.