26. Sequences and what convergence means

📖 Reading · 9 min
💡 Every code box below is live — edit it and hit Run.

Every limit so far has been a continuous variable approaching a value — x\to a, sliding smoothly along the real line. A sequence takes discrete steps instead: a_1,a_2,a_3,\ldots, indexed by whole numbers, with no values in between. This module asks the same question §1's limits asked — what happens as you get arbitrarily far along? — for a variable that can only move in jumps. It's also a hinge: everything from here through Module 8 builds toward representing functions as infinite sums, one of the most consequential ideas calculus contains.

Sequences as functions

A sequence is a function whose domain is the positive integers: a_n=f(n). Writing a_n=\frac1n or a_n=\frac{n}{n+1} describes the whole list at once, term by term. The question of interest is almost always: does a_n settle down to a single value as n grows, or does it not?

Defining the limit of a sequence

\lim_{n\to\infty}a_n=L

means: for every \varepsilon>0, there exists an integer N such that |a_n-L|<\varepsilon for all n>N. This is word-for-word §1.9's \varepsilon-\delta definition, with n>N (an integer threshold) taking the place of x near a (a real-number neighborhood) — the same "no matter how tight a tolerance you demand, eventually every term is within it" promise, just walked in discrete steps instead of slid continuously.

If no such L exists, the sequence diverges. Divergence comes in different flavors: a_n=n diverges by growing without bound; a_n=(-1)^n diverges by oscillating forever between -1 and 1, never settling anywhere at all.

Using limit laws and L'Hopital's rule

Because a sequence is a function evaluated only at integers, every technique from §1 and §3.3 for computing \lim_{x\to\infty}f(x) applies directly to \lim_{n\to\infty}a_n: sum, product, and quotient laws (§1.1) all carry over, and L'Hopital's rule (§3.3) applies by treating n as a continuous variable x, differentiating, and then restricting back to integers at the end — the limit of the continuous version, if it exists, forces the sequence's limit to match.

a_n=\frac{\ln n}{n}\quad\xrightarrow{\text{L'Hopital, treating }n\text{ as }x}\quad\lim_{x\to\infty}\frac{1/x}{1}=0\qquad\Longrightarrow\qquad\lim_{n\to\infty}\frac{\ln n}n=0

One sequence limit worth knowing on sight, because it will reappear throughout this module and the next:

\lim_{n\to\infty}\left(1+\frac1n\right)^n=e

— the same e from §2.6, arising here as a sequence limit rather than as a compounding-interest thought experiment, though it's really the identical idea: compounding interest infinitely often is this exact sequence.

Doing it in Python

Watching a_n=\left(1+\frac1n\right)^n close in on e:

from math import e

print(f"{'n':>8} {'a_n':>12} {'|a_n - e|':>12}")
for n in (10, 100, 1000, 10000, 100000):
    a_n = (1 + 1/n)**n
    print(f"{n:>8} {a_n:>12.6f} {abs(a_n - e):>12.6f}")

print(f"\ne = {e:.6f}")

Comparing a convergent sequence to a divergent-by-oscillation one, side by side:

print(f"{'n':>4} {'1/n':>10} {'(-1)^n':>10}")
for n in range(1, 11):
    print(f"{n:>4} {1/n:>10.4f} {(-1)**n:>10}")

print("\n1/n settles toward 0 -- convergent")
print("(-1)^n never settles anywhere -- divergent by oscillation")

Checking a limit with L'Hopital's rule via SymPy, treating n as a continuous variable:

import sympy as sp

n = sp.Symbol('n', positive=True)
a_n = sp.ln(n) / n

limit = sp.limit(a_n, n, sp.oo)
print(f"lim (ln n)/n as n -> oo = {limit}")

Worked example

Determine whether a_n=\dfrac{3n^2+2n}{n^2+5} converges, and find its limit if so.

Divide numerator and denominator by the highest power of n present, n^2 — the same technique §1.6 used for limits at infinity:

a_n=\frac{3n^2+2n}{n^2+5}=\frac{3+\frac2n}{1+\frac5{n^2}}

As n\to\infty, \frac2n\to0 and \frac5{n^2}\to0:

\lim_{n\to\infty}a_n=\frac{3+0}{1+0}=\boxed3

Sanity check. For large n, the 2n and 5 terms are dwarfed by 3n^2 and n^2 respectively, so a_n\approx\frac{3n^2}{n^2}=3 — matching. ✓ Plugging in n=1000: \frac{3{,}002{,}000}{1{,}000{,}005}\approx3.001985, already within 0.07\% of 3.

Your turn

1. Determine whether a_n=\dfrac{n}{2^n} converges, and find its limit (hint: L'Hopital, treating n as continuous, or recall which grows faster — exponentials or polynomials, from §1.6).

2. Determine whether a_n=\sin\!\left(\dfrac{n\pi}2\right) converges.

3. True or false: if a_n\to L, then every subsequence (a sequence formed by picking out some of the terms, in order) also converges to L.

Solutions

1. Treating n as continuous, \frac{x}{2^x}=\frac{x}{e^{x\ln2}} — an exponential in the denominator against a polynomial in the numerator. §1.6 established exponentials dominate polynomials, so:

\lim_{n\to\infty}\frac{n}{2^n}=\boxed0

By L'Hopital directly: \lim\frac{1}{2^x\ln2}=0, confirming it.

2. The sequence cycles: a_1=\sin\frac\pi2=1, a_2=\sin\pi=0, a_3=\sin\frac{3\pi}2=-1, a_4=\sin2\pi=0, a_5=1,\ldots — a repeating pattern 1,0,-1,0,1,0,-1,0,\ldots that never settles on one value. Diverges by oscillation, the same flavor of divergence as (-1)^n.

3. True. This is actually the more useful direction of a deeper fact: if a sequence converges to L, every subsequence must converge to the same L, because the full definition's "eventually within \varepsilon" promise applies to the whole tail, and any subsequence is still infinitely far out in that same tail. (The converse is false and is exactly how problem 2's divergence gets proven rigorously: the subsequence of even-indexed terms converges to 0 while the subsequence of terms at n\equiv1\pmod4 converges to 1 — two different subsequence limits is enough to prove the full sequence has no limit at all.)

Check yourself in code

Compute a_n=\left(1+\frac1n\right)^n for n=10,100,1000,10000,100000 and print each value alongside its distance from e.

Print exactly this:

      10     2.593742     0.124539
     100     2.704814     0.013468
    1000     2.716924     0.001358
   10000     2.718146     0.000136
  100000     2.718268     0.000014
from math import e

for n in (10, 100, 1000, 10000, 100000):
    a_n = (1 + 1/n)**n
    # print n, a_n to 6 decimals, and |a_n - e| to 6 decimals, right-aligned
    print(...)
from math import e

for n in (10, 100, 1000, 10000, 100000):
    a_n = (1 + 1/n)**n
    print(f"{n:>8} {a_n:>12.6f} {abs(a_n - e):>12.6f}")

A sequence is a function sampled only at the integers, and its limit uses the identical \varepsilon-N structure as §1.9's \varepsilon-\delta limits, walked in discrete steps. Every limit law and L'Hopital's rule transfer over unchanged, and one particular limit — \left(1+\frac1n\right)^n\to e — will keep resurfacing through this module. Convergence, when it happens, is unconditional: every subsequence of a convergent sequence inherits the same limit, which is precisely the tool used to prove divergence when a sequence oscillates.

Next: a special class of sequences — always increasing or always decreasing — for which convergence can be guaranteed without ever computing the limit directly.