Get AI summaries of any video or article — Sign up free
Pi hiding in prime regularities thumbnail

Pi hiding in prime regularities

3Blue1Brown·
5 min read

Based on 3Blue1Brown's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Rewriting lattice points (a,b) as Gaussian integers a+bi turns a²+b²=n into z·conj(z)=n, converting geometry into factoring.

Briefing

A hidden arithmetic regularity—how primes split inside the Gaussian integers—turns a messy lattice-point counting problem into a clean alternating series for π. The key move is to count integer grid points inside a large circle in two ways: geometrically, the count is about πr², but algebraically it can be expressed through which integers can be written as a sum of two squares. Once that algebraic count is reorganized using a special multiplicative function tied to primes mod 4, the circle’s area forces π to equal a simple alternating infinite sum.

The setup begins with lattice points (a,b) with integers a and b. Points at distance √n from the origin correspond exactly to solutions of a²+b²=n. Translating (a,b) into the complex number a+bi reframes the condition as (a+bi)(a−bi)=n, so the problem becomes one of factoring n inside the ring of Gaussian integers. In that ring, primes behave in a structured way: primes congruent to 1 mod 4 (like 5, 13, 17) split into two distinct Gaussian primes, while primes congruent to 3 mod 4 (like 3, 7, 11) remain “unsplittable” even after allowing i. This splitting/non-splitting dichotomy decides whether a given n has any representation as a²+b² and, if it does, how many lattice points lie on the circle of radius √n.

From there, the counting becomes a combinatorics-of-factorization recipe. For each prime power dividing n, the number of ways to distribute Gaussian prime factors between two conjugate columns determines the number of lattice points on the circle. A factor of 2 is special but ultimately doesn’t change the count: powers of 2 contribute no net increase because swapping conjugate Gaussian primes only rotates the final complex number by multiples of 90 degrees.

To package the prime-power rules efficiently, the argument introduces a function χ on natural numbers. It is defined so that χ(p)=1 when p≡1 (mod 4), χ(p)=−1 when p≡3 (mod 4), and χ(n)=0 for even n. χ is multiplicative, meaning χ(ab)=χ(a)χ(b), which allows the lattice-point count for radius √n to be written as 4 times a sum of χ over all divisors of n. When lattice points inside a circle of radius r are counted by summing over all n up to r², the divisor-sum structure can be reorganized by columns: for large r, the contribution from each divisor d is roughly proportional to r²/d. This collapses into the alternating series 1−1/3+1/5−1/7+… .

Since the geometric count of lattice points inside the circle is πr² up to smaller error, dividing by r² and letting r grow forces that alternating series to converge to π. The result is a rare bridge between geometry, complex multiplication, and prime factorization—showing that π emerges from the same mod-4 regularity that governs which primes split in the Gaussian integers.

Cornell Notes

Counting lattice points inside a circle leads to representations of integers as a²+b². Rewriting a+bi as a Gaussian integer turns a²+b²=n into (a+bi)(a−bi)=n, so the circle problem becomes a factoring problem in the Gaussian integers. Prime factorization there follows a mod-4 rule: primes p≡1 (mod 4) split into two Gaussian primes, while primes p≡3 (mod 4) stay prime; this determines whether and how many lattice points occur on the circle of radius √n. A multiplicative function χ encodes this splitting behavior, letting the number of lattice points on radius √n be written as 4 times a divisor-sum of χ. Summing over n≤r² and comparing with the geometric estimate πr² yields π=1−1/3+1/5−1/7+… .

Why does counting lattice points on a circle reduce to factoring in the Gaussian integers?

A lattice point (a,b) lies on the circle of radius √n exactly when a²+b²=n. Treating (a,b) as the complex number a+bi, the condition becomes (a+bi)(a−bi)=n because a−bi is the complex conjugate. That turns the problem into finding Gaussian integers z=a+bi whose product with their conjugate equals n—equivalently, understanding how n factors inside the ring of Gaussian integers.

What mod-4 rule for primes controls whether a circle hits lattice points?

In the Gaussian integers, primes p≡1 (mod 4) (examples: 5, 13, 17) split into exactly two distinct Gaussian primes, so circles with radius √p always hit lattice points (in fact, they hit 8 for such primes). Primes p≡3 (mod 4) (examples: 3, 7, 11) do not split at all, so circles with radius √p hit no lattice points. This splitting/non-splitting pattern is the engine behind the later π formula.

How does the counting recipe work for a specific n like 25 or 125?

For n=25=5², the prime 5 splits in the Gaussian integers, giving a conjugate pair of Gaussian primes (2+i and 2−i). Distributing copies of these conjugate primes between two conjugate “columns” yields multiple possible Gaussian integers z with z·conj(z)=25; rotations by 90° (multiplying by 1, i, −1, −i) account for the full set of lattice points, totaling 12 on the circle of radius √25. For n=125=5³, the exponent 3 leads to 4 distribution choices (one more than the exponent), and after the same final 4 rotations, the total becomes 16 lattice points—matching direct counting.

What role does the function χ play, and why is multiplicativity crucial?

χ is defined to reflect prime splitting: χ(p)=1 for primes p≡1 (mod 4), χ(p)=−1 for primes p≡3 (mod 4), and χ(n)=0 for even n. Because χ is multiplicative (χ(ab)=χ(a)χ(b)), the divisor-sum structure for lattice counts factors cleanly across prime powers. For a prime power p^k, the relevant contribution becomes 1+χ(p)+χ(p)²+…+χ(p)^k, which becomes 0 when an unsplittable prime p≡3 (mod 4) appears to an odd power (no lattice points), and 1 when it appears to an even power (exactly one way).

How does summing over divisors turn the lattice-point count into the alternating π series?

The number of lattice points inside radius r can be approximated by summing the circle counts for all n≤r². Each circle count is 4 times a sum of χ over divisors of n, so the double sum can be reorganized by divisor d: roughly r²/d terms contribute χ(d). Using that χ(d)=0 for even d and χ(d)=±1 for odd d, the reorganized series becomes 1−1/3+1/5−1/7+… . Comparing this with the geometric estimate πr² and dividing by r² forces the alternating series to equal π.

Review Questions

  1. How does the condition a²+b²=n translate into a Gaussian-integer factoring problem, and what does the conjugate accomplish?
  2. Why do primes p≡1 (mod 4) and p≡3 (mod 4) lead to opposite outcomes for whether √p circles contain lattice points?
  3. What does multiplicativity of χ allow you to do when computing the lattice-point count from prime powers?

Key Points

  1. 1

    Rewriting lattice points (a,b) as Gaussian integers a+bi turns a²+b²=n into z·conj(z)=n, converting geometry into factoring.

  2. 2

    In the Gaussian integers, primes p≡1 (mod 4) split into two distinct Gaussian primes, while primes p≡3 (mod 4) remain Gaussian primes.

  3. 3

    The splitting behavior determines both whether a circle of radius √n hits lattice points and how many points appear on that circle.

  4. 4

    A multiplicative function χ encodes the mod-4 prime behavior: χ(p)=1 for p≡1 (mod 4), χ(p)=−1 for p≡3 (mod 4), and χ(even)=0.

  5. 5

    The lattice-point count on radius √n can be expressed as 4 times a divisor-sum of χ over all divisors of n.

  6. 6

    Summing over n≤r² and comparing with the geometric estimate πr² forces π to equal the alternating series 1−1/3+1/5−1/7+… .

  7. 7

    Powers of 2 do not change the lattice-point counts in this framework because their Gaussian prime contributions only produce rotational redundancy.

Highlights

The mod-4 rule for primes—splitting for p≡1 (mod 4), staying prime for p≡3 (mod 4)—is what ultimately makes π appear.
Counting points at distance √n becomes counting Gaussian integers z with z·conj(z)=n, so factorization dictates geometry.
A multiplicative character χ converts complicated prime-power counting into a clean divisor-sum structure.
Reorganizing the divisor sums by size turns the circle-area comparison into the alternating π series 1−1/3+1/5−1/7+… .

Topics

  • Lattice Points
  • Gaussian Integers
  • Prime Factorization
  • Multiplicative Functions
  • Pi Series