19 Continuous Functions
Highlights of this Chapter: we prove two foundational results about continuous functions whose proofs have several steps in common:
- Continuous Functions are determined by their values on dense sets.
- The Extreme Value Theorem: a continuous function achieves a max and min on any closed interval.
- The Intermediate Value Theorem: a continuous function must take every value between \(f(a)\) and \(f(b)\) on the interval \([a,b]\).
Just like we have seen various ‘proof styles’ for sequences (recurrent themes in proofs, like ‘an \(\epsilon/2\) argument’) one of the biggest takeaways of this section is a proof technique for working with continuous functions. It has three steps, summarized below:
- Use whatever information you have to start, to construct a sequence of points.
- Use Bolzano Weierstrass to find a convergent subsequence.
- Apply \(f\) to that sequence and use continuity to know the result is also convergent.
This is to vague on its own to be useful, but in reading the proofs of the boundedness theorem, the extreme value theorem, and the intermediate value theorem below, look out for these three recurrent steps.
19.1 Dense Sets
Functions determined by values on dense set
Lemma 19.1 If \(f\) is a continuous function such that \(f(r)=0\) for every rational number \(r\), then \(f=0\) is the zero function.
Proof. Let \(f\) be such a function, and \(a\in\RR\) any real number. Then there is a sequence \(r_n\) of rational numbers converging to \(a\). Given that \(f\) is zero on all rationals, we see that \(f(r_n)=0\) for all \(n\). Thus \(f(r_n)\) is the constant zero sequence, and so its limit is zero: \[\lim f(r_n)=\lim 0 = 0\] But, since \(f\) is assumed to be continuous, we know that we can move the limit inside of \(f\): \[0=\lim f(r_n)=f\left(\lim r_n\right)=f(a)\] Thus \(f(a)=0\), and since \(a\) was arbitrary, we see \(f\) is the constant function equal to zero at all real numbers.
Proposition 19.1 (Equal on Rationals \(\implies\) Equal) Let \(f,g\) be continuous functions such that for all \(r\in\QQ\) they are equal: \(f(r)=g(r)\). Then in fact, \(f=g\): for all \(x\in\RR\), \(f(x)=g(x)\)
Proof. Since \(f\) and \(g\) are continuous, the function \(h=f-g\) is continuous using the theorems for field operations. And, since \(f(x)=g(x)\) for all rational \(x\), we see \(h(x)=0\) on the rationals. Thus, by ?prp-zero-on-rationals, \(h\) itself must be the zero function on all of \(\RR\). Thus for every \(x\), \(h(x)=f(x)-g(x)=0\), or rearranging, \[\forall x,\, f(x)=g(x)\]
This has a the pretty significant consequence that if we have a function and we know it is continuous, then being able to calculate its values at the rational numbers is good enough to completely determine the function on the real line. In particular, this can be used to prove various uniqueness results: you can show a certain function is uniquely defined if you can prove that its definition implies (1) continuity and (2) determines the rational points (or more generally, the values on a dense set).
Theorem 19.1 (Equal on a Dense Set \(\implies\) Equal) Continuous functions are determined by their values on a dense subset of their domains: if \(f,g\colon X\to\RR\) and \(D\subset X\) is dense with \(f=g\) on \(D\), then \(f(x)=g(x)\) for all \(x\in X\).
Exercise 19.1 Prove this (following the ideas for the special case of rationals)
We will use this property in understanding exponential functions (where their value at rational numbers are determined by powers and roots) and trigonometric functions (whose values on certain dyadic multiples of \(\pi\) are determined by the half-angle identities.)
There are many useful theorems of this type, that check a property of a function on a dense set and use it to conclude the same property holds generally. We give two more examples below, that prove useful in upcoming work
Proposition 19.2 If \(f\) is continuous and monotone on a dense set, then it is monotone on its entire domain.
Proof. Assume for contradiction that \(f\) is monotone increasing on a dense set \(D\) in the domain of \(f\), but that it is not monotone increasing on the entire domain. This means that there exists a pair \(x<y\) in the domain where \(f(x)>f(y)\), call the difference \(f(y)-f(x)=D\) and set \(\epsilon = D/3\). Then by continuity of \(f\) there is a \(\delta_x\) about \(x\) such that \(|x-a|<\delta_x\) implies \(|f(x)-f(a)|<\epsilon\), and similarly for a \(\delta_y\) about \(y\).
We are going to use these \(\delta\) neighborhoods to choose points in \(d_x,d_y\in D\) near \(x\) and \(y\), so we need to be careful: we wish to ensure \(d_x<d_y\) just as \(x<y\), so we want our \(\delta\) neighborhoods to not overlap. And since we got the values \(\delta_x\) and \(\delta_y\) from continuity we don’t have any control over their size, so they might be rather large! But this is no serious problem, we can easily shrink them if needed: if \(\delta = |y-x|\) we can set \(\delta_x\) to be the minimum of its original value and \(\delta/2\), and same for \(\delta_y\).
Now, by the density of \(D\) in the domain, there is a \(d_x\in D\) within \(\delta_x\) of \(x\) and a \(d_y\in D\) within \(\delta_y\) of \(y\). Together with the above this implies that \(f(d_x)\) is at least \(f(x)-\epsilon\) and \(f(d_y)\) is at most \(f(y)+\epsilon\). But the distance between \(f(x)\) and \(f(y)\) was \(D=3\epsilon\), so \(f(d_x)-f(d_y)\geq \epsilon > 0\) and hence \(f(d_x)>f(d_y)\). But this contradicts the fact that \(f\) is increasing on \(D\) as \(d_x<d_y\).
Exercise 19.2 Modify the above proof to show that if \(f\) is continuous and strictly increasing or strictly decreasing on a dense set, then it is strictly increasing/decreasing everywhere on its domain.
Exercise 19.3 If \(f\) is continuous and convex on a dense set, then it is convex on its entire domain.
19.2 Extreme Values
Proposition 19.3 (Continuous on Closed Interval \(\implies\) Bounded) Let \(f\) be a continuous function on a closed interval \([a,b]\). Then the image \(f([a,b])\) is bounded.
Proof. Assume for the sake of contradiction that \(f\) is not bounded. Then for each \(n\in\NN\) there must be some \(x_n\in[a,b]\) where \(|f(x_n)|>n\). This sequence \(\{x_n\}\) need not be convergent, but it lies in the interval \([a,b]\) so it is bounded, and thus contains a convergent subsequence \(x_{n_k}\) by Bolzano Weierstrass. Say \(x_{n_k}\to x\). Then since \(a\leq x_{n_k}\leq b\) for all \(k\), by the inequalities of limits we see \(a\leq x\leq b\) so the limit \(x\) lies in the interval \([a,b]\) as well.
But what is the value \(f(x)\)? Since \(f\) is continuous and \(x_{n_k}\to x\) we know that \[f(x_{n_k})\to f(x)\] But for each \(k\), \(x_{n_k}\) has the property that \(f(x_{n_k})>n_k\) by definition. Thus, the sequence \(f(x_{n_k})\) is not bounded, and cannot be convergent (since all convergent sequences are bounded). This is a contradiction, as it implies that \(f(x)\) is not defined, even though we have assumed \(f\) is defined on the entire interval \([a,b]\).
Thus, no such sequence \(x_n\) is possible, and so there must be some \(n\) where \(|f(x)|<n\) for all \(x\in [a,b]\). That is, \(f\) must be bounded on \([a,b]\).
Building off this result, one can prove that a continuous function actually achieves its upper and lower bounds on any closed interval. This result will play a role several times across the theory of functions and derivatives, so we give it a memorable name: the extreme value theorem (as maxima and minima taken collectively are called extrema).
Theorem 19.2 (Extreme Value Theorem) Let \(f\) be a continuous function on a closed interval \([a,b]\). Then \(f\) achieves a maximum and minimum value: that is, there exists a point \(p\) where \(f(p)\geq f(x)\) for all \(x\in[a,b]\), and a \(q\) where \(f(q)\leq f(x)\) for all \(x\in [a,b].\)
Proof. We show \(f\) achieves a maximum, and leave the minimum case as an exercise. Let \(f\) be continuous on \([a,b]\) and let \(R=\{f(x)\mid x\in[a,b]\}\) be the set of outputs, or the range of \(f\). Since \(f\) is bounded we see that \(R\) is a bounded subset of \(\RR\), and so by completeness \[m=\inf R\hspace{1cm} M=\sup R\] must exist. Our goal is to find values \(x_m, x_M\in [a,b]\) for which the infimum and supremum are realized: \[f(x_m)=m\hspace{1cm}f(x_M)=M\]
Here we show this holds for the supremum, the infimum is left as an exercise below. Since \(M\) is the supremum, for any \(\epsilon>0\) we know that \(M-\epsilon\) is not an upper bound for \(R=\{f(x)\mid x\in[a,b]\}\): thus there must be some \(x\) where \(f(x)>M-\epsilon\). So letting \(\epsilon=1/n\) each \(n\), let \(x_n\) be a point where \(M-\frac{1}{n}<f(x_n)\leq M\). As \(n\to\infty\) we know \(M-\frac{1}{n}\to M\) and so by the squeeze theorem we see that \(f(x_n)\to M\) as well.
We don’t know that the points \(x_n\) themselves converge, but we do know that this entire sequence lies inside the closed interval \([a,b]\) so its bounded and Bolzano Weierstrass lets us extract a convergent subsequence \(x_{n_k}\to x\). And as \(a\leq x_{n_k}\leq b\) it follows that the limit \(x\in[a,b]\) as well. Because subsequences of a convgent sequence converge to the same limit, we know that \(f(x_{n_k})\) is convergent, and still has limit \(M\). But now we can finally use continuity!
Since \(f\) is continuous, we know \(\lim f(x_n)=f(\lim x_n)\), and so \(M=f(x)\). Thus we managed to find a point \(x\in[a,b]\) where \(f(x)\) is the supremum: \(f(x)\) is an upper bound for all possible values of \(f\) on \([a,b]\), which by definition means its the max value! So \(f\) achieves a maximum on \([a,b]\).
Exercise 19.4 Complete the proof by showing a continuous function on a closed interval achieves a minimum.
19.3 Intermediate Values
The intermediate value theorem is the rigorous version of “you can draw the graph of a continuous function without picking up your pencil”.
One note: in the statement below we use the phrase \(y\) is between \(f(a)\) and \(f(b)\) as a shorthand to mean that either \(f(a)<y<f(b)\) or \(f(b)<y<f(a)\) (as we don’t know if \(f(a)\) or \(f(b)\) is larger).
Theorem 19.3 (The Intermediate Value Theorem) Let \(f\) be a continuous function on the interval \([a,b]\), and let \(y\) be any number between \(f(a)\) and \(f(b)\). Then there exists an \(x\) between \(a\) and \(b\) such that \(y=f(x)\).
Proof. Without loss of generality we will assume that \(f(a)<f(b)\) so that \(y\) lies in the interval \([f(a),f(b)]\) (the other case is analogous, we just instead must write the interval \([f(b),f(a)]\)). We wish to find a point \(x\in[a,b]\) where \(f(x)=y\), so we start by defining the set of points where \(f(x)\) is less than or equal to \(y\):
\[S=\{x\in[a,b]\mid f(x)\leq y\}\]
This set is nonempty: \(a\in S\) as \(f(a)<y\) by assumption. And its bounded above by \(b\): if \(x\in S\) then \(x\in[a,b]\) so \(x\leq b\) by definition. Thus, the supremum \(\sigma = \sup S\) exists, and \(\sigma\in[a,b]\). We will show that \(f(\sigma)=y\), by showing both inequalities \(f(\sigma)\leq y\) and \(f(\sigma)\geq y\).
First, we show \(\leq\). Since \(\sigma\) is the supremeum, for each \(n\) we know that \(\sigma-\frac{1}{n}\) is not an upper bound, and so there must be an point \(x_n\in(\sigma-1/n,\sigma)\) where \(f(x_n)\leq y\). The squeeze theorem assures that \(x_n\to\sigma\), and the continuity of \(f\) assures that \(f(x_n)\) converges (since \(x_n\) does). But for all \(n\) we know \(f(x_n)\leq y\), so by the inequalities of limits we also know \(\lim f(x_n)=f(\sigma)\leq y\).
Next, we show \(\geq\). First note that \(\sigma\neq b\) as \(f(\sigma)\leq y\) but \(f(b)>y\). So, \(\sigma< b\) and so after truncating finitely many terms, the sequence \(x_n=\sigma+1/n\) lies strictly between \(\sigma\) and \(b\). Since this sequence is greater than the upper bound \(\sigma\), we know that none of the \(x_n\) are in \(S\) and so \(f(x_n)>y\) by definition, for all \(n\). But as \(n\to\infty\) the sequence of \(x_n\)’s is squeezed to converge to \(\sigma\), and so by continuity we know \[f(\sigma)=f(\lim x_n)=\lim f(x_n)\] Applying the inequalities of limits this time yields the reverse: since for all \(n\) we know \(f(x_n)>y\), it follows that \(\lim f(x_n)\geq y\) so \(f(\sigma)\geq y\).
Putting these together we know that \(f(\sigma)\) is some number which must simultaneously by \(\geq y\) and \(\leq y\). The only number satisfying both of these inequalities is \(y\) itself, so \[f(\sigma)=y\]
Corollary 19.1 Continuous image of a closed interval is a closed interval.
Historically, the intermediate value theorem was one of the reasons for developing much of analysis: mathematicians knew that whatever the correct formal definition of continuity was, it should certainly imply this! So, our proof of the intermediate value theorem (which embodies the intuitive notion of continuity) may be seen as evidence that we have chosen good definitions of continuity and convergence: they work as we expect!
Remark 19.1. It may seem at first that the intermediate value theorem is equivalent to continuity: if a function satisfies the intermediate value property, then its continuous. Try to prove it! Where do you get stuck?
Example 19.1 Consider the following function \[f(x)=\begin{cases} \sin\left(\frac{1}{x}\right)& x\neq 0\\ 0 & x=0 \end{cases}\]
Then \(f\) satisfies the conclusion of the intermediate value theorem on every closed interval, but \(f\) is not continuous at \(0\).
19.4 Hitting and Missing Points
Continuity is a strong constraint on a function, and the behavior of a continouus function at one or more points can often be used to gain information about nearby points. We begin with an often-useful example that does not require any deep theory: if a continuous function is nonzero at a point, then it is actually nonzero in an entire small interval around that point:
Proposition 19.4 (Nonzero on a Neighborhood) If \(f\) is continuous, \(f(a)\neq 0\) then there is a small open interval about \(a\) where \(f\) is nonzero.
Proof. Let \(f(a)=c\) with \(c>0\), and set \(\epsilon= |f(c)|/2\). By continuity, there is some \(\delta\) such that if \(|x-c|<\delta\) we know \(|f(x)-f(c)|<\epsilon\). Unpacking this, for all \(x\in(c-\delta, c+\delta)\) we know
\[-\epsilon=\frac{-|f(c)|}{2} < f(x)-f(c)<\frac{|f(c)|}{2}=\epsilon\]
And thus
\[f(c)-\frac{|f(c)|}{2}< f(x)<f(c)+\frac{|f(c)|}{2}\]
If \(f(c)\) is positive, then the lower bound here is \(f(c)/2\) which is still positive, so \(f(x)\) is always positive in the interval. And, if \(f(c)\) is negative, the upper bound here is \(f(c)/2\) which is still negative: thus \(f(x)\) is always negative in the interval.
Exercise 19.5 If \(f\) is continuous and \(f(x)\geq a\) for all \(x\) in a dense subset of the domain, then \(f(x)\geq a\) everywhere.
Given this, its natural to wonder about the functions that we know cross zero, instead of ones we know stay away from zero. If a function is positive somewhere and negative somewhere else, must it be zero in-between? One cannot prove this easily from the definition as above, but it yields immediately to the intermediate value theorem.
Proposition 19.5 (Positive to Negative implies Zero) If \(f\) is a continuous function on an interval and it is positive one endpoint and negative on the other, then \(f\) has a zero in-between.
This suggests a means of finding the zeros of a function, which narrows in on them exponentially fast! Called “bisection”: find any two points where function changes sign. Divide region in half, evaluate at midpoint. Keep interval with different sign endpoints, repeat.
This argument is useful many places: here we give a classic fixed point theorem as an example
Proposition 19.6 (A Fixed Point Theorem) If \(f\colon [0,1]\to[0,1]\) is continuous then there is some \(x\in [0,1]\) with \(f(x)=x\).
Proof. Consider the function \(g(x)=f(x)-x\). Since \(f(0)\geq 0\) we know \(g(0)=f(0)-0\geq 0\), and as \(f(1)\leq 1\) we similarly know that \(g(1)=f(1)-1\leq 0\).
The intermediate value theorem can be used to prove many useful existence results like these, giving the existence of a number satisfying a certain equation. It similarly provides new, shorter proofs of the existence of square roots:
Example 19.2 (Existence of \(\sqrt{2}\)) The function \(f(x)=x^2\) is continuous on \(\RR\). But \(f(1)=1\) which is less than \(2\) and \(f(2)=4\) which is greater than \(2\). Thus, by the intermediate value theorem there must be some \(s\in[1,2]\) such that \(f(s)=s^2=2\), so \(s=\sqrt{2}\).
This generalizes directly to the existence of square roots of all positive real numbers.
Proposition 19.7 (Existence of Square Roots) For every \(v> 0\) there exists a positive \(u\) with \(u^2=v\): we call this the square root \(u=\sqrt{v}\).
Proof. Let \(v>0\) and consider the function \(f(x)=x^2-v\). This function is continuous, and at \(x=0\) this function is negative, so all we need to do is find a point where the function is positive to be able to apply the IVT. Note \(f(v+1)=(v+1)^2-v=v^2+v+1\) is positive: thus there must be some point \(u\in[0,v+1]\) such that \(u^2=v\), as required.
Exercise 19.6 (Existence of \(n^{th}\) roots.) For every \(x\geq 0\) there exists a unique positive number \(y\) such that \(y^n=x\).
Its worth mentioning one additional corollary of the interemediate value theorem together with the extreme value theorem, which helps us understand the ranges of continuous functions
Corollary 19.2 If \(f\) is a continuous function and \(I\subset\RR\) is a closed interval, then \(f(I)\) is an interval.
Here we allow the degenerate case \([a,a]=\{a\}\) to count as an interval, if \(f\) is constant.
19.5 \(\blacklozenge\) Uniform Continuity
19.5.1 Continuous Extension
Prove uniformly continuous on open interval implies can be extended to endpoints. This is something that can’t be done with a merely continuous function: example = topologist sine curve.
Theorem 19.4 (Extending Uniform Continuity to Endpoints) If \(f\colon(a,b)\to\RR\) is uniformly continuous, then there exists a continuous extension of \(\tilde{f}\) of \(f\) to \([a,b]\).
We could stop to prove this here, but in fact the same technique proves a more general extension theorem of which this is a special case:
Theorem 19.5 (The Continuous Extension Theorem)
Proof. Proof sketch: \(D\) dense in \(X\), define \(f(x)\) by \(\lim f(d_n)\) for \(d_n\to x\). Need to check (1) this defines a value, (2) its well defined, independent of sequence.
For (1): if \(d_n\to x\) then \(d_n\) is convergent, hence Cauchy. \(f\) is uniformly continuous so it takes Cauchy sequences to cauchy sequences. Thus \(f(x_n)\) is Cauchy, hence convergent.
Next for (2): if \(c_n,d_n\to x\) are two such sequences, make the interleaved sequence \(c_1,d_1,c_2,d_2,c_3,d_3\cdots\). This converges to \(x\) as well so is Cauchy. Thus applying \(f\) yields a cauchy (hence convergent) sequence, and all subsequences have the same limit. Since \(c_n\) and \(d_n\) are subsequences, we see \(f(c_n)\) and \(f(d_n)\) converge to the same value.
Note in the proof above we only used one property of uniformly continuous functions: that they take cauchy sequences to cauchy sequences. So this actually applies more generally, to Cauchy Continuous functions.
Corollary 19.3 (Continuous Extension of Cauchy Continuous Functions) If \(f\) is Cauchy continuous on a set \(D\) which is dense in \(X\), then there exists a unique continuous extension \(\tilde{f}\) of \(f\) to \(X\).
19.5.2 Continuous on a Closed Interval
The continuous extension theorems provide a first (of several) motivations for being interested in this stronger notion of continuity. Hence its useful to develop some results for telling when a function which known a priori only to be continuous is in fact uniformly continuous. The most useful of these provides a surprisingly simple condition: so long as the domain is a closed interval, continuity and uniform continuity are equivalent!
Theorem 19.6 (Continuous \(+\) Closed \(\implies\) Uniform) Let \(f\) be a continuous function defined on the closed interval \([a,b]\). Then \(f\) is in fact uniformly continuous on this interval.
Proof. Assume for the sake of contradiction that \(f\) is not uniformly continuous, and fix \(\epsilon>0\). Then there is no fixed \(\delta\) that works, so for any proposed \(\delta\), there must be some \(a\) where it fails.
We can use this to produce a sequence: for \(\delta=1/n\) let \(a_n\in I\) be a point where this \(\delta\) fails: there is some \(x_n\) within \(1/n\) of \(a_n\) but \(|f(x_n)-f(a_n)|>\epsilon\).
Thus, in fact we have two sequences \(x_n\) and \(a_n\)! We know very little about either except that they are in a closed interval \(I\), so we can apply Bolzano Weierstrass to get convergent subsequences (we have to be a bit careful here, see the exercise below).
We will call the subsequences \(X_n\) and \(A_n\) (with capital letters). Now that we know they both converge, we can see that they also have the same limit: (as, by construction \(|X_n-A_n|<\frac{1}{n}\)). Call that limit \(L\).
Then since \(f\) is continuous at \(L\), we know that \[\lim f(X_n)=f(\lim X_n)=f(L)=f(\lim A_n)=\lim f(A_n)\] Thus, \(\lim f(X_n)-f(A_n)=0\). However this is impossible, since for all values of \(n\) we know \(|f(X_n)-f(A_n)|>\epsilon\)! This is a contradiction, and thus there must have been some uniform \(\delta\) that worked all along.
In proof, use that we can simultaneously apply bolzano weierstrass to two sequences: this appears as an Exercise 9.14 back in the chapter on subsequences. If you didn’t do it then, you should prove this for yourself now.
Exercise 19.7 (Periodic Continuous Functions are Uniformly Continuous) Let \(f\) be a periodic continuous function on \(\RR\). Then \(f\) is uniformly continuous.