Skip to main content
Mathematics LibreTexts

3.3: Continuity

  • Page ID
    139443
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \(\newcommand{\longvect}{\overrightarrow}\)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Recall from the previous section that a limit \(\lim_{x \to a} f(x)\) can exist without being equal to \(f(a)\), or with \(f(a)\) not even being defined. Many functions encountered in applications, however, will meet those conditions, and they have a special name:

    Equation ([eqn:continuity]) in the above definition implies that \(f(a)\) is defined, i.e. \(x = a\) is in the domain of \(f\). Figure [fig:continuity] below shows some examples of continuity and discontinuity:

    In the above figure, \(f\) is not continuous at \(x = x_2\) because \(\lim_{x \to x_2} f(x) \ne f(x_2)\); \(f\) is not continuous at \(x = x_3\) because \(\lim_{x \to x_3} f(x)\) does not exist (the right and left limits do not agree—\(f\) is said to have a jump discontinuity at \(x = x_3\)); and \(f\) is not continuous at \(x = x_4\) because \(f(x_4)\) is not defined. However, \(f\) is continuous at \(x = x_1\).

    A function is continuous if its graph is one unbroken piece over its entire domain. Polynomials, rational functions, trigonometric functions, exponential functions, and logarithmic functions are all continuous on their domains. For example, \(\tan\,x\) is continuous over its domain, which is broken into disjoint intervals \((-\pi/2,\pi/2)\), \((\pi/2,3\pi/2)\), \((3\pi/2,5\pi/2)\), and so forth; the graph is unbroken on each of those intervals. However, \(\tan\,x\) is not continuous over all of \(\Reals\), since the function is not defined at all points in \(\Reals\).

    In the language of infinitesimals, a function \(f\) is continuous at \(x=a\) if \(f(a+\dx) - f(a)\) is an infinitesimal for any infinitesimal \(\dx\). This definition is rarely used.

    Physical examples of continuous functions are position, speed, velocity, acceleration, temperature, and pressure. Some discontinuous functions do arise in applications.

    Definition: Floor and Ceiling

    The floor function \(\lfloor x \rfloor\) is defined as

    \[\lfloor x \rfloor ~=~ \text{the largest integer less than or equal to $x$} ~. \nonumber \]

    In other words, \(\lfloor x \rfloor\) rounds a non-integer down to the previous integer, and integers stay the same. For example, \(\lfloor 0.1 \rfloor = 0\), \(\lfloor 0.9 \rfloor = 0\), \(\lfloor 0 \rfloor = 0\), and \(\lfloor -1.3 \rfloor = -2\). The graph of \(\lfloor x \rfloor\) is shown in Figure [fig:floorceil](a).

    Similarly, the ceiling function \(\lceil x \rceil\) is defined as

    \[\lceil x \rceil ~=~ \text{the smallest integer greater than or equal to $x$} ~. \nonumber \]

    In other words, \(\lceil x \rceil\) rounds a non-integer up to the next integer, and integers stay the same. For example, \(\lceil 0.1 \rceil = 1\), \(\lceil 0.9 \rceil = 1\), \(\lceil 1 \rceil = 1\), and \(\lceil -1.3 \rceil = -1\). The graph of \(\lceil x \rceil\) is shown in Figure [fig:floorceil](b).

    Clearly both \(\lfloor x \rfloor\) and \(\lceil x \rceil\) have jump discontinuities at the integers, but both are continuous at all non-integer values of \(x\). Both functions are also examples of step functions, due to the staircase appearance of their graphs. Step functions are useful in situations when you want to model a quantity that takes only a discrete set of values. For example, in a car with a 4-gear transmission, \(f(x)\) could be the gear the transmission has shifted to while the car travels at speed \(x\). Up to a certain speed the car remains in first gear (\(f = 1\)) and then shifts to second gear (\(f = 2\)) after attaining that speed, then it remains in second gear until reaching another speed, upon which the car then shifts to third gear (\(f = 3\)), and so on. In general, discrete changes in state are often modeled with step functions.

    Example \(\PageIndex{1}\): discontall

    Add text here.

    Solution

    For an extreme case of discontinuity, consider the function

    \[f(x) ~=~ \begin{cases} ~0 & \text{if $x$ is rational}\\ ~1 & \text{if $x$ is irrational} \end{cases} \nonumber \]

    This function is discontinuous at every value of \(x\) in \(\Reals\), since within any positive distance \(\delta\) of a real number \(x\)—no matter how small \(\delta\) is—there will be an infinite number of both rational and irrational numbers. This is a property of \(\Reals\). So the value of \(f\) will keep jumping between \(0\) and \(1\) no matter how close you get to \(x\). In other words, for any number \(a\) in \(\Reals\), \(f(a)\) exists but it will never equal \(\lim_{x \to a}\;f(x)\) because that limit will not exist.

    By the various rules for limits, it is straightforward to show that sums, differences, constant multiples, products and quotients of continuous functions are continuous. Likewise a continuous function of a continuous function (i.e. a composition of continuous functions) is also continuous. In addition, a continuous function of a finite limit of a function can be passed inside the limit:

    The above result is useful in evaluating the indeterminate forms \(0^0\), \(\infty^0\), and \(1^{\infty}\). The idea is to take the natural logarithm of the limit by passing the continuous function \(\ln\,x\) inside the limit and evaluate the resulting limit.

    Example \(\PageIndex{1}\): zerotozerolim

    Evaluate \(\displaystyle\lim_{x \to 0+}~x^x~\).

    Solution

    This limit is of the form \(0^0\), so let \(y = \displaystyle\lim_{x \to 0+}~x^x\) and then take the natural logarithm of \(y\):

    \[\begin{aligned} \ln\,y ~&=~ \ln\,\left(\lim_{x \to 0+}~x^x\right)\

    \[4pt] &=~ \lim_{x \to 0+}~\ln\,x^x \quad\text{(pass the natural logarithm function inside the limit)}\

    \[4pt] &=~ \lim_{x \to 0+}~x\;\ln\,x \quad\to\quad 0 \cdot (-\infty)\\ &=~ \lim_{x \to 0+}~\frac{\ln\,x}{1/x} \quad\to\quad\frac{-\infty}{\infty}\

    \[6pt] &=~ \lim_{x \to 0+}~\frac{1/x}{-1/x^2} \quad\text{by L'H\^{o}pital's Rule}\

    \[6pt] \ln\,y ~&=~ \lim_{x \to 0+}~(-x) ~=~ 0\end{aligned} \nonumber \]

    Thus, \(\displaystyle\lim_{x \to 0+}~x^x ~=~ y ~=~ e^0 ~=~ 1\).

    There is an important relationship between differentiability and continuity:

    Proof

    If a function \(f\) is differentiable at \(x = a\) then \(f'(a) = \displaystyle\lim_{x \to a}~\)\(\frac{f(x) - f(a)}{x - a}\) exists, so

    \[\lim_{x \to a}~(f(x) - f(a)) ~=~ \lim_{x \to a}~(f(x) - f(a)) \cdot \dfrac{x - a}{x - a} ~=~ \lim_{x \to a}~\dfrac{f(x) - f(a)}{x - a} ~\cdot~ \lim_{x \to a}~(x - a) ~=~ f'(a) \cdot 0 ~=~ 0 \nonumber \]

    which means that \(\displaystyle\lim_{x \to a}~f(x) ~=~ f(a)\,,\) i.e. \(f\) is continuous at \(x = a\,.\quad\checkmark\)

    Note that the converse is not true. For example, the absolute value function \(f(x) = \abs{x}\) is continuous everywhere—its graph is unbroken, as shown in the picture on the right—but recall from Example

    Example \(\PageIndex{1}\): absnondiff

    Add text here.

    Solution

    in Section 1.2 that it is not differentiable at \(x = 0\). Continuous curves can have sharp edges and cusps, but differentiable curves cannot.

    Two other important theorems4 about continuous functions are:

    Figure [fig:evt] shows why a closed interval is required for the Extreme Value Theorem, as \(f\) attains neither a maximum nor minimum on the open interval \((c,d)\). The Intermediate Value Theorem says that continuous functions cannot “skip over” intermediate values between two other function values. In Figure [fig:ivt] the function \(f\) skips the value \(k\) between \(f(c)=1\) and \(f(d)=2\) because \(f\) is not continuous over all of \(\ival{c}{d}\). On \(\ival{a}{b}\) the value \(k\) is attained by \(f\) at \(x = x_0\), i.e. \(f(x_0) = k\), since \(f\) is continuous on \(\ival{a}{b}\).

    Example \(\PageIndex{1}\): ivt

    Show that there is a solution to the equation \(\cos\,x = x\).

    Solution

    Let \(f(x) = \cos\,x ~-~ x\). Since \(f\) is continuous for all \(x\), in particular it is continuous on \(\ival{0}{1}\). So since \(f(0) = 1 > 0\) and \(f(1) = -0.459698 < 0\), then by the Intermediate Value Theorem there is a number \(c\) in the open interval \((0,1)\) such that \(f(c) = 0\), since \(0\) is between the values \(f(0)\) and \(f(1)\). Hence, \(\cos\,c ~-~ c ~=~ 0\), which means that \(\cos\,c ~=~ c\). That is, \(x = c\) is a solution of \(\cos\,x = x\).

    Note in the above example that the Intermediate Value Theorem does not tell you how to find the solution, just that the solution exists. To find the solution you can use the bisection method: divide the interval \(\ival{0}{1}\) in half and apply the Intermediate Value Theorem to each half-interval to determine which one contains the solution; repeat this procedure on that half-interval, resulting in a smaller interval containing the solution, then repeat the procedure over and over, until you eventually obtain an interval so small that the midpoint of that interval can be taken as the solution. Listing [bisectpython] below shows one way of implementing the bisection method for Example [exmp:ivt] to find the root of \(f(x) = \cos\,x - x\), using the Python programming language.

    import math
    
    def f(x):
        return math.cos(x) - x
    
    def bisect(a, b):
        midpt = (a+b)/2.0
        tol = 1e-15
        if b - a > tol:
            val = f(midpt)
        if val*f(a) < 0:
                bisect(a, midpt)
        elif val*f(b) < 0:
            bisect(midpt, b)
        else:
            print("Root = %.13f" % (midpt))
        else:
            print("Root = %.13f" % (midpt))
    
    bisect(0, 1)

    Line 8 sets the tolerance to \(10^{-15}\): the program terminates upon reaching an interval whose length is smaller than that. The output is shown below:

    Root = 0.7390851332152

    This is the number obtained by taking the cosine of a number (in radians) repeatedly. [sec3dot3]

    Exercises

    For Exercises 1-18, indicate whether the given function \(f(x)\) is continuous or discontinuous at the given value \(x=a\) by comparing \(f(a)\) with \(\lim_{x \to a}~ f(x)\).

    3

    \(f(x)=\abs{x}\); at \(x=0\)

    \(f(x)=\abs{x-1}\); at \(x=0\)

    \(f(x)=\lfloor x \rfloor\); at \(x=0\)

    3

    \(f(x)=\lfloor x \rfloor\); at \(x=0.3\)

    \(f(x)=\lceil x \rceil\); at \(x=0\)

    \(f(x)=\lceil x \rceil\); at \(x=0.5\)

    3

    \(f(x)=x \;-\; \lfloor x \rfloor\); at \(x=0\)

    \(f(x)=x \;-\; \lfloor x \rfloor\); at \(x=1.1\)

    \(f(x)=x \;-\; \abs{x}\); at \(x=0\)

    3

    \(f(x) ~=~ \begin{cases} 0 & \text{if\)x 0\(,}\\1 & \text{if\)x>0\(;}\end{cases}\)
    at \(x=0\)

    \(f(x) ~=~ \begin{cases} 0 & \text{if\)x 0\(,}\\1 & \text{if\)x>0\(;}\end{cases}\)
    at \(x=1\)

    \(f(x) ~=~ \begin{cases} x^2 & \text{if\)x 0\(,}\\1 & \text{if\)x>0\(;}\end{cases}\)
    at \(x=0\)

    3

    \(f(x) ~=~ \begin{cases} x+1 & \text{if\)x 0\(,}\\1 & \text{if\)x>0\(;}\end{cases}\)
    at \(x=1\)

    \(f(x) ~=~ \begin{cases} \sin\,(x^2 ) & \text{if\)x 0\(,}\\0 & \text{if\)x=0\(;}\end{cases}\)
    at \(x=0\)

    \(f(x) ~=~ \begin{cases} \sin\,(1/x) & \text{if\)x 0\(,}\\0 & \text{if\)x=0\(;}\end{cases}\)
    at \(x=0\)

    3

    \(f(x) ~=~ \begin{cases} 0 & \text{if\)x\(is rational,}\\1 & \text{if\)x\(is irrational;}\end{cases}\)
    at \(x=\sqrt{3}\)

    \(f(x) ~=~ \begin{cases} 0 & \text{if\)x\(is rational,}\\x & \text{if\)x\(is irrational;}\end{cases}\)
    at \(x=0\)

    \(f(x) ~=~ \begin{cases} 0 & \text{if\)x\(is rational,}\\x & \text{if\)x\(is irrational;}\end{cases}\)
    at \(x=1\)

    3

    Evaluate \(\displaystyle\lim_{x \to 0+}~x^{x^2}~\).

    Evaluate \(\displaystyle\lim_{x \to \infty}~x^{1/x}~\).

    Evaluate \(\displaystyle\lim_{x \to 0}~(1 - x)^{1/x}~\).

    If \(f(x) = \dfrac{x^2 + x - 2}{x-1}\) for \(x\ne 1\), how should \(f(1)\) be defined so that \(f(x)\) is continuous at \(x=1\;\)?

    If \(f(x) = 1/x\) for \(x\ne 0\), is there a way to define \(f(0)\) so that \(f(x)\) is continuous for all \(x\;\)? [[1.]]

    Can a function that is not continuous over a closed interval attain a maximum value and a minimum value in that interval? If so, then give an example; if not then explain why.

    Show that there is a number \(x\) such that \(x^5 - x ~=~ 3\).

    Prove that \(f(x) = x^8 + 3x^4 - 1\) has at least two distinct real roots.

    Suppose that a function \(f\) is continuous on the interval \(\ival{0}{3}\), \(f\) has no roots in \(\ival{0}{3}\), and \(f(1) = 1\). Prove that \(f(x) > 0\) for all \(x\) in \(\ival{0}{3}\).

    Show that an object whose average speed is \(v_{\text{avg}}\) over the time interval \(a\le t \le b\) will move with speed \(v_{\text{avg}}\) at some time \(t\) in \(\ival{a}{b}\).

    Let \(f(x) = 1/(x-1)\). Then \(f(0) = -1 <0\) and \(f(2) = 1 > 0\). Can you conclude by the Intermediate Value Theorem that \(f(x)\) must be \(0\) for some \(x\) in \(\ival{0}{2}\;\)? Explain.

    Show that if \(f'\) and \(f''\) exist and are continuous at \(x\) then

     

    \[f''(x) ~=~ \lim_{h \to 0}~\frac{f(x) ~-~ 2 f(x-h) ~+~ f(x-2h)}{h^2} ~. \nonumber \]

    Show that if \(f'\), \(f''\) and \(f'''\) exist and are continuous at \(x\) then

     

    \[f'''(x) ~=~ \lim_{h \to 0}~\frac{f(x) ~-~ 3 f(x-h) ~+~ 3 f(x-2h) ~-~ f(x-3h)}{h^3} ~. \nonumber \]


    This page titled 3.3: Continuity is shared under a GNU General Public License 3.0 license and was authored, remixed, and/or curated by Michael Corral via source content that was edited to the style and standards of the LibreTexts platform.