It was already pointed out that convergence is at the heart of
analysis as many problems can be solved by finding approximate
solutions and proving that they converge. Consider an abstract
equation such as
$$
f(x)=0,
$$
for a function $f:X\to \mathbb{R}$ and assume that we can find
locations $x_n\in X$ such that $|f(x_n)|\leq 1/n$ for any $n\in
\mathbb{N}$ (read approximate solutions). If $X$ carries a topology
and the sequence $x_n$ lies in a compact subset $C$ of $X$, then it
will have a convergent subsequence $(x_{n_k})_{k\in \mathbb{N}}$
with limit $x_\infty$. We would like to conclude that $x_\infty$ is a
solution. For that we would need that
$$
f(x_{n_k})\to 0\text{ as }n\to\infty.
$$
This is unfortunately not true for arbotrary functions $f$. As this is
apparently a desirable property for functions to have, it is given a
name: continuity. Clearly as we don't know along which sequence we
might be coming to $x_\infty$, the meaningful
definition would have to be that $f$ is continuous at $x_\infty$ iff
$$
f(x_n)\to f(x_\infty)\text{ whenever }x_n\to x_\infty,
$$
or iff, given any $(x_n)_{n\in\mathbb{N}}$ with $x_n\to x_\infty\,
(n\to\infty)$,
$$
\forall\,\varepsilon>0\:\exists\, N\in \mathbb{N} \text{
s.t. }|f(x_n)-f(x_\infty)|\leq\varepsilon\text{ for } n\geq N.
$$
This is precisely one of the definitions of continuity found in this
lecture. Another practical motivation for considering continuity stems
from the fact that many problems leading to a mathematical equation
contain parameters $\lambda$, so that often equations for an
unknown $x$ read
$$
f(x,\lambda)=0.
$$
As the parameters are often only known with a certain degree of
accuracy, we cannot be certain of their exact value. Thus we would
like to know whether a solution exist to the equation for $\lambda$
close to a fixed $\lambda _0$ provided one exists for $\lambda _0$ and
whether these solutions are similar (close to each other). While a
full understanding of this problem requires more than just continuity,
you still get a sense that continuity will have to play some role,
since it encodes the intuitive requirement that close enough arguments
should lead to close values.
Definitions (Limit and Continuity)
Let $(X, d_X)$ and $(Y, d_Y)$ be two metric spaces. Given a function
$f:E\to Y$ for a subset $E\subset X$, as well as $x_0\in E'\, ,\:
y_0\in Y$ we say that
(i) $f$ is said to have $y_0$ as a limit as $x\to x_0$,
or, in more mathematical notation
$$
\lim_{x\to x_0} f(x)=y_0,
$$
if and only if for any $\epsilon>0$, there is $\delta>0$ such that
$$
d_Y(f(x), y_0)\leq\epsilon\: \text{ whenever }\: 0 < d_X(x,
x_0)\leq\delta \: \text{ and } \: x\in E.
$$
(ii) $f$ is said to be continuous at $x_0\in E$ if and
only if $\lim_{x\to x_0} f(x)=f(x_0)$
(iii) $f$ is called discontinuous at $x_0$ iff $f$ is
not continuous at $x_0$.
We will study the case $X=\mathbb{R}^n$ and $Y=\mathbb{R}$ first.
Theorem
Let $f, g:\mathbb{R}^n\to \mathbb{R}$ be two functions and $x_0\in
\mathbb{R}^n$. Then
(i) $\lim_{x\to x_0}\bigl[ f(x)\pm g(x)\bigr]=\lim_{x\to x_0} f(x) \pm
\lim_{x\to x_0} g(x)$,
(ii) $\lim_{x\to x_0}\bigl(f(x)g(x)\bigr)=\lim_{x\to x_0} f(x)
\cdot\lim_{x\to x_0} g(x)$,
(iii) $\lim_{x\to x_0} \big(f(x) g(x)^{-1}\big)=\lim_{x\to x_0}
f(x)\bigl[\lim_{x\to x_0} g(x)\bigr]^{-1}$, whenever $\lim_{x\to x_0}
g(x)\ne 0$,
provided that all limits exist.
Example
Let
$$
f(x,y) = \left\{
\begin{array}{l l}
\frac{xy}{x^2 + y^2} & \quad (x,y) \ne (0,0)\\
0 & \quad (x,y) = (0,0)\\
\end{array} \right.
$$
Discuss the limit and the continuity of $f$ on $\mathbb{R}^2$ at
$x_0\in \mathbb{R} ^2$.
If $(x_0, y_0) \ne (0,0)$, that is, if $x_0^2 + y_0^2\neq 0$, then
$(x,y)\ne (0,0)$ for $(x,y)$ sufficiently close to $(x_0,y_0)$. It
follows that
$$
\lim_{(x,y) \to (x_0, y_0)} f(x,y) = \lim_{x \to x_0, y \to y_0}
\dfrac{xy}{x^2+y^2} = \dfrac{x_0y_0}{x_0^2 + y_0^2}=f(x_0, y_0)\, .
$$
If, on the other hand, $(x_0, y_0) = (0,0)$, then
$$
\lim_{x=y\to 0} f(x, y) = \lim_{x\to 0}\frac{x x}{x^2+x^2}=\frac{1}{2}
\quad\text{ and }\:
\lim_{x \to 0, y=0} f(x, y)=\lim_{x\to 0}\frac{0}{x^2}=0.
$$
We conclude that $\lim_{(x, y)\to (0,0)} f(x, y)$ does not exist and thus $f$ is
continuous on $\mathbb{R}\setminus\{(0,0)\}$.
Example
Let
$$
f(x,y) = \left\{
\begin{array}{l l}
\frac{x^3-y^2 x}{x^2 + y^2} & \quad (x,y) \ne (0,0)\\
0 & \quad (x,y) = (0,0)\\
\end{array} \right.
$$
and prove that $f$ is continuous on $\mathbb{R}^2$.
Example
Find the largest set $C\subset\mathbb{R}^2$ such that $f\big |_C$ is
continuous for
$$
f(x,y) = \left\{
\begin{array}{l l}
\dfrac{xy^2}{x^2+y^4} & \quad (x,y) \ne (0,0)\\
0 & \quad (x,y) = (0,0)\\
\end{array} \right.
$$
We claim that $C = \mathbb{R}^2 \setminus \{(0,0)\}$. For any $(x_0,
y_0) \in C$, we
have that
\begin{align*}
\lim_{(x,y)\to(x_0,y_0)} f(x,y) & =\lim_{(x,y)\to(x_0,y_0)}
\dfrac{xy^2}{x^2 + y^4}=\dfrac{x_0y_0^2}{x_0^2 + y_0^4} = f(x_0,
y_0),
\end{align*}
so that $f$ is continuous at $(x_0, y_0)$. Notice, however, that
$$
\lim_{x\to0, y= 0} \dfrac{xy^2}{x^2+ y^4} = \lim_{x\to 0}
\dfrac{0}{x^2} = 0,
$$
and that
$$
\lim_{x=y^2 \to0} \dfrac{xy^2}{x^2+ y^4} = \lim_{y\to 0}
\dfrac{y^2y^2}{y^4 + y^4}=1/2.
$$
Thus $\lim_{(x,y) \to (0,0)} f(x,y) = \lim_{(x,y) \to (0,0)}
\dfrac{xy^2}{x^2+y^4}$ does not exist, concluding the proof.
Example
Construct a function $f: \mathbb{R} \to \mathbb{R}$ that is
discontinuous everywhere.
The Dirichlet function
\[D(x)= \left\{
\begin{array}{l l}
1 & \quad \mbox{$x$ is rational}\\
0 & \quad \mbox{$x$ irrational}\\
\end{array} \right.
\]
is discontinuous at every point of $\mathbb{R}$ due to the fact that
$\mathbb{Q}$ and $\mathbb{R}\setminus{Q}$ both are dense in
$\mathbb{R} $.
Example
Construct a function $f$ on $[0,1]$ which is continuous at every
irrational point and discontinuous at every rational point in $[0,1]$.
The Riemann function
$$
R(x)=\begin{cases}
0\, ,&\text{if }x\text{ is irrational}\\
1/n\, ,&\text{if }x=m/n\, ,\: (m,n)=1\\
1\, , &\text{if } x=0,1
\end{cases}
$$
is such a function. Indeed, if $x_0 \in (0,1)$ is an irrational
number, we know that $R(x_0) = 0$. Let $\epsilon>0$ and consider the
set
$$
E_{\epsilon}=:\{m/n\in (0,1)\, |\, (m,n) =1\text{ and
}\dfrac{1}{n}\ge\epsilon\}
$$
It is easily seen that $E_{\epsilon}$ is a finite set, so that
$$
E_{\epsilon}=\{{p_j /q_j}\, |\, j=1,\dots, k\}\, .
$$
Then
$$
R(x)|\leq\epsilon\text{ whenever }|x-x_0|\leq\delta
$$
for $\delta=\min\{|p_j/q_j-x_0|\, :\, j=1,\dots, k\}$.
It follows that $R(x)$ is continuous at $x_0$.
If, on the other hand, $x_0$ is rational, then $R(x_0)>0$, while, by
density of the irrationals, there are inftinitely many irrational
numbers $x$ in any interval around $x_0$ where $R(x)=0$.
Definition (monotony)
A function $f:(a,b)\to \mathbb{R}$ is called
[strictly] increasing if
$$
f(x_1) \le f(x_2)\: [f(x_1) < f(x_2)],\text{ whenever }x_1\leq
x_2.
$$
Theorem
Let $f:(a,b)\to \mathbb{R}$ be an increasing function and set
$$
D_f = \{x_0 \in (a,b)\, |\, f\text{ is discontinuous at }x_0 \}.
$$
Then, $D_f$ is at most countable.
Let $x_0 \in D_f$. Since $f$ is increasing, we have that
$$
\lim_{x \to x_0\pm} f(x) = f(x_0\pm)
$$
exist. For the same reason we must also have that $f(x_0-)<
f(x_0+)$ at points of discontinuity. Define
$$
I_{x_0} = \bigl(f(x_0-), f(x_0+)\bigr).
$$
We also have that $f(x_0+)\le f(x_1-)$ for $x_0 < x_1$ and that
$$
I_{x_0} \cap I_{x_1} =\emptyset,\: x_0\ne x_1,
$$
for $x_0, x_1 \in D_f$. For $x\in D_f$ choose a
rational number $\gamma_{x} \in I_{x}$. It follows that
$$
\gamma_{x_0} < \gamma_{x_1}\text{ if }x_0,x_1 \in D_f\text{ satisfty
}x_0 < x_1.
$$
The proof is completed by observing that $\{\gamma_{x_0} : x_0 \in D_f
\}$ is at most countable as a subset of $\mathbb{Q}$ and so is $D_f$.
Example
We now give an abstract characterization of the exponential
function. Let $f:\mathbb{R} \to \mathbb{R}$ be a continuous function
satisfying
$$
f(x+y) = f(x) f(y),\: x,y \in \mathbb{R}\text{ and }f(1)=e.
$$
Then $f(x) = e^x$ for $x \in \mathbb{R}$.
It follows from $f(1)=f(0)\, f(1)$ that $f(0)=1$. The fact that
$f(0)=f(-1)\, f(1)$ yields $f(-1)=e^{-1}$. Thus
$$
f(m) = f(1) f(m-1) = f(1)^m= e^m\, ,\: m \in \mathbb{Z}.
$$
Now $f(1)=f(n/n)=f(1/n)^n$ implies that $f(1/n)=e^{1/n}$ and that
$f(m/n)=f(1/n)^m=e^{m/n}$. Finally continuity combined with the
density of $\mathbb{Q}$ in $\mathbb{R}$ yields
$$
f(x)=\lim_{n\to\infty} f(r_n)=\lim_{n\to\infty} e^{r_n}=e^x,
$$
by choosing a sequence $\{r_n\}$ in $\mathbb{Q}$ such that
$x=\lim_{n\to\infty}r_n$.
Example
An analogous characterization works for $\log$. Let $f: (0,\infty) \to
\mathbb{R}$ be a continuous function satisfying
$$
f(x y) = f(x) +f(y)\, ,\: x,y \in (0,\infty)\text{ and }f(e) = 1.
$$
Then $f(x)=\log x$ for $x \in \mathbb{R}$.
Definition (Convexity)
Let $E$ be convex and $f:E\to \mathbb{R}$ be a function. We say that
$f$ is convex iff
$$
f\bigl(\lambda x+(1-\lambda) y\bigr)\le \lambda f(x)+(1-\lambda)
f(y),\: x,y\in E,\:\lambda\in (0,1)\, .
$$
Exercise
Let $I\subset\mathbb{R}$ be an interval and prove that $f$ is convex
if and only if
$$
f\bigl(\frac{x+y}{2}\bigr)\le \frac{1}{2}f(x)+\frac{1}{2}f(y),\: x,
y\in I.
$$
Theorem
If $f:E\to \mathbb{R}$ is a convex function on a convex subset
$E\subset\mathbb{R}^n$, then $f$ is locally bounded and continuous on
$E$.
We consider $n=1$ case, so that $E$ is an interval. If $E$ has no
interior, there is nothing to prove. Otherwise take any $a,b, c\in E$
such that $a < b < c$. Using
$$
f\bigl( \lambda a+(1-\lambda)b\bigr)\leq\lambda f(a)+(1-\lambda)f(b),
$$
it follows that
$$
\limsup_{x\to b-} f(x)=\limsup_{x\to b-} f(\lambda_x
a+(1-\lambda_x)b)\le \limsup_{x\to b-} \bigl[\lambda_x\, f(a)+(1-\lambda_x)
f(b)\bigr]\le f(b),
$$
since $\lambda_x\to 0$ if $x\to b$. The validity of
$$
f\bigl( \lambda b+(1-\lambda)c\bigr)\leq\lambda f(b)+(1-\lambda)f(c)
$$
implies that
$$
\limsup_{x\to b+}f(x)=\limsup_{\lambda\to 1-} f(\lambda
b+(1-\lambda)c)\le f(b).
$$
Now, for any $0 < \epsilon < \min \{b-a, c-b\}$, one has
$$
f(b)=f({b-\epsilon\over 2}+{b+\epsilon\over 2})\le {1\over
2}f(b-\epsilon)+{1\over 2} f(b+\epsilon).
$$
This, in turn, implies that
$$
f(b)\le {1\over 2} \limsup_{\epsilon\to 0+}f(b-\epsilon)+{1\over
2}\liminf_{\epsilon\to 0+} f(b+\epsilon)\le {1\over 2} f(b)+{1\over 2}
\liminf_{\epsilon\to 0+} f(b+\epsilon)
$$
Thus
$$
f(b)\le \liminf_{x\to b+}f(x)\text{ and similarly }f(b)\le
\liminf_{x\to b-}f(x).
$$
and therefore
$$
\limsup_{x\to b+}f(x)=f(b)=\liminf_{x\to b+}f(x)\hbox{ and }
\limsup_{x\to b-}f(x)=f(b)=\liminf_{x\to b-}f(x).
$$
We conclude that $f$ is continuous at $b$, and hence continuous in
$E$. Therefore, it is locally bounded on $E$.
Exercise
Convince yourself that $f$ cannot be unbounded below at such
endpoints.
Properties of continuous functions
Theorem
Let $(X, d)$ be a metric space and the function $f:X\to \mathbb{R}$ be
continuous at $x_0 \in X $. If $f(x_0)>0$, then there is $\delta>0$
such that
$$
f(x)\ge \frac{f(x_0)}{2}>0\text{ for all }x\in \mathbb{B}(x_0,
\delta).
$$
Setting $\epsilon=\frac{f(x_0)}{2}>0$ continuity yields a $\delta>0$
such that
$$
|f(x)-f(x_0)|\leq\epsilon=\frac{f(x_0)}{2}\text{ for }x\in
\mathbb{B}(x_0,\delta).
$$
Thus $f(x)-f(x_0)\geq-\frac{f(x_0)}{2}$ and thus $f(x)\geq
\frac{f(x_0)}{2}>0$ for any $x\in \mathbb{B}(x_0, \delta)$.
Theorem (Topological Characterization)
Let $(X, d_X)$ and $(Y, d_Y)$ be two metric spaces. Then $f: X \to Y$
is continuous if and only if preimages of open sets are open, i.e. iff
$$
f^{-1}(V) = \big\{ x\in X\, |\, f(x)\in V\big\}\text{ is open in }X\text{
whenever }V\text{ is open in }Y\, .
$$
"$\Rightarrow$" Assume $f$ is continuous from $X \to Y$ and let
$V\subset Y$ be open. We need to prove $f^{-1}(V)$ is open in
$X$. Take $x_0\in f^{-1}(V)$ so that $y_0=f(x_0)\in V$. Since $V$ is
open, there is $\epsilon>0$ with
$$
\mathbb{B}_Y(y_0,\epsilon)\subset V.
$$
Continuity of $f$ at $x_0$ yields $\delta>0$ such that
$$
f\bigl(\mathbb{B}_X(x_0, \delta)\bigr)\subset
\mathbb{B}_Y(y_0,\epsilon)\subset V,
$$
so that $\mathbb{B}(x_0, \delta)\subset f^{-1}(V)$ and $f^{-1}(V)$ is
open since $x_0$ was arbitrary.
"$\Leftarrow$" Assume $f^{-1}(V)$ is open in $X$ whenever $V$ is open
in $Y$. We show $f$ is continuous. For any $x_0 \in X$, $f(x_0)\in Y$
and, for any $\epsilon>0$, $\mathbb{B}_Y(f(x_0), \epsilon)$ is an open
set in $Y$. Then
$$
f^{-1}\Bigl(\mathbb{B}_Y\bigl(f(x_0), \epsilon\bigr)\Bigr)\text{ is
open in }X,
$$
and contains $x_0$. So, there must be $\delta>0$ with
$$
\mathbb{B}_X(x_0,\delta)\subset f^{-1}\Bigl(\mathbb{B}_Y\bigl(f(x_0),
\epsilon\bigr)\Bigr)
$$
or $f\bigl(\mathbb{B}_X(x_0,\delta)\bigr)\subset
\mathbb{B}_Y\bigl(f(x_0),\epsilon\bigr)$. Thus, $f$ is continuous at
$x_0$.
Exercise
Given an equivalent characterization of continuity using sequences.
Theorem (Extrema)
Let $(X, d)$ be a complete metric space and let $K\subset X$ be
compact. Let $F: K \to \mathbb{R}$ be a continuous function.
Then there are $x_0, y_0 \in K$ such that
$$
f(x_0)\le f(x)\le f(y_0),\: x\in K.
$$
Let
$$
M=\sup\big\{f(x): x\in K\big\} \text{ and } m=\inf\big\{f(x): x\in
K\big\}.
$$
By definition, there are sequences $\{x_n\}_{n=}^\infty$ and
$\{y_n\}_{n=1}^\infty$ in $K$ such that
$$
M=\lim_{n\to\infty} f(y_n)\quad\hbox{ and } \lim_{n\to \infty}
f(x_n)=m.
$$
Since $K$ is compact and $X$ is complete, there are subsequences
$(x_{n_k})_{k\in\mathbb{N}}$ and $(y_{n_k})_{k\in \mathbb{N} }$ as
well as $x_0, y_0\in K$ such that
$$
\lim_{k\to\infty} x_{n_k}=x_0\quad\hbox{and }\lim_{k\to\infty}
y_{n_k}=y_0.
$$
By continuity of $f$ at $x_0$ and $y_0$ it follows that
$$
f(x_0)=\lim_{k\to\infty} f(x_{n_k})=m\text{ and }
f(y_0)=\lim_{k\to\infty}f(y_{n_k})=M,
$$
and the proof is complete.
Theorem (Intermediate Value Theorem)
Let $f:[a, b]\to \mathbb{R}$ be continuous. Then
$$
f\bigl([a,b]\bigr)=[m, M]
$$
where $M=\max\big\{f(x)\, |\, x\in K\big\}$ and $m=min\big\{f(x)\, |\,
x\in K\big\}$.
Exercise
Show that $f(x)=-2x^3+100 x^2-x+100$ has at least one real root.
Uniform continuity
Definition
Let
$(X, d_X)$ and $(Y,d_Y)$ be metric spaces and $K\subset X$. $f: K \to
Y$ is said to be uniformly continuous on $K$ iff, for any
$\epsilon>0$, there is $\delta>0$ such that
$$
d_Y\bigl(f(x),f(y)\bigr)\leq\epsilon\text{ whenever }x,y \in K\text{
with }d_X(x,y)\leq\delta.
$$
We observe that continuity is a local property while uniform
continuity is global as it depends on the behavior of the function
everywhere.
Proposition
If $f$ is uniformly continuous on $K$, then $f:K\to Y$ is continuous
on $K$. The converse is not true.
Nexample
Consider $f(x) = x^2$ for $x\in \mathbb{R}$. While $f$ is continuous,
it is not uniformly continuous on $\mathbb{R}$. In order to prove
this, we need to find $\epsilon_0>0$ such that, for any $\delta>0$,
there are $x, y\in \mathbb{R}$ with
$$
|x-y|<\delta\text{ but }|f(x) - f(y)|\ge\epsilon_0.
$$
If $f$ is not uniformly continuous on $K$, then we can find
$\epsilon_0>0$ such that, for any $\delta>0$, there are $x_\delta$,
$y_\delta \in K$ with
$$
d_X(x_{\delta}, y_{\delta})\leq\delta \text{ and }d_Y\bigl(f(x_\delta),
f(y_\delta)\bigr)\ge\epsilon_0 \, .
$$
For $n\in\mathbb{N}$, choose $\delta=1/n$ and $x_n, y_n \in K$ such that
$$
d_X(x_n, y_n)\leq 1/n \text{ and }d_Y\bigl(f(x_n), f(y_n)\bigr)\ge\epsilon_0
$$
Since $K$ is compact, there are subsequences $(x_{n_k})_{k\in \mathbb{N}}$ and
$(y_{n_k})_{k\in \mathbb{N}}$ with
$$
\lim_{k\to \infty} x_{n_k}=x=\lim_{k\to \infty} y_{n_k}\, ,
$$
for some $x\in K$.
Thus
\begin{equation*}
0<\epsilon_0\leq d_Y\bigl(f(x_{n_k}), f(y_{n_k})\bigr)\leq
d_Y\bigl(f(x_{n_k}), f(x)\bigr)+ d_Y\bigl(f(x), f(y_{n_k})\bigr)\, ,
\end{equation*}
which contradicts the continuity of $f$ at $x$.
Definition
Let $(X,d_X)$ and $(Y,d_Y)$ be metric spaces and $f:X\to Y$ be
given. The function $f$ is called Hölder
continuous of exponent $\alpha\in(0,1)$ if there is a constant
$c\geq 0$ such that
$$
d_Y\bigl(f(x),f(y)\bigr)\leq c\, d_X(x,y)^\alpha\, ,\: x,y\in X\, .
$$
If the inequality holds with $\alpha=1$, the function is called
Lipschitz continuous continuous.
Example
Prove that Hölder and Lipschitz functions are uniformly
continuous.
Example
Let $D \subset \mathbb{R}^n$ be convex and $f: D\to \mathbb{R}$ be
differentiable. If
$$
\big |\nabla f(x)\big | =\bigl[ \sum_{j=1}^n \Big | \frac{\partial f
(x)}{\partial x_j} \Big| ^2 \bigr]^{1/2}
$$
is bounded on $D$, then $f$ must be uniformly continuous on
$D$. Indeed, if $x,y\in D$, then there is $\xi$ on the connecting
segment between $x$ and $y$ (this follows from the Mean Value Theorem
to be proved later) such that
$$
f(x)-f(y)=\nabla f(\xi)\cdot (x-y).
$$
It follows that
$$
|f(x)-f(y)|\leq |\nabla f(\xi)||x-y|\leq M|x-y|,
$$
and $f$ is Lipschitz continuous since $x$ and $y$ are arbitrary.
Example
Show $f(x)=\sqrt{x}$ is uniformly continuous on $(0,\infty)$.
Method 1: Fix $\epsilon>0$. Since $f$ is continuous on the
compact interval $[0,2]$, it is uniformly continuous there and we can
find $\delta_1>0$ such that
$$
|f(x_1)-f(x_2)|\leq\epsilon\text{ if }x_1, x_2\in [0,2]\text{ and
}|x_1-x_2|<\delta_1.
$$
Let $\delta_2=2\epsilon$.
Since $f'(x) = \dfrac{1}{2} \dfrac{1}{\sqrt{x}}$ and $|f'(x)| \le
\dfrac{1}{2}$ on $[1,\infty)$, the Mean Value Theorem (proved later)
yields
$$
|f(x_1) - f(x_2) | = f'(\xi)|x_1 - x_2| \le \dfrac{1}{2} |x_1 -
x_2|\leq\epsilon
$$
for $x_1, x_2 \in [1, \infty)$ such that $|x_1-x_2|\leq\delta_2$, and
some $\xi\in(x_1,x_2)$. Finally choosing
$$
\delta=\min\{\delta_1, \delta_2, 1\},
$$
it is easy to see that $x_1, x_2\in (0,2]$ and $|x_1-x_2|<\delta_1$ or
$x_1, x_2\in[1,\infty)$ and $|x_1-x_2|<\delta_2$ whenever
$x_1, x_2\in (0,\infty)$ and $|x_1-x_2|<\delta$. Therefore, in any
case, we have that
$$
|f(x_1)-f(x_2)|\leq\epsilon\text{ for }x_1,x_2\in(0,\infty)\text{
with }|x_1, x_2|\leq\delta,
$$
as desired.
Method 2: Set $\delta=\epsilon^2$ for $\epsilon>0$. For any $0
< x_1\le x_2 <\infty$ and $x_2-x_1<\delta$, one either has that $
x_2\le \epsilon^2$, in which case
$$
|\sqrt{x_2}-\sqrt{x_1}|\le \sqrt{x_2}\le \epsilon
$$
or $x_2\ge \epsilon^2$ and then
$$
|\sqrt{x_2}-\sqrt{x_1}|= {x_2-x_1\over \sqrt{x_2}+\sqrt{x_1}}\le
{\epsilon^2\over \epsilon}=\epsilon.
$$
Thus $\sqrt{x}$ is uniformly continuous on $(0,\infty)$.
Exercise
Show that, if $f$ is uniformly continuous on $[\delta, \infty)$ and on
$[0,2\delta]$ for any fixed $\delta>0$, then it is uniformly
continuous on $[0,\infty)$.
Example
Show that $f(x)=\log(1 + | x| ^2)$ is uniformly continuous on
$\mathbb{R}^n$.
Since $\frac{\partial f}{\partial x_j} (x) = \frac{2 x_j}{1+|x|^2}$,
for any $x\in \mathbb{R}^n$, it follows that
$$
|\nabla f(x)|=\sum_{j=1}^n \big | \frac{\partial f}{\partial
x_j}\big | ^2=\sum_{n=1}^n\frac{4 x_j^2}{(1+ | x| ^2)^2}=
\frac{4 | x| ^2 }{(1+ |x|^2)^2}= \bigl(\frac{2 |x|}{(1+|x|
^2)}\bigr)^2 \le 1.
$$
Then we have that $f$ is uniformly continuous on $\mathbb{R}^n$. In
fact
\begin{equation*}
|f(x) - f(y)|=|\nabla f(\xi) \cdot (x-y) | \le |\nabla f(\xi) | |
x-y|\le | x-y|
\end{equation*}
for $\xi=\tau x +(1-\tau)y$ and some $\tau\in(0,1)$.
Theorem (Extension of Uniformly Continuous
Functions)
Let $(X,d)$ be a metric space and $K \subset X$. If $f:K\to
\mathbb{R}$ is uniformly continuous, then it can be extended to a
uniformly continuous function $\tilde f$ to $\overline{K}$.
Fix $x_0 \in K' \setminus K$. How can we define $\tilde f(x_0)$? Choose
first a sequence $\{x_n\}_{n=1}^\infty$ in $K$ with $\lim
_{n\to\infty}x_n=x_0$. Uniform continuity ensures that $\bigl(
f(x_n)\bigr)_{n\in \mathbb{N}}$ is a Cauchy sequence in $\mathbb{R}$
(verify this for yourself!). Then take $\tilde f(x_0)$ to be its limit, which
exists by completeness of $\mathbb{R}$.
Next we need to make sure that this limit does not depend on the
choice of approximating sequence for $x_0$. Let $\{y_n\}_{n=1}^\infty$
be any other sequence in $K$ converging to $x_0$. Then
$$
|f(y_n)-\tilde f(x_0)|\le |\tilde f(x_0)-f(x_n)|+|f(x_n)-f(y_n)|\, ,\:
n\in\mathbb{N}
$$
and uniform continuity ensures smallness of the second term on the
righ-hand-side of the inequality. Thus $f$ can be extended uniquely to
$\tilde f:\overline{K}\to\mathbb{R}$.
It remains to show that $\tilde f$ is uniformly continuous on
$\overline{K}$. Given $\epsilon>0$, uniform continuity of $f$ yields a
$\delta>0$ such that
$$
|f(x)-f(y)|\leq\epsilon\text{ whenever }x, y\in K\text{ with }d(x,
y)\leq\delta.
$$
For any $x, y\in \overline{K}$ with $d(x, y)<\delta/3$ there are $x',
y'\in K$ such that
$$
d(x, x')\leq\delta/3,\: |\tilde f(x)-f(x')|\leq\epsilon\text{
and that }d(y, y')\leq\delta/3,\: |\tilde f(y)-f(y')|\leq\epsilon.
$$
It follows that
$$
d(x', y')\le d(x', x)+d(x,y)+d(y, y')\leq\delta
$$
and that
$$
|\tilde f(x)-\tilde f(y)|\le|\tilde
f(x)-f(x')|+|f(x')-f(y')|+|f(y')-\tilde f(y)|\leq\epsilon
+\epsilon+\epsilon=3\epsilon,
$$
and $f$ is indeed uniformly continuous on $\bar{K}$.
Example
Let $f:\mathbb{Q}\to\mathbb{R}$ be a uniformly continuous
function. Show that there is a unique uniformly continuous extension
$\tilde f:\mathbb{R}\to\mathbb{R}$ satisfying
$$
\tilde f\big |_\mathbb{Q} = f.
$$
We have that $\mathbb{\bar{Q}} = \mathbb{R}$, since $\mathbb{Q}$ is
dense in $\mathbb{R}$. Thus existence of an extension now follows from
the previous theorem.
Continuity of the Inverse
Definition (Inverse)
Let $f: X \to Y$ be one-to-one and onto. The inverse
function $f^{-1}: Y \to X$ is defined by setting
$$
f^{-1} (y) = x \text{ for }x\in X\text{ such that }f(x) = y.
$$
Lemma
If $f:X\to Y$ is continuous and $K \subset X$ is compact, then so is
$f(K)$.
Any open covering $\{V_\lambda: \lambda \in I\}$ of $f(K)$ yields the
open cover $\{f^{-1} (V_\lambda): \lambda \in I\}$ for $K$ by
continuity of $f$. Now $K$ is compact and there must be a finite
subcover, that is, $\{ f^{-1} (V_{\lambda_j})\, |\, j=1,\dots,n\}$
with
$$
K\subset \cup_{j=1}^n f^{-1} (V_{\lambda_n})\, .
$$
It follows that $f(K) \subset \cup_{j=1}^n V_{\lambda_j}$ and $f(K)$
is compact.
Exercise
Use the characterization of of continuity and of compactness by
sequences to give an alternative proof of the lemma.
Theorem
Let $(X,d_X)$ and $(Y,d_Y)$ be metric spaces and $X$ be compact. If
$f:X \to Y$ is a continuous, one-to-one, and onto function, then
$f^{-1}: Y\to X$ is also continuous.
Let $U$ be any open set in $X$. Then $U^c$ is closed in $X$. Since
$X$ is compact, so is $U^c$. Then $f(U^c)$ is compact in $Y$ and
therefore also closed. Now, since $f$ is injective,
$$
f(U) = Y\setminus f(U^c)
$$
is open and $f^{-1}: Y\to X$ is continuous.