An Interactive Study in Two Voices

Euler&Gauss

One wrote mathematics the way rivers flow — endlessly, joyfully, in every direction at once. The other polished each theorem like a lens until it was flawless. Between them, they built the mathematical world we still live in.

LEONHARD EULER · 1707–1783 CARL FRIEDRICH GAUSS · 1777–1855
scroll
Prologue

Two Lives, One Century Apart

Euler died in St. Petersburg in 1783. Gauss was born in Brunswick in 1777. For six years the two greatest mathematicians who ever lived shared the Earth — one a blind old man still dictating papers at a ferocious pace, the other a small child who would soon astonish his schoolmasters. They never met. They didn't need to: Gauss learned his craft from Euler's books, and later told students that the study of Euler's works remains the best school for the different fields of mathematics, and nothing can replace it.

Leonhard Euler

BASEL → ST. PETERSBURG → BERLIN → ST. PETERSBURG

The most prolific mathematician in history: roughly 850 works, filling over 70 volumes of collected papers. He lost sight in one eye at 31 and in both by 64 — and his output increased, computed entirely in his head. He gave us the notation we still write: f(x), e, i, π (popularized), Σ.

  • Founded graph theory and topology
  • Solved the Basel problem at 28
  • Connected e, i, π in one equation
  • Created the calculus of variations
  • Worked until the hour of his death

Carl Friedrich Gauss

BRUNSWICK → GÖTTINGEN (FOR LIFE)

The Princeps Mathematicorum — prince of mathematicians. A poor bricklayer's son whose genius won him a duke's patronage. His motto was pauca sed matura: few, but ripe. He published reluctantly, and his private notebooks turned out to contain decades of unannounced discoveries, including non-Euclidean geometry.

  • Proved the Fundamental Theorem of Algebra
  • Wrote the Disquisitiones Arithmeticae at 21
  • Rediscovered the lost planet Ceres
  • Founded differential geometry of surfaces
  • Directed the Göttingen Observatory 48 years

Parallel timelines

1707

Euler born in Basel, Switzerland, son of a pastor who wanted him to study theology.

1727

Joins the St. Petersburg Academy at 20, recruited to Catherine I's new scientific court.

1735

Solves the Basel problem: the sum of reciprocal squares is π²/6. Europe takes notice.

1736

The Seven Bridges of Königsberg paper — the birth of graph theory.

1748

Publishes the Introductio in analysin infinitorum, containing e = cos θ + i sin θ.

1766

Returns to St. Petersburg; goes almost completely blind. Productivity rises.

1777

Gauss born in Brunswick. He will later joke that he could count before he could talk.

1783

Euler dies mid-calculation, discussing the newly discovered planet Uranus. "He ceased to calculate and to live."

1796

At 19, Gauss constructs the regular 17-gon with compass and straightedge — the first advance on Greek geometry in 2,000 years.

1799

Doctoral thesis: the first widely accepted proof of the Fundamental Theorem of Algebra.

1801

Publishes the Disquisitiones Arithmeticae and predicts the position of the lost asteroid Ceres. Becomes famous across Europe in a single year.

1809

Publishes his method of least squares and the theory of the normal error curve.

1827

The Theorema Egregium: curvature is intrinsic. Differential geometry is born.

1855

Gauss dies in Göttingen. His brain is preserved; his notebooks stun the mathematicians who open them.

Read Euler, read Euler — he is the master of us all.
— PIERRE-SIMON LAPLACE, ADVICE TO YOUNG MATHEMATICIANS
Euler · I

The Number e and the Most Beautiful Equation

Euler took three numbers that seem to come from different universes — e from compound interest, i from impossible square roots, π from circles — and showed they were the same story told three ways.

Start with e ≈ 2.71828, the natural growth constant. It answers the question: if a bank paid 100% annual interest and compounded it continuously, what would $1 become in a year? Euler defined it cleanly:

e = limn→∞ (1 + 1n)n = 1 + 11! + 12! + 13! +

The function ex is the unique function that is its own derivative — growth whose speed equals its size. Then Euler did something audacious: he fed the series an imaginary number. Substituting x = iθ and watching the powers of i cycle through i, −1, −i, 1, the series splits perfectly into two familiar pieces — cosine and sine:

e = cos θ + i sin θ
EULER'S FORMULA · INTRODUCTIO IN ANALYSIN INFINITORUM, 1748

This says that exponential growth in an imaginary direction is rotation. Multiplying by e doesn't stretch a number — it turns it by angle θ around the origin. The whole machinery of waves, signals, alternating current, and quantum mechanics runs on this one fact. Set θ = π (half a turn) and you land exactly on −1:

e + 1 = 0
EULER'S IDENTITY — FIVE FUNDAMENTAL CONSTANTS, ONE LINE
Interactive · Walk the Unit Circle

Drag the slider (or press play) to move θ from 0 to 2π. The gold point is e on the complex plane. Watch its shadow on the real axis trace cosine while its shadow on the imaginary axis traces sine. At θ = π, the point lands on −1: Euler's identity, live.

0.60 rad

Try it in Octave

GNU Octave handles complex numbers natively — exp() happily accepts imaginary arguments. Verify Euler's formula and identity numerically:

Lab 1 · e, Euler's formula, Euler's identity
% --- Approximating e two ways -------------------------------
n = 1e6;
e_limit  = (1 + 1/n)^n            % compound-interest limit
e_series = sum(1 ./ factorial(0:15)) % series: converges FAST
abs(e_series - exp(1))             % error ~ 1e-13 with 16 terms

% --- Euler's formula: exp(i*theta) == cos + i*sin -----------
theta = linspace(0, 2*pi, 9).';
lhs = exp(1i*theta);
rhs = cos(theta) + 1i*sin(theta);
max(abs(lhs - rhs))               % ~ 1e-16: machine epsilon

% --- Euler's identity ---------------------------------------
exp(1i*pi) + 1                     % ~ 0 + 1.2246e-16i

% --- Draw the unit circle from pure exponentials ------------
t = linspace(0, 2*pi, 400);
z = exp(1i*t);
plot(real(z), imag(z), 'linewidth', 2); axis equal; grid on;
title('The unit circle is e^{i\theta}');
The residual 1.2246e-16i in the identity check is floating-point roundoff — π cannot be stored exactly in binary. Euler's mathematics is exact; our machines merely approximate it.
Euler · II

The Basel Problem: π Hiding in the Integers

For ninety years, the best mathematicians in Europe — including the Bernoullis of Euler's home city of Basel — had tried to sum a simple-looking series and failed. In 1735, a 28-year-old Euler announced the answer, and it was scandalous: π appears out of nowhere.

Σn=1 1 = 1 + 14 + 19 + 116 += π²6

What does a circle have to do with adding up fractions of square numbers? Euler's insight was to treat sin(x)/x as an infinite polynomial and factor it by its roots (±π, ±2π, ±3π, …), exactly as you'd factor a quadratic. Comparing the x² coefficient on both sides forces the sum of reciprocal squares to equal π²/6. It was daring, not yet rigorous — and completely correct.

The move opened a door Euler kept walking through. He computed Σ 1/n⁴ = π⁴/90, Σ 1/n⁶ = π⁶/945, and — most consequentially — discovered the Euler product, rewriting the whole series as a product over the primes:

Σn=1 1ns = Πp prime 11 − p−s
THE EULER PRODUCT — THE SEED OF THE RIEMANN ZETA FUNCTION

That identity is the bridge between analysis (smooth sums) and arithmetic (the primes). A century later Riemann would extend it into the complex plane; a young Gauss, as we'll see, would attack the primes from the other side entirely.

Interactive · Watch the Series Converge

Each bar adds one more term 1/n². The running total creeps toward the gold line at π²/6 ≈ 1.6449. Notice how slowly it converges — the gap that remains after N terms is roughly 1/N.

12
Lab 2 · Basel problem & the Euler product
% --- Partial sums of the Basel series -----------------------
N = 100000;
n = 1:N;
partial = cumsum(1 ./ n.^2);
target  = pi^2 / 6;
printf('sum of 1/n^2 (N=%d): %.10f\n', N, partial(end));
printf('pi^2/6            : %.10f\n', target);
printf('remaining gap ~1/N: %.2e\n', target - partial(end));

% --- Visualize convergence ----------------------------------
semilogx(n, partial, 'linewidth', 1.5); hold on;
yline(target, '--');
xlabel('terms'); ylabel('partial sum');
title('Basel problem: crawling toward \pi^2/6');

% --- Euler product over primes vs the zeta sum, s = 2 --------
p = primes(2000);
euler_product = prod(1 ./ (1 - p.^(-2)));
printf('Euler product : %.10f\n', euler_product);
printf('zeta(2)       : %.10f\n', target);
% Two utterly different computations, one number.
The Euler product converges much faster than the sum — primes up to 2000 already give ~7 correct digits, while the direct sum needs 10 million terms for the same accuracy.
Euler · III

Seven Bridges, and the Birth of Graph Theory

The citizens of Königsberg had a Sunday puzzle: could you stroll through the city crossing each of its seven bridges exactly once? In 1736 Euler proved you couldn't — and in doing so invented a new kind of mathematics where shape doesn't matter, only connection.

Euler's move was ruthless abstraction. The islands and riverbanks became dots (vertices); the bridges became lines (edges). Distances, angles, the width of the river — all irrelevant. What remained was pure connectivity, and one decisive observation: every time your walk passes through a landmass, it consumes two bridges — one in, one out. So any landmass that isn't the start or end of the walk must touch an even number of bridges.

A walk crossing every edge once exists the graph is connected and has 0 or 2 odd-degree vertices
EULER PATH CRITERION · SOLUTIO PROBLEMATIS AD GEOMETRIAM SITUS PERTINENTIS, 1736

In Königsberg, all four landmasses touch an odd number of bridges. The walk is impossible — not hard, not undiscovered, but provably impossible. This paper is the founding document of graph theory and an ancestor of topology, which Euler called geometria situs: the geometry of position.

Interactive · Attempt the Impossible Walk

This is Königsberg as Euler drew it: two banks (N, S), the island Kneiphof (I), and the eastern spit (E), joined by seven bridges. Click a landmass to start, then click connected bridges to cross them. The degree counters show why you'll always get stuck.

Lab 3 · Graphs as matrices: checking Euler's criterion
% Königsberg as an adjacency matrix (multigraph: entries count bridges)
% order: N (north bank), I (island), S (south bank), E (east spit)
A = [0 2 0 1;
     2 0 2 1;
     0 2 0 1;
     1 1 1 0];

deg = sum(A, 2).'            % degree of each landmass -> [3 5 3 3]
odd_vertices = sum(mod(deg, 2) == 1)

if odd_vertices == 0
  disp('Euler CIRCUIT exists (return to start).')
elseif odd_vertices == 2
  disp('Euler PATH exists (start and end differ).')
else
  disp('No Euler path: Königsberg walk is impossible.')
end

% Repair the city: remove one bridge between N and I ...
B = A;  B(1,2) = 1;  B(2,1) = 1;
degB = sum(B,2).'
printf('odd vertices after demolition: %d -> walk possible!\n', ...
       sum(mod(degB,2)==1));
History obliged: two of Königsberg's bridges were destroyed in WWII, and the walk became possible in the modern city (Kaliningrad). Euler's criterion, of course, still decides it.
Euler · IV

V − E + F = 2: The First Topological Invariant

Count the corners of a cube, subtract its edges, add its faces: 8 − 12 + 6 = 2. Do the same for a pyramid, a soccer ball, a diamond crystal — always 2. Euler noticed this in 1750 and understood it was not a fact about any particular solid, but about space itself.

V E + F = 2
EULER'S POLYHEDRON FORMULA — FOR ANY CONVEX POLYHEDRON

The number 2 is the Euler characteristic of the sphere. Deform a cube like clay into a ball and the formula survives, because it never depended on flatness or angles — only on how the surface is stitched together. A donut-shaped polyhedron gives V − E + F = 0; a two-holed pretzel gives −2. Each shape of space has its own number. This is the seed of algebraic topology, and it's Euler's geometria situs again: position without measurement.

One elegant consequence: the formula proves there are exactly five Platonic solids — no sixth regular solid can exist, because V − E + F = 2 combined with regularity has only five integer solutions.

Interactive · Count Any Solid

Pick a polyhedron and drag on the canvas to rotate it. The census updates live — and the alternating sum stubbornly refuses to be anything but 2.

Cross-reference: if you've read the Gödel or topology material in this library, the Euler characteristic is the same invariant that classifies surfaces there — and in the string theory guide, it counts the "holes" that determine how many particle families a Calabi–Yau compactification produces.
Euler · V

The Totient: Euler's Gift to Cryptography

Euler also planted the flag Gauss would later claim: number theory. His totient function φ(n) counts how many integers from 1 to n share no factor with n — and it powers a theorem that, 250 years later, became the engine of RSA encryption.

For a prime p, every smaller number is coprime to it, so φ(p) = p − 1. For a product of two distinct primes, φ(pq) = (p−1)(q−1) — easy to compute if you know the factors, and believed hard if you don't. That asymmetry is the entire secret of public-key cryptography. Euler's theorem generalizes Fermat's little theorem:

aφ(n) 1 (mod n)  whenever gcd(a, n) = 1
EULER'S THEOREM, 1763 — THE MATHEMATICAL HEART OF RSA
Lab 4 · Totient, Euler's theorem, and a toy RSA
% helper: Octave's built-in is powmod; alias for portability
if ~exist('powermod','file')
  function r = powermod(a,e,n), r = powmod(a,e,n); endfunction
endif

% helper for portability: Octave builtin is powmod
if ~exist('powermod','file')
  function r = powermod(a,e,n), r = powmod(a,e,n); endfunction
endif

% --- Euler's totient from first principles ------------------
function t = totient(n)
  t = sum(gcd(1:n, n) == 1);
endfunction

arrayfun(@totient, 1:12)        % 1 1 2 2 4 2 6 4 6 4 10 4

% --- Verify Euler's theorem: a^phi(n) mod n == 1 ------------
n = 20; a = 7;                   % gcd(7,20)=1
printf('7^phi(20) mod 20 = %d\n', powermod(a, totient(n), n));

% --- Toy RSA in eight lines ---------------------------------
p = 61; q = 53;                  % (real keys use 300-digit primes)
n = p*q;                         % public modulus: 3233
phi = (p-1)*(q-1);               % Euler's totient: 3120
e = 17;                          % public exponent, coprime to phi
[g, d, ~] = gcd(e, phi); d = mod(d, phi);  % d = e^{-1} mod phi, requires g==1  % private key: e*d ≡ 1 mod phi
msg = 1707;                      % the message: Euler's birth year
c   = powermod(msg, e, n);       % encrypt with the PUBLIC key
back= powermod(c,   d, n);       % decrypt with the PRIVATE key
printf('message %d -> cipher %d -> decrypted %d\n', msg, c, back);
Decryption works precisely because med = m1+k·φ(n) ≡ m (mod n) — Euler's theorem doing the heavy lifting. For the full story, see the cryptography guides elsewhere in this library.
Interlude

The Torch Passes

In 1784, one year after Euler's death, a seven-year-old in Brunswick was set a busywork problem by his schoolmaster Büttner: add every number from 1 to 100. The boy wrote a single number on his slate almost immediately and announced, in Low German, "Ligget se" — there it lies.

Young Gauss had seen what the drill was hiding. Fold the sequence in half: 1 + 100 = 101, 2 + 99 = 101, 3 + 98 = 101 … fifty pairs, each summing to 101. The answer is 50 × 101 = 5050. The story may be polished by retelling, but the instinct it captures is authentic Gauss: never compute what you can understand.

1 + 2 ++ n = n(n+1)2
Interactive · Fold the Sequence Like Young Gauss

Slide n and watch the pairing: outermost numbers join first, each arc summing to the same constant n + 1. The formula assembles itself below.

16

The duke of Brunswick heard of the bricklayer's son and paid his way through school and university. Gauss repaid the debt by absorbing everything — above all the works of Euler, the master he never met. Then, at nineteen, he did something Euler never had: he broke a problem that had stood since Euclid.

Gauss · I

The Disquisitiones and Clock Arithmetic

In 1801, at 24, Gauss published the Disquisitiones Arithmeticae — and number theory went from a collection of clever puzzles to a systematic science. Its opening move looks almost too simple: a new notation for remainders.

a b (mod m)  ⟺ m divides a − b
CONGRUENCE — DISQUISITIONES ARITHMETICAE, ARTICLE 1

Two numbers are congruent modulo m if they leave the same remainder on division by m — if they land on the same position of an m-hour clock. The genius is in the ≡ sign itself: Gauss chose a symbol that looks like equality because congruences behave like equations. You can add them, multiply them, and (carefully) divide them. Whole theories — quadratic reciprocity, which Gauss proved at 19 and loved enough to prove seven more times, calling it his theorema aureum, the golden theorem — flow from this one piece of good notation.

Euler had proven individual results about remainders; Gauss built them a home. Every hash table, every checksum, every cryptographic protocol on Earth now speaks Gauss's language of congruence.

Interactive · Multiplication on a Clock

Place m points on a circle, numbered 0 to m−1. Draw a chord from every k to (a·k) mod m — multiplication as geometry. The patterns (cardioids, nephroids, star polygons) are pure structure of modular arithmetic made visible. Try a = 2 with large m, then a = m−1.

60
2
Lab 5 · Congruences, residues & quadratic reciprocity's raw material
% helper: Octave's built-in is powmod; alias for portability
if ~exist('powermod','file')
  function r = powermod(a,e,n), r = powmod(a,e,n); endfunction
endif

% --- Congruence basics --------------------------------------
mod(1777, 7)                     % Gauss's birth year on a 7-clock
mod(-3, 12)                      % Octave gives 9: always in 0..m-1

% --- A multiplication table mod 7 (a field!) ----------------
m = 7;
[K, J] = meshgrid(0:m-1);
mod(K .* J, m)                   % every nonzero row is a permutation

% --- Quadratic residues: which numbers are squares mod p? ---
p = 13;
QR = unique(mod((1:p-1).^2, p))  % -> 1 3 4 9 10 12 (exactly (p-1)/2)

% --- Euler's criterion links the two men directly -----------
% a is a square mod p  <=>  a^((p-1)/2) ≡ 1 (mod p)
a = 10;
powermod(a, (p-1)/2, p)          % 1 -> yes, 10 is a QR mod 13
a = 5;
powermod(a, (p-1)/2, p)          % p-1 (i.e. -1) -> not a square
Quadratic reciprocity — the crown of the Disquisitiones — states an unbelievable symmetry: whether p is a square mod q is tied to whether q is a square mod p. Euler conjectured it from data; Gauss proved it. That division of labor repeats throughout this story.
Gauss · II

The Seventeen-Sided Polygon

On the morning of March 30, 1796, a nineteen-year-old still deciding between philology and mathematics woke up knowing something no human had known in the 2,000 years since Euclid: the regular 17-gon can be drawn with compass and straightedge alone. He chose mathematics that day, and started a diary.

The Greeks could construct regular polygons with 3, 4, 5, 6, 8, 10, 12, 15 sides — but 7, 9, 11, 13, 14 defeated them, and everyone assumed 17 was equally hopeless. Gauss saw the problem wasn't geometry at all. The corners of an n-gon are the complex roots of zn = 1 — points e2πik/n on Euler's unit circle. Compass and straightedge can only take square roots. So the question becomes pure algebra: can cos(2π/17) be built from nested square roots? Gauss proved it can — because 17 = 2⁴ + 1 is a Fermat prime, and 16 halves down to 1 in exactly four steps: 16 → 8 → 4 → 2 → 1, each step a square root.

A regular n-gon is constructible n = 2k · p₁ p₂ ⋯ pr,  distinct Fermat primes pi ∈ {3, 5, 17, 257, 65537}
GAUSS–WANTZEL THEOREM — GAUSS PROVED ⟸ IN 1796, AGE 19

He was so proud of it that he asked for a 17-gon on his tombstone. (The stonemason refused — with that many sides it would just look like a circle — and carved a 17-pointed star on a memorial in Brunswick instead.)

Interactive · The Constructibility Census

Slide through n. Silver-blue polygons are constructible with compass and straightedge; muted red ones are provably impossible. The factorization beneath shows why: strip out powers of 2 and check what's left against the five known Fermat primes.

17
Euler's fingerprint, again: Fermat had conjectured that every number 22ᵏ+1 is prime. It was Euler who shattered this in 1732 by factoring 2³²+1 = 4,294,967,297 = 641 × 6,700,417 — by hand. Only five Fermat primes are known to this day, and hence only 31 odd-sided constructible polygons.
Gauss · III

Finding a Lost Planet: Ceres and Least Squares

On New Year's Day 1801, the astronomer Piazzi spotted a faint new "planet" between Mars and Jupiter — then lost it in the sun's glare after tracking it across just 3° of sky. Europe's astronomers despaired of ever finding it again. A 24-year-old with no telescope announced where it would reappear. In December, it was exactly there.

Gauss's weapon was a question nobody had answered properly: when your measurements disagree — and they always disagree — what is the best estimate they collectively point to? His answer: choose the parameters that minimize the sum of the squared errors.

minβ Σi (yi f(xi, β))2
THE METHOD OF LEAST SQUARES — THEORIA MOTUS, 1809

Why squares? Gauss showed that if measurement errors follow his bell-shaped curve (next section), least squares gives the most probable parameters — the method and the distribution justify each other. Squaring also punishes large errors heavily, keeps everything differentiable, and reduces the whole problem to solving a linear system (by, naturally, Gaussian elimination). Two centuries later, least squares is still the beating heart of statistics, GPS positioning, machine learning's loss functions, and every trend line ever fitted.

Interactive · Be Gauss: Fit the Data

Click anywhere to add observations (click a point again to remove it). The line solves the least-squares problem live; faint stems show each residual, and the shaded squares are literally the squares being minimized. Toggle them to see the geometry of the method.

Lab 6 · Least squares three ways in Octave
% Noisy observations of a hidden line y = 2.5x - 1 -------------
rng(1801)  % Octave ≥7: use rng; older: rand("seed",1801);              % the year of Ceres
x = linspace(0, 10, 25).';
y = 2.5*x - 1 + randn(size(x))*1.5;

% --- Way 1: the normal equations, exactly as Gauss did -------
A = [x, ones(size(x))];          % design matrix
beta1 = (A.'*A) \ (A.'*y)         % solve A'A β = A'y

% --- Way 2: Octave's backslash (QR under the hood) -----------
beta2 = A \ y

% --- Way 3: polyfit -------------------------------------------
beta3 = polyfit(x, y, 1)

% --- Judge the fit --------------------------------------------
yhat = A*beta1;
SSres = sum((y - yhat).^2);
SStot = sum((y - mean(y)).^2);
R2 = 1 - SSres/SStot
plot(x, y, 'o', x, yhat, '-', 'linewidth', 2);
title(sprintf('Least squares: y = %.2fx + %.2f  (R^2 = %.3f)', ...
      beta1(1), beta1(2), R2));
All three give identical answers, but Way 2 is what you should use in practice — the backslash operator uses QR factorization, which is numerically far more stable than forming A'A when columns are nearly collinear.
Gauss · IV

The Bell Curve: A Portrait of Error Itself

Every measurement lies a little. Gauss asked what the lies look like in aggregate — and derived the one curve consistent with reasonable assumptions about error: symmetric, concentrated, with the arithmetic mean as the best estimate. The result is the most famous shape in science.

f(x) = 1σ√(2π) e−(x−μ)²/2σ²
THE GAUSSIAN (NORMAL) DISTRIBUTION

Look closely at the formula: e and π — Euler's constants — are right there in the portrait of randomness. The mean μ slides the bell; the standard deviation σ sets its width; the √(2π) (from the Gaussian integral ∫e−x²dx = √π) makes the total probability exactly 1.

The reason this curve is everywhere — heights, exam scores, noise in electronics, thermal motion — is the central limit theorem: add up many small independent influences, whatever their individual shapes, and their sum drifts inevitably toward the Gaussian. It is less a law of nature than a law of aggregation.

Interactive · Sculpt the Bell

Move μ and σ. The shaded bands mark 1σ, 2σ and 3σ from the mean — always 68.3%, 95.4% and 99.7% of the probability, no matter how you stretch the curve. That invariance is why "how many sigmas?" is science's universal measure of surprise.

0.0
1.0
Lab 7 · The central limit theorem, witnessed
% Sums of UNIFORM randomness become GAUSSIAN -------------------
N = 20000;                        % experiments
k = 12;                           % dice per experiment
sums = sum(rand(k, N));           % each column: sum of k uniforms

mu  = k/2;  sigma = sqrt(k/12);   % theory for uniform sums
z = (sums - mu) / sigma;          % standardize

histogram(z, 60, 'Normalization','pdf');  hold on;  % was hist(z,60,1) – deprecated         % normalized histogram
t = linspace(-4, 4, 200);
plot(t, exp(-t.^2/2)/sqrt(2*pi), 'linewidth', 2);
title('12 uniform dice, summed: the bell emerges');

% The 68-95-99.7 rule, checked empirically ---------------------
for s = 1:3
  printf('within %d sigma: %.2f%% (theory %.2f%%)\n', s, ...
         100*mean(abs(z) < s), 100*erf(s/sqrt(2)));
end

% Bonus: the Gaussian integral that tames sqrt(2*pi) -----------
quadgk(@(x) exp(-x.^2), -10, 10)  % sqrt(pi)   % -> 1.7725 = sqrt(pi)
Twelve uniform dice already produce a nearly perfect bell — the CLT converges remarkably fast. (Old graphics code exploited this: sum 12 rand() calls, subtract 6, and you have a cheap standard normal.)
Gauss · V

Counting the Primes: A Teenager's Conjecture

At fifteen, Gauss was given a table of logarithms with a list of primes bound in the back. He began tallying primes in blocks of a thousand — a lifelong hobby; he eventually counted into the millions — and noticed that their density near a number x thins out like 1/ln x.

π(x) xln x ,   π(x) Li(x) = 2x dtln t
GAUSS'S CONJECTURE, c. 1792–93 — PROVED AS THE PRIME NUMBER THEOREM IN 1896

Here π(x) counts the primes up to x. Gauss's refined guess, the logarithmic integral Li(x), is astonishingly accurate: at x = 10⁹ it errs by 0.0003%. He never published the conjecture — pauca sed matura — mentioning it only in an 1849 letter. The proof took a century and required, fittingly, the machinery Euler had seeded: Riemann carried the Euler product into the complex plane, and the primes' rhythm turned out to be written in the zeros of the zeta function. The two protagonists of this guide meet inside the deepest unsolved problem in mathematics, the Riemann Hypothesis.

Interactive · The Prime Staircase

The jagged silver staircase is π(x) — it jumps at every prime. The smooth gold curve is Gauss's x/ln x estimate; the dashed curve is the sharper Li(x). Zoom out and the wild staircase becomes indistinguishable from the smooth prediction: order emerging from apparent chaos.

500
Lab 8 · Sieving primes & testing Gauss's guess
% --- Sieve of Eratosthenes, vectorized -----------------------
function pr = sieve(N)
  isp = true(1, N); isp(1) = false;
  for k = 2:floor(sqrt(N))
    if isp(k), isp(k*k:k:N) = false; end
  end
  pr = find(isp);
endfunction

N = 1e6;
pr = sieve(N);
x  = logspace(2, 6, 40);
pix = arrayfun(@(v) sum(pr <= v), x);   % π(x) by counting

approx1 = x ./ log(x);                    % Gauss, age 15
approx2 = arrayfun(@(v) quadgk(@(t) 1./log(t), 2, v)  % quad is deprecated → quadgk, x);  % Li(x)

% Relative errors of the two approximations -------------------
semilogx(x, 100*(approx1 - pix)./pix, '-o', ...
         x, 100*(approx2 - pix)./pix, '-s');
legend('x/ln x', 'Li(x)'); grid on;
ylabel('error (%)');
title('Gauss vs the primes: Li(x) is eerily good');

printf('pi(10^6) = %d;  Li: %.0f;  x/ln x: %.0f\n', ...
       pix(end), approx2(end), approx1(end));
π(10⁶) = 78,498. Li(10⁶) ≈ 78,628 — off by 0.17%. The simple x/ln x is off by ~7%. Gauss compiled his prime counts by hand during "idle quarter hours" over decades; the sieve above does it in milliseconds.
Gauss · VI

The Remarkable Theorem: Curvature from Within

In the 1820s Gauss spent summers doing something unglamorous: surveying the Kingdom of Hanover, hauling instruments up hills. Out of that muddy fieldwork came the deepest idea of his career — that a surface's curvature can be measured entirely from inside it.

Gauss defined the curvature K of a surface at a point as the product of its two principal curvatures — how sharply it bends in its most- and least-curved directions. A sphere of radius R has K = 1/R² everywhere; a flat sheet has K = 0; a saddle has K < 0. The shock is his Theorema Egregium ("remarkable theorem"): K is unchanged by any bending that doesn't stretch the surface. Creatures living on the surface, measuring only distances along it, can compute K without ever peeking at the third dimension.

Gaussian curvature is intrinsic: measurable by distances within the surface alone
THEOREMA EGREGIUM · DISQUISITIONES GENERALES CIRCA SUPERFICIES CURVAS, 1827

Everyday consequences first: a flat sheet (K = 0) can roll into a cylinder (still K = 0) but can never wrap a sphere (K > 0) without wrinkling or tearing — which is why every flat map of Earth lies, and why a slice of pizza droops until you fold it lengthwise, forcing its zero curvature to spend itself on stiffness. Deeper consequence: if curvature is intrinsic, then a space needs no outside to be curved in. Gauss's student Riemann generalized this to any number of dimensions; Einstein then proposed that gravity is the intrinsic curvature of four-dimensional spacetime. The line from Hanover's muddy survey triangles to general relativity is direct.

I am becoming more and more convinced that the necessity of our geometry cannot be proved... perhaps in another life we will attain other insights into the essence of space, which is now unattainable to us.
— GAUSS, LETTER TO OLBERS, 1817 — DECADES BEFORE NON-EUCLIDEAN GEOMETRY WAS PUBLISHED

His private notebooks show he had worked out non-Euclidean geometry and suppressed it, fearing — as he wrote to Bessel — the "clamor of the Boeotians." When Bolyai and Lobachevsky published, priority passed to bolder hands. Pauca sed matura cut both ways.

Coda

Convergence: Two Voices, One Mathematics

Put the two life's-works side by side and a pattern emerges: again and again, Euler discovers the phenomenon and Gauss discovers the law. Euler is the explorer who maps the coastline; Gauss is the cartographer who proves the map correct.

ThemeEuler's moveGauss's move
PRIMESThe Euler product ties primes to analysis; proves infinitude of primes analyticallyConjectures the Prime Number Theorem from hand-tallied data at 15
RECIPROCITYConjectures quadratic reciprocity from numerical patternsProves it at 19 — then seven more times, his "golden theorem"
COMPLEX NUMBERSComputes with them fearlessly: e, roots of unityLegitimizes them: the complex plane, and the Fundamental Theorem of Algebra — every polynomial of degree n has exactly n complex roots
ROOTS OF UNITYPlaces the n-gon's corners at e2πik/nDissects them with Gaussian periods to construct the 17-gon
TOPOLOGY & GEOMETRYV − E + F = 2; geometry of positionIntrinsic curvature; the Gauss–Bonnet theorem later welds the two: ∫K dA = 2πχ
METHODPublish everything — 850 works; let ideas breathe in the openPauca sed matura — publish only what is polished; the notebooks keep the rest

The last row of that table is the real lesson. Euler's torrential openness gave the 18th century its working vocabulary; Gauss's ruthless standards gave the 19th century its rigor. Mathematics needs both temperaments — the river and the lens — and arguably every mathematician since has had to choose a point on the axis between them.

One last meeting point: the FFT

In an unpublished 1805 manuscript on interpolating asteroid orbits, Gauss worked out a fast recursive trick for computing trigonometric sums — the fast Fourier transform, 160 years before Cooley and Tukey reinvented it in 1965. And what does the FFT compute? Sums of Euler's e−2πikn/N — his formula, factored by Gauss's cleverness. Every JPEG, MP3, Wi-Fi packet and MRI scan runs on the two of them jointly.

Lab 9 · The FFT: Euler's exponentials, Gauss's algorithm
% A signal with two hidden tones + noise -----------------------
fs = 512;  t = (0:fs-1)/fs;
sig = sin(2*pi*17*t) + 0.6*sin(2*pi*60*t) + 0.4*randn(size(t));
%              ^ a 17 Hz tone, in Gauss's honor

% The DFT is literally a matrix of Euler's formula --------------
N = numel(sig);
[k, n] = meshgrid(0:N-1);
W = exp(-2i*pi*k.*n/N);          % e^{-2πikn/N}: pure Euler
slow = W * sig.';                 % O(N^2) multiply

fast = fft(sig).';               % O(N log N): pure Gauss
max(abs(slow - fast))            % ~1e-10: same numbers

% Time them ------------------------------------------------------
tic; W * sig.';   t_slow = toc;
tic; fft(sig);    t_fast = toc;
printf('matrix DFT: %.4fs   fft: %.6fs   speedup: %.0fx\n', ...
       t_slow, t_fast, t_slow/max(t_fast,eps));

% Find the hidden tones ------------------------------------------
P = abs(fast)/N;
f = (0:N-1)*fs/N;
plot(f(1:N/2), 2*P(1:N/2), 'linewidth', 1.5);
xlabel('Hz'); title('Spectrum: peaks at 17 and 60 Hz');
At N = 512 the speedup is already large; at N = 10⁶ the O(N²) approach would take hours while the FFT takes milliseconds. Gauss filed the idea in a drawer because it wasn't "ripe." It was 160 years ahead of schedule.

And one for the road: Gaussian elimination

Lab 10 · Solving systems the Gauss way
% Fit a parabola through three observed points -------------------
% (the shape of every projectile, and of Ceres' apparent path)
P = [1 4;  2 3;  4 7];            % (x, y) observations
A = [P(:,1).^2, P(:,1), ones(3,1)];
b = P(:,2);

coef = A \ b                      % Gaussian elimination inside

[L, U, Pm] = lu(A);               % see the elimination explicitly
L, U                              % A = P'LU: the row-reduction record

xs = linspace(0, 5, 100);
plot(P(:,1), P(:,2), 'o', xs, polyval(coef, xs), '-');
title('Three points, one parabola: A\\b');
% Historical footnote: "Gaussian" elimination appears in the
% Chinese "Nine Chapters" ~2000 years earlier; Gauss systematized
% it for least-squares normal equations, and the name stuck.
Octave's backslash operator chooses the right factorization automatically (LU for square systems, QR for least squares) — a small monument to how thoroughly Gauss's methods became infrastructure.

Where to go next in this library

Euler's formula is the working language of the Feynman path-integral guide (every path contributes eiS/ħ) and the Fourier machinery in the Maxwell and circuits guides. Gauss's totient and modular arithmetic are the foundation of the cryptography series, and his intrinsic curvature leads directly into the string theory / M-theory guide. The Basel problem's zeta function reappears — analytically continued — in the Mathematical Tapestry. This page is a hub; nearly every guide on the shelf cites one of these two men.

Mathematics is the queen of the sciences, and arithmetic the queen of mathematics.
— CARL FRIEDRICH GAUSS · SARTORIUS VON WALTERSHAUSEN'S MEMOIR, 1856