2.2 Continuous functions
Definition 2.2.1. Let \(X\) and \(Y\) be subsets of \(\mathbb {R}\). Suppose \(E\subseteq X\), \(p\in E\), and \(f\) maps \(E\) into \(Y\). Then \(f\) is said to be continuous at \(p\) if for every \(\varepsilon > 0\) there exists \(\delta > 0\) such that \(|f(x) - f(p)| < \varepsilon \) for all points \(x\in E\) with \(|x - p| < \delta \).
If \(f\) is continuous at every point of \(E\), then \(f\) is said to be continuous on \(E\).
In general \(\delta \) depends not only on \(\varepsilon \) but also on the point \(p\). Note that \(f\) has to be defined at \(p\) in order to be continuous there.
Theorem 2.2.2. Let \(E\subseteq \mathbb {R}\), let \(f\) be a real valued function on \(E\), and let \(p\in E\) be a limit point of \(E\). Then \(f\) is continuous at \(p\) if and only if \(\lim _{x\rightarrow p} f(x) = f(p)\).
Proof. If \(f\) is continuous at \(p\) and \(\varepsilon >0\), there is a \(\delta >0\) with \(|f(x) - f(p)|<\varepsilon \) for all \(x\in E\) with \(|x-p|<\delta \), in particular for those with \(0<|x-p|<\delta \). Hence \(\lim _{x\rightarrow p} f(x) = f(p)\).
Conversely, if \(\lim _{x\rightarrow p} f(x) = f(p)\) and \(\varepsilon >0\), there is a \(\delta >0\) with \(|f(x) - f(p)| < \varepsilon \) for all \(x \in E\) with \(0<|x - p| < \delta \). The inequality also holds trivially at \(x=p\). Hence \(f\) is continuous at \(p\). □
Theorem 2.2.3 (Sequential Criterion). Let \(f\) be a real valued function on \(E\subseteq \mathbb {R}\) and let \(p\in E\). Then \(f\) is continuous at \(p\) if and only if \(\lim _{n\rightarrow \infty } f(x_n) = f(p)\) for every sequence \(\{x_n\}\) in \(E\) with \(\lim _{n\rightarrow \infty } x_n = p\).
Proof. Let \(f\) be continuous at \(p\), and let \(\varepsilon > 0\). Then there is a \(\delta > 0\) such that \begin {equation} \label {eq:seqcont} |f(x) - f(p)| < \varepsilon \quad \text {whenever } x\in E \text { and } |x - p| < \delta . \end {equation} Now let \(\{x_n\}\) be a sequence in \(E\) with \(\lim _{n\rightarrow \infty } x_n = p\). For this \(\delta \) there is an \(N\in \mathbb {N}\) such that \begin {equation} \label {eq:seqconv} |x_n - p| < \delta \quad \text {for all } n > N. \end {equation} Putting \(x= x_n\) in (2.4) and using (2.5), we get \(|f(x_n) - f(p)| < \varepsilon \) for all \(n > N\). Hence \(\lim _{n\rightarrow \infty } f(x_n) = f(p)\).
Conversely, suppose \(f\) is not continuous at \(p\). Then there is an \(\varepsilon > 0\) such that for every \(\delta > 0\) there is an \(x\in E\) with \(|x - p| < \delta \) but \(|f(x) - f(p)|\geq \varepsilon \). Taking \(\delta = \frac {1}{n}\), \(n\in \mathbb {N}\), we obtain for each \(n\) a point \(x_n\in E\) with \begin {equation} \label {eq:seqneg} |x_n - p| < \frac {1}{n} \qquad \text {and}\qquad |f(x_n) - f(p)|\geq \varepsilon . \end {equation} The first inequality in (2.6) gives \(\lim _{n\rightarrow \infty } x_n = p\), while the second shows that \(f(x_n)\) does not converge to \(f(p)\). So if \(f(x_n)\longrightarrow f(p)\) for every such sequence, \(f\) must be continuous at \(p\). □
Corollary 2.2.4 (Discontinuity Criterion). Let \(f\) be a real valued function on \(E\subseteq \mathbb {R}\) and let \(p\in E\). Then \(f\) is discontinuous at \(p\) if and only if there exists a sequence \(\{x_n\}\) in \(E\) with \(\lim _{n\rightarrow \infty } x_n = p\) such that \(\{f(x_n)\}\) does not converge to \(f(p)\).
Example 2.2.5. Define \(f\) on \([0,1]\) by \(f(x) = \frac {1}{x}\) for \(0<x\leq 1\) and \(f(0) = 0\). Then \(f\) is not continuous at \(x=0\).
Proof. The sequence \(x_n = \frac {1}{n}\) lies in \([0,1]\) and converges to \(0\), but \(f(x_n) = n\) does not converge to \(f(0) = 0\). By the Discontinuity Criterion, \(f\) is discontinuous at \(0\). (No choice of \(f(0)\) would make \(f\) continuous there, since \(f(x_n)\) does not converge at all.) □
Theorem 2.2.6. Let \(f\) and \(g\) be real valued functions on \(E\subseteq \mathbb {R}\), continuous at a point \(p\in E\), and let \(\alpha \in \mathbb {R}\). Then
- 1.
- the functions \(f\pm g\), \(\alpha f\) and \(fg\) are continuous at \(p\);
- 2.
- the function \(\frac {f}{g}\) is continuous at \(p\), provided \(g(p) \neq 0\).
Proof. Let \(\{x_n\}\) be any sequence in \(E\) converging to \(p\). By the Sequential Criterion, \(f(x_n)\longrightarrow f(p)\) and \(g(x_n)\longrightarrow g(p)\). By the rules for limits of sequences, \begin {gather*} f(x_n)\pm g(x_n)\longrightarrow f(p)\pm g(p),\qquad \alpha f(x_n)\longrightarrow \alpha f(p),\\ f(x_n)g(x_n)\longrightarrow f(p)g(p), \end {gather*} and, if \(g(p)\neq 0\) (so that \(g(x)\neq 0\) for \(x\) near \(p\), by Theorem 2.3.3 below), \(\frac {f(x_n)}{g(x_n)}\longrightarrow \frac {f(p)}{g(p)}\). By the Sequential Criterion again, each function is continuous at \(p\). □
Theorem 2.2.7. Let \(f\) be a continuous real valued function on \(E\subseteq \mathbb {R}\). Then the function \(|f|\), defined by \(|f|(x) = |f(x)|\) for \(x\in E\), is also continuous on \(E\).
Proof. Let \(p\in E\) and \(\varepsilon > 0\). There exists \(\delta > 0\) such that \(|f(x) - f(p)| < \varepsilon \) whenever \(x\in E\) and \(|x - p| < \delta \). For such \(x\), \[\bigl ||f(x)| - |f(p)|\bigr | \leq |f(x) - f(p)| < \varepsilon .\] Therefore \(|f|\) is continuous at \(p\).
The converse is false. For example, the function \[f(x) = \begin {cases} 1, & x \text { rational},\\ -1, & x \text { irrational}, \end {cases}\] is discontinuous everywhere, but \(|f|= 1\) is constant and hence continuous everywhere. □
Theorem 2.2.8 (Continuity of Composite functions). Let \(X\), \(Y\) and \(Z\) be subsets of \(\mathbb {R}\). Suppose \(f\) maps \(E\subseteq X\) into \(Y\), \(g\) maps \(f(E)\) into \(Z\), and \(h = g\circ f\) is the mapping of \(E\) into \(Z\) defined by \(h(x) = g(f(x))\), \(x\in E\). If \(f\) is continuous at a point \(p\in E\) and \(g\) is continuous at \(f(p)\), then \(h\) is continuous at \(p\).
Proof. Let \(\varepsilon > 0\) be given. Since \(g\) is continuous at \(f(p)\), there exists \(\eta > 0\) such that \(|g(y) - g(f(p))| < \varepsilon \) whenever \(y \in f(E)\) and \(|y - f(p)| < \eta \). Since \(f\) is continuous at \(p\), there exists \(\delta > 0\) such that \(|f(x) - f(p)| < \eta \) whenever \(x\in E\) and \(|x - p| < \delta \). Hence \[|h(x) - h(p)| = |g(f(x)) - g(f(p))| < \varepsilon \qquad \text {whenever } x\in E \text { and } |x - p| < \delta .\] Therefore \(h\) is continuous at \(p\). □
When \(f\) is defined only on a subset \(X\) of \(\mathbb {R}\), openness has to be measured inside \(X\). A set \(V\subseteq X\) is open in \(X\) if for each \(p\in V\) there is a \(\delta >0\) such that every \(x\in X\) with \(|x-p|<\delta \) lies in \(V\); equivalently, \(V = X\cap O\) for some open set \(O\subseteq \mathbb {R}\) (take \(O\) to be the union of the intervals \((p-\delta ,p+\delta )\)). A set \(C\subseteq X\) is closed in \(X\) if \(X\setminus C\) is open in \(X\), equivalently \(C = X\cap F\) for some closed set \(F\subseteq \mathbb {R}\).
Theorem 2.2.9. Let \(X\) and \(Y\) be subsets of \(\mathbb {R}\). A function \(f\) of \(X\) into \(Y\) is continuous on \(X\) if and only if \(f^{-1}(O)\) is open in \(X\) for every set \(O\) open in \(Y\).
Proof. Suppose \(f\) is continuous on \(X\) and \(O\) is open in \(Y\). Let \(p\in f^{-1}(O)\), so that \(f(p)\in O\). Since \(O\) is open in \(Y\), there exists \(\varepsilon > 0\) such that \(y \in O\) whenever \(y\in Y\) and \(|y - f(p)| < \varepsilon \). Since \(f\) is continuous at \(p\), there exists \(\delta > 0\) such that \(|f(x) - f(p)| < \varepsilon \) whenever \(x\in X\) and \(|x - p| < \delta \). For such \(x\), \(f(x)\in O\), that is, \(x \in f^{-1}(O)\). Hence \(f^{-1}(O)\) is open in \(X\).
Conversely, suppose \(f^{-1}(O)\) is open in \(X\) for every set \(O\) open in \(Y\). Fix \(p\in X\) and \(\varepsilon > 0\), and let \(O = \{y\in Y : |y - f(p)| < \varepsilon \}\), which is open in \(Y\). Since \(p\in f^{-1}(O)\) and this set is open in \(X\), there exists \(\delta > 0\) such that \(x\in f^{-1}(O)\) whenever \(x\in X\) and \(|x - p|< \delta \). For such \(x\), \(|f(x) - f(p)| < \varepsilon \). Therefore \(f\) is continuous at \(p\), and since \(p\) was arbitrary, \(f\) is continuous on \(X\). □
Corollary 2.2.10. A function \(f\) of \(X\subseteq \mathbb {R}\) into \(Y\subseteq \mathbb {R}\) is continuous if and only if \(f^{-1}(C)\) is closed in \(X\) for every set \(C\) closed in \(Y\).
Proof. This follows from the theorem, since a set is closed in \(Y\) if and only if its complement in \(Y\) is open in \(Y\), and \(f^{-1}(Y\setminus C) = X\setminus f^{-1}(C)\) for every \(C\subseteq Y\). □
Example 2.2.11. Show that \(f(x) = \sqrt {x}\) is continuous on \([0,\infty )\), giving \(\delta \) explicitly.
Solution. At \(c>0\): for \(x\geq 0\), \[|\sqrt {x} - \sqrt {c}| = \frac {|x-c|}{\sqrt {x}+\sqrt {c}}\leq \frac {|x-c|}{\sqrt {c}},\] so \(\delta = \varepsilon \sqrt {c}\) works. At \(c = 0\): \(|\sqrt {x}-0|<\varepsilon \) whenever \(0\leq x<\varepsilon ^2\), so \(\delta = \varepsilon ^2\) works. Notice that the \(\delta \) at \(c>0\) shrinks as \(c\longrightarrow 0\); we return to this under uniform continuity.
Example 2.2.12. Let \(f(x) = x\) if \(x\) is rational and \(f(x) = 0\) if \(x\) is irrational. Show that \(f\) is continuous at \(0\) and at no other point.
Solution. At \(0\): \(|f(x) - f(0)|\leq |x|\) for every \(x\), so \(\delta = \varepsilon \) works.
Let \(c\neq 0\). Choose irrational numbers \(x_n\longrightarrow c\) and rational numbers \(y_n\longrightarrow c\) (both exist because every interval contains rationals and irrationals). Then \(f(x_n) = 0\longrightarrow 0\) and \(f(y_n) = y_n\longrightarrow c\neq 0\). The two limits differ, so at least one of them differs from \(f(c)\), and by the Discontinuity Criterion \(f\) is discontinuous at \(c\).
Example 2.2.13 (Thomae’s function). Define \(f\) on \((0,1)\) by \(f(x) = \frac {1}{q}\) if \(x = \frac {p}{q}\) in lowest terms with \(q\geq 1\), and \(f(x) = 0\) if \(x\) is irrational. Show that \(f\) is continuous at every irrational point and discontinuous at every rational point.
Solution. Rational points. If \(c = \frac {p}{q}\), then \(f(c) = \frac {1}{q}>0\), but irrational \(x_n\longrightarrow c\) give \(f(x_n) = 0\). So \(f\) is discontinuous at \(c\).
Irrational points. Let \(c\) be irrational and \(\varepsilon >0\). Choose \(N\) with \(\frac {1}{N}<\varepsilon \). In \((0,1)\) there are only finitely many rationals \(\frac {p}{q}\) with \(q\leq N\), and none of them equals \(c\). Let \(\delta >0\) be smaller than the distance from \(c\) to each of them. If \(|x-c|<\delta \), then either \(x\) is irrational and \(f(x) = 0\), or \(x = \frac {p}{q}\) with \(q>N\) and \(f(x) = \frac {1}{q}<\varepsilon \). Either way \(|f(x) - f(c)| = f(x)<\varepsilon \).
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.