---
title: The Limit of a Function
module: Limits and Continuity
moduleNumber: 1
lessonNumber: 2
order: 102
summary: >
  The tangent and velocity problems both ask for a value a ratio approaches but
  never reaches — the limit. Its intuitive two-sided form splits into one-sided
  limits that must agree; a limit fails to exist when they disagree or when the
  function grows without bound, the latter producing a vertical asymptote.
topics: [Limits and Continuity]
sources:
  - book: Stewart
    ref: "Ch. 1 — Functions and Limits; §1.4 The Tangent and Velocity Problems"
  - book: Stewart
    ref: "§1.5 The Limit of a Function"
draft: false
---

Two geometric problems motivate the entire subject, and both run into the same
obstacle: they ask for the value of a ratio at a point where the ratio is
undefined. The resolution is the **limit**, a value that a quantity approaches as
its input approaches a target, without the input ever reaching that target.

## Two problems that need a limit

### The tangent problem

The slope of a straight line is $\Delta y / \Delta x$, computed from any two points on
it. A curve has no single slope, but it has a **tangent line** at each point, and we
want that tangent's slope. The difficulty is that a tangent touches the curve at only
one point, and one point does not determine a slope.

The workaround uses a nearby second point. Fix $P = (1, 1)$ on the parabola
$y = x^2$ and let $Q = (x, x^2)$ be another point on it. The line $PQ$ is a
**secant**, and its slope is a genuine two-point quotient,

$$
m_{PQ} = \frac{x^2 - 1}{x - 1} = x + 1 \qquad (x \ne 1).
$$

As $Q$ slides toward $P$ along the curve, the secant pivots toward the tangent, and
its slope approaches the tangent's slope.

$$
% caption: Secant lines through $P$ and a moving point $Q$ pivot toward the
% tangent as $Q$ approaches $P$; their slopes approach the tangent slope.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-0.4,0) -- (2.8,0) node[right] {$x$};
\draw[black, ->] (0,-0.4) -- (0,4.2) node[above] {$y$};
\draw[black, very thick] plot[domain=-0.35:2.05, samples=60] (\x, {\x*\x});
% point P at (1,1)
\fill[acc] (1,1) circle (1.8pt);
\node[acc, anchor=north east, font=\scriptsize] at (1,1) {$P$};
% secants to Q at x=2, 1.6, 1.3
\foreach \q in {2.0, 1.6, 1.3} {
  \fill[black] (\q,{\q*\q}) circle (1.4pt);
  \draw[black, thin] ($(1,1)!-0.25!(\q,{\q*\q})$) -- ($(1,1)!1.15!(\q,{\q*\q})$);
}
\node[black, anchor=west, font=\scriptsize] at (2.0,4.0) {$Q$};
% tangent line slope 2 through (1,1): y = 2x - 1
\draw[acc, very thick] (0.1,-0.8) -- (2.5,4.0);
\node[acc, anchor=north west, font=\scriptsize] at (2.1,3.4) {tangent};
\end{tikzpicture}
$$

Substituting values of $x$ approaching $1$ gives $m_{PQ}$ approaching $2$; the
tangent slope is $2$, even though $m_{PQ}$ is undefined at $x = 1$ itself.

> **Worked example (secant slopes approaching the tangent).** Compute $m_{PQ} = x + 1$
> for $Q$ sliding toward $P = (1, 1)$ on $y = x^2$.
>
> | $x$ | $2$ | $1.5$ | $1.1$ | $1.01$ | $1.001$ |
> | --- | --- | --- | --- | --- | --- |
> | $m_{PQ} = x + 1$ | $3$ | $2.5$ | $2.1$ | $2.01$ | $2.001$ |
>
> Values from the left ($x = 0.999, 0.99, \dots$) approach $2$ the same way. The secant
> slopes close in on $2$ from both sides, so the tangent at $P$ has slope $2$.

### The velocity problem

The same structure governs instantaneous velocity. A body falling from rest travels
$s(t) = 4.9\,t^2$ meters in $t$ seconds. Its **average velocity** over the interval
from $t = 5$ to $t = 5 + h$ is a difference quotient,

$$
\frac{s(5+h) - s(5)}{h} = \frac{4.9\,(5+h)^2 - 4.9\,(5)^2}{h} = 49 + 4.9\,h.
$$

At $h = 0$ this is undefined, but as $h$ shrinks the average velocities approach
$49$, and $49$ m/s is the **instantaneous velocity** at $t = 5$.

> **Worked example (average velocity approaching instantaneous).** Tabulate the average
> velocity $49 + 4.9\,h$ over $[5, 5 + h]$ for shrinking $h$.
>
> | $h$ (s) | $1$ | $0.1$ | $0.01$ | $0.001$ |
> | --- | --- | --- | --- | --- |
> | avg. velocity (m/s) | $53.9$ | $49.49$ | $49.049$ | $49.0049$ |
>
> The averages descend toward $49$ as $h \to 0^+$, and the same values arise for $h < 0$;
> the instantaneous velocity at $t = 5$ is $49$ m/s.

Tangent slope and instantaneous velocity are the same operation on different quantities:
a difference quotient evaluated in the limit as the increment vanishes.

## The intuitive definition

> **Definition (Limit, intuitive).** Suppose $f(x)$ is defined when $x$ is near a
> number $a$ (on both sides of $a$, though not necessarily at $a$). We write
> $$
> \lim_{x \to a} f(x) = L
> $$
> and say the limit of $f(x)$ as $x$ approaches $a$ equals $L$ if the values of
> $f(x)$ can be made arbitrarily close to $L$ by taking $x$ sufficiently close to
> $a$ (from either side) but not equal to $a$.[^stewart-lim]

The phrase "but not equal to $a$" is essential: the limit describes the approach to
$a$ and is indifferent to the value $f(a)$, which may equal $L$, differ from $L$, or
fail to exist. All three cases carry the same limit.

$$
% caption: In all three cases the limit at $a$ equals $L$: $f(a)$ may match $L$
% (left), differ from it (middle), or be undefined (right).
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\begin{scope}
  \draw[black, ->] (-0.3,0) -- (2.5,0) node[right]{$x$};
  \draw[black, ->] (0,-0.3) -- (0,2.7) node[above]{$y$};
  \draw[very thick] plot[domain=0.2:2.2, samples=40] (\x, {0.4 + 0.55*\x});
  \fill[acc] (1.2,{0.4+0.55*1.2}) circle (1.8pt);
  \draw[black, dashed] (1.2,0)--(1.2,{0.4+0.55*1.2});
  \draw[black, dashed] (0,{0.4+0.55*1.2})--(1.2,{0.4+0.55*1.2});
  \node[anchor=north,font=\scriptsize] at (1.2,-0.05){$a$};
  \node[anchor=east,font=\scriptsize] at (0,{0.4+0.55*1.2}){$L$};
  \node[anchor=north,font=\scriptsize] at (1.1,-0.62){$f(a) = L$};
\end{scope}
\begin{scope}[xshift=4.2cm]
  \draw[black, ->] (-0.3,0) -- (2.5,0) node[right]{$x$};
  \draw[black, ->] (0,-0.3) -- (0,2.7) node[above]{$y$};
  \draw[very thick] plot[domain=0.2:1.13, samples=25] (\x, {0.4 + 0.55*\x});
  \draw[very thick] plot[domain=1.27:2.2, samples=25] (\x, {0.4 + 0.55*\x});
  \draw[acc, fill=white, thick] (1.2,{0.4+0.55*1.2}) circle (2.2pt);
  \fill[acc] (1.2,2.2) circle (1.8pt);
  \draw[black, dashed] (0,{0.4+0.55*1.2})--(1.2,{0.4+0.55*1.2});
  \node[anchor=north,font=\scriptsize] at (1.2,-0.05){$a$};
  \node[anchor=east,font=\scriptsize] at (0,{0.4+0.55*1.2}){$L$};
  \node[anchor=north,font=\scriptsize] at (1.05,-0.62){$f(a) > L$};
\end{scope}
\begin{scope}[xshift=8.4cm]
  \draw[black, ->] (-0.3,0) -- (2.5,0) node[right]{$x$};
  \draw[black, ->] (0,-0.3) -- (0,2.7) node[above]{$y$};
  \draw[very thick] plot[domain=0.2:1.13, samples=25] (\x, {0.4 + 0.55*\x});
  \draw[very thick] plot[domain=1.27:2.2, samples=25] (\x, {0.4 + 0.55*\x});
  \draw[acc, fill=white, thick] (1.2,{0.4+0.55*1.2}) circle (2.2pt);
  \draw[black, dashed] (0,{0.4+0.55*1.2})--(1.2,{0.4+0.55*1.2});
  \node[anchor=north,font=\scriptsize] at (1.2,-0.05){$a$};
  \node[anchor=east,font=\scriptsize] at (0,{0.4+0.55*1.2}){$L$};
  \node[anchor=north,font=\scriptsize] at (1.05,-0.62){hole at $a$};
\end{scope}
\end{tikzpicture}
$$

Consider

$$
g(x) = \frac{x^2 - 1}{x - 1},
$$

undefined at $x = 1$. For every other $x$ it equals $x + 1$, so a table of values
converges on $2$ from both sides.

| $x \to 1^-$ | $g(x)$ | | $x \to 1^+$ | $g(x)$ |
| --- | --- | --- | --- | --- |
| $0.9$ | $1.9$ | | $1.1$ | $2.1$ |
| $0.99$ | $1.99$ | | $1.01$ | $2.01$ |
| $0.999$ | $1.999$ | | $1.001$ | $2.001$ |

$$
% caption: A table converging on the limit from both sides, and the graph with an
% open circle marking that $g$ is undefined at $x = 1$ though the limit is $2$.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-0.4,0) -- (2.9,0) node[right] {$x$};
\draw[black, ->] (0,-0.4) -- (0,3.6) node[above] {$y$};
% line y = x+1 with a hole at x=1
\draw[very thick] (-0.3,0.7) -- (0.85,1.85);
\draw[very thick] (1.15,2.15) -- (2.4,3.4);
\draw[acc, fill=white, thick] (1,2) circle (2.2pt);
\draw[black, dashed] (1,0) -- (1,2);
\draw[black, dashed] (0,2) -- (1,2);
\node[anchor=north, font=\scriptsize] at (1,-0.05) {$1$};
\node[anchor=east, font=\scriptsize] at (0,2) {$2$};
\node[anchor=west, font=\scriptsize] at (2.0,3.35) {$y = g(x)$};
\end{tikzpicture}
$$

Tables suggest a limit but do not prove one; a function can mislead a coarse table
by oscillating between the sampled points. The [precise definition](/calculus/limits-and-continuity/limit-laws-and-the-precise-definition)
is what settles a limit for certain, with tables reduced to forming the guess a proof
then confirms.

A table used with care still gives the right guess when the function is well behaved
between samples.

> **Worked example (guessing a limit from a table).** Estimate
> $\displaystyle \lim_{x \to 0} \frac{\sin x}{x}$, with $x$ in radians.
>
> The quotient is undefined at $0$ ($0/0$). Tabulating values symmetric about $0$:
>
> | $x$ | $\pm 0.5$ | $\pm 0.1$ | $\pm 0.05$ | $\pm 0.01$ |
> | --- | --- | --- | --- | --- |
> | $\sin(x)/x$ | $0.958851$ | $0.998334$ | $0.999583$ | $0.999983$ |
>
> The values climb toward $1$ from both sides, so the guess is
> $\lim_{x \to 0}(\sin x)/x = 1$. A geometric squeeze argument proves it exactly in the
> [differentiation rules](/calculus/derivatives/differentiation-rules-and-the-chain-rule),
> where it delivers the derivative of $\sin x$.

The oscillation trap is not hypothetical. Sampling $\sin(\pi/x)$ at the reciprocals of
integers reads $0$ every time, which invites the wrong guess.

$$
% caption: $y = \sin(\pi/x)$ oscillates between $-1$ and $1$ ever faster as $x \to 0$;
% the values never settle, so the limit at $0$ does not exist.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-1.75,0) -- (1.85,0) node[right]{$x$};
\draw[black, ->] (0,-1.45) -- (0,1.55) node[above]{$y$};
\draw[black, dashed] (-1.6,1) -- (1.6,1);
\draw[black, dashed] (-1.6,-1) -- (1.6,-1);
\node[anchor=south east,font=\scriptsize] at (-0.05,1){$1$};
\draw[acc, very thick] plot[domain=0.11:1.6, samples=420] (\x, {sin(180/\x)});
\draw[acc, very thick] plot[domain=-1.6:-0.11, samples=420] (\x, {sin(180/\x)});
\end{tikzpicture}
$$

> **Worked example (a limit that does not exist).** Investigate
> $\displaystyle \lim_{x \to 0} \sin\frac{\pi}{x}$.
>
> At $x = 1/n$ for integer $n$, the argument is $n\pi$ and $\sin(n\pi) = 0$, so a table
> of these inputs suggests the limit is $0$. But at $x = 2/(4k+1)$ the argument is
> $\tfrac{\pi}{2}(4k+1)$, an odd multiple of $\pi/2$, giving $\sin(\pi/x) = 1$; at
> $x = 2/(4k+3)$ it gives $-1$. Every neighborhood of $0$ contains infinitely many
> inputs of each kind, so the values sweep the full range $[-1, 1]$ without settling.
> The limit does not exist.

## One-sided limits

Approaching $a$ from the left and from the right can give different results, so it
helps to name each side.

> **Definition (One-sided limits).** We write $\displaystyle \lim_{x \to a^-} f(x) = L$
> if $f(x)$ approaches $L$ as $x$ approaches $a$ through values **less** than $a$,
> and $\displaystyle \lim_{x \to a^+} f(x) = L$ for values **greater** than $a$.

The two-sided limit exists exactly when the one-sided limits agree.

> **Theorem (Two-sided from one-sided).**
> $$
> \lim_{x \to a} f(x) = L \quad\Longleftrightarrow\quad
> \lim_{x \to a^-} f(x) = L \ \text{ and } \ \lim_{x \to a^+} f(x) = L.
> $$

When the one-sided limits differ, the two-sided limit **does not exist**. The
Heaviside function

$$
H(t) = \begin{cases} 0 & \text{if } t < 0, \\ 1 & \text{if } t \ge 0, \end{cases}
$$

models a switch thrown at $t = 0$. Its left limit is $0$ and its right limit is $1$,
so $\lim_{t \to 0} H(t)$ does not exist: the graph jumps.

$$
% caption: A jump discontinuity: the left limit is $0$ and the right limit is $1$,
% so the two-sided limit at $0$ does not exist.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-2.2,0) -- (2.4,0) node[right] {$t$};
\draw[black, ->] (0,-0.5) -- (0,2.0) node[above] {$H$};
\draw[very thick] (-2.0,0) -- (-0.05,0);
\draw[very thick] (0,1.2) -- (2.0,1.2);
\draw[acc, fill=white, thick] (0,0) circle (2.2pt);
\draw[acc, fill=acc, thick] (0,1.2) circle (2.2pt);
\node[anchor=east, font=\scriptsize] at (0,1.2) {$1$};
\node[black, anchor=north east, font=\scriptsize] at (-0.1,-0.05) {left limit $= 0$};
\node[anchor=south west, font=\scriptsize] at (0.15,1.25) {right limit $= 1$};
\end{tikzpicture}
$$

A piecewise function is tested for a limit at each junction by comparing the one-sided
limits computed from the formulas on either side.

> **Worked example (a piecewise one-sided limit).** For
> $$
> f(x) = \begin{cases} 1 + x & \text{if } x < -1, \\ x^2 & \text{if } -1 \le x < 1, \\ 2 - x & \text{if } x \ge 1, \end{cases}
> $$
> determine the values of $a$ at which $\lim_{x \to a} f(x)$ exists.
>
> At $x = -1$, the two sides use different formulas:
> $$
> \lim_{x \to -1^-}(1 + x) = 0, \qquad \lim_{x \to -1^+} x^2 = 1.
> $$
> The one-sided limits disagree, so $\lim_{x \to -1} f(x)$ does not exist. At $x = 1$,
> $$
> \lim_{x \to 1^-} x^2 = 1, \qquad \lim_{x \to 1^+}(2 - x) = 1,
> $$
> which agree, so $\lim_{x \to 1} f(x) = 1$. At every other point $f$ is locally a single
> polynomial, whose limit equals its value. The two-sided limit therefore exists for all
> $a \ne -1$.

## Infinite limits

A limit can fail because the function grows without bound rather than because two
sides disagree. For $f(x) = 1/x^2$, values near $x = 0$ become arbitrarily large and
positive.

> **Definition (Infinite limit).** Let $f$ be defined on both sides of $a$, except
> possibly at $a$. Then $\displaystyle \lim_{x \to a} f(x) = \infty$ means the
> values of $f(x)$ can be made arbitrarily large by taking $x$ sufficiently close to
> $a$ but not equal to $a$; $\displaystyle \lim_{x \to a} f(x) = -\infty$ is the same
> with arbitrarily large negative values.

The symbol $\infty$ is not a number, and the statement $\lim_{x \to a} f(x) = \infty$
does not assert that a limit exists in the ordinary sense; it is shorthand for a
specific mode of non-existence, unbounded growth. One-sided infinite limits are
defined the same way. The behavior of $1/x$ near $0$ splits by side:

$$
\lim_{x \to 0^+} \frac{1}{x} = \infty, \qquad \lim_{x \to 0^-} \frac{1}{x} = -\infty.
$$

An infinite limit locates a vertical feature of the graph.

> **Definition (Vertical asymptote).** The line $x = a$ is a **vertical asymptote**
> of $y = f(x)$ if at least one of the one-sided or two-sided limits of $f$ at $a$ is
> $+\infty$ or $-\infty$.

$$
% caption: Near a vertical asymptote $x = a$ the graph climbs without bound; here
% the two-sided limit is $+\infty$.
\begin{tikzpicture}[scale=1.0, font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black, ->] (-2.4,0) -- (2.6,0) node[right] {$x$};
\draw[black, ->] (0,-0.3) -- (0,3.4) node[above] {$y$};
% vertical asymptote at x = 0.8
\draw[black, dashed] (0.8,-0.2) -- (0.8,3.4);
\node[black, anchor=north, font=\scriptsize] at (0.8,-0.2) {$x = a$};
% two branches of 0.35/(x-0.8)^2
\draw[acc, very thick] plot[domain=-2.1:0.42, samples=60] (\x, {min(3.3, 0.28/((\x-0.8)*(\x-0.8)))});
\draw[acc, very thick] plot[domain=1.18:2.4, samples=60] (\x, {min(3.3, 0.28/((\x-0.8)*(\x-0.8)))});
\end{tikzpicture}
$$

The sign of an infinite limit is read off the sign of numerator and denominator as the
input approaches from one side.

> **Worked example (a one-sided infinite limit).** Evaluate
> $\displaystyle \lim_{x \to 3^+} \frac{2x}{x - 3}$ and $\displaystyle \lim_{x \to 3^-} \frac{2x}{x - 3}$.
>
> Near $x = 3$ the numerator $2x$ is close to $6$, a fixed positive number. As
> $x \to 3^+$, the denominator $x - 3$ is a small **positive** number, so the quotient is
> large positive: at $x = 3.01$, $\ 2x/(x-3) = 6.02/0.01 = 602$. Thus
> $\lim_{x \to 3^+} 2x/(x-3) = +\infty$. As $x \to 3^-$, the denominator is a small
> **negative** number while the numerator stays near $6$, so
> $\lim_{x \to 3^-} 2x/(x-3) = -\infty$. The line $x = 3$ is a vertical asymptote.

Rational functions produce vertical asymptotes at the zeros of the denominator that
do not cancel, and $\tan x = \sin x / \cos x$ has one at every odd multiple of
$\pi/2$, where $\cos x = 0$. Locating these asymptotes is a standard step in
[curve sketching](/calculus/applications-of-derivatives/how-derivatives-shape-a-graph).

[^stewart-lim]: Stewart, §1.5 — the intuitive definition of a limit, the role of one-sided limits, and the interpretation of infinite limits and vertical asymptotes.
