** Continuous Functions**

**3.2 Continuous functions Note: 2–2.5 lectures**

You undoubtedly heard of continuous functions in your schooling. A high-school criterion for this concept 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.

### 3.2.1

### Definition and basic properties

Definition 3.2.1. LetS_{⊂}_{R},c_{∈}S, and let f: S_{→}_{R}be a function. We say that f iscontinuous at c
if for everyε >0 there is aδ >0 such that wheneverx∈Sand|x−c|<δ, then|f(x)−f(c)|<ε.

When f: S_{→}Ris continuous at allc∈S, then we simply say f is acontinuous function.

y= f(x) c f(c) ε ε δ δ

Figure 3.2:For_{|}x_{−}c_{|}<δ, the graph of f(x)should be within the gray region.

If f is continuous for allc_{∈}A, we say f is continuous onA_{⊂}S. It is left as an easy exercise to
show that this implies that f_{|A}is continuous, although the converse does not hold.

Continuity may be the most important definition to understand in analysis, and it is not an easy one. See . Note thatδ not only depends onε, but also onc; we need not pick oneδ for

allc_{∈}S. 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.

Proposition 3.2.2. Let S_{⊂}_{R}, let f: S_{→}_{R}be a function, and let c_{∈}S be a point. Then
(i) If c is not a cluster point of S, then f is continuous at c.

(ii) If c is a cluster point of S, then f is continuous at c if and only if the limit of f(x)as x→c exists and

lim

x→cf(x) = f(c).

(iii) f is continuous at c if and only if for every sequence_{{}x_{n}}where xn∈S andlimxn=c, the
sequence{f(xn)}converges to f(c).

Proof. Let us start with the first item. Suppose cis not a cluster point ofS. Then there exists a

δ >0 such thatS∩(c−δ,c+δ) ={c}. Therefore, for anyε >0, simply pick this given delta. The

onlyx_{∈}Ssuch that|x−c|<δ isx=c. Then|f(x)−f(c)|=|f(c)−f(c)|=0<ε.

Let us move to the second item. Suppose cis a cluster point of S. Let us first suppose that limx→c f(x) = f(c). Then for everyε >0 there is aδ >0 such that ifx∈S\ {c}and|x−c|<δ,

then|f(x)−f(c)|<ε. Also|f(c)−f(c)|=0<ε, so the definition of continuity atcis satisfied.

On the other hand, suppose f is continuous atc. For everyε >0, there exists aδ >0 such that for

x_{∈}Swhere|x−c|<δ we have |f(x)−f(c)|<ε. Then the statement is, of course, still true if

x_{∈}S_{\ {}c_{} ⊂}S. Therefore, limx→cf(x) = f(c).

For the third item, first suppose f is continuous atc. Let{xn}be a sequence such thatxn∈S and limxn=c. Letε >0 be given. Find aδ >0 such that|f(x)−f(c)|<ε for allx∈Swhere

|x−c|<δ. Find anM∈_{N}such that forn≥Mwe have|x_{n}−c|<δ. Then forn≥Mwe have that

|f(xn)−f(c)|<ε, so{f(xn)}converges to f(c).

Let us prove the other direction of the third item by contrapositive. Suppose f is not continuous atc. Then there exists anε>0 such that for allδ >0, there exists anx∈Ssuch that|x−c|<δ and

|f(x)−f(c)| ≥ε. Let us define a sequence{xn}as follows. Letxn∈Sbe such that|xn−c|<1/n

and |f(xn)−f(c)| ≥ε. Now {xn} is a sequence of numbers inS such that limxn=c and such
that|f(xn)−f(c)| ≥ε for alln∈_{N}. Thus{f(x_{n})}does not converge to f(c). It may or may not

converge, but it definitely does not converge to f(c).

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 .

Example 3.2.3: f: (0,∞)_{→}Rdefined by f(x):=1/xis continuous.

Proof: Fixc_{∈}(0,∞). Let_{{}x_{n}}be a sequence in(0,∞)such that limxn=c. Then we know that
f(c) = 1
c =
1
limxn =nlim→∞
1
xn =nlim→∞f(xn).

Thus f is continuous atc. As f is continuous at allc∈(0,∞), f is continuous.

We have previously shown limx→cx2=c2directly. Therefore the functionx2is continuous. We can use the continuity of algebraic operations with respect to limits of sequences, which we proved in the previous chapter, to prove a much more general result.

Proposition 3.2.4. Let f: _{R}_{→}_{R}be apolynomial. That is

f(x) =adxd+ad−1xd−1+···+a1x+a0, for some constants a0,a1, . . . ,ad. Then f is continuous.

Proof. Fixc_{∈}R. Let{xn}be a sequence such that limxn=c. Then
f(c) =adcd+ad−1cd−1+···+a1c+a0

=ad(limxn)d+ad−1(limxn)d−1+···+a1(limxn) +a0 = lim n→∞ adxdn+ad−1xnd−1+···+a1xn+a0 = lim n→∞f(xn). Thus f is continuous atc. As f is continuous at allc∈R, f is continuous.

By similar reasoning, or by appealing to , we can prove the following. The details of the proof are left as an exercise.

Proposition 3.2.5. Let f: S_{→}_{R}and g: S_{→}_{R}be functions continuous at c_{∈}S.
(i) The function h: S_{→}_{R}defined by h(x):= f(x) +g(x)is continuous at c.
(ii) The function h: S→Rdefined by h(x):= f(x)−g(x)is continuous at c.

(iii) The function h: S→Rdefined by h(x):= f(x)g(x)is continuous at c.

(iv) If g(x)_{6}=0for all x_{∈}S, the function h: S_{→}Rdefined by h(x):= _{g}f(_{(}x_{x})_{)} is continuous at c.

Example 3.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|sin(x)| ≤ |x|, |cos(x)| ≤1, and|sin(x)| ≤1.

|sin(x)−sin(c)|=
2sin
x
−c
2
cos
x
+c
2
=2
sin
x
−c
2
cos
x
+c
2
≤2
sin
x
−c
2
≤2
x_{−}c
2
=|x−c|
|cos(x)−cos(c)|=
−
2sin
x
−c
2
sin
x
+c
2
=2
sin
x
−c
2
sin
x
+c
2
≤2
sin
x
−c
2
≤2
x_{−}c
2
=|x−c|

The claim that sin and cos are continuous follows by taking an arbitrary sequence{xn}converg- ing toc, or by applying the definition of continuity directly. Details are left to the reader.

### 3.2.2

### Composition 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 andg, the composition f_{◦}gis
defined by(f◦g)(x):= f g(x)

. A composition of continuous functions is again continuous.
Proposition 3.2.7. Let A,B_{⊂}Rand f: B→Rand g: A→B be functions. If g is continuous at

Proof. Let {xn}be a sequence in A such that limxn=c. Asg is continuous atc, then {g(xn)} converges tog(c). As f is continuous atg(c), then{f g(xn)}converges to f g(c). Thus f◦gis continuous atc.

Example 3.2.8: Claim: sin(1_{/}_{x)}2

is a continuous function on(0,∞).

Proof: First note that1_{/}_{x}_{is a continuous function on}_{(}_{0}_{,}∞_{)}_{and sin}_{(x)}_{is a continuous function}
on(0,∞)(actually on all of_{R}, but(0,∞)is the range for 1_{/}x). Hence the composition sin(1_{/}_{x)}_{is}
continuous. We also know thatx2_{is continuous on the interval}_{(}_{−}_{1}_{,}_{1}_{)}_{(the range of sin). Thus the}
composition sin(1_{/}_{x)}2

is also continuous on(0,∞).

### 3.2.3

### Discontinuous functions

When f is not continuous atc, we say f isdiscontinuousatc, or that it has adiscontinuityatc. The
following proposition is a useful test and follows immediately from third item of .
Proposition 3.2.9. Let f: S_{→}_{R}be a function and c_{∈}S. Suppose there exists a sequence_{{}x_{n}},
xn∈S, andlimxn=c such that{f(xn)}does not converge to f(c). Then f is discontinuous at c.

Again,{f(xn)}may or may not converge, but if it does, it definitely does not converge to f(c).
Example 3.2.10: The function f: _{R}_{→}_{R}defined by

f(x):=

(

−1 ifx<0,

1 ifx≥0, is not continuous at 0.

Proof: Take the sequence{−1_{/}_{n}_{}}_{, which converges to 0. Then} _{f}_{(}_{−}1_{/}_{n) =}_{−}_{1 for every}_{n}_{, and}
so lim f(−1_{/}_{n) =}_{−}_{1, but} _{f}_{(}_{0}_{) =}_{1. Thus the function is not continuous at 0. See} _{.}

1 5 1 4 1 3 1 2 1 ···

Figure 3.3:Graph of the jump discontinuity. The values of f(_{−}1_{/}_{n}_{)}_{and} _{f}_{(}_{0}_{)}_{are marked.}

Notice that f(1_{/}_{n) =}_{1 for all}_{n}_{∈}_{N}_{. Hence, lim} _{f}_{(}1_{/}_{n) =} _{f}_{(}_{0}_{) =}_{1. So}_{{}_{f}_{(xn)}_{}}_{may converge}
to f(0)for some specific sequence_{{}x_{n}}going to 0, despite the function being discontinuous at 0.

Finally, consider f (−_{n}1)n

= (−1)n. This sequence diverges.

Example 3.2.11: For an extreme example, take the so-calledDirichlet function . f(x):=

(

1 ifxis rational, 0 ifxis irrational.

The function f is discontinuous at allc∈R.

Proof: Supposecis rational. Take a sequence{xn}of irrational numbers such that limxn=c (why can we?). Then f(xn) =0 and so lim f(xn) =0, but f(c) =1. Ifcis irrational, take a sequence of rational numbers{xn}that converges toc(why can we?). Then lim f(xn) =1, but f(c) =0.

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. The following example is called the Thomae function or thepopcorn function.

Example 3.2.12: Let f: (0,1)_{→}_{R}be defined by
f(x):=

(

1_{/}_{k} _{if}_{x}_{=}m_{/}_{k}_{, where}_{m}_{,}_{k}_{∈}_{N}_{and}_{m}_{and}_{k}_{have no common divisors,}
0 ifxis irrational.

See the graph of f in . We claim that f is continuous at all irrationalcand discontinuous at all rationalc.

Figure 3.4:Graph of the “popcorn function.”

Proof: Suppose c=m_{/}_{k} _{is rational. Take a sequence of irrational numbers} _{{}_{x}_{n}} _{such that}
limxn=c. Then lim f(xn) =lim 0=0, but f(c) =1/k_{6}=0. So f is discontinuous atc.

Now letcbe irrational, so f(c) =0. Take a sequence{xn}in(0,1)such that limxn=c. Given

ε>0, findK∈_{N}such that1/K<ε by the . Ifm/k∈(0,1)is in lowest terms

(no common divisors), thenm<k. So there are only finitely many rational numbers in(0,1)whose
denominator k in lowest terms is less thanK. Hence there is anM such that for n_{≥}M, all the
numbersxnthat are rational have a denominator larger than or equal toK. Thus forn≥M,

|f(xn)−0|= f(xn)≤1/K<ε.

Therefore, f is continuous at irrationalc. Let us end on an easier example.

Example 3.2.13: Defineg: _{R}_{→}_{R}byg(x):=0 ifx6=0 andg(0):=1. Thengis not continuous
at zero, but continuous everywhere else (why?). The pointx=0 is called aremovable discontinuity.
That is because if we would change the definition ofg, by insisting thatg(0)be 0, we would obtain

a continuous function. On the other hand let f be the function of example . Then f does not have a removable discontinuity at 0. No matter how we would define f(0)the function would still fail to be continuous. The difference is that limx→0g(x)exists while limx→0 f(x)does not.

Let us stay with this example but show another phenomenon. LetA=_{{}0_{}}, theng_{|A}is continuous
(why?), whilegis not continuous onA.

### 3.2.4

### Exercises

Exercise 3.2.1: Using the definition of continuity directly prove that f: R→Rdefined by f(x):=x2 is

continuous.

Exercise3.2.2: Using the definition of continuity directly prove that f:(0,∞)_{→}Rdefined by f(x):=1/xis

continuous.

Exercise3.2.3: Let f:R→Rbe defined by

f(x):=

(

x if x is rational,
x2 _{if x is irrational.}

Using the definition of continuity directly prove that f is continuous at1and discontinuous at2.

Exercise3.2.4: Let f:R→Rbe defined by

f(x):=

(

sin(1_{/}_{x}_{)} _{if x}_{6}_{=}_{0,}
0 if x=0.

Is f continuous? Prove your assertion.

Exercise3.2.5: Let f:R→Rbe defined by

f(x):=

(

xsin(1_{/}_{x}_{)} _{if x}_{6}_{=}_{0,}
0 if x=0.

Is f continuous? Prove your assertion.

Exercise3.2.6: Prove .

Exercise3.2.7: Prove the following statement. Let S_{⊂}Rand A⊂S. Let f:S→Rbe a continuous function.

Then the restriction f|Ais continuous.

Exercise3.2.8: Suppose S⊂R. Suppose for some c∈Randα >0, we have A= (c−α,c+α)⊂S. Let f:S→Rbe a function. Prove that if f|Ais continuous at c, then f is continuous at c.

Exercise3.2.9: Give an example of functions f:R→Rand g:R→Rsuch that the function h defined by

h(x):= f(x) +g(x)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?

Exercise 3.2.10: Let f: R→Rand g: R→R be continuous functions. Suppose that for all rational

Exercise3.2.11: Let f:R→Rbe continuous. Suppose f(c)>0. Show that there exists anα>0such that
for all x∈(c_{−}α,c+α)we have f(x)>0.

Exercise3.2.12: Let f:Z→Rbe a function. Show that f is continuous.

Exercise3.2.13: Let f:S→Rbe a function and c∈S, such that for every sequence{xn}in S withlimxn=c,

the sequence{f(xn)}converges. Show that f is continuous at c.

Exercise 3.2.14: Suppose f: [_{−}1,0]_{→} R and g: [0,1]→R are continuous and f(0) =g(0). Define

h:[−1,1]→Rby h(x):= f(x)if x≤0and h(x):=g(x)if x>0. Show that h is continuous.

Exercise3.2.15: Suppose g:R→Ris a continuous function such that g(0) =0, and suppose f:R→Ris

such that|f(x)_{−}f(y)_{| ≤}g(x_{−}y)for all x and y. Show that f is continuous.

Exercise3.2.16(Challenging): Suppose f(x+y) = f(x)+f(y)for some f:R→Rsuch that f is continuous

at 0. Show that f(x) =ax for some a∈R. Hint: Show that f(nx) =n f(x), then show f is continuous onR.

Then show that f(x)_{/}x= f(1)for all rational x.

Exercise3.2.17: Suppose S_{⊂}Rand let f:S→Rand g:S→Rbe continuous functions. Define p:S→R

by p(x):=max{f(x),g(x)}and q:S→Rby q(x):=min{f(x),g(x)}. Prove that p and q are continuous.
Exercise3.2.18: Suppose f: [_{−}1,1]_{→}Ris a function continuous at all x∈[−1,1]\ {0}. Show that for

everyε such that0<ε <1, there exists a function g:[−1,1]→Rcontinuous on all of[−1,1], such that

f(x) =g(x)for all x∈[−1,−ε]∪[ε,1], and|g(x)| ≤ |f(x)|for all x∈[−1,1].

Exercise3.2.19(Challenging): A function f:I_{→}Risconvexif whenever a≤x≤b for a,x,b in I, we have

f(x)_{≤} f(a)b_{b}−_{−}x_{a}+f(b)x_{b}−_{−}a_{a}. In other words, if the line drawn between a,f(a)

and b,f(b)

is above the graph of f .

a) Prove that if I= (α,β)an open interval and f:I→Ris convex, then f is continuous.