Limits and continuity
极限与连续性
Turn approaching values into an epsilon-delta guarantee, and distinguish a gap from a jump.
limits-continuityGetting close is different from arriving
Consider f(x)=(x²−1)/(x−1). A calculator rejects x=1, yet inputs just below and above 1 give outputs close to 2. There is no contradiction. The formula is undefined at the point, while its nearby values have a limit.
Now imagine a classifier that outputs 0 below a threshold and 1 at or above it. Inputs on opposite sides can be arbitrarily close while their labels differ by 1. A small input change does not guarantee a small output change. This simple contrast motivates continuity.
Limits let us state what “approaches” means without assuming that a finite table of values settles it. They support derivatives, convergence arguments and error analysis. This chapter starts with real-valued functions of one real variable, at an interior accumulation point of their domain.
A guarantee for every requested accuracy
A finite limit L at a means that any positive output tolerance ε can be met by restricting inputs to a sufficiently small positive radius δ around a, excluding a itself:
The order matters. δ may depend on ε and on the fixed function and point; it must work for all permitted x in that neighborhood. Choosing a new δ after seeing each x would change the claim. The point a is excluded because a limit describes nearby behavior. OpenStax §2.5 develops this definition and tolerance-based proofs.
For x≠1, our quotient simplifies exactly to x+1. Therefore |f(x)−2|=|x−1|, and δ=ε proves that its limit at 1 is 2. This argument handles every nearby real x; the program below samples only a few rational ones.
Continuity connects the nearby values to the actual value
At a point in the domain, continuity requires the limit to agree with the value there:
For the original quotient, a=1 is outside the domain, so the original function is not continuous at that point. Assigning value 2 creates a continuous extension; assigning value 7 does not. The nearby limit stays 2 in either case. OpenStax §2.4 separates existence of the value, existence of the limit and equality between them.
At an interior point, a two-sided limit exists only when both one-sided limits exist and agree. For a threshold function that is 0 when x is negative and 1 otherwise, the left limit at zero is 0 and the right limit is 1. No choice of the value at zero repairs this jump. At a domain endpoint, use the corresponding domain-relative, one-sided continuity condition.
Prove a nonlinear example by controlling a neighborhood
To prove x² tends to 1 as x tends to 1, factor the output error. First keep x within distance 1, so 0<x<2 and |x+1|<3. Then select a radius that also enforces the requested tolerance:
The extra bound controls the factor x+1, which depends on the unknown input. δ need not be the largest valid radius. A smaller positive radius is enough. This is how a useful estimate becomes a proof rather than an impression from a plot.
Use exact samples to illustrate the proof
The complete Python 3.12 program uses only Fraction from the standard library. Integers and fractions are accepted, while floats and booleans are rejected. It keeps the undefined original quotient separate from its continuous extension. These functions are a small numerical illustration, not a general limit solver.
from fractions import Fraction as F
def rational(x):
if type(x) not in (int,F):
raise ValueError('integer or Fraction required')
return F(x)
def punctured_quotient(x):
x=rational(x)
if x == 1:
raise ValueError('original quotient is undefined at 1')
return (x*x-1)/(x-1)
def continuous_extension(x):
x=rational(x)
return F(2) if x == 1 else punctured_quotient(x)
def square_delta(epsilon):
epsilon=rational(epsilon)
if epsilon <= 0:
raise ValueError('epsilon must be positive')
return min(F(1),epsilon/3)
if __name__ == '__main__':
for h in (F(1,10),F(1,100),F(1,1000)):
left,right=punctured_quotient(1-h),punctured_quotient(1+h)
assert (left,right) == (2-h,2+h)
print('h='+str(h), 'left='+str(left), 'right='+str(right))
print('extension at 1:',continuous_extension(1))
eps=F(1,100);delta=square_delta(eps)
distances=[-delta/2,delta/2]
errors=[abs((1+d)**2-1) for d in distances]
assert all(error < eps for error in errors)
print('epsilon='+str(eps),'delta='+str(delta),'sample errors='+str([str(v) for v in errors]))
Output:
h=1/10 left=19/10 right=21/10
h=1/100 left=199/100 right=201/100
h=1/1000 left=1999/1000 right=2001/1000
extension at 1: 2
epsilon=1/100 delta=1/300 sample errors=['1199/360000', '1201/360000']
The first three lines show both sides of the removable gap. The last line samples two points inside the proof’s δ-neighborhood for ε=1/100. Passing those sample checks does not establish the universal quantifier in the definition; the inequality above does that work.
Each sample uses a constant number of rational arithmetic operations. As denominators grow, integer arithmetic becomes more expensive, so this is not constant bit complexity. In floating-point arithmetic, an attempted value 1+h may round to exactly 1 when h is too small. That numerical event does not change the mathematical limit. See floating-point arithmetic before using tiny steps to diagnose a discontinuity.
Continuity does not promise everything you might want
Continuity at one point supplies a local tolerance guarantee, not a uniform sensitivity constant across every input. A derivative or a Lipschitz bound addresses stronger quantitative questions. The absolute-value function is continuous at zero but has different left and right slopes there, so continuity does not imply differentiability.
A continuous loss function does not by itself guarantee that an optimization method converges, that a minimum is attained on an unbounded domain, or that small training-data changes produce the same fitted parameters. Those conclusions require further assumptions. For example, a continuous positive function exp(−x) on the real line has infimum zero but never attains it.
Finite tables and plots can suggest a limit and reveal counterexamples, but cannot inspect every real input. Rational-only sampling is especially limited: a function may behave differently on irrational inputs. Also distinguish a finite limit from divergence to infinity; “grows without bound” is not convergence to a real number.
Identify which part of the definition fails
- Define the quotient’s value at 1 to be 7. What is its limit at 1, and is the new function continuous there?
Answer 1: The limit is still 2 because all nearby values are unchanged. Continuity fails because the assigned value is 7.
- To prove 3x tends to 6 as x tends to 2, choose a valid δ for an arbitrary ε>0.
Answer 2: Choose δ=ε/3. Then |3x−6|=3|x−2|<3δ=ε for every permitted input.
- Can changing only the value at zero make the threshold function continuous there?
Answer 3: No. The left and right limits remain 0 and 1, so a two-sided limit does not exist regardless of the assigned point value.
- Why does checking a million inputs not replace the proof for x² near 1?
Answer 4: The definition quantifies over every domain input in a whole neighborhood and every positive tolerance. A finite sample leaves other inputs and tolerances unchecked; the factored inequality bounds all of them for the chosen δ.
Use limits to separate models from numerical artifacts
The two OpenStax sections provide the formal definition and continuity criteria; the examples here connect those criteria to code contracts and threshold decisions. Next, read derivatives to apply a limit to a difference quotient, then numerical stability to examine whether an implementation preserves useful accuracy.
For a follow-up experiment, compare the original quotient with x+1 for floating-point inputs approaching 1. Record the first point where the numerical inputs become identical or the results disagree, and explain it using representation and cancellation. Keep that numerical diagnosis separate from the exact proof that the limit is 2.
Make a prediction, then check
The quotient (x²−1)/(x−1) has limit 2 at 1. Which assigned value makes its extension continuous?
Learning objectives
- Prove a simple limit with an explicit delta.
- Distinguish point values, limits and numerical samples.
Prerequisites & connections
Explore related knowledge →References
- Calculus Volume 1 — 2.5 The Precise Definition of a Limit
Gilbert Strang; Edwin Herman; OpenStax · 2016 - Calculus Volume 1 — 2.4 Continuity
Gilbert Strang; Edwin Herman; OpenStax · 2016
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-06 · Codex single-agent authored technical review: primary-source locations, derivations, literal or exact computational checks, real runtime experiments where stated, and bilingual review; not independent human or second-agent peer review.
- Four tests passed on exact quotient samples, the undefined point, continuous extension and delta choices. Sampling is not described as a real-analysis proof; the explicit inequality supplies that proof. Three paired formulas and four answers render.
- Single-agent authored technical review, with primary-source locations, stated assumptions and matching bilingual examples/exercises. Not independent human or second-agent review. Final publication navigation and repository checks are separate.
- Promoted the full prose, equations, code and exercises. Tests read formal MDX only; removed temporary fallbacks/draft skips and updated review assertion to checked. Algorithm and independent references are unchanged; final record binds both locale hashes.
- Publication navigation points published topics to complete articles and removes corresponding pending wording, retaining directory entries for unwritten targets. Principles, equations, programs and exercises are unchanged; final article SHA values rebound.
Source locations checked:
- Calculus Volume 1 — 2.5 The Precise Definition of a Limit · Precise finite-limit definition and choosing delta independent of x, including bounding factors on a neighborhood.
- Calculus Volume 1 — 2.4 Continuity · Three conditions for continuity at a point and one-sided limits; original gap/jump examples in our prose.
Related topics