Throughout this chapter, \(A\) is a non-empty subset of \(\real\) and \(f:A\rightarrow\real\) is a function.

Continuous Functions

The function \(f\) is continuous at \(c\in A\) if for any given \(\eps \gt 0\) there exists \(\delta \gt 0\) such that if \(x\in A\) and \(|x-c| \lt \delta\) then \(|f(x)-f(c)| \lt \eps\). If \(f\) is not continuous at \(c\) then we say that \(f\) is discontinuous at \(c\). The function \(f\) is continuous on \(A\) if \(f\) is continuous at every point in \(A\).
Suppose that \(c\in A\) is a cluster point of \(A\) and \(f\) is continuous at \(c\). Then from the definition of continuity, \(\displaystyle\lim_{x\rightarrow c}f(x)\) exists and equal to \(f(c)\). If \(c\) is not a cluster point of \(A\) then there exists \(\delta \gt 0\) such that \((c-\delta, c+\delta)\cap A = \{c\}\) and continuity of \(f\) at \(c\) is immediate. In either case, we see that \(f\) is continuous at \(c\) if and only if \[ \lim_{x\rightarrow c}f(x) = f(c) \] The following is then immediate.
The function \(f\) is continuous at \(c\in A\) if and only if for every sequence \((x_n)\) in \(A\) converging to \(c\), \(f(x_n)\) converges to \(f(c)\): \[ \lim_{n\rightarrow\infty} f(x_n) = f(\lim_{x\rightarrow\infty}x_n) = f(c). \]
Notice that here \((x_n)\) is allowed to take on the value \(c\). The following is immediate.
The function \(f\) is discontinuous at \(c\) if and only if there exists a sequence \((x_n)\) in \(A\) converging to \(c\) but \(f(x_n)\) does not converge to \(f(c)\).
If \(f(x)=a_0 + a_1 x + a_2x^2 + \cdots + a_n x^n\) is a polynomial function then \(\lim_{x\rightarrow c} f(x) = f(c)\) for every \(c\in\real\). Thus, \(f\) is continuous everywhere. If \(g(x) = b_0 + b_1 x + b_2 x+ \cdots + b_m x^m\) is another polynomial function and \(g(c)\neq 0\) then \[ \lim_{x\rightarrow c} \frac{f(x)}{g(x)} = \frac{f(c)}{g(c)}. \] Hence, \(h(x)=f(x)/g(x)\) is continuous at every \(c\) where \(g\) is non-zero.
Determine the points of continuity of \[ f(x) = \begin{cases} \frac{1}{x}, & x\neq 0\\[2ex] 0, & x=0.\end{cases} \]
Suppose that \(c\neq 0\). Then \(\lim_{x\rightarrow c} f(x) = \frac{1}{c} = f(c)\). Hence, \(f\) is continuous at \(c\in\real\backslash\hspace{-0.3em}\{0\}\). Consider now \(c=0\). The sequence \(x_n=\frac{1}{n}\) converges to \(c=0\) but \(f(x_n)=n\) does not converge. Hence, \(\lim_{x\rightarrow 0}f(x)\) does not exist. Thus, even though \(f(0)=0\) is well-defined, \(f\) is discontinuous at \(c=0\).
The following function was considered by Peter Dirichlet in 1829: \begin{equation} f(x) = \begin{cases} 1, & x\in\mathbb{Q}\\[2ex] 0, & x\in\real\backslash\hspace{-0.3em}\mathbb{Q}\end{cases} \end{equation} Prove that \(f\) is discontinuous everywhere.
Let \(c\) be irrational and let \(\eps=1/2\). Then for all \(\delta \gt 0\), there exists \(x\in\mathbb{Q}\cap (c-\delta, c+\delta)\) (by the Density theorem) and therefore \(|f(x)-f(c)|=1 \gt \eps\). Hence, \(f\) is discontinuous at \(c\). A similar argument shows that \(f\) is discontinuous \(c\in\mathbb{Q}\). Alternatively, if \(c\in\mathbb{Q}\) then there exists a sequence of irrational numbers \((x_n)\) converging to \(c\). Now \(f(x_n)=0\) and \(f(c)=1\), and this proves that \(f\) is discontinuous at \(c\). A similar arguments holds for \(c\) irrational.
Let \(A=\{x\in\real\;:\; x \gt 0\}\) and define \(f:A\rightarrow\real\) as \[ f(x) = \begin{cases} 0, & x\in\real\backslash\hspace{-0.3em}\mathbb{Q},\\[2ex] \frac{1}{n}, & x=\frac{m}{n}\in\mathbb{Q}, \;\gcd(m,n)=1,\; n\in\N\end{cases} \] The graph of \(f\) is shown in Figure 5.1. Prove that \(f\) is continuous at every irrational number in \(A\) and is discontinuous at every rational number in \(A\).
Let \(c=\frac{m}{n}\in\mathbb{Q}\) with \(\gcd(m,n)=1\). There exists a sequence \((x_n)\) of irrational numbers in \(A\) converging to \(c\). Hence, \(f(x_n)=0\) while \(f(c)=\frac{1}{n}\). This shows that \(f\) is discontinuous at \(c\). Now let \(c\) be irrational and let \(\eps \gt 0\) be arbitrary. Let \(N\in\N\) be such that \(\frac{1}{N} \lt \eps\). In the interval \((c-1,c+1)\), there are only a finite number of rationals \(\frac{m}{n}\) with \(n \lt N\), otherwise we can create a sequence \(\frac{m_k}{n_k}\) with \(n_k \lt N\), all the rationals \(\frac{m_k}{n_k}\) distinct and thus necessarily \(\frac{m_k}{n_k}\) is unbounded. Hence, there exists \(\delta \gt 0\) such that the interval \((c-\delta,c+\delta)\) contains only rational numbers \(x=\frac{m}{n}\) with \(n \gt N\). Hence, if \(x=\frac{m}{n}\in (c-\delta,c+\delta)\) then \(f(x)=\frac{1}{n} \lt \frac{1}{N}\) and therefore \(|f(x)-f(c)|=\frac{1}{n} \lt \frac{1}{N} \lt \eps\). On the other hand, if \(x\in(c-\delta,c+\delta)\) is irrational then \(|f(x)-f(c)|=|0-0| \lt \eps\). This proves that \(f\) is continuous at \(c\).
figures/thomae-function.svg
Thomae's function is continuous at each irrational and discontinuous at each rational
Suppose that \(f\) has a limit \(L\) at \(c\) but \(f\) is not defined at \(c\). We can extend the definition of \(f\) by defining \[ F(x) = \begin{cases} f(x), & x\neq c\\[2ex] L, & x=c.\end{cases} \] Now, \(\lim_{x\rightarrow c} F(x) = \lim_{x\rightarrow c} f(x) = L = F(c)\), and thus \(F\) is continuous at \(c\). Hence, functions that are not defined at a particular point \(c\) but have a limit at \(c\) can be extended to a function that is continuous at \(c\). Points of discontinuity of this type are called removal singularities. On the other hand, the function \(f(x)=\sin(1/x)\) is not defined at \(c=0\) and has not limit at \(c=0\), and therefore cannot be extended at \(c=0\) to a continuous function.

Exercises

Let \[ f(x) = \begin{cases} x^2\sin(1/x), & x\neq 0\\0, & x=0\end{cases} \] Prove that \(f\) is continuous at \(c=0\).
Let \[ f(x) = \begin{cases} (1/x)\sin(1/x^2), & x\neq 0\\0, & x=0\end{cases} \] Prove that \(f\) is discontinuous at \(c=0\).
This is an interesting exercise.
  1. Suppose that \(h:\real\rightarrow\real\) is continuous on \(\real\) and that \(h(r)=0\) for every rational number \(r\in\mathbb{Q}\). Prove that in fact \(h(x)=0\) for all \(x\in\real\).
  2. Let \(f,g:\real\rightarrow\real\) be continuous functions on \(\real\) such that \(f(r)=g(r)\) for every rational number \(r\in\mathbb{Q}\). Prove that in fact \(f(x)=g(x)\) for all \(x\in\real\). Hint: Part (a) will be useful here.
Suppose that \(f:\real\rightarrow\real\) is a continuous function such that \(f(p+q) = f(p) + f(q)\) for every \(p, q\in\mathbb{Q}\). Prove that in fact \(f(x+y) = f(x) + f(y)\) for every \(x,y\in\real\).

Combinations of Continuous Functions

Not surprisingly, the set of continuous functions is closed under the basic operation of arithmetic.
Let \(f,g:A\rightarrow\real\) be continuous functions at \(c\in A\) and let \(b\in\real\). Then
  1. \(f+g\), \(f-g\), \(fg\), and \(bf\) are continuous at \(c\).
  2. If \(h:A\rightarrow\real\) is continuous at \(c\in A\) and \(h(x)\neq 0\) for all \(x\in A\) then \(\frac{f}{h}\) is continuous at \(c\).
Let \(\eps \gt 0\) be arbitrary. By continuity of \(f\) and \(g\) at \(c\), there exists \(\delta_1 \gt 0\) such that \(|f(x)-f(c)| \lt \eps/2\) for all \(x\in A\) such that \(0 \lt |x-c| \lt \delta_1\), and there exists \(\delta_2 \gt 0\) such that \(|g(x)-g(c)| \lt \eps/2\) for all \(x\in A\) such that \(0 \lt |x-c| \lt \delta_2\). Let \(\delta=\min\{\delta_1,\delta_2\}\). Then for \(x\in A\) such that \(0 \lt |x-c| \lt \delta\) we have that \begin{align*} |f(x)+g(x)-(f(c)+g(c))| &\leq |f(x)-f(c)| + |g(x)-g(c)|\\ & \lt \eps/2+\eps/2\\ & = \eps. \end{align*} This proves that \(f+g\) is continuous at \(c\). A similar proof holds for \(f-g\). Consider now the function \(bf\). If \(b=0\) then \(bf(x)=0\) for all \(x\in A\) and continuity is trivial. So assume that \(b\neq 0\). Let \(\eps \gt 0\) be arbitrary. Then there exists \(\delta \gt 0\) such that if \(x\in A\cap (c-\delta,c+\delta)\), \(x\neq c\), then \(|f(x)-f(c)| \lt \eps/(|b|)\). Therefore, for \(x\in A\cap (c-\delta,c+\delta)\), \(x\neq c\), we have that \begin{align*} |bf(x)-bf(c)| &= |b| |f(x)-f(c)| \\ & \lt |b| \eps/(|b|)\\ & = \eps. \end{align*} We now prove continuity of \(fg\). Let \((x_n)\) be any sequence in \(A\) converging to \(c\). Then \(y_n=f(x_n)\) converges to \(f(c)\) by continuity of \(f\) at \(c\), and \(z_n=g(x_n)\) converges to \(g(c)\) by continuity of \(g\) at \(c\). Hence the sequence \(w_n=y_nz_n\) converges to \(f(c)g(c)\). Hence, for every sequence \((x_n)\) converging to \(c\), \(f(x_n)g(x_n)\) converges to \(f(c)g(c)\). This shows that \(fg\) is continuous at \(c\).
Let \(f,g:A\rightarrow\real\) be continuous functions on \(A\) and let \(b\in\real\). Then
  1. \(f+g\), \(f-g\), \(fg\), and \(bf\) are continuous on \(A\).
  2. If \(h:A\rightarrow\real\) is continuous on \(A\) and \(h(x)\neq 0\) for all \(x\in A\) then \(\frac{f}{h}\) is continuous on \(A\).
Prove that \(f(x)=x\) is continuous on \(\real\).
Let \(\eps \gt 0\) be arbitrary. Let \(\delta=\eps\). If \(0 \lt |x-c| \lt \delta\) then \(|f(x)-f(c)|=|x-c| \lt \delta=\eps\).
All polynomials \(p(x)=a_0+a_1x+\cdots+a_nx^n\) are continuous everywhere.
Rational functions \(f(x)=p(x)/q(x)\), with \(q(x)\neq 0\) on \(A\subset\real\), are continuous on \(A\).
If \(f:\real\rightarrow\real\) is continuous then \(g(x)=f(x+\alpha)\) is continuous, where \(\alpha\in\real\) is arbitrary.
Let \(\eps \gt 0\) be arbitrary. Then there exists \(\delta \gt 0\) such that \(|f(y)-f(d)| \lt \eps\) for all \(0 \lt |y-d| \lt \delta\). Therefore, if \(0 \lt |x-c|=|(x+\alpha)-(c+\alpha)| \lt \delta\) then \(|f(x+\alpha)-f(c+\alpha)| \lt \eps\) and therefore \[ |g(x)-g(c)| = |f(x+\alpha)-f(c+\alpha)| \lt \eps. \]
To prove continuity of \(\sin(x)\) and \(\cos(x)\) we use the following facts. For all \(x\in\real\), \(|\sin(x)|\leq |x|\) and \(|\cos(x)|\leq 1\), and for all \(x,y,\in\real\) \begin{gather*} \sin(x)-\sin(y) = 2\sin\left(\tfrac{1}{2}(x-y)\right) \cos\left(\tfrac{1}{2}(x+y)\right). \end{gather*}
Prove that \(\sin(x)\) and \(\cos(x)\) are continuous everywhere.
We have that \begin{align*} |\sin(x)-\sin(c)| & \leq 2|\sin(\tfrac{1}{2}(x-c))| |\cos(\tfrac{1}{2}(x-c))| \\[2ex] &\leq 2 \frac{1}{2} |x-c| \\[2ex] &= |x-c|. \end{align*} Hence given \(\eps \gt 0\) we choose \(\delta=\eps\). The proof that \(\cos(x)\) is continuous follows from the fact that \(\cos(x)=\sin(x+\pi/2)\) and Lemma 5.2.6.
The functions \(\tan(x)=\frac{\sin(x)}{\cos(x)}\), \(\cot(x)=\frac{\cos(x)}{\sin(x)}\), \(\sec(x)=\frac{1}{\cos(x)}\), and \(\csc(x)=\frac{1}{\sin(x)}\) are continuous on their domain.
Prove that \(f(x)=\sqrt{x}\) is continuous on \(A=\{x\in\real\;|\; x\geq 0\}\).
For \(c=0\), we must consider \(|\sqrt{x}-\sqrt{0}| = \sqrt{x}\). Given \(\eps \gt 0\) let \(\delta=\eps^2\). Then if \(x\in A\) and \(x \lt \delta=\eps^2\) then \(\sqrt{x} \lt \eps\). This shows that \(f\) is continuous at \(c=0\). Now suppose that \(c\neq 0\). Then \begin{align*} |\sqrt{x}-\sqrt{c}| &= |\sqrt{x}-\sqrt{c}| \cdot \frac{\sqrt{x}+\sqrt{c}}{\sqrt{x}+\sqrt{c}}\\[2ex] & = \frac{|x-c|}{\sqrt{x}+\sqrt{c}}\\[2ex] &\leq \frac{1}{\sqrt{c}} |x-c|. \end{align*} Hence, given \(\eps \gt 0\), suppose that \(0 \lt |x-c| \lt \sqrt{c}\eps\). Then \(|\sqrt{x}-\sqrt{c}| \lt \eps\).
Prove that \(f(x)=|x|\) is continuous everywhere.
Follows from the inequality \(||x|-|c||\leq |x-c|\).
The last theorem of this section is concerned with the composition of continuous functions.
Let \(f:A\rightarrow\real\) and let \(g:B\rightarrow\real\) be continuous functions and suppose that \(f(A)\subset B\). Then the composite function \((g\circ f):A\rightarrow\real\) is continuous.
Let \(\eps \gt 0\) be given. Let \(c\in A\) and let \(d=f(c)\in B\). Then there exists \(\delta_1 \gt 0\) such that if \(0 \lt |y-d| \lt \delta_1\) then \(|g(y)-g(d)| \lt \eps\). Now since \(f\) is continuous at \(c\), there exists \(\delta_2 \gt 0\) such that if \(0 \lt |x-c| \lt \delta_2\) then \(|f(x)-f(c)| \lt \delta_1\). Therefore, if \(0 \lt |x-c| \lt \delta_2\) then \(|f(x)-d| \lt \delta_1\) and therefore \(|g(f(x))-g(d)| \lt \eps\). This proves that \((g\circ f)\) is continuous at \(c\in A\). Since \(c\) is arbitrary, \((g\circ f)\) is continuous on \(A\).
If \(f:A\rightarrow\real\) is continuous then \(g(x)=|f(x)|\) is continuous. If \(f(x)\geq 0\) for all \(x\in A\) then \(h(x)=\sqrt{f(x)}\) is continuous.

Continuity on Closed Intervals

In this section we develop properties of continuous functions on closed intervals.
We say that \(f:A\rightarrow\real\) is bounded on \(A\) if there exists \(M \gt 0\) such that \(|f(x)|\leq M\) for all \(x\in A\).
If \(f\) is not bounded on \(A\) then for any given \(M \gt 0\) there exists \(x\in A\) such that \(|f(x)| \gt M\).
Consider the function \(f(x)=\frac{1}{x}\) defined on the interval \(A=(0,\infty)\). Let \(M \gt 0\) be arbitrary. Then if \(0 \lt x \lt \frac{1}{M}\) then \(f(x)=\frac{1}{x} \gt M\). For instance, take \(x=\frac{1}{M+1}\). However, on the interval \([2,3]\), \(f\) is bounded by \(M=\frac{1}{2}\).
Let \(f:A\rightarrow\real\) be a continuous function. If \(A=[a,b]\) is a closed and bounded interval then \(f\) is bounded on \(A\).
Suppose that \(f\) is unbounded. Then for each \(n\in\mathbb{N}\) there exists \(x_n\in [a,b]\) such that \(|f(x_n)| \gt n\). Now the sequence \((x_n)\) is bounded since \(a\leq x_n\leq b\). By the Bolzano-Weierstrass theorem, \((x_n)\) has a convergent subsequence, say \((x_{n_k})\), whose limit \(u=\lim_{k\rightarrow\infty}x_{n_k}\) satisfies \(a\leq u\leq b\). Since \(f\) is continuous at \(u\) then \(\lim_{k\rightarrow\infty} f(x_{n_k})\) exists and equal to \(f(u)\). This is a contradiction since \(|f(x_{n_k})| \gt n_k \geq k\) implies that \(f(x_{n_k})\) is unbounded.
Let \(f:A\rightarrow\real\) be a function.
  1. The function \(f\) has an absolute maximum on \(A\) if there exists \(x^*\in A\) such that \(f(x)\leq f(x^*)\) for all \(x\in A\). We call \(x^*\) a maximum point and \(f(x^*)\) the maximum value of \(f\) on \(A\).
  2. The function \(f\) has an absolute minimum on \(A\) if there exists \(x_*\in A\) such that \(f(x_*)\leq f(x)\) for all \(x\in A\). We call \(x_*\) a minimum point and \(f(x_*)\) the minimum value of \(f\) on \(A\).
Suppose that \(f:[a,b]\rightarrow\real\) is continuous. By Theorem 5.3.3, the range of \(f\), that is \(S=\{f(x)\;|\; x\in [a,b]\}\), is bounded and therefore \(\inf(S)\) and \(\sup(S)\) exist. In this case, we want to answer the question as to whether \(\inf(S)\) and \(\sup(S)\) are elements of \(S\). In other words, as to whether \(f\) achieves its maximum and/or minimum value on \([a,b]\). That is, if there exists \(x_*,x^*\in [a,b]\) such that \(f(x_*)\leq f(x) \leq f(x^*)\) for all \(x\in [a,b]\).
The function \(f(x)=\frac{1}{x}\) is continuous on \(A=(0,1]\). However, \(f\) is unbounded on \(A\) and never achieves a maximum value on \(A\).
The function \(f(x)=x^2\) is continuous on \([0,2)\), is bounded on \([0,2)\) but never reaches its maximum value on \([0,2)\), that is, if \(S=\{x^2\;:\; x\in [0,2)\}\) then \(\sup(S)=4\notin S\).
Let \(f:A\rightarrow\real\) be a continuous function. If \(A=[a,b]\) is a closed and bounded interval then \(f\) has a maximum and minimum point on \([a,b]\).
Let \(S=\{f(x)\;|\; x\in [a,b]\}\) be the range of \(f\). By Theorem 5.3.3, \(\sup(S)\) exists; set \(M=\sup(S)\). By the definition of the supremum, for each \(\eps \gt 0\) there exists \(x\in [a,b]\) such that \(M-\eps \lt f(x)\leq M\). In particular, for \(\eps_n=1/n\), there exists \(x_n\in [a,b]\) such that \(M-\eps_n \lt f(x_n)\leq M\). Then \(\lim_{n\rightarrow\infty} f(x_n) = M\). The sequence \((x_n)\) is bounded and thus has a convergent subsequence, say \((x_{n_k})\). Let \(x^* = \lim_{k\rightarrow\infty} x_{n_k}\). Clearly, \(a\leq x^* \leq b\). Since \(f\) is continuous at \(x^*\), we have that \(M = \lim_{k\rightarrow\infty} f(x_{n_k}) = f(x^*)\). Hence, \(x^*\) is a maximum point. A similar proof establishes that \(f\) has a minimum point on \([a,b]\).
By Theorem 5.3.7, we can replace \(\sup\{f(x)\;|\; x\in [a,b]\}\) with \(\max\{f(x)\;|\; x\in [a,b]\}\), and \(\inf\{f(x)\;|\; x\in [a,b]\}\) with \(\min\{f(x)\;|\; x\in [a,b]\}\). When the interval \([a,b]\) is clear from the context, we will simply write \(\max(f)\) and \(\min(f)\). The following example shows the importance of continuity in achieving a maximum/minimum.
The function \(f:[-1,1]\rightarrow\real\) defined by \[ f(x) = \begin{cases} 3-x^2, & 0 \lt x\leq 1\\[2ex] x^2, & -1\leq x\leq 0\end{cases} \] does not achieve a maximum value on the closed interval \([-1,1]\).
The next theorem, called the Intermediate Value Theorem, is the main result of this section, and one of the most important results in this course.
Consider the function \(f:[a,b]\rightarrow\real\) and suppose that \(f(a) \lt f(b)\). If \(f\) is continuous then for any \(\xi\in\real\) such that \(f(a) \lt \xi \lt f(b)\) there exists \(c\in (a,b)\) such that \(f(c)=\xi\).
Let \(S=\{x\in [a,b]\;:\; f(x) \lt \xi \}\). The set \(S\) is non-empty because \(a\in S\). Moreover, \(S\) is clearly bounded above. Let \(c=\sup(S)\). By the definition of the supremum, there exists a sequence \((x_n)\) in \(S\) such that \(\limi x_n = c\). Since \(a\leq x_n\leq b\) it follows that \(a \leq c \leq b\). By definition of \(x_n\), \(f(x_n) \lt \xi\) and since \(f\) is continuous at \(c\) we have that \(f(c) = \limi f(x_n) \leq \xi\), and thus \(f(c)\leq \xi\). Now let \(\delta_n \gt 0\) be such that \(\delta_n\rightarrow 0\) and \(c+\delta_n \lt b\). Then \(z_n = c+\delta_n\) converges to \(c\) and \(\xi \leq f(z_n)\) because \(z_n\not\in S\). Therefore, since \(\limi f(z_n) = f(c)\) we have that \(\xi \leq f(c)\). Therefore, \(f(c)\leq \xi \leq f(c)\) and this proves that \(\xi=f(c)\). This shows also that \(a \lt c \lt b\).
The Intermediate Value Theorem has applications in finding points where a function is zero.
Let \(f:[a,b]\rightarrow\real\) be a function and suppose that \(f(a)f(b) \lt 0\). If \(f\) is continuous then there exists \(c\in (a,b)\) such that \(f(c)=0\).
A hiker begins his climb at 7:00 am on a marked trail and arrives at the summit at 7:00 pm. The next day, the hiker begins his trek down the mountain at 7:00 am, takes the same trail down as he did going up, and arrives at the base at 7:00 pm. Use the Intermediate Value Theorem to show that there is a point on the path that the hiker crossed at exactly the same time of day on both days.
Let \(f(t)\) be the distance traveled along the trail on the way up the mountain after \(t\) units of time, and let \(g(t)\) be the distance remaining to travel along the trail on the way down the mountain after \(t\) units of time. Both \(f\) and \(g\) are defined on the same time interval, say \([0,12]\) if \(t\) is measured in hours. If \(M\) is the length of the trail, then \(f(0)=0\), \(f(12)=M\), \(g(0)=M\) and \(g(12)=0\). Let \(h(t)=g(t)-f(t)\). Then \(h(0)=M\) and \(h(12)=-M\). Hence, there exists \(t^*\in (0,12)\) such that \(h(t^*)=0\). In other words, \(f(t^*)=g(t^*)\), and therefore \(t^*\) is the time of day when the hiker is at exactly the same point on the trail.
Prove by the Intermediate Value Theorem that \(f(x)=xe^x-2\) has a root in the interval \([0,1]\).
The function \(f\) is continuous on \([0,1]\). We have that \(f(0)=-2 \lt 0\) and \(f(1)=e-2 \gt 0\). Therefore, there exists \(x^*\in (0,1)\) such that \(f(x^*)=0\), i.e., \(f\) has a zero in the interval \((0,1)\).
The next results says, roughly, that continuous functions preserve closed and bounded intervals. In the following theorem, we use the short-hand notation \(f([a,b])=\{ f(x)\,|\, x\in [a,b]\}\) for the range of \(f\) under \([a,b]\).
If \(f:[a,b]\rightarrow\real\) is continuous then \(f([a,b]) = [\min(f), \max(f)]\).
Since \(f\) achieves its maximum and minimum value on \([a,b]\), there exists \(x^*,x_*\in [a,b]\) such that \(f(x_*)\leq f(x)\leq f(x^*)\) for all \(x\in [a,b]\). Hence, \(f([a,b])\subset [f(x_*),f(x^*)]\). Assume for simplicity that \(x_* \lt x^*\). Then \([x_*,x^*]\subset [a,b]\). Let \(\xi\in\real\) be such that \(f(x_*) \lt \xi \lt f(x^*)\). Then by the Intermediate Value Theorem, there exists \(c \in (x_*,x^*)\) such that \(\xi=f(c)\). Hence, \(\xi \in f([a,b])\), and this shows that \([f(x_*),f(x^*)] \subset f([a,b])\). Therefore, \(f([a,b]) = [f(x_*),f(x^*)]=[\min(f), \max(f)]\).
It is worth noting that the previous theorem does not say that \(f([a,b]) = [f(a), f(b)]\).

Exercises

Let \(f:A\rightarrow\real\) be any function. Show that if \(-f\) achieves its maximum at \(x_0\in A\) then \(f\) achieves its minimum at \(x_0\).
Let \(f\) and \(g\) be continuous functions on \([a,b]\). Suppose that \(f(a)\geq g(a)\) and \(f(b)\leq g(b)\). Prove that \(f(x_0)=g(x_0)\) for at least one \(x_0\) in \([a,b]\).
Let \(f:[0,1]\rightarrow\real\) be a continuous function and suppose that \(f(x)\in [0,1]\) for all \(x\in [0,1]\). Show that there exists \(x_0\in[0,1]\) such that \(f(x_0)=x_0\). Hint: Consider the function \(g(x)=f(x)-x\) on the interval \([0,1]\).
Let \(f:[a,b]\rightarrow\real\) be a continuous function. Prove that if \(f(x)\in\mathbb{Q}\) for all \(x\in[a,b]\) then \(f\) is a constant function. Hint: You will need the Density Theorem and the Intermediate Value Theorem.

Uniform Continuity

In the definition of continuity of \(f:A\rightarrow\real\) at \(c\in A\), the \(\delta\) will in general not only depend on \(\eps\) but also on \(c\). In other words, given two points \(c_1,c_2\) and fixed \(\eps \gt 0\), the minimum \(\delta_1\) and \(\delta_2\) needed for \(c_1\) and \(c_2\) in the definition of continuity are generally going to be different. To see this, consider the continuous function \(f(x)=x^2\). Then it is straightforward to verify that if \(c^2-\eps \gt 0\) then \(|x^2-c^2| \lt \eps\) if and only if \[ \sqrt{c^2-\eps} - c \lt x-c \lt \sqrt{c^2+\eps}-c. \] Let \(c_1=1\) and \(c_2=3\), and let \(\eps = 1/2\). Then \(|x-1| \lt \delta_1\) implies that \(|f(x)-f(1)| \lt \eps\) if and only \(\delta_1\leq \sqrt{1+\eps}-1\approx 0.2247\). On the other hand, \(|x-c| \lt \delta_2\) implies that \(|f(x)-f(3)| \lt \eps\) if and only if \(\delta_2\leq \sqrt{9+\eps}-9\approx 0.0822\). The reason that a smaller delta is needed at \(c=3\) is that the slope of \(f\) at \(c=3\) is larger than that at \(c=1\). On the other hand, consider the function \(f(x)=\sin(2x)\). For any \(c\) it holds that \begin{align*} |f(x)-f(c)| &=|\sin(2x)-\sin(2c)|\\ & \leq 2|x-c|. \end{align*} Hence, given any \(\eps \gt 0\) we can set \(\delta=\eps/2\) and then \(|x-c| \lt \delta\) implies that \(|f(x)-f(c)| \lt \eps\). The punchline is that \(\delta=\eps/2\) will work for any \(c\). These motivating examples lead to the following definition.
The function \(f:A\rightarrow\real\) is said to be uniformly continuous on \(A\) if for each \(\eps \gt 0\) there exists \(\delta \gt 0\) such that for all \(x,u\in A\) satisfying \(|x-u| \lt \delta\) it holds that \(|f(x)-f(u)| \lt \eps\).
Let \(k\neq 0\) be any non-zero constant. Show that \(\displaystyle f(x)=kx\) is uniformly continuous on \(\real\).
We have that \(|f(x)-f(c)|=|kx-kc|=|k||x-c|\). Hence, for any \(\eps \gt 0\) we let \(\delta=\eps/|k|\), and thus if \(|x-c| \lt \delta\) then \(|f(x)-f(c)| \lt \eps\).
Prove that \(f(x)=\sin(x)\) is uniformly continuous.
We have that \begin{align*} |\sin(x)-\sin(c)| &\leq 2 |\sin(\tfrac{1}{2}(x-c))|\\ & \leq |x-c|. \end{align*} Hence, for \(\eps \gt 0\) let \(\delta=\eps\) and if \(|x-c| \lt \delta\) then \(|\sin(x)-\sin(c)| \lt \eps\).
Show that \(\displaystyle f(x)=\frac{1}{1+x^2}\) is uniformly continuous on \(\real\).
We have that \begin{align*} |f(x)-f(c)| &= \left|\frac{1}{1+x^2}-\frac{1}{1+c^2}\right| \\[2ex] &= \left|\frac{1+c^2-1-x^2}{(1+x^2)(1+c^2)}\right|\\[2ex] &= \left|\frac{x+c}{(1+x^2)(1+c^2)}\right| |x-c|\\[2ex] &= \left|\frac{x}{(1+x^2)(1+c^2)}+\frac{c}{(1+x^2)(1+c^2)}\right| |x-c|. \end{align*} Now, \(|x|\leq 1+x^2\) implies that \(\frac{|x|}{1+x^2}\leq 1\) and therefore \[ \frac{|x|}{(1+x^2)(1+c^2)} \leq \frac{1}{1+c^2} \leq 1. \] It follows that \(|f(x)-f(c)|\leq 2|x-c|\). Hence, given \(\eps \gt 0\) we let \(\delta=\eps/2\), and if \(|x-c| \lt \delta\) then \(|f(x)-f(c)| \lt \eps\).
The following is a simple consequence of the definition of uniform continuity.
Let \(f:A\rightarrow\real\) be a function. The following are equivalent:
  1. The function \(f\) is not uniformly continuous on \(A\).
  2. There exists \(\eps_0 \gt 0\) such that for every \(\delta \gt 0\) there exists \(x,u\in A\) such that \(|x-u| \lt \delta\) but \(|f(x)-f(c)|\geq \eps_0\).
  3. There exists \(\eps_0 \gt 0\) and two sequences \((x_n)\) and \((u_n)\) such that \(\displaystyle\limi (x_n-u_n)=0\) and \(|f(x_n)-f(u_n)|\geq \eps_0\).
Let \(f(x)=\frac{1}{x}\) and let \(A=(0,\infty)\). Let \(x_n=\frac{1}{n}\) and let \(u_n=\frac{1}{n+1}\). Then \(\lim (x_n-u_n)=0\). Now \(|f(x_n)-f(u_n)|=|-1|=1\). Hence, if \(\eps=1/2\) then \(|f(x_n)-f(u_n)| \gt \eps\). This proves that \(f\) is not uniformly continuous on \(A=(0,\infty)\).
Let \(f:A\rightarrow\real\) be a continuous function with domain \(A=[a,b]\). If \(f\) is continuous on \(A\) then \(f\) is uniformly continuous on \(A\).
We prove the contrapositive, that is, we will prove that if \(f\) is not uniformly continuous on \([a,b]\) then \(f\) is not continuous on \([a,b]\). Suppose then that \(f\) is not uniformly continuous on \([a,b]\). Then there exists \(\eps \gt 0\) such that for \(\delta_n=1/n\), there exists \(x_n,u_n\in [a,b]\) such that \(|x_n-u_n| \lt \delta_n\) but \(|f(x_n)-f(u_n)|\geq \eps\). Clearly, \(\lim (x_n-u_n) = 0\). Now, since \(a\leq x_n\leq b\), by the Bolzano-Weierstrass theorem there is a subsequence \((x_{n_k})\) of \((x_n)\) that converges to a point \(z \in [a,b]\). Now, \[ |u_{n_k}-z| \leq |u_{n_k}-x_{n_k}| + |x_{n_k}-z| \] and therefore also \(\lim_{k\rightarrow\infty} u_{n_k} = z\). Hence, both \((x_{n_k})\) and \((u_{n_k})\) are sequences in \([a,b]\) converging to \(z\) but \(|f(x_{n_k})-f(u_{n_k})|\geq \eps\). Hence \(f(x_{n_k})\) and \(f(u_{n_k})\) do not converge to the same limit and thus \(f\) is not continuous at \(z\). This completes the proof.
The following example shows that boundedness of a function does not imply uniform continuity.
Show that \(f(x)=\sin(x^2)\) is not uniformly continuous on \(\real\).
Consider \(x_n=\sqrt{\pi n}\) and \(u_n=\sqrt{\pi n} + \frac{\sqrt{\pi}}{4\sqrt{n}}\). Clearly \(\lim (x_n-u_n)=0\). On the other hand \begin{align*} |f(x_n)-f(u_n)| &= \left|\sin(\pi n) - \sin(\sqrt{\pi n} +\tfrac{\sqrt{\pi}}{4\sqrt{n}})^2\right| \\[2ex] & = \left| \sin\left(\pi n + \tfrac{\pi}{2} + \tfrac{\pi}{16n}\right)\right| \\[2ex] &= \left| \cos \left(\pi n + \tfrac{\pi}{16n}\right)\right|\\[2ex] &= \left| \cos(n\pi)\cos(\tfrac{\pi}{16n}) - \sin(n\pi)\sin(\tfrac{\pi}{16n}) \right| \\[2ex] &= |(-1)^n \cos(\tfrac{\pi}{16n})|\\[2ex] &= \cos(\tfrac{\pi}{16n})\\[2ex] &\geq \cos(\tfrac{\pi}{16}) \end{align*}
The reason that \(f(x)=\sin(x^2)\) is not uniformly continuous is that \(f\) is increasing rapidly on arbitrarily small intervals. Explicitly, it does not satisfy the following property.
A function \(f:A\rightarrow\real\) is called a Lipschitz function on \(A\) if there exists a constant \(K \gt 0\) such that \(|f(x)-f(u)| \leq K |x-u|\) for all \(x,u\in A\).
Suppose that \(f\) is Lipschitz with Lipschitz constant \(K \gt 0\). Then for all \(x,u\in A\) we have that \[ \left|\frac{f(x)-f(u)}{x-u}\right| \leq K. \] Hence, the secant line through the points \((x,f(x))\) and \((u,f(u))\) has slope no larger than \(K\) in magnitude. Hence, a Lipschitz function has a constraint on how quickly it can change (measured by \(|f(x)-f(u)|\)) relative to the change in its inputs (measured by \(|x-u|\)).
Since \(|\sin(x)-\sin(u)|\leq |x-u|\), \(f(x)=\sin(x)\) is a Lipschitz function on \(\real\) with constant \(K=1\).
If \(a\neq 0\), the function \(f(x)=ax+b\) is Lipschitz on \(\real\) with constant \(K=|a|\). When \(a=0\), \(f\) is clearly Lipschitz with arbitrary constant \(K \gt 0\).
If \(f:A\rightarrow\real\) is a Lipschitz function on \(A\) then \(f\) is uniformly continuous on \(A\).
By assumption, \(|f(x)-f(u)|\leq K |x-u|\) for all \(x,u \in A\) for some constant \(K \gt 0\). Let \(\eps \gt 0\) be arbitrary and let \(\delta=\eps/K\). Then if \(|x-u| \lt \delta\) then \(|f(x)-f(u)|\leq K |x-u| \lt \eps\). Hence, \(f\) is uniformly continuous on \(A\).
The following example shows that a uniformly continuous function is not necessarily Lipschitzian.
Consider the function \(f(x)=\sqrt{x}\) defined on \(A=[0,2]\). Since \(f\) is continuous, \(f\) is uniformly continuous on \([0,2]\). To show that \(f\) is not Lipschitzian on \(A\), let \(u=0\) and consider the inequality \(|f(x)|=\sqrt{x}\leq K |x|\) for some \(K \gt 0\). If \(x\in [0,2]\) then \(\sqrt{x}\leq K|x|\) if and only if \(x\leq K^2x^2\) if and only if \(x(K^2x-1)\geq 0\). If \(x\in (0,1/K^2)\cap A\), it holds that \(K^2x-1 \lt 0\), and thus no such \(K\) can exist. Thus, \(f\) is not Lipschitzian on \([0,2]\).

Exercises

Let \(f:A\rightarrow\real\) and let \(g:A\rightarrow\real\) be uniformly continuous functions on \(A\). Prove that \(f+g\) is uniformly continuous on \(A\)
Let \(f:A\rightarrow\real\) and let \(g:A\rightarrow\real\) be Lipschitz functions on \(A\). Prove that \(f+g\) is a Lipschitz function on \(A\).
Give an example of a function that is uniformly continuous on \(\real\) but is not bounded on \(\real\).
Prove that \(f(x)=x^2\) is not uniformly continuous on \(\real\).
Give an example of distinct functions \(f:\real\rightarrow\real\) and \(g:\real\rightarrow\real\) that are uniformly continuous on \(\real\) but \(fg\) is not uniformly continuous on \(\real\). Prove that your resulting function \(fg\) is indeed not uniformly continuous.
A function \(f:\real\rightarrow\real\) is said to be \(T\)-periodic on \(\real\) if there exists a number \(T \gt 0\) such that \(f(x+T)=f(x)\) for all \(x\in\real\). Prove that a \(T\)-periodic continuous function on \(\real\) is bounded and uniformly continuous on \(\real\). Hint: First consider \(f\) on the interval \([0,T]\).