A limit is the value a function heads towards near a point, even where it has no value at the point itself. Estimate one from a table and a graph, then pin it down as a game of tolerances: for every output tolerance there is an input window.
Estimate a limit from a table of values and from a graph, approaching the point from both sides.
Explain why the limit of f at a does not depend on the value f(a), and can exist where f(a) does not.
State the epsilon-delta definition of a limit and read it as a game of tolerances.
Find a window delta that answers every tolerance epsilon for a linear function, and so prove its limit.
Explain why a table of values is evidence for a limit but not a proof.
In review. The maths and code on this page are checked by automated tests on every change, but an independent reader has not signed it off yet. Spot a mistake or a confusing step? Tell us.
The question
Gradient descent follows the slope of a loss. To find the slope of the curve \({y = x^2}\) at \({x = 1}\), take a second point on the curve, divide the rise by the run, and slide the second point in. Between 1 and \(x\) the slope is \({(x^2 - 1)/(x - 1)}\). At \({x = 1}\) that is \({0/0}\), which is no number at all. Yet the slope at 1 should be a definite number. Which one? And what exactly does it mean for a formula to head towards a number at a point where it cannot be computed?
Intuition
Give the slope formula a name:
\[
f(x) = \frac{x^2 - 1}{x - 1} .
\]
It has a value for every \(x\) except 1. Compute it at inputs closer and closer to 1, from both sides, and mark the points on its graph.
M04.1.1-F1
The graph of \({f(x) = (x^2 - 1)/(x - 1)}\) is a straight line with one point missing, at \({(1, 2)}\). Values computed nearer and nearer to 1 (vermillion) close in on 2 from both sides. The number they close in on is the limit, drawn in the truth colour; \({f(1)}\) itself does not exist.
Two things are true at once. The formula breaks at 1, so \({f(1)}\) has no value. And the values of \(f\) near 1 are all close to 2, closer the nearer \(x\) is to 1. The number 2 is called the limit of \(f(x)\) as \(x\) approaches 1, written
\[
\lim_{x \to 1} f(x) = 2 .
\]
Read it aloud as “the limit of \(f\) of \(x\), as \(x\) tends to 1, is 2”. This course writes the value of a limit with a lower-case ell, \(\ell\), because the capital \(L\) is kept for a loss.
A limit asks about the neighbourhood of a point and never about the point itself. That is why it can exist where the function does not, and it is why calculus can be built on it: the slope of a curve at a point is exactly a limit of this kind, as module M04.2 shows.
Build it up
Step 1. Simplify away from the point. For every \(x\) other than 1, the top factors and the factor \({x - 1}\) cancels:
Cancelling is allowed only because \({x - 1}\) is not zero. So the graph of \(f\) is the line \({y = x + 1}\) with the point above \({x = 1}\) taken out: a hole at \({(1, 2)}\).
Step 2. Make a table. Approach 1 from below and from above.
\(x\)
\(f(x)\)
\(x\)
\(f(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
Each step ten times closer to 1 brings \(f(x)\) ten times closer to 2. The table suggests the limit 2, and Step 1 says why: near 1, \(f(x)\) is \({x + 1}\), which is near 2.
Step 3. The value at the point does not count. Change \(f\) at the single input 1 and nothing near 1 changes, so the limit cannot change either.
M04.1.1-F2
Three functions that agree everywhere except at \({x = 1}\). There one has the value 2, one has no value and one has the value 3. The limit looks only near 1, so it is 2 for all three.
Step 4. Turn “close” into a game. “As close as we like” needs a referee. Suppose a sceptic names a tolerance, say 0.1: “I will believe the limit is 2 only if you can keep \(f(x)\) within 0.1 of 2.” You answer with a window round 1: “Take any \(x\) within 0.1 of 1, other than 1 itself.” Near 1, \({f(x) - 2 = x - 1}\), so every such \(x\) gives an output within 0.1 of 2. You win the round. The sceptic tries 0.001, and you answer 0.001. Whatever tolerance comes, a window of the same size wins. That is what it means for the limit to be 2.
M04.1.1-F3
The tolerance game. Left: the sceptic’s challenge, a band of half-height \(\varepsilon\) round the claimed limit \({\ell = 2}\). Right: your answer, a window of half-width \(\delta\) round \({x = 1}\). Above the window the graph stays inside the band, so this window works.
The tolerance is written \(\varepsilon\) (epsilon) and the window \(\delta\) (delta). Both are drawn in the parameter colour, because they are numbers you set.
The formal statement
NoteDefinition: limit
Let \(f\) be defined at every \(x\) near \(a\), except perhaps at \(a\) itself. The limit of \(f(x)\) as \(x\) tends to \(a\) is \(\ell\), written \({\lim_{x \to a} f(x) = \ell}\), if for every \({\varepsilon > 0}\) there is a \({\delta > 0}\) such that
Each piece of the definition is a piece of the game.
\({\abs{f(x) - \ell}}\) is the distance from the output to the claimed limit. Asking that it be less than \(\varepsilon\) puts the point of the graph inside the band.
\({\abs{x - a} < \delta}\) says that \(x\) lies in the window, within \(\delta\) of \(a\).
\({0 < \abs{x - a}}\) says that \({x \neq a}\). The point itself is left out, which is Step 3 written in symbols.
“For every \(\varepsilon\) there is a \(\delta\)” fixes the order of the moves. The tolerance comes first, and the window may depend on it.
The order matters. “There is one \(\delta\) that works for every \(\varepsilon\)” is a far stronger claim: the graph above one fixed window would have to stay inside every band, however thin, and that happens only when \({f(x) = \ell}\) for every \(x\) in the window. As in M01.6, a claim about every \(\varepsilon\) is disproved by a single \(\varepsilon\) for which no window works. When that happens for every candidate \(\ell\), we say the limit does not exist.
The definition does not say how to find \(\delta\). The usual way is to work backwards from the inequality you need, as in the next section.
Worked example
Prove that \({\lim_{x \to 1} (2x + 1) = 3}\), and find the window for \({\varepsilon = 0.5}\) and for \({\varepsilon = 0.2}\).
Work backwards. The distance from the output to 3 is
Every tolerance has its window, so the limit is 3.
M04.1.1-F4
Two rounds of the game for \({f(x) = 2x + 1}\) at \({x = 1}\). The line is twice as steep as the diagonal, so the window is half the band: \({\varepsilon = 0.5}\) needs \({\delta = 0.25}\), and \({\varepsilon = 0.2}\) needs \({\delta = 0.1}\).
With numbers: \({\varepsilon = 0.5}\) gives \({\delta = 0.25}\), and \({\varepsilon = 0.2}\) gives \({\delta = 0.1}\). A spot check: \({x = 1.04}\) lies in the second window, and \({f(1.04) = 3.08}\), which is 0.08 from 3, well inside the band of 0.2. The slope explains the factor of one half: each step in \(x\) moves the output twice as far.
Now the function from the question. For \({x \neq 1}\), Step 1 gives \({f(x) - 2 = (x + 1) - 2 = x - 1}\), so \({\abs{f(x) - 2} = \abs{x - 1}}\). Take \({\delta = \varepsilon}\): if \({0 < \abs{x - 1} < \varepsilon}\), then \({\abs{f(x) - 2} < \varepsilon}\). So
\[
\lim_{x \to 1} \frac{x^2 - 1}{x - 1} = 2
\]
is now proved, not just suggested by a table. The slope of \({y = x^2}\) at 1 is 2, the fact that M04.2.1 starts from.
Code
First the table, in plain Python. The function is never called at 1 itself.
def f(x):"""The slope of y = x**2 between 1 and x. It has no value at x = 1."""return (x**2-1) / (x -1)for k inrange(1, 7): h =10.0**-k # the distance from 1: 0.1, 0.01, ..., 0.000001print(f"h = {h:.6f} f(1 - h) = {f(1- h):.6f} f(1 + h) = {f(1+ h):.6f}")
The rows close in on 2 from both sides. Now play the game in code: a function that tests whether a window works by trying many inputs inside it.
def window_works(f, a, ell, eps, delta, tries=10_000):"""Try |f(x) - ell| < eps at many x with 0 < |x - a| < delta. False is certain (a counterexample was found); True is only evidence."""for i inrange(1, tries +1): gap = delta * i / (tries +1) # strictly between 0 and deltafor x in (a - gap, a + gap):ifnotabs(f(x) - ell) < eps:returnFalsereturnTruedef line(x):return2* x +1for eps in (0.5, 0.2, 0.01):print(f"eps = {eps}: delta = eps/2 works? {window_works(line, 1, 3, eps, eps /2)}"f" delta = eps works? {window_works(line, 1, 3, eps, eps)}")print("hole, delta = eps = 0.01 works?", window_works(f, 1, 2, 0.01, 0.01))
The window \({\varepsilon / 2}\) passes every round and the wider window \(\varepsilon\) fails, as the algebra said. But window_works only samples, so its “True” is evidence, like the table. The proof is the two lines of algebra in the worked example.
NumPy builds the same table in one call, because its arithmetic works on a whole array at once. It also shows how a table can mislead: \({\sin(\pi / x)}\) is 0 at \({x = 0.1, 0.01, 0.001}\), yet it is 1 at \({x = 2/5, 2/41, 2/401}\), which are just as close to 0.
import numpy as nphs = np.array([0.1, 0.01, 0.001])print("f near 1: ", np.round(f(np.concatenate([1- hs, 1+ hs])), 6))g =lambda x: np.sin(np.pi / x)print("g at 1/10^k: ", np.round(g(np.array([0.1, 0.01, 0.001])), 6) +0.0)print("g at 2/(4k+1): ", np.round(g(np.array([2/5, 2/41, 2/401])), 6))
f near 1: [1.9 1.99 1.999 2.1 2.01 2.001]
g at 1/10^k: [0. 0. 0.]
g at 2/(4k+1): [1. 1. 1.]
(The + 0.0 turns a rounded \({-0.0}\) into 0.0. The computer’s \({\sin(10\pi)}\) is not exactly 0 but about \({10^{-15}}\), because \(\pi\) itself is stored rounded.)
Explore
M04.1-X1
Limit window
Pick a function, then set the tolerance \(\varepsilon\) with the first slider and the window \(\delta\) with the second, or drag the two orange handles. Halve ε plays the sceptic and Find δ plays you. The read-out says whether the graph above the window stays inside the band.
Things to try:
With the hole, press Halve ε and then Find δ, several times. The window always shrinks with the band, and here \({\delta = \varepsilon}\) is exactly enough.
With the curve\({y = x^2}\) at \({x = 1}\), Find δ gives a window a little under \({\varepsilon / 2}\): the curve is steeper to the right of 1, so the right side decides.
With the jump, shrink \(\varepsilon\) to 1 or below. Now no window works, however small. That is what “the limit does not exist” looks like.
Pitfalls
M04.1.1-F5
Wrong beside right. Left: a table of \({\sin(\pi / x)}\) at \({x = 1, \tfrac12, \tfrac13, \ldots}\) reads 0 every time. Right: the graph swings between \({-1}\) and 1 faster and faster near 0 and is back at 1 at \({x = 2/5, 2/9, 2/13, \ldots}\), so it has no limit at 0.
“The table settles on a number, so that number is the limit.”
A table looks at a few inputs only. \({\sin(\pi / x)}\) is exactly 0 at every \({x = 1/k}\), yet between those points it climbs back to 1 and falls to \({-1}\), so no band of half-height below 1, wherever it is centred, can hold the graph for all \(x\) near 0. A table can also be spoiled by rounding. Write the slope of the question with the step \({h = x - 1}\), as \({((1 + h)^2 - 1)/h}\), and push \(h\) below about \({10^{-8}}\): rounding swamps the trend. The computer gives 2.000178 at \({h = 10^{-12}}\) and 0 at \({h = 10^{-16}}\), because it stores \({1 + h}\) rounded (M04.2.4 explains why). A table is evidence. The proof is the game.
“The limit at \(a\) is just \(f(a)\).”
Often the two agree; the functions for which they always agree are the continuous ones of M04.1.4. But the third function in the Step 3 figure has \({f(1) = 3}\) and limit 2. A limit never looks at the point itself.
“If \(f(a)\) has no value, there can be no limit at \(a\).”
The question’s slope formula has no value at 1 and limit 2. Every slope in machine learning is a limit of exactly this kind: a ratio that is \({0/0}\) at the point, with a perfectly good limit.
“I found a window for \({\varepsilon = 0.1}\), so the limit is proved.”
One round won is not the game. A proof gives a rule, such as \({\delta = \varepsilon / 2}\), that wins every round, however small \(\varepsilon\) is.
Check yourself
Recall
1. In words, what does \({\lim_{x \to a} f(x) = \ell}\) mean?
Show answer
\(f(x)\) can be kept as close to \(\ell\) as anyone asks by taking \(x\) close enough to \(a\), but not equal to \(a\).
2. Why does \({(x^2 - 1)/(x - 1)}\) have no value at \({x = 1}\), and what is its limit there?
Show answer
At 1 it gives \({0/0}\), which is not a number. For \({x \neq 1}\) it equals \({x + 1}\), so its limit at 1 is 2.
3. If you change the value of \(f\) at \(a\) alone, does \({\lim_{x \to a} f(x)}\) change?
Show answer
No. The definition only uses \(x\) with \({0 < \abs{x - a}}\), so the value at \(a\) itself plays no part.
4. In the tolerance game, which is chosen first, \(\varepsilon\) or \(\delta\), and what does each measure?
Show answer
\(\varepsilon\) comes first: it is the tolerance on the output, the half-height of the band round \(\ell\). Then \(\delta\), the half-width of the window of inputs round \(a\), which may depend on \(\varepsilon\).
5. For \({f(x) = 2x + 1}\) at \({x = 1}\), which window answers the tolerance \({\varepsilon = 0.1}\)?
Show answer
\({\delta = \varepsilon / 2 = 0.05}\), or any smaller window.
Exercises
1.★ Estimate \({\lim_{x \to 2} (x^2 - 4)/(x - 2)}\) from its values at \({x = 1.9, 1.99, 2.01, 2.1}\). Then find the limit exactly by cancelling.
Show solution
The values are 3.9, 3.99, 4.01 and 4.1, which suggest 4. Exactly: the top is a difference of two squares, so for \({x \neq 2}\)
2.★★ For \({f(x) = 3x - 1}\), what is the limit at \({x = 2}\)? Find a window \(\delta\) that works for every \(\varepsilon\), and the window that answers \({\varepsilon = 0.03}\).
Show solution
The limit is \({\ell = 3 \times 2 - 1 = 5}\). Work backwards:
which is less than \(\varepsilon\) exactly when \({\abs{x - 2} < \varepsilon / 3}\). So \({\delta = \varepsilon / 3}\) works for every \(\varepsilon\): if \({0 < \abs{x - 2} < \delta}\), then \({\abs{f(x) - 5} = 3\,\abs{x - 2} < 3\delta = \varepsilon}\). For \({\varepsilon = 0.03}\) the window is \({\delta = 0.01}\).
3.★★★ Prove that \({\lim_{x \to 1} x^2 = 1}\). Hint: when \({\abs{x - 1} < 1}\), the number \(x\) lies between 0 and 2.
The first factor is what the window controls. The second must be kept from growing. If \({0 < \abs{x - 1} < 1}\), then \({0 < x < 2}\), so \({1 < x + 1 < 3}\) and \({\abs{x + 1} < 3}\). Then \({\abs{x^2 - 1} < 3\,\abs{x - 1}}\).
Now let \({\varepsilon > 0}\) and take \(\delta\) to be the smaller of 1 and \({\varepsilon / 3}\). If \({0 < \abs{x - 1} < \delta}\), then \({\abs{x - 1} < 1}\), so the bound holds, and
For example, \({\varepsilon = 0.3}\) gives \({\delta = 0.1}\); at \({x = 1.09}\), \({x^2 = 1.1881}\), which is 0.1881 from 1, inside the band. This \(\delta\) is safe but not the largest: the interactive’s Find δ shows that the largest window for \({\varepsilon = 0.3}\) is \({\sqrt{1.3} - 1 \approx 0.1402}\).
Summary card
A limit is where a function is heading, not where it is.
M04.1.1-F1
Values close in on 2; \({f(1)}\) does not exist.
Definition.\({\lim_{x \to a} f(x) = \ell}\) when for every \({\varepsilon > 0}\) there is a \({\delta > 0}\) with \({\abs{f(x) - \ell} < \varepsilon}\) whenever \({0 < \abs{x - a} < \delta}\).
The point itself does not count.\({f(a)}\) may differ from \(\ell\), or not exist.
Find \(\delta\) by working backwards. For \({2x + 1}\) at 1, \({\delta = \varepsilon / 2}\).
A table is evidence; the game is proof.
Sources and next steps
Sources. Each was opened and checked against this lesson on 12 November 2026.
Gilbert Strang and Edwin Herman, Calculus Volume 1 (OpenStax), Section 2.2, The limit of a function: the intuitive definition of a limit, limits estimated from tables of values (Examples 2.4 and 2.5), and a limit that fails to exist, \({\sin(1/x)}\) at 0 (Example 2.7). Section 2.5, The precise definition of a limit: the \(\varepsilon\)–\(\delta\) definition, and Example 2.39, which proves that \({2x + 1}\) tends to 3 as \(x\) tends to 1 with \({\delta = \varepsilon / 2}\).
Matthew Boelkins, Active Calculus (single variable), Section 1.2, The notion of limit: Definition 1.2.2 (we can make \({f(x)}\) as close to \(L\) as we like by taking \(x\) close enough to \(a\), but not equal to it), the remark that the value of the function at the point does not matter, and Example 1.2.4, where a table of \({\sin(\pi / x)}\) near 0 misleads.
Next.M04.1.2 Limits by algebra finds limits without playing the game every time: a few laws do the work, and a squeeze settles \({\sin(x)/x}\) at 0.