Sequences
A sequence is an infinite list and the central question is whether it settles down to a limit. This lesson gives the precise – definition, the rules that let you compute limits without it, and the Monotone Convergence Theorem with its proof, which is the tool for sequences defined by a recursion, the way most algorithms produce them.
The survey lesson Sequences covers notation and first examples; here we go into the proofs.
The precise definition
Formally, a sequence is a function , written . We say converges to , , if
Read it as a game: you name a tolerance , I must produce a point after which every term stays within of . If no such exists the sequence diverges; means for every there is an with for .
Example. Prove . We need , which holds whenever . So works. The proof is literally an algorithm that turns into :
from fractions import Fraction
import math
def a(n):
return Fraction(3*n + 1, n + 2)
for eps in [Fraction(1, 10), Fraction(1, 1000), Fraction(1, 10**6)]:
N = math.ceil(5 / eps - 2)
worst = max(abs(a(n) - 3) for n in range(N + 1, N + 200))
print(f"ε = {str(eps):9s} N = {N:8d} max |aₙ − 3| after N: {float(worst):.3e} < ε: {worst < eps}")ε = 1/10 N = 48 max |aₙ − 3| after N: 9.804e-02 < ε: True
ε = 1/1000 N = 4998 max |aₙ − 3| after N: 9.998e-04 < ε: True
ε = 1/1000000 N = 4999998 max |aₙ − 3| after N: 1.000e-06 < ε: True
Checking 200 terms is not a proof, of course; the inequality for all is. Since is decreasing, the first term after is the worst one, which is why the maximum sits just under .
Rules that save you the work
| Result | Statement |
|---|---|
| Functions | If and , then (so l'Hospital's rule applies to ) |
| Limit laws | sums, products, constant multiples and quotients (non-zero limit) of convergent sequences converge to the obvious limit |
| Squeeze | for and |
| Absolute value | |
| Continuity | and continuous at |
| Geometric | if , if ; diverges otherwise |
The converse of the first row fails: for every integer , so the sequence converges, but has no limit.
Proof that convergent sequences are bounded. Take : for , . The finitely many terms have a maximum absolute value, so for all . ∎ Boundedness is necessary but not sufficient: is bounded and diverges.
Example with the squeeze theorem. For write
because every factor after the first is at most 1. Since , .
Monotone sequences
A sequence is increasing if for all (non-decreasing with ), decreasing similarly, and monotonic if it is one of these. It is bounded above if for all .
Monotone Convergence Theorem. Every bounded, monotonic sequence converges.
Proof (increasing case). The set is non-empty and bounded above, so by the completeness axiom of it has a least upper bound . Given , is not an upper bound, so for some . For , monotonicity gives , hence and . ∎
Completeness is essential: in the rationals, the increasing bounded sequence has no limit, because is missing.
Recursive sequences
Take , . To use the theorem, prove two things by induction:
So exists. Pass to the limit in the recursion ( is continuous): , , (the root is ruled out because ). Notice the order: you may only solve after knowing that the limit exists. The recursion has "fixed point" but diverges from .
import math
a = 1.0
for n in range(1, 13):
if n in (1, 2, 3, 4, 6, 8, 12):
print(f"a_{n:<2d} = {a:.12f} error {2 - a:.2e}")
a = math.sqrt(2 + a)
# Newton's iteration for √2 converges much faster (quadratically)
x = 1.0
for k in range(1, 6):
x = (x + 2 / x) / 2
print(f"Newton step {k}: {x:.15f} error {abs(x - math.sqrt(2)):.1e}")a_1 = 1.000000000000 error 1.00e+00
a_2 = 1.732050807569 error 2.68e-01
a_3 = 1.931851652578 error 6.81e-02
a_4 = 1.982889722748 error 1.71e-02
a_6 = 1.998929174953 error 1.07e-03
a_8 = 1.999933067835 error 6.69e-05
a_12 = 1.999999738545 error 2.61e-07
Newton step 1: 1.500000000000000 error 8.6e-02
Newton step 2: 1.416666666666667 error 2.5e-03
Newton step 3: 1.414215686274510 error 2.1e-06
Newton step 4: 1.414213562374690 error 1.6e-12
Newton step 5: 1.414213562373095 error 2.2e-16
The first error shrinks by a factor of about 4 per step (linear convergence: has , and errors scale by ). Newton's error roughly squares at each step (quadratic convergence) until it hits the floating-point floor of about .
In software
- Iterative algorithms are sequences: Newton's method, gradient descent, PageRank's power iteration and value iteration in reinforcement learning all produce . Proving that loop terminates is proving the sequence converges, often with a monotone-and-bounded or a contraction argument.
- Stopping criteria like
abs(x_new - x) < tolare a practical stand-in for the – definition, and the convergence rate (linear vs quadratic) tells you how many iterations a tolerance costs. - Training curves: a loss that decreases and is bounded below by 0 must converge (Monotone Convergence Theorem), but possibly to a value that is not the minimum; see gradient descent.
Exercises
Exercise 1: Compute limits
Find the limits: a) , b) , c) .
Answer
a) , b) 1, c) 0.
Solution
Exercise 2: Find N
For , find an that works for in the definition of .
Answer
(any gives ).
Solution
also works ( gives ); any valid is fine.
Exercise 3: A recursive limit
Let and . Prove the sequence converges and find its limit.
Answer
It increases, is bounded above by 6, and converges to 6.
Solution
a = 2.0
for n in range(30):
a = (a + 6) / 2
print(a)5.99999999627471
The error halves each step: after 30 steps it is .
Exercise 4: Is it monotone?
Show that is decreasing for and find its limit. Then write a loop that finds the first with .
Answer
Decreasing, limit 0; the first with is .
Solution
n = 1
while n / 2**n >= 1e-6:
n += 1
print(n, n / 2**n)25 7.450580596923828e-07
Test yourself
Which sequence is bounded but divergent?
The Monotone Convergence Theorem relies on which property of ?
- Every number has a decimal expansion
- is countable
- Every non-empty set bounded above has a least upper bound
- Every polynomial has a root
For , why must you prove convergence before solving ?
- Because a divergent recursion can still have a fixed point
- Because is not continuous
- Because must be an integer
- You don't need to