From: 3blue1brown

This article explores a deep formula for pi that intricately connects prime numbers, complex numbers, and pi itself [00:00:07]. This connection often appears in modern mathematics, particularly with the Riemann zeta function [00:00:14]. The derivation reveals a hidden circle [00:01:07] and demonstrates a surprising regularity in the way that prime numbers behave when viewed within the complex numbers [00:01:34].

Approaching Pi through Lattice Points

One method to derive a formula for pi is by asking how many lattice points (points with integer coordinates) lie inside a large circle [00:01:54]. For a circle centered at the origin with radius r, the number of lattice points is approximately equal to the circle’s area, πr² [00:02:56]. As the radius increases, this approximation becomes more accurate [00:03:08]. The goal is to find a second way to count these lattice points, leading to an alternative expression for the area of a circle and thus for pi [00:03:19].

Instead of counting all points at once, one can count lattice points on individual “rings” or circles of specific radii [00:03:40]. A lattice point (a,b) has a distance from the origin of √(a² + b²), where a² + b² is an integer [00:03:48]. Counting how many lattice points sit on a ring with radius √n means finding integer pairs (a,b) such that a² + b² = n [00:05:23]. The pattern of how many points are on each ring appears chaotic [00:04:41], suggesting that interesting mathematics, rooted in the distribution of primes, is involved [00:04:50]. For example, a ring with radius √11 hits no lattice points because 11 cannot be expressed as the sum of two squares [00:05:36].

Gaussian Integers and Prime Factorization

To understand this pattern, the problem is reframed using complex numbers [00:05:52]. A lattice point (a,b) is thought of as a Gaussian integer, a + bi [00:06:00]. The sum of squares a² + b² is equivalent to multiplying a + bi by its complex conjugate, a - bi [00:06:10]. This transforms the counting problem into a factoring problem within the Gaussian integers [00:06:37].

Factoring Ordinary Primes in Gaussian Integers

Factoring within Gaussian integers is “almost unique” [00:09:09]. Ordinary prime numbers behave differently when factored into Gaussian primes:

  • Primes 1 mod 4: Prime numbers that are one above a multiple of four (e.g., 5, 13, 17) can always be factored into exactly two distinct Gaussian primes (e.g., 5 = (2+i)(2-i)) [00:10:35]. This corresponds to the fact that a circle with a radius equal to the square root of such a prime will hit lattice points [00:10:48].
  • Primes 3 mod 4: Prime numbers that are three above a multiple of four (e.g., 3, 7, 11) cannot be factored further within the Gaussian integers; they are also Gaussian primes [00:11:03]. This means a circle with a radius equal to the square root of such a prime will not hit any lattice points [00:11:22].
  • The prime 2: The prime number 2 is special because it factors as (1+i)(1-i). These two Gaussian primes are rotations of each other, meaning one can be obtained by multiplying the other by i [00:12:04].

This pattern of how prime numbers behave based on their remainder when divided by 4 is a crucial regularity that will be exploited [00:11:33].

The Chi Function and Lattice Point Count

A systematic way to count lattice points with a given magnitude √n involves a “recipe”:

  1. Factor n: Factor n into its prime powers in the ordinary integers [00:12:58].
  2. Factor into Gaussian Primes: Further factor primes that are 1 mod 4 into their conjugate Gaussian prime pairs [00:13:04]. Primes 3 mod 4 remain unsplittable.
  3. Divvy up Factors: Organize these Gaussian prime factors into two columns, ensuring conjugate pairs are kept together [00:13:13]. Each distinct product from the left column represents a unique Gaussian integer whose product with its conjugate equals n [00:13:31].
  4. Account for Rotations: Finally, multiply the result from the left column by 1, i, -1, or -i to account for all possible rotations that preserve the magnitude [00:15:03]. This means there are always 4 final choices [00:18:34].
  • For prime factors p that are 1 mod 4 (e.g., 5), if p^k is a factor of n, this contributes k+1 options to the count [00:18:01].
  • For prime factors p that are 3 mod 4 (e.g., 3), if p^k is a factor of n:
    • If k is even, this contributes 1 option [00:18:23].
    • If k is odd, this contributes 0 options (no lattice points) [00:18:29].
  • Factors of 2 (or any power of 2) do not change the count of lattice points; they effectively contribute 1 option [00:19:50].

To simplify this complex recipe, a multiplicative function, χ (chi), is introduced [00:21:24]:

The number of lattice points on a circle with radius √n can be expressed as 4 times the sum of χ(d) for all divisors d of n [00:24:58]. This holds for any natural number n [00:25:03].

Deriving the Pi Formula

To find the total number of lattice points inside a large circle of radius r:

  1. Sum the number of lattice points on all rings √n for n from 1 to [00:25:32].
  2. This sum can be reorganized by considering how many times each χ(d) contributes. For example, χ(1) is added for every n, χ(2) for every even n, χ(3) for every n divisible by 3, and so on [00:26:40].
  3. Approximately, the total number of lattice points is r² * (χ(1)/1 + χ(2)/2 + χ(3)/3 + ...) [00:27:15].
  4. Multiplying by the final factor of 4 from the recipe [00:27:22], the total count is approximately 4 * r² * (χ(1)/1 + χ(2)/2 + χ(3)/3 + ...) [00:27:33].
  5. Since χ(n) is 0 for even numbers and alternates between 1 and -1 for odd numbers [00:27:38], the sum becomes 1 - 1/3 + 1/5 - 1/7 + ... [00:27:53].

Equating this to the area approximation πr² [00:27:54] and dividing by yields:

π = 4 * (1 - 1/3 + 1/5 - 1/7 + ...) [00:28:13]

This is the Leibniz formula for pi, an alternating infinite sum [00:00:36]. Its simplicity ultimately stems from the regular pattern of how prime numbers factor within the Gaussian integers [00:28:29]. This derivation provides a glimpse into the intersection of algebraic number theory (dealing with new number systems like Gaussian integers) and analytic number theory (dealing with functions like χ and the Riemann zeta function’s cousins, L-functions) [00:28:59].