A Study in Limits, Cardinality & the Zeros of Zeta

Taylor. Cantor. Riemann.

How an infinite sum learns to speak for a function, how one infinity was found to outweigh another, and why every known zero of ζ stands on a single vertical line.

The critical strip  0 < Re(s) < 1  ·  zeros shown to scale on Re(s) = ½
I

Taylor Series & the Question of Convergence

A polynomial of infinite degree, built entirely from what a function does at a single point — and the surprisingly delicate question of where that construction can be trusted.

Suppose a function \(f\) is infinitely differentiable at a point \(a\). Then everything about \(f\)'s local behavior — its value, slope, curvature, and every higher-order wiggle — is recorded in the list of numbers \(f(a), f'(a), f''(a), \dots\) The Taylor series is the audacious claim that this list, gathered at one single point, might reconstruct the function everywhere nearby.

Definition — Taylor series

The Taylor series of \(f\) centered at \(a\) is the power series

$$ T_f(x) \;=\; \sum_{n=0}^{\infty} \frac{f^{(n)}(a)}{n!}\,(x-a)^n \;=\; f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots $$

When \(a = 0\) it is called a Maclaurin series. The degree-\(N\) truncation \(T_N(x)\) is the Taylor polynomial — the unique polynomial of degree \(\le N\) whose first \(N\) derivatives at \(a\) agree with those of \(f\).

Why those coefficients?

The formula is not arbitrary. Assume for a moment that \(f\) can be written as a power series \(f(x) = \sum c_n (x-a)^n\) that may be differentiated term by term. Setting \(x = a\) kills every term but the first, so \(c_0 = f(a)\). Differentiate once and set \(x=a\): \(c_1 = f'(a)\). Differentiate \(n\) times and the surviving constant term is \(n!\,c_n\), giving

$$ c_n = \frac{f^{(n)}(a)}{n!}. $$

So if a function has a power series representation, the Taylor coefficients are the only possible choice. The real question — the one this whole section turns on — is whether the resulting series converges, and if so, whether it converges to \(f\). Those are genuinely separate questions, and both can fail.

Taylor's theorem and the remainder

The bridge between the polynomial and the function is the remainder term \(R_N(x) = f(x) - T_N(x)\). Taylor's theorem pins it down.

Theorem — Taylor with Lagrange remainder

If \(f\) is \((N{+}1)\)-times differentiable on an interval containing \(a\) and \(x\), then there exists some \(\xi\) strictly between \(a\) and \(x\) with

$$ f(x) = \sum_{n=0}^{N} \frac{f^{(n)}(a)}{n!}(x-a)^n \;+\; \underbrace{\frac{f^{(N+1)}(\xi)}{(N+1)!}\,(x-a)^{N+1}}_{R_N(x)} . $$

The remainder looks exactly like “the next term,” except the derivative is evaluated at an unknown intermediate point \(\xi\). It generalizes the Mean Value Theorem, which is precisely the case \(N = 0\).

The Taylor series converges to \(f(x)\) exactly when \(R_N(x) \to 0\) as \(N \to \infty\). For a function like \(e^x\), whose derivatives on any bounded interval are uniformly bounded by some constant \(M\), the estimate

$$ |R_N(x)| \;\le\; \frac{M\,|x-a|^{N+1}}{(N+1)!} \;\longrightarrow\; 0 $$

settles everything: the factorial in the denominator crushes the geometric growth in the numerator, for every \(x\). Functions like this — equal to their Taylor series on the whole line — are called entire when viewed over \(\mathbb{C}\).

The radius of convergence

Most power series are not so generous. A power series \(\sum c_n (x-a)^n\) has a precise domain of convergence, and its shape is always the same: an interval (over \(\mathbb{R}\)) or a disk (over \(\mathbb{C}\)) centered at \(a\).

Theorem — Cauchy–Hadamard

For every power series there is a unique \(R \in [0, \infty]\), the radius of convergence, given by

$$ \frac{1}{R} \;=\; \limsup_{n \to \infty} |c_n|^{1/n}, $$

such that the series converges absolutely for \(|x-a| < R\) and diverges for \(|x-a| > R\). On the boundary \(|x-a| = R\) anything can happen, and each boundary point must be examined by hand.

In practice the ratio test does the work: if \(\lim |c_{n+1}/c_n| = L\) exists, then \(R = 1/L\). The three-way boundary behavior is worth internalizing through the classic trio, all with \(R = 1\):

A working bestiary

SeriesExpansion at 0RadiusBoundary notes
\(e^x\)\(\sum_{n\ge0} \dfrac{x^n}{n!}\)\(\infty\)Entire; converges everywhere, fast.
\(\sin x\)\(\sum_{k\ge0} \dfrac{(-1)^k x^{2k+1}}{(2k+1)!}\)\(\infty\)Entire; only odd powers.
\(\cos x\)\(\sum_{k\ge0} \dfrac{(-1)^k x^{2k}}{(2k)!}\)\(\infty\)Entire; only even powers.
\(\dfrac{1}{1-x}\)\(\sum_{n\ge0} x^n\)\(1\)Diverges at both endpoints; pole at \(x=1\).
\(\ln(1+x)\)\(\sum_{n\ge1} \dfrac{(-1)^{n+1} x^n}{n}\)\(1\)Converges (conditionally) at \(x=1\): \(\ln 2\). Diverges at \(x=-1\).
\(\arctan x\)\(\sum_{k\ge0} \dfrac{(-1)^k x^{2k+1}}{2k+1}\)\(1\)Converges at \(x = \pm 1\); at \(x=1\) gives Leibniz's \(\pi/4\).
\((1+x)^\alpha\)\(\sum_{n\ge0} \binom{\alpha}{n} x^n\)\(1\)*Newton's binomial series; \(R=\infty\) if \(\alpha \in \mathbb{N}\).

Interactive — watch the polynomials converge

Below, the pale curve is the true function; the bright one is its Taylor polynomial \(T_N\) at \(0\). Drag \(N\) upward. For \(e^x\) and \(\sin x\) the polynomial hugs the function further and further out with no obstruction. For \(1/(1-x)\), \(\ln(1+x)\), and \(\arctan x\), the fit becomes essentially perfect inside \(|x|<1\) — shaded — and then catastrophically wrong outside it, no matter how large \(N\) grows. The wall at \(R=1\) is absolute.

Taylor Approximator — TN against f

When Taylor lies: smooth but not analytic

Infinite differentiability is not enough. The standard counterexample deserves to be seen in full:

$$ g(x) = \begin{cases} e^{-1/x^2} & x \neq 0 \\ 0 & x = 0 \end{cases} $$

Every derivative of \(g\) at \(0\) exists and equals \(0\) — near the origin the function is flatter than any polynomial can detect. Its Maclaurin series is therefore the zero series, which converges beautifully everywhere… to the wrong function. \(g\) is smooth (\(C^\infty\)) but not analytic at \(0\): its Taylor series converges, yet not to \(g\), on any neighborhood of the origin. Convergence of the series and representation of the function are independent demands.

The mystery a real variable cannot explain

Expand \(f(x) = \dfrac{1}{1+x^2}\) about \(0\): the series \(1 - x^2 + x^4 - \cdots\) has radius exactly \(1\). But \(f\) is flawless on the entire real line — no pole, no kink, nothing at \(x = \pm 1\) to blame. Why does the series die there?

The answer lives off the real axis. In the complex plane, \(f(z) = 1/(1+z^2)\) has poles at \(z = \pm i\), each at distance exactly \(1\) from the origin. A power series converges on the largest disk that avoids every singularity, and the disk of radius \(1\) is precisely the one that grazes \(\pm i\). Real Taylor series secretly obey complex geography. This is the first hint of a theme that dominates Part III: to understand a function on the line, one must follow it into the plane.

Operations that preserve the radius

Inside its open disk of convergence, a power series is as well-behaved as a polynomial: it may be differentiated and integrated term by term, and the radius does not change. This is how the \(\arctan\) series is honestly derived — integrate the geometric series for \(1/(1+t^2)\) from \(0\) to \(x\):

$$ \arctan x = \int_0^x \frac{dt}{1+t^2} = \int_0^x \sum_{k\ge0} (-1)^k t^{2k}\,dt = \sum_{k\ge0} \frac{(-1)^k x^{2k+1}}{2k+1}, \qquad |x| < 1. $$

Abel's theorem then extends the equality to the boundary point \(x=1\) where the series still converges, yielding \(\frac{\pi}{4} = 1 - \frac13 + \frac15 - \cdots\) — a formula of great beauty and legendarily terrible numerics (it needs on the order of \(10^6\) terms for six digits; the Octave lab in Part IV measures this).

Uniform convergence, briefly but honestly

Pointwise convergence of \(T_N \to f\) is weaker than it looks: it permits the error to survive indefinitely, merely relocating as \(N\) grows. The stronger notion, uniform convergence on a set \(S\), demands \(\sup_{x \in S} |f(x) - T_N(x)| \to 0\): one \(N\) works for every \(x\) simultaneously. Power series deliver this on every closed subinterval \([a - r, a + r]\) with \(r < R\), which is exactly why term-by-term calculus is legal there. Uniformity fails, in general, on the full open interval — the geometric series converges pointwise on \((-1,1)\) but its error near the endpoints is unbounded at every fixed \(N\), which is the wall you can watch in the widget above.

II

Cantor & the Hierarchy of the Infinite

Georg Cantor asked a question so simple it had never been asked properly: are all infinite collections the same size? The answer — no — rebuilt the foundations of mathematics.

Part I trusted the real line to hold the limits of convergent series. But what is the real line? In the 1870s, while working on the convergence of trigonometric series (Taylor's Fourier-flavored cousins), Cantor was forced to confront the structure of \(\mathbb{R}\) itself — and discovered that infinity comes in genuinely different sizes.

Definition — same cardinality

Two sets \(A\) and \(B\) have the same cardinality, written \(|A| = |B|\), if there exists a bijection between them — a pairing that matches every element of \(A\) with exactly one element of \(B\), leaving nothing out on either side. A set is countable if it is finite or has the same cardinality as \(\mathbb{N} = \{1, 2, 3, \dots\}\); that is, if its elements can be arranged in a single infinite list.

Surprising equalities: ℤ and ℚ are no bigger than ℕ

Counting the integers is a matter of interleaving: \(0, 1, -1, 2, -2, 3, -3, \dots\) — a perfectly good list, so \(|\mathbb{Z}| = |\mathbb{N}|\). The rationals feel far denser: between any two of them lie infinitely many more. Yet they, too, can be listed. Arrange all fractions \(p/q\) in a grid — numerators across, denominators down — and walk the diagonals: \(\frac11, \frac21, \frac12, \frac13, \frac22, \frac31, \frac41, \dots\), skipping repeats. Every rational is reached in finitely many steps. Density is a statement about order; cardinality ignores order entirely, and by its measure

$$ |\mathbb{N}| = |\mathbb{Z}| = |\mathbb{Q}| = \aleph_0, $$

the first infinite cardinal, aleph-nought. At this point one might reasonably conjecture that all infinite sets are countable — that infinity is simply infinity. Cantor's 1874 paper, and more famously his 1891 diagonal argument, destroyed that conjecture.

The diagonal argument

Theorem — Cantor, 1891

The set of real numbers in \((0,1)\) is uncountable: no list of real numbers can contain them all.

Proof. Suppose someone hands you an alleged complete list \(r_1, r_2, r_3, \dots\) of the reals in \((0,1)\), each written as an infinite decimal. Construct a new number \(d\) by sabotage: for its \(n\)-th digit, look at the \(n\)-th digit of \(r_n\) — the entries running down the diagonal of the list — and choose something different (avoiding 0 and 9 to sidestep dual representations like \(0.4999\ldots = 0.5\)). Then \(d\) differs from \(r_1\) in the first digit, from \(r_2\) in the second, from \(r_n\) in the \(n\)-th. It appears nowhere on the list. The list was never complete, and no list can be. \(\blacksquare\)

The proof is constructive sabotage: it does not merely say a missing number exists, it builds one from any proposed list. Watch it operate:

Diagonalization Engine
Rule applied: each diagonal digit \(k \mapsto k+1\), with 8, 9 \(\mapsto\) 1.

Cantor's theorem: the ladder never ends

Uncountability is not a one-off anomaly. The diagonal idea generalizes into a machine that manufactures ever-larger infinities.

Theorem — Cantor

For every set \(S\), the power set \(\mathcal{P}(S)\) — the set of all subsets of \(S\) — satisfies \(|\mathcal{P}(S)| > |S|\).

Proof. Given any function \(f : S \to \mathcal{P}(S)\), form the diagonal set \(D = \{\, x \in S : x \notin f(x) \,\}\). If \(D = f(y)\) for some \(y\), then \(y \in D \iff y \notin f(y) = D\) — a contradiction. So no \(f\) is surjective. \(\blacksquare\)

Iterating gives an unending tower \( |\mathbb{N}| < |\mathcal{P}(\mathbb{N})| < |\mathcal{P}(\mathcal{P}(\mathbb{N}))| < \cdots \) There is no largest infinity. Since infinite binary sequences encode subsets of \(\mathbb{N}\) and also encode reals, one obtains the fundamental identity

$$ |\mathbb{R}| \;=\; |\mathcal{P}(\mathbb{N})| \;=\; 2^{\aleph_0} \;=\; \mathfrak{c}, $$

the cardinality of the continuum.

The Continuum Hypothesis

Cantor conjectured that no set has cardinality strictly between \(\aleph_0\) and \(\mathfrak{c}\) — i.e., \(\mathfrak{c} = \aleph_1\), the very next infinite cardinal. He pursued a proof for decades; it became Hilbert's Problem #1 in 1900. The resolution is one of the strangest results in mathematics: Gödel (1940) showed CH cannot be disproved from the standard ZFC axioms, and Cohen (1963), inventing the method of forcing, showed it cannot be proved from them either. CH is independent of the axioms of set theory: the standard foundations of mathematics simply do not decide it. Compare Part III — the Riemann Hypothesis is also unresolved, but no one seriously expects it to be independent; it is expected to be true and provable, merely beyond us so far.

The Cantor set: small and enormous at once

Cantor also built the first genuinely strange subset of the line. Start with \([0,1]\). Delete the open middle third \((\frac13, \frac23)\). From each of the two remaining pieces, delete its open middle third. Repeat forever. What survives is the Cantor set \(\mathcal{C}\).

Its measure is easy: after \(n\) steps the remaining length is \((2/3)^n \to 0\), so \(\mathcal{C}\) has Lebesgue measure zero. Its cardinality is the shock: a point survives forever precisely when its base-3 expansion uses only the digits 0 and 2, so the survivors correspond to all infinite binary sequences (read 2 as 1) — and by the diagonal argument that set is uncountable, with cardinality \(\mathfrak{c}\), the same as the whole interval it was carved from. The Cantor set contains no interval at all, has zero total length, and yet has exactly as many points as \(\mathbb{R}\).

It is also perfectly self-similar: \(\mathcal{C}\) is two copies of itself scaled by \(\frac13\), which gives it fractal (Hausdorff) dimension

$$ \dim \mathcal{C} = \frac{\ln 2}{\ln 3} \approx 0.6309\ldots $$

— strictly between a point (dimension 0) and a line (dimension 1).

Cantor Set Constructor — middle thirds, iterated

A companion curiosity worth knowing: integrating “along” the Cantor set produces the Cantor function (the devil's staircase) — continuous, non-decreasing, climbing from 0 to 1, yet with derivative zero almost everywhere. All of its rise happens on a set of measure zero. Analysis after Cantor had to learn to live with such objects, and measure theory — the foundation beneath modern integration, and ultimately beneath the analytic machinery of Part III — was largely built to cope with them.

Why this mattered beyond set theory

III

The Riemann Hypothesis

One function, one line, one sentence written in 1859 — and the deepest unsolved problem in mathematics, on which the fine structure of the prime numbers depends.

The two earlier parts assemble here. From Part I: a power series lives on a disk whose edge is set by invisible complex singularities, so real questions demand complex functions. From Part II: the real line is a completed, rigorous continuum on which analysis can be trusted. Now take the most innocent-looking series in mathematics and follow it into the complex plane.

The zeta function and Euler's golden key

For a real number \(s > 1\), define

$$ \zeta(s) \;=\; \sum_{n=1}^{\infty} \frac{1}{n^s} \;=\; 1 + \frac{1}{2^s} + \frac{1}{3^s} + \frac{1}{4^s} + \cdots $$

At \(s = 2\) it equals \(\pi^2/6\) — Euler's solution of the Basel problem, 1735. At \(s = 1\) it is the harmonic series and diverges. So far, pure Part I material: a Dirichlet series with an abscissa of convergence at \(\mathrm{Re}(s) = 1\). Euler's deeper discovery is that this analytic object secretly knows arithmetic:

Euler product, 1737
$$ \zeta(s) \;=\; \prod_{p \text{ prime}} \frac{1}{1 - p^{-s}}, \qquad \mathrm{Re}(s) > 1. $$

Expand each factor as a geometric series \(1 + p^{-s} + p^{-2s} + \cdots\) (Part I again) and multiply out: every \(n^{-s}\) appears exactly once, because every integer factors into primes exactly once. The identity is the Fundamental Theorem of Arithmetic, transcribed into analysis. Since the harmonic series diverges, the product at \(s=1\) must diverge too — an analytic proof that there are infinitely many primes, with quantitative teeth Euclid's proof never had: \(\sum_p 1/p\) diverges.

Analytic continuation: the function beyond the series

The series defines \(\zeta\) only for \(\mathrm{Re}(s) > 1\), just as \(\sum x^n\) defines \(1/(1-x)\) only for \(|x|<1\) — while the function \(1/(1-x)\) itself sensibly exists everywhere except \(x=1\). The same extension is possible here, and it is unique (a consequence of the identity theorem for analytic functions: two analytic functions agreeing on any small region agree everywhere they are both defined). Riemann showed that \(\zeta\) continues to a function analytic on the entire complex plane except for a single simple pole at \(s = 1\).

A first step is elementary. The alternating series \(\eta(s) = \sum_{n \ge 1} (-1)^{n-1} n^{-s}\) converges for all \(\mathrm{Re}(s) > 0\), and a two-line computation gives

$$ \zeta(s) \;=\; \frac{\eta(s)}{1 - 2^{1-s}}, $$

extending \(\zeta\) to the right half-plane \(\mathrm{Re}(s) > 0\) minus the pole. (This identity, plus a convergence-acceleration trick from Part I's toolbox, is exactly how the interactive below and the Octave script in Part IV compute \(\zeta\) on the critical line.) Riemann went further with the functional equation:

$$ \zeta(s) \;=\; 2^s \pi^{s-1} \sin\!\Big(\frac{\pi s}{2}\Big)\, \Gamma(1-s)\, \zeta(1-s), $$

a mirror symmetry exchanging \(s \leftrightarrow 1 - s\) across the vertical line \(\mathrm{Re}(s) = \frac12\). Two immediate consequences:

The Riemann Hypothesis, 1859

Every nontrivial zero of \(\zeta(s)\) has real part exactly \(\tfrac{1}{2}\).

Riemann's own words were almost offhand: it is very probable that all roots are real (he phrased it via an auxiliary function \(\Xi\)); one would wish for a rigorous proof, but he set the search aside “after some fleeting futile attempts” as unnecessary for his immediate purpose. The remark has now resisted proof for 167 years, survived the retirement of Hilbert's other problems around it, and carries a Clay Millennium Prize of one million dollars.

Interactive — walking the critical line

The plot traces \(|\zeta(\tfrac12 + it)|\) as \(t\) climbs. Each time the curve touches zero, you are standing on a nontrivial zero of \(\zeta\). The panel on the right shows the value \(\zeta(\tfrac12+it)\) as a point in the complex plane, dragging a comet-tail of recent values: at each zero, the path threads exactly through the origin. The first zeros sit at \(t \approx 14.1347,\ 21.0220,\ 25.0109,\ 30.4249,\ 32.9351, \dots\) — irregular, unpredicted, and (as far as \(10^{13}\) zeros of direct verification can say) all exactly on the line.

Zeta Explorer — |ζ(½ + it)| and its path through ℂ

What the zeros are for: the music of the primes

Riemann's 1859 paper was not about zeros for their own sake; it was titled On the Number of Primes Less Than a Given Magnitude. Let \(\pi(x)\) count the primes up to \(x\). Gauss, as a teenager, had conjectured from tables that \(\pi(x)\) grows like the logarithmic integral

$$ \pi(x) \;\sim\; \mathrm{Li}(x) = \int_2^x \frac{dt}{\ln t}, $$

which was finally proved in 1896 (Hadamard and de la Vallée Poussin, independently) as the Prime Number Theorem — crucially, by showing \(\zeta\) has no zeros on the line \(\mathrm{Re}(s) = 1\). The connection runs through Riemann's explicit formula, which in von Mangoldt's form reads

$$ \psi(x) \;=\; x \;-\; \sum_{\rho} \frac{x^{\rho}}{\rho} \;-\; \ln 2\pi \;-\; \tfrac12 \ln\!\big(1 - x^{-2}\big), $$

where \(\psi(x) = \sum_{p^k \le x} \ln p\) is a weighted prime count and the sum runs over the nontrivial zeros \(\rho\). Read it as a Fourier decomposition: the primes are the smooth main term \(x\) plus one oscillating wave \(x^\rho/\rho = x^{\beta} e^{i\gamma \ln x}/\rho\) for each zero \(\rho = \beta + i\gamma\). The imaginary part \(\gamma\) sets the wave's frequency; the real part \(\beta\) sets its amplitude \(x^\beta\). The zeros are, quite literally, the spectrum of the primes — their harmonics.

Why Re(ρ) = ½ is the best of all worlds

If every zero has \(\beta = \frac12\), every corrective wave has amplitude \(\sqrt{x}\) — the smallest the symmetry of the functional equation permits — and one gets the sharpest possible error bound: RH is equivalent to

$$ \big|\pi(x) - \mathrm{Li}(x)\big| \;\le\; \frac{1}{8\pi} \sqrt{x}\, \ln x \qquad (x \ge 2657), $$

(Schoenfeld's explicit version). A single zero drifting off the line would mean one rogue frequency sounding louder than all the rest — a structural bias in how primes fall, persisting at arbitrarily large scales. RH is the statement that the primes are as fairly, as randomly distributed as they can possibly be: pseudo-randomness written as the geometry of a single vertical line.

Prime Counting — π(x) vs Li(x) vs x/ln x

The state of the evidence

YearResultMeaning
1896Hadamard, de la Vallée PoussinNo zeros on \(\mathrm{Re}(s)=1\) ⇒ Prime Number Theorem.
1914HardyInfinitely many zeros lie exactly on the critical line.
1942–Selberg; Levinson; Conrey (1989)A positive proportion — ultimately more than 40% — of all zeros are on the line.
1973Montgomery (with Dyson's remark)Pair correlation of zeros matches eigenvalues of random Hermitian matrices (GUE) — the statistics of heavy-nucleus energy levels.
1980s–OdlyzkoMassive computations at heights near the \(10^{20}\)-th zero: GUE agreement to remarkable precision.
2004Gourdon–DemichelFirst \(10^{13}\) nontrivial zeros verified on the line, without exception.
1974/2015DeligneThe analogue of RH for zeta functions of varieties over finite fields is a theorem — the strongest structural reason for belief.

The Montgomery–Odlyzko phenomenon feeds the oldest serious strategy, the Hilbert–Pólya conjecture: find a self-adjoint operator whose eigenvalues are the heights \(\gamma\) of the zeros. Self-adjointness would force the eigenvalues real — and RH would follow the way a spectral theorem follows, with the zeros as the energy levels of some yet-unknown quantum system. No such operator has been found; the random-matrix statistics are exactly what one would expect if it exists.

Equivalent formulations — many doors, one room

And the stakes are practical as well as aesthetic: hundreds of published theorems begin “Assume RH.” A proof ratifies an entire shadow literature at a stroke; a disproof — one verified zero off the line — deletes it, and with it our best quantitative grip on the primes that underwrite, among other things, the public-key cryptography that secures the modern internet.

IV

GNU Octave Lab

Four self-contained scripts — one per thread of the guide, plus a finale. Each runs as-is: save as the given filename and execute from the Octave prompt. Tested conventions: no toolboxes required, plots use core plot/stairs only.

Lab 1 — Taylor convergence and the wall at R = 1

Measures how the Taylor error decays for an entire function versus how it explodes outside the radius of convergence, and times the infamous slowness of the Leibniz series for \(\pi\).

taylor_convergence.mGNU Octave
% taylor_convergence.m
% Part I lab: remainder decay, radius of convergence, and Leibniz's pi.

clear; close all;

% ---- 1. Entire function: e^x. Error vs degree N at x = 3 -------------
x = 3;
N = 0:25;
approx = cumsum(x.^N ./ factorial(N));   % partial sums T_N(3)
err = abs(approx - exp(x));

figure(1);
semilogy(N, err, 'o-', 'linewidth', 1.5);
grid on;
xlabel('degree N'); ylabel('|e^3 - T_N(3)|');
title('Factorial beats geometric: error for e^x at x = 3');

% ---- 2. The wall: ln(1+x) inside and outside R = 1 -------------------
xs = [0.5, 0.9, 0.99, 1.5];              % last one is OUTSIDE the radius
Nmax = 60;
E = zeros(numel(xs), Nmax);
for i = 1:numel(xs)
  n = (1:Nmax)';
  terms = (-1).^(n+1) .* xs(i).^n ./ n;  % series for ln(1+x)
  E(i,:) = abs(cumsum(terms)' - log(1 + xs(i)));
end

figure(2);
semilogy(1:Nmax, E, 'linewidth', 1.5);
grid on;
legend('x = 0.5', 'x = 0.9', 'x = 0.99', 'x = 1.5 (diverges)', ...
       'location', 'northwest');
xlabel('degree N'); ylabel('|ln(1+x) - T_N(x)|');
title('Convergence dies at the radius: ln(1+x), R = 1');

% ---- 3. Leibniz: pi/4 = 1 - 1/3 + 1/5 - ...  (beautiful, terrible) ---
K = 1e6;
k = (0:K-1)';
leibniz = 4 * cumsum((-1).^k ./ (2*k + 1));
digits_ok = -log10(abs(leibniz - pi));

printf('Leibniz after %d terms:  pi ~ %.10f  (%.1f correct digits)\n', ...
       K, leibniz(end), digits_ok(end));
printf('Machin-like check: 4*atan(1) = %.15f\n', 4*atan(1));

% Error shrinks like 1/N: each extra digit costs ~10x the terms.
figure(3);
loglog(1:K, abs(leibniz - pi), 'linewidth', 1.2); grid on;
xlabel('terms N'); ylabel('|4 \Sigma - \pi|');
title('Leibniz series: error \sim 1/N');

Lab 2 — The Cantor set, its measure, and its dimension

Builds the middle-thirds construction as a list of intervals, plots the stages, and verifies numerically that the surviving length \((2/3)^n \to 0\) while the box-counting dimension approaches \(\ln 2/\ln 3\).

cantor_set.mGNU Octave
% cantor_set.m
% Part II lab: middle-thirds Cantor set -- construction, measure, dimension.

clear; close all;

depth = 9;
segs = [0 1];                       % rows: [left right]
figure(1); hold on;

for level = 0:depth
  % draw current stage as horizontal bars
  y = -level;
  for r = 1:rows(segs)
    plot(segs(r,:), [y y], 'linewidth', 4);
  end

  % report remaining measure
  len = sum(segs(:,2) - segs(:,1));
  printf('level %d: %6d intervals, total length %.6f  (=(2/3)^%d = %.6f)\n', ...
         level, rows(segs), len, level, (2/3)^level);

  % subdivide: keep outer thirds of every interval
  L = segs(:,1);  R = segs(:,2);  w = (R - L) / 3;
  segs = [ [L, L+w] ; [R-w, R] ];
  segs = sortrows(segs);
end

axis([0 1 -depth-0.5 0.5]); axis off;
title('Cantor middle-thirds construction, levels 0..9');

% ---- Box-counting dimension estimate ---------------------------------
% At level n the set is covered by 2^n boxes of size (1/3)^n:
n = (1:depth)';
dim_est = log(2.^n) ./ log(3.^n);   % constant, but compute it honestly
printf('\nBox-counting dimension estimate: %.6f\n', dim_est(end));
printf('Exact value ln(2)/ln(3):         %.6f\n', log(2)/log(3));

% ---- Cardinality demo: random base-3 survivor ------------------------
% A point survives iff its base-3 digits avoid 1. Build one from random bits:
bits = randi([0 1], 1, 52);
x = sum(2 * bits .* 3.^(-(1:52)));  % digits in {0,2} -> a Cantor point
printf('\nA (pseudo)random Cantor-set point: %.15f\n', x);

Lab 3 — Zeta on the critical line

Computes \(\zeta(\tfrac12+it)\) via the eta function with Cohen–Rodriguez Villegas–Zagier convergence acceleration — the same algorithm running in the interactive above — then locates the first zeros by sign changes of the phase-corrected magnitude and prints them next to the published values.

zeta_critical_line.mGNU Octave
% zeta_critical_line.m
% Part III lab: zeta(1/2 + it) via accelerated eta; locate the first zeros.

clear; close all;

function z = zeta_cvz(s, n)
  % Cohen-Rodriguez Villegas-Zagier acceleration of
  % eta(s) = sum (-1)^(k-1) / k^s, then zeta = eta / (1 - 2^(1-s)).
  % Valid for real(s) > 0, s != 1. n ~ 70 is ample for |imag(s)| <= 60.
  d = (3 + sqrt(8))^n;  d = (d + 1/d) / 2;
  b = -1;  c = -d;  z = 0;
  for k = 0:n-1
    c = b - c;
    z = z + c * (k+1)^(-s);          % complex power via exp/log internally
    b = (k + n) * (k - n) * b / ((k + 0.5) * (k + 1));
  end
  z = (z / d) / (1 - 2^(1 - s));
end

% ---- Sample the critical line ----------------------------------------
t  = 0:0.02:60;
zc = arrayfun(@(tt) zeta_cvz(0.5 + 1i*tt, 70), t);
m  = abs(zc);

figure(1);
plot(t, m, 'linewidth', 1.4); grid on;
xlabel('t'); ylabel('|\zeta(1/2 + it)|');
title('The critical line: every touch of zero is a nontrivial zero');

% ---- Find zeros: local minima of |zeta| below a tolerance ------------
published = [14.134725 21.022040 25.010858 30.424876 32.935062 ...
             37.586178 40.918719 43.327073 48.005151 49.773832];
zeros_found = [];
for k = 2:numel(t)-1
  if m(k) < m(k-1) && m(k) < m(k+1) && m(k) < 0.08
    % refine by parabolic interpolation through the three points
    a = m(k-1); b0 = m(k); c0 = m(k+1); h = t(2)-t(1);
    shift = 0.5 * h * (a - c0) / (a - 2*b0 + c0);
    zeros_found(end+1) = t(k) + shift;
  end
end

printf('   found        published     diff\n');
for k = 1:min(numel(zeros_found), numel(published))
  printf('%10.6f   %10.6f   %+.2e\n', zeros_found(k), published(k), ...
         zeros_found(k) - published(k));
end

% ---- The path of zeta through the complex plane ----------------------
figure(2);
plot(real(zc), imag(zc), 'linewidth', 1.1); hold on;
plot(0, 0, 'k+', 'markersize', 12, 'linewidth', 2);
axis equal; grid on;
xlabel('Re \zeta'); ylabel('Im \zeta');
title('\zeta(1/2+it), 0 \leq t \leq 60: the curve threads the origin at each zero');

Lab 4 — The primes against Li(x): hearing the error term

Compares \(\pi(x)\) with \(x/\ln x\) and \(\mathrm{Li}(x)\), then plots the normalized error \((\pi(x)-\mathrm{Li}(x))/\sqrt{x}\) — the quantity RH asserts stays logarithmically small forever.

primes_vs_li.mGNU Octave
% primes_vs_li.m
% Part III lab, continued: pi(x) vs Li(x), and the RH-normalized error.

clear; close all;

X  = 2e5;
p  = primes(X);                       % sieve of Eratosthenes, built in
x  = 2:X;

% pi(x) as a step function via histogram counting
pix = cumsum(histc(p, x));            % pi at each integer x

% Li(x): cumulative trapezoid of 1/log(t) from 2 (offset convention +1.045)
li  = cumtrapz(x, 1 ./ log(x)) + 1.04516378;

figure(1);
plot(x, pix, 'linewidth', 1.4); hold on;
plot(x, li, '--', 'linewidth', 1.4);
plot(x, x ./ log(x), ':', 'linewidth', 1.4);
grid on; legend('\pi(x)', 'Li(x)', 'x / ln x', 'location', 'northwest');
xlabel('x'); title('Gauss was right: Li(x) hugs the prime staircase');

% ---- The error term RH governs ---------------------------------------
figure(2);
plot(x, (pix - li) ./ sqrt(x), 'linewidth', 1.1); grid on;
xlabel('x'); ylabel('(\pi(x) - Li(x)) / \surd x');
title('RH  \Leftrightarrow  this stays O(ln x) forever');

% Note: Li(x) > pi(x) throughout this window -- and for every x anyone
% has ever computed. Littlewood proved the sign flips infinitely often;
% the first crossing is below the Skewes-type bound ~1.397 x 10^316.
printf('max of pi(x) - Li(x) on [2, %d]:  %.2f (never positive here)\n', ...
       X, max(pix - li));
Running the labs

From a shell: octave --persist taylor_convergence.m, or from the Octave prompt simply type the script name. Lab 3's function definition at the top of the file requires Octave ≥ 4.4 (script-file functions); on older versions, save zeta_cvz as its own file. Nothing here needs Forge packages.

One Story, Told Three Times

ConvergenceCardinalityThe Critical Line

Taylor's series taught analysis that an infinite process can be trusted — but only inside a boundary drawn by invisible complex singularities. Cantor, forced by convergence questions to examine the real line itself, found that the continuum is a strictly larger infinity than the integers, and gave analysis a foundation solid enough to bear weight. Riemann stood on both: he continued a convergent series past its wall, out into the full complex plane, and found waiting there a single vertical line of zeros on which the deepest regularity of the prime numbers depends.

A series, a set, a line. Each is a different answer to the same question: what, exactly, is the infinite willing to tell us?