A high-school criterion for the concept of continuity is that a function is continuous if we can draw its graph without lifting the pen from the paper. While that intuitive concept may be useful in simple situations, we require rigor. The following definition took three great mathematicians (Bolzano, Cauchy, and finally Weierstrass) to get correctly and its final form dates only to the late 1800s.
Subsection3.2.1Definition and basic properties
Definition3.2.1.
Suppose \(S \subset \R\) and \(c \in S\text{.}\) We say \(f \colon S \to \R\) is continuous at \(c\) if for every \(\epsilon > 0\) there is a \(\delta > 0\) such that whenever \(x \in S\) and \(\abs{x-c} <
\delta\text{,}\) we have \(\abs{f(x)-f(c)} < \epsilon\text{.}\)
When \(f \colon S \to \R\) is continuous at all \(c \in S\text{,}\) then we simply say \(f\) is a continuous function.
If \(f\) is continuous for all \(c \in A\text{,}\) we say \(f\) is continuous on \(A \subset S\). A straightforward exercise (Exercise 3.2.7) shows that this implies that \(f|_A\) is continuous, although the converse does not hold (as we will see in Example 3.2.13).
Continuity may be the most important definition to understand in analysis, and it is not an easy one. See Figure 3.3. Note that \(\delta\) not only depends on \(\epsilon\text{,}\) but also on \(c\text{;}\) we need not pick one \(\delta\) for all \(c \in S\text{.}\) It is no accident that the definition of continuity is similar to the definition of a limit of a function. The main feature of continuous functions is that these are precisely the functions that behave nicely with limits.
Proposition3.2.2.
Consider a function \(f \colon S \to \R\) defined on a set \(S \subset \R\) and let \(c \in S\text{.}\) Then:
If \(c\) is not a cluster point of \(S\text{,}\) then \(f\) is continuous at \(c\text{.}\)
If \(c\) is a cluster point of \(S\text{,}\) then \(f\) is continuous at \(c\) if and only if the limit of \(f(x)\) as \(x \to c\) exists and
The function \(f\) is continuous at \(c\) if and only if for every sequence \(\{ x_n \}_{n=1}^\infty\) where \(x_n \in S\) and \(\lim\limits_{n\to\infty} x_n = c\text{,}\) the sequence \(\bigl\{ f(x_n) \bigr\}_{n=1}^\infty\) converges to \(f(c)\text{.}\)
Proof.
We start with i. Suppose \(c\) is not a cluster point of \(S\text{.}\) Then there exists a \(\delta > 0\) such that \(S \cap (c-\delta,c+\delta) = \{ c \}\text{.}\) For any \(\epsilon > 0\text{,}\) simply pick this given \(\delta\text{.}\) The only \(x \in S\) such that \(\abs{x-c} < \delta\) is \(x=c\text{.}\) Then \(\abs{f(x)-f(c)} = \abs{f(c)-f(c)} = 0 < \epsilon\text{.}\)
Let us move to ii. Suppose \(c\) is a cluster point of \(S\text{.}\) Let us first suppose that \(\lim_{x\to c} f(x) = f(c)\text{.}\) Then for every \(\epsilon > 0\text{,}\) there is a \(\delta > 0\) such that if \(x \in S \setminus \{ c \}\) and \(\abs{x-c} < \delta\text{,}\) then \(\abs{f(x)-f(c)} < \epsilon\text{.}\) Also \(\abs{f(c)-f(c)} = 0 < \epsilon\text{,}\) so the definition of continuity at \(c\) is satisfied. On the other hand, suppose \(f\) is continuous at \(c\text{.}\) For every \(\epsilon > 0\text{,}\) there exists a \(\delta > 0\) such that for \(x \in S\) where \(\abs{x-c} < \delta\text{,}\) we have \(\abs{f(x)-f(c)} < \epsilon\text{.}\) Then the statement is, of course, still true if \(x \in S \setminus \{ c \} \subset S\text{.}\) Therefore, \(\lim_{x\to c} f(x) =
f(c)\text{.}\)
For iii, first suppose \(f\) is continuous at \(c\text{.}\) Let \(\{ x_n \}_{n=1}^\infty\) be a sequence such that \(x_n \in S\) and \(\lim_{n\to\infty} x_n = c\text{.}\) Let \(\epsilon > 0\) be given. Find a \(\delta > 0\) such that \(\abs{f(x)-f(c)} < \epsilon\) for all \(x \in S\) where \(\abs{x-c} < \delta\text{.}\) Find an \(M \in \N\) such that for \(n \geq M\text{,}\) we have \(\abs{x_n-c} < \delta\text{.}\) Then for \(n \geq M\text{,}\) we have that \(\abs{f(x_n)-f(c)} < \epsilon\text{,}\) so \(\bigl\{ f(x_n) \bigr\}_{n=1}^\infty\) converges to \(f(c)\text{.}\)
We prove the other direction of iii by contrapositive. Suppose \(f\) is not continuous at \(c\text{.}\) Then there exists an \(\epsilon > 0\) such that for every \(\delta > 0\text{,}\) there exists an \(x \in S\) such that \(\abs{x-c} < \delta\) and \(\abs{f(x)-f(c)} \geq \epsilon\text{.}\) Define a sequence \(\{ x_n \}_{n=1}^\infty\) as follows. Let \(x_n \in S\) be such that \(\abs{x_n-c} < \nicefrac{1}{n}\) and \(\abs{f(x_n)-f(c)} \geq \epsilon\text{.}\) Now \(\{ x_n \}_{n=1}^\infty\) is a sequence in \(S\) such that \(\lim_{n\to\infty} x_n = c\) and such that \(\abs{f(x_n)-f(c)} \geq \epsilon\) for all \(n \in \N\text{.}\) Thus \(\bigl\{ f(x_n) \bigr\}_{n=1}^\infty\) does not converge to \(f(c)\text{.}\) It may or may not converge, but it definitely does not converge to \(f(c)\text{.}\)
The last item in the proposition is particularly powerful. It allows us to quickly apply what we know about limits of sequences to continuous functions and even to prove that certain functions are continuous. It can also be strengthened, see Exercise 3.2.13.
Example3.2.3.
The function \(f \colon (0,\infty) \to \R\) defined by \(f(x) \coloneqq \nicefrac{1}{x}\) is continuous.
Proof: Fix \(c \in (0,\infty)\text{.}\) Let \(\{ x_n \}_{n=1}^\infty\) be a sequence in \((0,\infty)\) such that \(\lim_{n\to\infty} x_n = c\text{.}\) Then
Thus \(f\) is continuous at \(c\text{.}\) As \(f\) is continuous at all \(c \in
(0,\infty)\text{,}\)\(f\) is continuous.
We have previously shown \(\lim_{x \to c} x^2 = c^2\) directly. Therefore the function \(x^2\) is continuous. The last item of Proposition 3.2.2 and the continuity of algebraic operations with respect to limits of sequences, Proposition 2.2.5, gives a quick proof of a much more general result.
Proposition3.2.4.
Let \(f \colon \R \to \R\) be a polynomial. That is,
Thus \(f\) is continuous at \(c\text{.}\) As \(f\) is continuous at all \(c \in \R\text{,}\)\(f\) is continuous.
By similar reasoning, or by appealing to Corollary 3.1.12, we can prove the following proposition. The proof is left as an exercise.
Proposition3.2.5.
Let \(f \colon S \to \R\) and \(g \colon S \to \R\) be functions continuous at \(c \in S\text{.}\)
The function \(h \colon S \to \R\) defined by \(h(x) \coloneqq f(x)+g(x)\) is continuous at \(c\text{.}\)
The function \(h \colon S \to \R\) defined by \(h(x) \coloneqq f(x)-g(x)\) is continuous at \(c\text{.}\)
The function \(h \colon S \to \R\) defined by \(h(x) \coloneqq f(x)g(x)\) is continuous at \(c\text{.}\)
If \(g(x)\not=0\) for all \(x \in S\text{,}\) the function \(h \colon S \to \R\) given by \(h(x) \coloneqq \frac{f(x)}{g(x)}\) is continuous at \(c\text{.}\)
Example3.2.6.
The functions \(\sin(x)\) and \(\cos(x)\) are continuous. In the following computations we use the sum-to-product trigonometric identities. We also use the simple facts that \(\abs{\sin(x)} \leq \abs{x}\text{,}\)\(\abs{\cos(x)} \leq 1\text{,}\) and \(\abs{\sin(x)} \leq 1\text{.}\)
The claim that \(\sin\) and \(\cos\) are continuous follows by taking an arbitrary sequence \(\{ x_n \}_{n=1}^\infty\) converging to \(c\text{,}\) or by applying the definition of continuity directly. Details are left to the reader.
Subsection3.2.2Composition of continuous functions
You probably already realized that one of the basic tools in constructing complicated functions out of simple ones is composition. Recall that for two functions \(f\) and \(g\text{,}\) the composition \(f \circ g\) is defined by \((f \circ g)(x) \coloneqq f\bigl(g(x)\bigr)\text{.}\) A composition of continuous functions is again continuous.
Proposition3.2.7.
Let \(A, B \subset \R\) and \(f \colon B \to \R\) and \(g \colon A \to B\) be functions. If \(g\) is continuous at \(c \in A\) and \(f\) is continuous at \(g(c)\text{,}\) then \(f \circ g \colon A \to \R\) is continuous at \(c\text{.}\)
Proof.
Let \(\{ x_n \}_{n=1}^\infty\) be a sequence in \(A\) such that \(\lim_{n\to\infty} x_n = c\text{.}\) As \(g\) is continuous at \(c\text{,}\) we have \(\bigl\{ g(x_n) \bigr\}_{n=1}^\infty\) converges to \(g(c)\text{.}\) As \(f\) is continuous at \(g(c)\text{,}\) we have \(\bigl\{ f\bigl(g(x_n)\bigr)
\bigr\}_{n=1}^\infty\) converges to \(f\bigl(g(c)\bigr)\text{.}\) Thus \(f \circ g\) is continuous at \(c\text{.}\)
Example3.2.8.
Claim: \({\bigl(\sin(\nicefrac{1}{x})\bigr)}^2\) is a continuous function on \((0,\infty)\text{.}\)
Proof: The function \(\nicefrac{1}{x}\) is continuous on \((0,\infty)\) and \(\sin(x)\) is continuous on \((0,\infty)\) (actually on \(\R\text{,}\) but \((0,\infty)\) is the range for \(\nicefrac{1}{x}\)). Hence the composition \(\sin(\nicefrac{1}{x})\) is continuous. Also, \(x^2\) is continuous on the interval \([-1,1]\) (the range of \(\sin\)). Thus the composition \({\bigl(\sin(\nicefrac{1}{x})\bigr)}^2\) is continuous on \((0,\infty)\text{.}\)
Subsection3.2.3Discontinuous functions
When \(f\) is not continuous at \(c\text{,}\) we say \(f\) is discontinuous at \(c\text{,}\) or that it has a discontinuity at \(c\text{.}\) The following proposition is a useful test and follows immediately from third item of Proposition 3.2.2.
Proposition3.2.9.
Let \(f \colon S \to \R\) be a function and \(c \in S\text{.}\) Suppose there exists a sequence \(\{ x_n \}_{n=1}^\infty\text{,}\)\(x_n \in S\) for all \(n\text{,}\) and \(\lim_{n\to\infty} x_n = c\) such that \(\bigl\{ f(x_n) \bigr\}_{n=1}^\infty\) does not converge to \(f(c)\text{.}\) Then \(f\) is discontinuous at \(c\text{.}\)
Again, saying that \(\bigl\{ f(x_n) \bigr\}_{n=1}^\infty\) does not converge to \(f(c)\) means that it either does not converge at all, or it converges to something other than \(f(c)\text{.}\)
Proof: Consider \(\{ \nicefrac{-1}{n} \}_{n=1}^\infty\text{,}\) which converges to 0. Then \(f(\nicefrac{-1}{n}) = -1\) for every \(n\text{,}\) and so \(\lim_{n\to\infty} f(\nicefrac{-1}{n}) = -1\text{,}\) but \(f(0) = 1\text{.}\) Thus the function is not continuous at 0. See Figure 3.4.
Notice that \(f(\nicefrac{1}{n}) = 1\) for all \(n \in \N\text{.}\) Hence, \(\lim_{n\to\infty} f(\nicefrac{1}{n}) = f(0) = 1\text{.}\) So \(\bigl\{ f(x_n) \bigr\}_{n=1}^\infty\) may converge to \(f(0)\) for some specific sequence \(\{ x_n \}_{n=1}^\infty\) going to 0, despite the function being discontinuous at 0.
Finally, consider \(f\Bigl(\frac{{(-1)}^n}{n}\Bigr) = {(-1)}^n\text{.}\) This sequence diverges.
Example3.2.11.
For an extreme example, take the so-called Dirichlet function 1
\begin{equation*}
f(x) \coloneqq
\begin{cases}
1 & \text{if } x \text{ is rational,} \\
0 & \text{if } x \text{ is irrational.}
\end{cases}
\end{equation*}
The function \(f\) is discontinuous at all \(c \in \R\text{.}\)
Proof: If \(c\) is rational, take a sequence \(\{ x_n \}_{n=1}^\infty\) of irrational numbers such that \(\lim_{n\to\infty} x_n = c\) (why can we?). Then \(f(x_n) = 0\) and so \(\lim_{n\to\infty} f(x_n) = 0\text{,}\) but \(f(c) = 1\text{.}\) If \(c\) is irrational, take a sequence of rational numbers \(\{ x_n \}_{n=1}^\infty\) that converges to \(c\) (why can we?). Then \(\lim_{n\to\infty} f(x_n) = 1\text{,}\) but \(f(c) = 0\text{.}\)
Let us test the limits of our intuition. Can there exist a function continuous at all irrational numbers, but discontinuous at all rational numbers? There are rational numbers arbitrarily close to any irrational number. Perhaps strangely, the answer is yes, such a function exists. The following example is called the Thomae function 2
\begin{equation*}
f(x) \coloneqq
\begin{cases}
\nicefrac{1}{k} & \text{if } x=\nicefrac{m}{k}, \text{ where } m,k \in \N
\text{ and have no common divisors (lowest terms),} \\
0 & \text{if } x \text{ is irrational.}
\end{cases}
\end{equation*}
See the graph of \(f\) in Figure 3.5. We claim that \(f\) is continuous at all irrational \(c\) and discontinuous at all rational \(c\text{.}\)
Proof: Let \(c = \nicefrac{m}{k}\) be rational and in lowest terms. Take a sequence of irrational numbers \(\{ x_n \}_{n=1}^\infty\) such that \(\lim_{n\to\infty} x_n = c\text{.}\) Then \(\lim_{n\to\infty} f(x_n) = \lim_{n\to\infty} 0 = 0\text{,}\) but \(f(c) = \nicefrac{1}{k} \not= 0\text{.}\) So \(f\) is discontinuous at \(c\text{.}\)
Now let \(c\) be irrational, so \(f(c) = 0\text{.}\) Take a sequence \(\{ x_n \}_{n=1}^\infty\) in \((0,1)\) such that \(\lim_{n\to\infty} x_n = c\text{.}\) Given \(\epsilon > 0\text{,}\) find \(K \in \N\) such that \(\nicefrac{1}{K} < \epsilon\) by the Archimedean property. If \(\nicefrac{m}{k} \in (0,1)\) and \(m,k \in \N\text{,}\) then \(0 < m < k\text{.}\) So there are only finitely many rational numbers in \((0,1)\) whose denominator \(k\) in lowest terms is less than \(K\text{.}\) As \(\lim_{n\to\infty} x_n = c\text{,}\) every number not equal to \(c\) can appear at most finitely many times in \(\{ x_n \}_{n=1}^\infty\text{.}\) Hence, there is an \(M\) such that for \(n \geq M\text{,}\) all the numbers \(x_n\) that are rational have a denominator larger than or equal to \(K\text{.}\) Thus for \(n \geq M\text{,}\)
Therefore, \(f\) is continuous at irrational \(c\text{.}\)
Let us end on an easier example.
Example3.2.13.
Define \(g \colon \R \to \R\) by \(g(x) \coloneqq 0\) if \(x \not= 0\) and \(g(0) \coloneqq 1\text{.}\) Then \(g\) is not continuous at zero, but continuous everywhere else (why?). The point \(x=0\) is called a removable discontinuity. That is because if we would change the definition of \(g\text{,}\) by insisting that \(g(0)\) be \(0\text{,}\) we would obtain a continuous function. On the other hand, let \(f\) be the function of Example 3.2.10. Then \(f\) does not have a removable discontinuity at \(0\text{.}\) No matter how we would define \(f(0)\) the function would still fail to be continuous. The difference is that \(\lim_{x\to 0} g(x)\) exists while \(\lim_{x\to 0} f(x)\) does not.
We stay with this example to show another phenomenon. Let \(A \coloneqq \{ 0 \}\text{,}\) then \(g|_A\) is continuous (why?), while \(g\) is not continuous on \(A\text{.}\) Similarly, if \(B \coloneqq \R \setminus \{0 \}\text{,}\) then \(g|_B\) is also continuous, and \(g\) is in fact continuous on \(B\text{.}\)
Exercises3.2.4Exercises
3.2.1.
Using the definition of continuity directly prove that \(f \colon \R \to \R\) defined by \(f(x) \coloneqq x^2\) is continuous.
3.2.2.
Using the definition of continuity directly prove that \(f \colon (0,\infty) \to \R\) defined by \(f(x) \coloneqq \nicefrac{1}{x}\) is continuous.
3.2.3.
Define \(f \colon \R \to \R\) by
\begin{equation*}
f(x) \coloneqq
\begin{cases}
x & \text{if } x \text{ is rational,} \\
x^2 & \text{if } x \text{ is irrational.}
\end{cases}
\end{equation*}
Using the definition of continuity directly prove that \(f\) is continuous at \(1\) and discontinuous at \(2\text{.}\)
Let \(S \subset \R\) and \(A \subset S\text{.}\) Let \(f \colon S \to \R\) be a continuous function. Prove that the restriction \(f|_A\) is continuous.
3.2.8.
Suppose \(S \subset \R\text{,}\) such that \((c-\alpha,c+\alpha) \subset S\) for some \(c \in \R\) and \(\alpha > 0\text{.}\) Let \(f \colon S \to \R\) be a function and \(A \coloneqq (c-\alpha,c+\alpha)\text{.}\) Prove that if \(f|_A\) is continuous at \(c\text{,}\) then \(f\) is continuous at \(c\text{.}\)
3.2.9.
Give an example of functions \(f \colon \R \to \R\) and \(g \colon \R \to \R\) such that the function \(h\text{,}\) defined by \(h(x) \coloneqq f(x) + g(x)\text{,}\) is continuous, but \(f\) and \(g\) are not continuous. Can you find \(f\) and \(g\) that are nowhere continuous, but \(h\) is a continuous function?
3.2.10.
Let \(f \colon \R \to \R\) and \(g \colon \R \to \R\) be continuous functions. Suppose that \(f(r) = g(r)\) for all \(r \in \Q\text{.}\) Show that \(f(x) = g(x)\) for all \(x \in \R\text{.}\)
3.2.11.
Let \(f \colon \R \to \R\) be continuous. Suppose \(f(c) > 0\text{.}\) Show that there exists an \(\alpha > 0\) such that for all \(x \in (c-\alpha,c+\alpha)\text{,}\) we have \(f(x) > 0\text{.}\)
3.2.12.
Let \(f \colon \Z \to \R\) be a function. Show that \(f\) is continuous.
3.2.13.
Let \(f \colon S \to \R\) be a function and \(c \in S\text{,}\) such that for every sequence \(\{ x_n \}_{n=1}^\infty\) in \(S\) with \(\lim_{n\to\infty} x_n = c\text{,}\) the sequence \(\bigl\{ f(x_n) \bigr\}_{n=1}^\infty\) converges. Show that \(f\) is continuous at \(c\text{.}\)
3.2.14.
Suppose \(f \colon [-1,0] \to \R\) and \(g \colon [0,1] \to \R\) are continuous and \(f(0) = g(0)\text{.}\) Define \(h \colon [-1,1] \to \R\) by \(h(x) \coloneqq f(x)\) if \(x \leq 0\) and \(h(x) \coloneqq g(x)\) if \(x > 0\text{.}\) Show that \(h\) is continuous.
3.2.15.
Suppose \(g \colon \R \to \R\) is a continuous function such that \(g(0) = 0\text{,}\) and suppose \(f \colon \R \to \R\) is such that \(\abs{f(x)-f(y)} \leq g(x-y)\) for all \(x\) and \(y\text{.}\) Show that \(f\) is continuous.
3.2.16.
(Challenging) Suppose \(f \colon \R \to \R\) is continuous at \(0\) and such that \(f(x+y) = f(x) + f(y)\) for every \(x\) and \(y\text{.}\) Show that \(f(x) = ax\) for some \(a \in \R\text{.}\) Hint: Show that \(f(nx) = nf(x)\text{,}\) then show \(f\) is continuous on \(\R\text{.}\) Then show that \(\nicefrac{f(x)}{x} = f(1)\) for all rational \(x\text{.}\)
3.2.17.
Suppose \(S \subset \R\) and let \(f \colon S \to \R\) and \(g \colon S \to \R\) be continuous functions. Define \(p \colon S \to \R\) by \(p(x) \coloneqq \max \bigl\{ f(x) , g(x) \bigr\}\) and \(q \colon S \to \R\) by \(q(x) \coloneqq \min \bigl\{ f(x) , g(x) \bigr\}\text{.}\) Prove that \(p\) and \(q\) are continuous.
3.2.18.
Suppose \(f \colon [-1,1] \to \R\) is a function continuous at all \(x \in
[-1,1] \setminus \{ 0 \}\text{.}\) Show that for every \(\epsilon\) such that \(0 < \epsilon < 1\text{,}\) there exists a function \(g \colon [-1,1] \to \R\) continuous on all of \([-1,1]\text{,}\) such that \(f(x) = g(x)\) for all \(x \in [-1,-\epsilon] \cup [\epsilon,1]\text{,}\) and \(\abs{g(x)} \leq \abs{f(x)}\) for all \(x \in [-1,1]\text{.}\)
3.2.19.
(Challenging) A function \(f \colon I \to \R\) is convex if whenever \(a \leq x \leq b\) for \(a,x,b\) in \(I\text{,}\) we have \(f(x) \leq f(a) \frac{b-x}{b-a} + f(b) \frac{x-a}{b-a}\text{.}\) In other words, if the line drawn between \(\bigl(a,f(a)\bigr)\) and \(\bigl(b,f(b)\bigr)\) is above the graph of \(f\text{.}\)
Prove that if \(I = (\alpha,\beta)\) an open interval and \(f \colon I \to \R\) is convex, then \(f\) is continuous.
Find an example of a convex \(f \colon [0,1] \to \R\) that is not continuous.
For a higher quality printout use the PDF versions: https://www.jirka.org/ra/realanal.pdf or https://www.jirka.org/ra/realanal2.pdf