---
title: Continuous Functions
module: Limits and Continuity
moduleNumber: 4
lessonNumber: 2
order: 402
summary: >
  A function is continuous at c when its limit there equals its own value,
  lim f(x) = f(c). The epsilon–delta and sequential forms agree; sums, products,
  quotients, and compositions of continuous functions are continuous; and the
  failures split into jump, Dirichlet, popcorn, and removable types. The
  topological reading is that preimages of open sets are open.
topics: [Limits and Continuity]
sources:
  - book: Lebl
    ref: "Ch. 3 — Continuous Functions; §3.2 Continuous functions"
  - book: Rosenlicht
    ref: "Ch. 4 — Continuous functions"
draft: false
---

The high-school slogan is that a function is continuous if its graph can be drawn
without lifting the pen. That picture is useful and, near a jump, misleading. The
rigorous definition took Bolzano, Cauchy, and Weierstrass to settle, and it is
the [limit definition](/real-analysis/continuity/limits-of-functions) with $L$
forced to equal $f(c)$: a function is continuous at $c$ when nudging the input
near $c$ keeps the output near $f(c)$, with no exceptional value at $c$ to
discard.

> **Definition (Continuity at a point).** Let $S \subseteq \mathbb{R}$ and
> $c \in S$. A function $f : S \to \mathbb{R}$ is **continuous at** $c$ if for
> every $\epsilon > 0$ there is a $\delta > 0$ such that
> $$
> x \in S \text{ and } |x - c| < \delta \implies |f(x) - f(c)| < \epsilon.
> $$
> If $f$ is continuous at every $c \in S$, it is a **continuous function**.[^lebl-def]

Two differences from the limit definition: the target is prescribed ($f(c)$, not
some free $L$), and the window now includes $c$ (no "$\setminus \{c\}$"), which
is harmless because $|f(c) - f(c)| = 0 < \epsilon$ always holds. As with the
limit, $\delta$ depends on both $\epsilon$ and the point $c$; one need not find
a single $\delta$ good for all $c$.
[Uniform continuity](/real-analysis/continuity/uniform-continuity) is the
stronger demand of one $\delta$ good for every $c$ at once.

## Three equivalent characterizations

> **Proposition (Characterizations of continuity).** For $f : S \to \mathbb{R}$
> and $c \in S$:
> - if $c$ is **not** a cluster point of $S$, then $f$ is automatically
>   continuous at $c$;
> - if $c$ is a cluster point of $S$, then $f$ is continuous at $c$ if and only
>   if $\lim_{x\to c} f(x)$ exists and equals $f(c)$;
> - $f$ is continuous at $c$ if and only if for every sequence $\{x_n\}$ in $S$
>   with $x_n \to c$, the sequence $\{f(x_n)\}$ converges to $f(c)$.[^lebl-char]

An isolated point carries no constraint: a $\delta$ small enough to trap only
$x = c$ makes the condition vacuous, so every $f$ is continuous there; in
particular, every $f : \mathbb{Z} \to \mathbb{R}$ is continuous. The
**sequential characterization** imports the
[sequence limit laws](/real-analysis/sequences-series/limit-laws-monotone)
wholesale and is the form used most often below.

> **Worked example ($1/x$, sequential form).** On $(0,\infty)$, fix $c$ and take
> any $x_n \to c$ with $x_n > 0$. Then
> $$
> \lim_{n\to\infty} \frac{1}{x_n} = \frac{1}{\lim_{n\to\infty} x_n} = \frac{1}{c},
> $$
> using the quotient law, so $f(x) = 1/x$ is continuous at every $c > 0$.

The same fact has a direct $\epsilon$–$\delta$ proof that exposes the explicit
$\delta(\epsilon, c)$, showing how the window must shrink near the singularity.

> **Worked example ($1/x$, explicit $\delta$).** Fix $c > 0$ and $\epsilon > 0$.
> Restrict attention to $x$ with $|x - c| < c/2$, so $x > c/2$ and hence
> $\tfrac{1}{x} < \tfrac{2}{c}$. Then
> $$
> \left|\frac{1}{x} - \frac{1}{c}\right| = \frac{|x - c|}{xc} < \frac{2}{c^2}\,|x - c|.
> $$
> Taking $\delta = \min\!\left\{\tfrac{c}{2},\ \tfrac{c^2}{2}\epsilon\right\}$
> forces this below $\epsilon$. The bound $\delta \le c^2\epsilon/2$ collapses to
> $0$ as $c \to 0^+$: the same tolerance needs an ever-smaller window near the
> pole, which is why $1/x$ is continuous on $(0,\infty)$ yet fails to be
> [uniformly continuous](/real-analysis/continuity/uniform-continuity) there.

## Building continuous functions

Continuity is stable under every algebraic operation, so large classes of
functions are continuous for one-line reasons.

> **Proposition (Algebra of continuity).** If $f, g : S \to \mathbb{R}$ are
> continuous at $c$, then so are $f + g$, $f - g$, and $fg$; and if $g(c) \neq 0$
> and $g$ is nonzero on $S$, so is $f/g$.[^lebl-alg]

> **Proof.** Each follows from the sequential characterization and the
> corresponding sequence law.

Two consequences cover most functions met in practice:

- **Polynomials are continuous on $\mathbb{R}$.** Since $x \mapsto x$ and
  constants are continuous, repeated sums and products give continuity of
  $a_d x^d + \cdots + a_1 x + a_0$.
- **Rational functions are continuous wherever the denominator is nonzero**, by
  the quotient rule.

> **Worked example ($\sin$ and $\cos$).** The sum-to-product identities give
> $|\sin x - \sin c| \le |x - c|$ and $|\cos x - \cos c| \le |x - c|$, so both
> are continuous (take $\delta = \epsilon$). These bounds also make sine and
> cosine [Lipschitz](/real-analysis/continuity/uniform-continuity) with constant
> $1$.

### Composition

> **Proposition (Composition).** If $g : A \to B$ is continuous at $c$ and
> $f : B \to \mathbb{R}$ is continuous at $g(c)$, then $f \circ g$ is continuous
> at $c$.[^lebl-comp]

> **Proof.** For $x_n \to c$, continuity of $g$ gives $g(x_n) \to g(c)$, and then
> continuity of $f$ at $g(c)$ gives $f(g(x_n)) \to f(g(c))$.

$$
% caption: Continuity composes: a sequence to c is carried by g to a sequence to
% g(c), which f carries to a sequence to f(g(c)), so the composite is continuous.
\begin{tikzpicture}[scale=1.0, font=\small,
  dom/.style={draw, black, ellipse, minimum width=22mm, minimum height=30mm}]
\definecolor{acc}{HTML}{4A6FA5}
\node[dom] (A) at (0,0) {};      \node[anchor=south] at (0,1.6) {$A$};
\node[dom] (B) at (4,0) {};      \node[anchor=south] at (4,1.6) {$B$};
\node[dom] (C) at (8,0) {};      \node[anchor=south] at (8,1.6) {$\mathbb{R}$};
\fill[acc] (0,0.4) circle (1.6pt); \node[acc, anchor=east] at (-0.15,0.4) {$c$};
\fill[acc] (4,0.4) circle (1.6pt); \node[acc, anchor=west] at (4.2,0.4) {$g(c)$};
\fill[acc] (8,0.4) circle (1.6pt); \node[acc, anchor=west] at (8.2,0.4) {$f(g(c))$};
\draw[acc, ->, thick] (0.9,0.4) .. controls (2,1.0) .. (3.1,0.4);
\node[acc, anchor=south] at (2,0.85) {$g$};
\draw[acc, ->, thick] (4.9,0.4) .. controls (6,1.0) .. (7.1,0.4);
\node[acc, anchor=south] at (6,0.85) {$f$};
\draw[black, ->, thick] (0.6,-0.9) .. controls (4,-2.0) .. (7.4,-0.9);
\node[black, anchor=north] at (4,-1.75) {composite is cont. at $c$};
\end{tikzpicture}
$$

## Failure modes of continuity

When $f$ is not continuous at $c$, we call $c$ a **discontinuity**. The sequential
characterization gives the most direct test: if some $x_n \to c$ has $\{f(x_n)\}$
not converging to $f(c)$, then $f$ is discontinuous at $c$.[^lebl-disc]

> **Worked example (jump discontinuity).** For $f(x) = -1$ ($x < 0$) and
> $f(x) = 1$ ($x \ge 0$), the sequence $-1/n \to 0$ has $f(-1/n) = -1 \to -1
> \neq 1 = f(0)$. The sequence $1/n \to 0$ does give $f(1/n) = 1 \to f(0)$, but
> one such sequence does not establish continuity, since the definition
> quantifies over all of them.

$$
% caption: A continuous graph stays inside every epsilon-band over a small strip;
% at a jump, no strip narrow enough keeps the graph inside a band thinner than
% the gap, so continuity fails.
\begin{tikzpicture}[scale=0.95, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\definecolor{wrn}{HTML}{B0672F}
% --- left: continuous ---
\begin{scope}
\draw[black, ->] (-0.3,0) -- (4.3,0) node[anchor=north] {$x$};
\draw[black, ->] (0,-0.3) -- (0,3.6) node[anchor=east] {$y$};
\fill[acc!12] (0,1.6) rectangle (4,2.4);
\draw[acc!55] (0,1.6) -- (4,1.6); \draw[acc!55] (0,2.4) -- (4,2.4);
\draw[acc, very thick] (0.3,0.7) .. controls (1.6,1.9) and (2.4,2.1) .. (4,3.1);
\fill[acc] (2.0,2.0) circle (1.6pt);
\node[anchor=north] at (2.0,-0.05) {$c$};
\node[anchor=south, font=\footnotesize] at (2.0,3.15) {graph stays in the band};
\end{scope}
% --- right: jump ---
\begin{scope}[xshift=6.2cm]
\draw[black, ->] (-0.3,0) -- (4.3,0) node[anchor=north] {$x$};
\draw[black, ->] (0,-0.3) -- (0,3.6) node[anchor=east] {$y$};
\fill[wrn!12] (0,1.9) rectangle (4,2.5);
\draw[wrn!55] (0,1.9) -- (4,1.9); \draw[wrn!55] (0,2.5) -- (4,2.5);
\draw[acc, very thick] (0.3,0.7) -- (1.95,1.15);
\draw[acc, very thick] (2.05,2.9) -- (3.9,3.3);
\fill[acc] (2.0,2.9) circle (1.7pt);
\fill[white] (2.0,1.15) circle (2pt); \draw[acc] (2.0,1.15) circle (2pt);
\node[anchor=north] at (2.0,-0.05) {$c$};
\node[wrn, anchor=south, font=\footnotesize] at (2.0,3.15) {jump: left values miss $f(c)$};
\end{scope}
\end{tikzpicture}
$$

> **Worked example (Dirichlet function).** Define $f(x) = 1$ for rational $x$ and
> $f(x) = 0$ for irrational $x$. Every $c$ is a cluster point of both the
> rationals and the irrationals, so a sequence of the "wrong" type approaching
> $c$ sends $f(x_n)$ to the wrong constant. Hence $f$ is discontinuous
> **everywhere**.

A single factor of $x$ localizes the misbehavior to the origin: multiplying the
Dirichlet function by $x$ leaves it continuous at exactly one point.

> **Worked example (continuous at exactly one point).** Define $g(x) = x$ for
> rational $x$ and $g(x) = 0$ for irrational $x$. At $c = 0$: for any $x$,
> $|g(x) - g(0)| = |g(x)| \le |x|$, so $\delta = \epsilon$ gives continuity. At
> any $c \neq 0$: rationals $x_n \to c$ send $g(x_n) = x_n \to c$, while
> irrationals $x_n \to c$ send $g(x_n) = 0 \to 0 \neq c$, so the two image
> sequences disagree and $g$ is discontinuous. Thus $g$ is continuous at $0$ and
> nowhere else.

> **Worked example (popcorn/Thomae function).** On $(0,1)$ set $f(x) = 1/k$ when
> $x = m/k$ in lowest terms and $f(x) = 0$ for irrational $x$. This function is
> continuous at every irrational and discontinuous at every rational. At an
> irrational $c$, given $\epsilon > 0$ pick $K$ with $1/K < \epsilon$; only
> finitely many rationals in $(0,1)$ have denominator below $K$, so past some
> index every $x_n$ near $c$ either is irrational or has $f(x_n) \le 1/K <
> \epsilon$, forcing $f(x_n) \to 0 = f(c)$. At a rational $c$, irrationals
> approaching $c$ send $f$ to $0 \neq f(c)$.

A function can therefore be continuous on a dense set and discontinuous on
another dense set at once.

$$
% caption: The popcorn function: spikes of height 1/k sit over each fraction m/k
% in lowest terms, shrinking as the denominator grows, with value zero at every
% irrational; it is continuous exactly at the irrationals.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-0.2,0) -- (6.5,0) node[anchor=north] {$x$};
\draw[black, ->] (0,-0.2) -- (0,2.9) node[anchor=east] {$y$};
\node[anchor=north east] at (0,-0.02) {$0$};
\node[anchor=north] at (6,-0.02) {$1$};
% denominator 2: x=1/2 -> 3, height 1/2 -> 1.3
\fill[acc] (3,1.3) circle (1.6pt); \draw[acc!45] (3,0) -- (3,1.3);
\node[acc, anchor=south, font=\footnotesize] at (3,1.32) {$\frac{1}{2}$};
% denominator 3: 1/3->2, 2/3->4, height 1/3 -> 0.87
\foreach \x in {2,4} {\fill[acc] (\x,0.87) circle (1.4pt); \draw[acc!40] (\x,0) -- (\x,0.87);}
% denominator 4: 1/4->1.5, 3/4->4.5, height 0.65
\foreach \x in {1.5,4.5} {\fill[acc] (\x,0.65) circle (1.2pt); \draw[acc!35] (\x,0) -- (\x,0.65);}
% denominator 5: height 0.52
\foreach \x in {1.2,2.4,3.6,4.8} {\fill[acc] (\x,0.52) circle (1.0pt);}
% denominator 6/7 low
\foreach \x in {1.0,5.0,0.86,5.14,2.57,3.43} {\fill[acc] (\x,0.4) circle (0.8pt);}
\node[black, anchor=west, font=\footnotesize] at (5.0,2.3) {height $=\frac{1}{k}$};
\end{tikzpicture}
$$

**Removable versus not.** Let $g(x) = 0$ for $x \neq 0$ and $g(0) = 1$. Here
$\lim_{x\to 0} g(x) = 0$ exists but misses $g(0)$; redefining $g(0) = 0$ repairs
continuity, so this is a **removable discontinuity**. The jump function above is
not removable: no value at $0$ can equal two different one-sided limits.

| Discontinuity | Left/right limits | Repairable by redefining $f(c)$? |
| --- | --- | --- |
| Removable | both exist and agree, $\neq f(c)$ | yes |
| Jump | both exist, disagree | no |
| Essential (e.g. $\sin(1/x)$) | at least one absent | no |
| Dirichlet | absent at every point | no |

## The topological reading

Continuity has a formulation with no $\epsilon$, no $\delta$, and no sequences,
phrased entirely in [open sets](/real-analysis/metric-spaces/open-closed-sets).

> **Theorem (Preimage characterization).** $f : \mathbb{R} \to \mathbb{R}$ is
> continuous if and only if for every open set $U \subseteq \mathbb{R}$, the
> preimage $f^{-1}(U)$ is open.

> **Proof.** If $f$ is continuous and $U$ is open, take $c \in f^{-1}(U)$; some
> $(f(c)-\epsilon, f(c)+\epsilon) \subseteq U$, and continuity gives $\delta$
> with $f((c-\delta, c+\delta)) \subseteq (f(c)-\epsilon, f(c)+\epsilon)
> \subseteq U$, so $(c-\delta, c+\delta) \subseteq f^{-1}(U)$ and the preimage is
> open. Conversely, open preimages of the bands around $f(c)$ deliver the
> required $\delta$.

$$
% caption: Under a continuous map the preimage of an open interval is open: around
% each source point sits a whole open window that still lands inside the target
% interval.
\begin{tikzpicture}[scale=1.0, font=\small]
\definecolor{acc}{HTML}{4A6FA5}
% target line
\draw[black, thick] (0,2.4) -- (8,2.4);
\node[anchor=west] at (8.05,2.4) {$y$};
\fill[acc!16] (3,2.4) ++(-1.0,-0.07) rectangle ++(2.0,0.14);
\draw[acc] (2.0,2.33) -- (2.0,2.47); \draw[acc] (4.0,2.33) -- (4.0,2.47);
\node[acc, anchor=south] at (3.0,2.5) {open $U$};
% source line
\draw[black, thick] (0,0) -- (8,0);
\node[anchor=west] at (8.05,0) {$x$};
\fill[acc!16] (2.6,0) ++(-0.9,-0.07) rectangle ++(1.8,0.14);
\draw[acc] (1.7,-0.07) -- (1.7,0.07); \draw[acc] (3.5,-0.07) -- (3.5,0.07);
\node[acc, anchor=north] at (2.6,-0.12) {preimage of $U$ (open)};
\fill[acc] (2.6,0) circle (1.5pt); \node[acc, anchor=north west, font=\footnotesize] at (2.65,-0.02) {$c$};
\draw[acc, ->, thick] (2.6,0.12) -- (3.0,2.28);
\node[acc, anchor=west, font=\footnotesize] at (3.0,1.2) {$f$};
\end{tikzpicture}
$$

This formulation carries over unchanged to
[metric spaces](/real-analysis/continuity/continuity-metric-spaces), where balls
replace intervals but "preimage of open is open" stays verbatim. On a closed
bounded interval, continuity forces two theorems that calculus uses without
proof: a continuous function there attains its extremes and takes every
intermediate value, the
[extreme and intermediate value theorems](/real-analysis/continuity/evt-ivt).

[^lebl-def]: **Lebl**, _Basic Analysis I_, §3.2 — Definition 3.2.1 (continuity at a point).
[^lebl-char]: **Lebl**, _Basic Analysis I_, §3.2 — Proposition 3.2.2 (limit and sequential characterizations of continuity).
[^lebl-alg]: **Lebl**, _Basic Analysis I_, §3.2 — Propositions 3.2.4 and 3.2.5 (polynomials continuous; algebra of continuous functions).
[^lebl-comp]: **Lebl**, _Basic Analysis I_, §3.2 — Proposition 3.2.7 (composition of continuous functions).
[^lebl-disc]: **Lebl**, _Basic Analysis I_, §3.2 — Proposition 3.2.9 and Examples 3.2.10–3.2.13 (jump, Dirichlet, Thomae/popcorn, removable discontinuities).
