---
title: Continuity
module: Limits and Continuity
moduleNumber: 1
lessonNumber: 4
order: 104
summary: >
  A function is continuous at a point when its limit there equals its value, so
  the graph has no break. Continuity fails in three geometric ways; it is closed
  under arithmetic and composition, so the elementary families and their
  combinations are continuous; and on a closed interval it forces the
  Intermediate Value Theorem, which locates roots.
topics: [Limits and Continuity]
sources:
  - book: Stewart
    ref: "Ch. 1 — Functions and Limits; §1.8 Continuity"
draft: false
---

The [Direct Substitution Property](/calculus/limits-and-continuity/limit-laws-and-the-precise-definition)
computes a limit of a polynomial or rational function by plugging in. The functions for
which substitution works are the **continuous** ones: those whose graph has no holes,
jumps, or breaks, so the curve can be drawn without lifting the pen.

## Continuity at a point

> **Definition (Continuity at a point).** A function $f$ is **continuous at** a
> number $a$ if
> $$
> \lim_{x \to a} f(x) = f(a).
> $$

The equation encodes three separate requirements; continuity fails if any one of
them fails:

- **$f(a)$ is defined** — that is, $a$ lies in the domain of $f$.
- **$\displaystyle \lim_{x \to a} f(x)$ exists** — the two-sided limit is a finite
  number.
- **The two agree** — the limit equals the value.

If $f$ is defined near $a$ but is not continuous there, $f$ is **discontinuous** at
$a$. Continuity captures the idea that a small change in $x$ produces only a small
change in $f(x)$: the point $(x, f(x))$ slides toward $(a, f(a))$ with no jump.

## The three ways continuity fails

Discontinuities come in three geometric types, distinguished by which requirement
above breaks.

$$
% caption: The three discontinuity types at $x = a$: a removable hole, a jump where
% one-sided limits differ, and an infinite blow-up at a vertical asymptote.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
% --- removable ---
\begin{scope}
  \draw[black, ->] (-0.3,0) -- (2.6,0) node[right] {$x$};
  \draw[black, ->] (0,-0.3) -- (0,2.6);
  \draw[acc, very thick] plot[domain=0.1:2.2, samples=40] (\x, {0.5 + 0.7*\x});
  \draw[acc, fill=white, thick] (1.2,{0.5+0.7*1.2}) circle (2.2pt);
  \fill[acc] (1.2,0.55) circle (1.8pt);
  \node[anchor=north, font=\scriptsize] at (1.2,-0.05) {$a$};
  \node[anchor=north, font=\scriptsize] at (1.1,-0.65) {removable};
\end{scope}
% --- jump ---
\begin{scope}[xshift=4.4cm]
  \draw[black, ->] (-0.3,0) -- (2.6,0) node[right] {$x$};
  \draw[black, ->] (0,-0.3) -- (0,2.6);
  \draw[acc, very thick] (0.1,0.5) -- (1.15,1.0);
  \draw[acc, very thick] (1.2,1.9) -- (2.2,2.3);
  \draw[acc, fill=acc, thick] (1.2,1.0) circle (2.0pt);
  \draw[acc, fill=white, thick] (1.2,1.9) circle (2.2pt);
  \node[anchor=north, font=\scriptsize] at (1.2,-0.05) {$a$};
  \node[anchor=north, font=\scriptsize] at (1.1,-0.65) {jump};
\end{scope}
% --- infinite ---
\begin{scope}[xshift=8.8cm]
  \draw[black, ->] (-0.3,0) -- (2.6,0) node[right] {$x$};
  \draw[black, ->] (0,-0.3) -- (0,2.6);
  \draw[black, dashed] (1.2,-0.2) -- (1.2,2.5);
  \draw[acc, very thick] plot[domain=0.15:0.95, samples=40] (\x, {min(2.4, 0.28/((\x-1.2)*(\x-1.2)))});
  \draw[acc, very thick] plot[domain=1.45:2.3, samples=40] (\x, {min(2.4, 0.28/((\x-1.2)*(\x-1.2)))});
  \node[anchor=north, font=\scriptsize] at (1.2,-0.05) {$a$};
  \node[anchor=north, font=\scriptsize] at (1.1,-0.65) {unbounded};
\end{scope}
\end{tikzpicture}
$$

The types and their signatures:

- **Removable.** The limit exists, but $f(a)$ is undefined or unequal to it, leaving
  a single-point hole. Redefining $f$ at that one point repairs continuity. The
  function $f(x) = (x^2 - x - 2)/(x - 2)$ has a removable discontinuity at $2$, where
  it is undefined though $\lim_{x \to 2} f(x) = 3$.
- **Jump.** The one-sided limits both exist but differ, so the two-sided limit does
  not. The [Heaviside function](/calculus/limits-and-continuity/the-limit-of-a-function)
  and every step function jump at their transitions.
- **Infinite.** A one-sided limit is $+\infty$ or $-\infty$, so the graph runs off to
  a vertical asymptote. The function $1/x^2$ has one at $0$.

| Type | Limit exists? | Repairable by one value? | Example |
| --- | --- | --- | --- |
| Removable | yes | yes | $(x^2 - x - 2)/(x - 2)$ at $2$ |
| Jump | no (sides differ) | no | Heaviside $H$ at $0$ |
| Infinite | no ($\pm\infty$) | no | $1/x^2$ at $0$ |

Deciding the type reduces to checking the three requirements in turn: whether $f(a)$ is
defined, whether the limit exists, and whether they match.

> **Worked example (classifying discontinuities).** Locate and classify the
> discontinuity of each function.
>
> **(a)** $f(x) = \dfrac{x^2 - x - 2}{x - 2}$. Here $f(2)$ is undefined, so $f$ is
> discontinuous at $2$. Since $\dfrac{x^2 - x - 2}{x - 2} = \dfrac{(x - 2)(x + 1)}{x - 2} = x + 1$
> for $x \ne 2$, the limit $\lim_{x \to 2} f(x) = 3$ exists. **Removable.**
>
> **(b)** $f(x) = \dfrac{1}{x^2}$ for $x \ne 0$, with $f(0) = 1$. Now $f(0)$ is defined,
> but $\lim_{x \to 0} 1/x^2 = \infty$ does not exist. **Infinite.**
>
> **(c)** $f(x) = \dfrac{x^2 - x - 2}{x - 2}$ for $x \ne 2$, with $f(2) = 1$. The value
> $f(2) = 1$ is defined and $\lim_{x \to 2} f(x) = 3$ exists, but $3 \ne 1$. **Removable**
> — redefining $f(2) = 3$ repairs it.
>
> **(d)** $f(x) = \lfloor x \rfloor$, the greatest-integer function. At each integer $n$
> the left limit is $n - 1$ and the right limit is $n$, so the one-sided limits differ.
> **Jump** discontinuities at every integer.

$$
% caption: The greatest-integer function $y = \lfloor x \rfloor$ jumps by one at every
% integer; each step is closed on the left and open on the right.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-0.3,0) -- (4.5,0) node[right]{$x$};
\draw[black, ->] (0,-0.4) -- (0,3.5) node[above]{$y$};
\draw[acc, very thick] (0,0) -- (1,0);
\fill[acc] (0,0) circle (1.8pt);
\draw[acc, fill=white, thick] (1,0) circle (2.0pt);
\draw[acc, very thick] (1,1) -- (2,1);
\fill[acc] (1,1) circle (1.8pt);
\draw[acc, fill=white, thick] (2,1) circle (2.0pt);
\draw[acc, very thick] (2,2) -- (3,2);
\fill[acc] (2,2) circle (1.8pt);
\draw[acc, fill=white, thick] (3,2) circle (2.0pt);
\draw[acc, very thick] (3,3) -- (4,3);
\fill[acc] (3,3) circle (1.8pt);
\draw[acc, fill=white, thick] (4,3) circle (2.0pt);
\node[anchor=north, font=\scriptsize] at (1,-0.06){$1$};
\node[anchor=north, font=\scriptsize] at (2,-0.06){$2$};
\node[anchor=north, font=\scriptsize] at (3,-0.06){$3$};
\node[anchor=east, font=\scriptsize] at (-0.05,1){$1$};
\node[anchor=east, font=\scriptsize] at (-0.05,2){$2$};
\node[anchor=east, font=\scriptsize] at (-0.05,3){$3$};
\end{tikzpicture}
$$

### One-sided and interval continuity

At an endpoint of a domain, only one side is available, so continuity is defined by a
one-sided limit.

> **Definition (One-sided continuity).** $f$ is **continuous from the right** at $a$
> if $\lim_{x \to a^+} f(x) = f(a)$, and **continuous from the left** at $a$ if
> $\lim_{x \to a^-} f(x) = f(a)$.

> **Definition (Continuity on an interval).** $f$ is **continuous on an interval** if
> it is continuous at every number in the interval, where continuity at an endpoint
> means continuity from the appropriate side.

For example, $f(x) = 1 - \sqrt{1 - x^2}$ is continuous on $[-1, 1]$: at interior
points the limit equals the value, and at the endpoints it is continuous from the
right at $-1$ and from the left at $1$, which is all the domain permits.

## Building continuous functions

Verifying continuity from the definition every time would be tedious. A few theorems
let complicated continuous functions be recognized at a glance.

> **Theorem (Combinations).** If $f$ and $g$ are continuous at $a$ and $c$ is a
> constant, then $f + g$, $f - g$, $cf$, $fg$, and $f/g$ (where $g(a) \ne 0$) are all
> continuous at $a$.

This follows from the corresponding Limit Laws. Combined with the base cases
$\lim_{x \to a} c = c$ and $\lim_{x \to a} x = a$, it certifies whole families at
once.

> **Theorem (Continuous families).** The following are continuous at every number in
> their domains: **polynomials**, **rational functions**, **root functions**,
> **trigonometric functions**, **exponential functions**, and **logarithmic
> functions**.[^stewart-cont]

A continuous outer function commutes with a limit: it can be moved inside.

> **Theorem (Limit inside a continuous function).** If $\lim_{x \to a} g(x) = b$ and $f$
> is continuous at $b$, then
> $$
> \lim_{x \to a} f(g(x)) = f(b) = f\Bigl(\lim_{x \to a} g(x)\Bigr).
> $$

> **Worked example (moving a limit inside a root).** Evaluate
> $\displaystyle \lim_{x \to 2} \sqrt{\frac{x^2 - x - 2}{x - 2}}$.
>
> The inner quotient has a removable hole at $2$ but a genuine limit: for $x \ne 2$,
> $\dfrac{x^2 - x - 2}{x - 2} = x + 1$, so $\lim_{x \to 2}\dfrac{x^2 - x - 2}{x - 2} = 3$.
> The square root is continuous at $3$, so it moves inside the limit:
> $$
> \lim_{x \to 2} \sqrt{\frac{x^2 - x - 2}{x - 2}} = \sqrt{\,\lim_{x \to 2}\frac{x^2 - x - 2}{x - 2}\,} = \sqrt{3}.
> $$

Composing two continuous functions keeps continuity, which makes nested expressions
tractable.

> **Theorem (Continuity of composites).** If $g$ is continuous at $a$ and $f$ is
> continuous at $g(a)$, then the composite $f \circ g$ given by $(f \circ g)(x) =
> f(g(x))$ is continuous at $a$.

$$
% caption: A continuous $g$ carries inputs near $a$ to outputs near $g(a)$, and a
% continuous $f$ carries those to outputs near $f(g(a))$; the composite has no break.
\begin{tikzpicture}[scale=1.0, font=\footnotesize,
  box/.style={draw, thick, minimum width=15mm, minimum height=12mm, align=center}]
\definecolor{acc}{HTML}{4A6FA5}
\node (x) at (0,0) {$x \to a$};
\node[box] (g) at (2.6,0) {$g$};
\node[box, draw=acc, text=acc] (f) at (6.6,0) {$f$};
\node (out) at (9.4,0) {$f(g(x)) \to f(g(a))$};
\draw[->, thick] (x) -- (g);
\draw[->, thick] (g) -- node[above, font=\scriptsize] {$g(x) \to g(a)$} (f);
\draw[->, acc, thick] (f) -- (out);
\end{tikzpicture}
$$

With these theorems, a function such as $F(x) = \sin(x^2 + 1)$ is continuous
everywhere because it is a composite of the continuous $\sin$ with the continuous
polynomial $x^2 + 1$; no limit calculation is required. Likewise
$G(x) = (x^2 + 7)/(x - 1)$ is continuous everywhere except $x = 1$, the lone zero of
its denominator.

The domain of continuity is read off directly from the pieces and where the denominator
vanishes.

> **Worked example (where a function is continuous).** Determine where
> $f(x) = \dfrac{\sqrt{x + 3}}{x^2 - 4}$ is continuous.
>
> The numerator $\sqrt{x + 3}$ is a root function, continuous for $x + 3 \ge 0$, i.e.
> $x \ge -3$. The denominator $x^2 - 4 = (x - 2)(x + 2)$ is a polynomial, continuous
> everywhere and zero at $x = \pm 2$. By the combination theorem the quotient is
> continuous wherever the numerator is defined and the denominator is nonzero:
> $$
> [-3, -2) \cup (-2, 2) \cup (2, \infty).
> $$

A piecewise function joined at a boundary can be forced continuous by tuning a
parameter so the two pieces meet.

> **Worked example (choosing a constant for continuity).** Find $c$ making
> $$
> f(x) = \begin{cases} c x^2 + 2x & \text{if } x < 2, \\ x^3 - c x & \text{if } x \ge 2, \end{cases}
> $$
> continuous on $\mathbb{R}$.
>
> Each piece is a polynomial, continuous on its own side, so only $x = 2$ can break
> continuity. There $f(2) = 8 - 2c$, and the left-hand limit is
> $\lim_{x \to 2^-}(c x^2 + 2x) = 4c + 4$. Continuity requires them equal:
> $$
> 4c + 4 = 8 - 2c \ \Longrightarrow\ 6c = 4 \ \Longrightarrow\ c = \tfrac{2}{3}.
> $$
> With $c = \tfrac{2}{3}$ the pieces agree at $x = 2$ and $f$ is continuous everywhere.

## The Intermediate Value Theorem

Continuity on a closed interval has a consequence that is obvious to the eye and
indispensable in practice: a continuous curve cannot get from one height to another
without passing through every height in between.

> **Theorem (Intermediate Value Theorem).** Suppose $f$ is continuous on the closed
> interval $[a, b]$ and let $N$ be any number strictly between $f(a)$ and $f(b)$,
> where $f(a) \ne f(b)$. Then there exists a number $c$ in $(a, b)$ with $f(c) = N$.

$$
% caption: A continuous graph from $f(a)$ to $f(b)$ must cross every intermediate
% height $N$, giving a point $c$ with $f(c) = N$.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-0.3,0) -- (5.0,0) node[right] {$x$};
\draw[black, ->] (0,-0.3) -- (0,3.4) node[above] {$y$};
% curve built to pass through (c, N) = (2, 1.4) and stay increasing
\draw[acc, very thick] plot[domain=0.5:4.3, samples=80]
  (\x, {1.4 + 0.62*(\x-2) + 0.18*sin((\x-2)*60)});
% endpoints
\fill[acc] (0.5,0.29) circle (1.8pt);
\fill[acc] (4.3,2.95) circle (1.8pt);
\node[anchor=north, font=\scriptsize] at (0.5,-0.05) {$a$};
\node[anchor=north, font=\scriptsize] at (4.3,-0.05) {$b$};
\draw[black, dashed] (0,0.29) -- (0.5,0.29);
\draw[black, dashed] (0,2.95) -- (4.3,2.95);
\node[anchor=east, font=\scriptsize] at (0,0.29) {$f(a)$};
\node[anchor=east, font=\scriptsize] at (0,2.95) {$f(b)$};
% level N
\draw[black, dashed] (0,1.4) -- (4.5,1.4);
\node[anchor=east, font=\scriptsize] at (0,1.4) {$N$};
% crossing c, on the curve at height N
\fill[black] (2.0,1.4) circle (1.8pt);
\draw[black, dashed] (2.0,0) -- (2.0,1.4);
\node[anchor=north, font=\scriptsize] at (2.0,-0.05) {$c$};
\end{tikzpicture}
$$

Continuity is essential; a function with a jump can step over $N$ without ever
attaining it. The theorem is an **existence** result: it guarantees a solution
without producing one.

### Locating roots

Setting $N = 0$ turns the theorem into a root-existence test: a continuous function
that changes sign across an interval must have a root inside. Repeating the test on the
half that still straddles zero — bisection — traps the root in ever-shorter intervals.

> **Worked example (locating a root).** Show that $4x^3 - 6x^2 + 3x - 2 = 0$ has a root
> between $1$ and $2$, and narrow its location.
>
> Let $f(x) = 4x^3 - 6x^2 + 3x - 2$, a polynomial, hence continuous on $[1, 2]$. The
> endpoints straddle zero:
> $$
> f(1) = 4 - 6 + 3 - 2 = -1 < 0, \qquad f(2) = 32 - 24 + 6 - 2 = 12 > 0.
> $$
> Since $N = 0$ lies between $f(1)$ and $f(2)$, the theorem supplies a $c \in (1, 2)$ with
> $f(c) = 0$. Applying it again on the subinterval where the sign flips narrows the
> enclosure:
>
> | $x$ | $1$ | $2$ | $1.2$ | $1.3$ | $1.22$ | $1.23$ |
> | --- | --- | --- | --- | --- | --- | --- |
> | $f(x)$ | $-1$ | $12$ | $-0.128$ | $0.548$ | $-0.007$ | $0.056$ |
> | sign | $-$ | $+$ | $-$ | $+$ | $-$ | $+$ |
>
> Each sign change brackets a root: from $(1, 2)$ to $(1.2, 1.3)$ to $(1.22, 1.23)$. The
> interval shrinks by roughly a factor of ten at each stage, pinning the root to any
> desired precision.

The same sign-change test works on equations that no algebra solves, once they are
rearranged so one side is zero.

> **Worked example (a transcendental equation has a solution).** Show that
> $\cos x = x$ has a solution.
>
> Move everything to one side: let $g(x) = \cos x - x$, continuous everywhere as a
> difference of continuous functions. Test two points:
> $$
> g(0) = \cos 0 - 0 = 1 > 0, \qquad g\!\left(\tfrac{\pi}{2}\right) = 0 - \tfrac{\pi}{2} < 0.
> $$
> Since $g$ changes sign on $[0, \pi/2]$, the Intermediate Value Theorem (with $N = 0$)
> gives a $c \in (0, \pi/2)$ where $g(c) = 0$, i.e. $\cos c = c$.

The sign-change-and-bisect idea is the seed of the numerical root-finding refined in
[Newton's Method](/calculus/applications-of-derivatives/newtons-method-and-antiderivatives).

[^stewart-cont]: Stewart, §1.8 — continuity at a point and its three requirements, the discontinuity types, closure of continuity under arithmetic and composition, and the Intermediate Value Theorem with its application to root location.
