Introduction to Limits
What value does have at ? Plugging in gives , which is meaningless. But for very close to 1, is very close to 2. A limit captures that idea: the value a function approaches, whether or not it actually gets there. This lesson builds the intuition with tables and graphs, shows one-sided limits and limits at infinity, and connects limits to what happens when a simulation's time step shrinks to 0.
The idea
We write
when can be made as close to as we like by taking close enough to , but not equal to . The value itself does not matter; it may not even exist.
For , factor the top: for every . So near 1 the function behaves like , and the limit is 2, even though is undefined. The graph is the line with a hole at .
Tables of values
A numerical table approaches from both sides:
def f(x):
return (x**2 - 1) / (x - 1)
print(" x f(x)")
for h in [0.1, 0.01, 0.001, 0.0001]:
print(f"{1 - h:<10} {f(1 - h):.6f}")
for h in [0.0001, 0.001, 0.01, 0.1]:
print(f"{1 + h:<10} {f(1 + h):.6f}") x f(x)
0.9 1.900000
0.99 1.990000
0.999 1.999000
0.9999 1.999900
1.0001 2.000100
1.001 2.001000
1.01 2.010000
1.1 2.100000
Both sides close in on 2. Tables are evidence, not proof, and they can mislead: with extremely close to , floating-point rounding takes over (try in a formula like ). Algebra, like the factoring above, confirms what the table suggests.
A famous limit
as also has the form , but no factoring helps. The table says the answer is 1:
import math
for x in [0.5, 0.1, 0.01, 0.001]:
print(f"x = {x:<6} sin(x)/x = {math.sin(x) / x:.10f}")x = 0.5 sin(x)/x = 0.9588510772
x = 0.1 sin(x)/x = 0.9983341665
x = 0.01 sin(x)/x = 0.9999833334
x = 0.001 sin(x)/x = 0.9999998333
The series explains it: , which tends to 1. This limit is the reason the small-angle approximation works, and it only holds with in radians.
One-sided limits and when limits fail
Sometimes the function approaches different values from the left and the right. We write (from below) and (from above). The two-sided limit exists only if both one-sided limits exist and agree.
| Function near | From the left | From the right | Limit |
|---|---|---|---|
| 1 | 1 | 1 | |
| −1 | 1 | does not exist (jump) | |
| grows without bound | |||
| does not exist | |||
| oscillates | oscillates | does not exist |
Writing is shorthand for "grows without bound"; it is not a number, so the limit does not exist in the strict sense. It signals a vertical asymptote, as in rational functions.
Limits at infinity
We can also ask what happens as grows without bound. as is 3: divide top and bottom by and the small terms vanish. That gives a horizontal asymptote . The same idea gave the limits of sequences.
In software: in simulations
A physics simulation advances in small time steps . Each step updates velocity and position with formulas like x += v * dt. The smaller , the closer the simulation gets to the exact motion: the exact answer is the limit as .
# Ball dropped from rest, g = 9.81. Exact: fallen distance after 2 s = 0.5*g*t^2 = 19.62 m
g, T = 9.81, 2.0
exact = 0.5 * g * T**2
for dt in [0.5, 0.1, 0.01, 0.001, 0.0001]:
x, v = 0.0, 0.0
for _ in range(round(T / dt)):
x += v * dt # explicit Euler step
v += g * dt
print(f"dt = {dt:<7} distance = {x:.5f} error = {exact - x:.5f}")
print("exact:", exact)dt = 0.5 distance = 14.71500 error = 4.90500
dt = 0.1 distance = 18.63900 error = 0.98100
dt = 0.01 distance = 19.52190 error = 0.09810
dt = 0.001 distance = 19.61019 error = 0.00981
dt = 0.0001 distance = 19.61902 error = 0.00098
exact: 19.62
Each tenfold smaller makes the error ten times smaller: the error is proportional to , so it goes to 0 in the limit. In practice cannot be tiny (the work grows like , and rounding errors add up), which is why game engines use a fixed, modest with better integrators (Integrators, Fixed Timestep).
Limits are the foundation of calculus: derivatives and integrals are both defined as limits. Next: Limits and Continuity. The deeper treatment is in Limits and, with the precise – definition, The Limit of a Function and Epsilon–Delta.
Exercises
Exercise 1: Factor and cancel
Find as .
Answer
6
Solution
Exercise 2: Table it
Make a table for near and guess the limit. Then confirm with algebra.
Answer
Solution
import math
for x in [0.1, 0.001, -0.001, -0.1]:
print(x, round((math.sqrt(x + 4) - 2) / x, 6))0.1 0.248457
0.001 0.249984
-0.001 0.250016
-0.1 0.251582
Exercise 3: One-sided
Let for and for . Find both one-sided limits at 2. Does the limit exist?
Answer
Left limit 3, right limit 3; yes, the limit is 3.
Solution
Exercise 4: At infinity
Find as .
Answer
2
Solution
Test yourself
is undefined. Can as still exist?
- No, never
- Yes: the limit only depends on values near 3, not at 3
- Only if is a polynomial
- Only if the limit is 0
What is as ( in radians)?
- 0
- 1
- It does not exist
A simulation's error halves every time is halved. What happens as ?
- The error tends to 0
- The error doubles
- The error stays constant
- The simulation becomes unstable