The Story of Fermat’s Last Theorem, Part 5

By Zhenyi Tan

A function is something that takes some input and gives you some output. The McDonald’s near my house is a function. Every time I order a McSpicy, they always give me a McSpicy. On the other hand, when I order nasi lemak from the kopitiam, the auntie always forgets the egg or the chili or the ikan bilis. Nasi lemak auntie is not a function.

And it’s not like I can only pay $6 to buy a burger. I can also redeem one with 800 points and top up another $2. Even though it’s a rip-off. Mathematicians call this symmetry. It means you have more than 1 way to buy a burger. Or how you can change the input in some way, and the function doesn’t care.

Now let’s say I open a rival restaurant. No matter what you give me, I’ll give you a burger. What’s going to happen? I guess people will buy my burgers with rocks and I’ll go out of business. It’s too good to be true. A function with too many symmetries is either too good to be true, or it’s a boring constant and not worth studying.

Modular forms are functions that obey a large group of symmetries, yet somehow aren’t boring (to mathematicians, anyway1).

Okay cool. Nice. Fascinating. But what is a modular form, really? Can you plot it out like the pimple curves? If you do an image search, you’ll only see pictures that look like someone’s tripping. Fortunately, Quanta Magazine has a very long explainer on modular forms2. The post includes a less trippy image of a modular form, which I’ve shamelessly reproduced here:

The x-axis shows ordinary numbers like −2, −1, 0, 1, 2. The y-axis shows imaginary numbers like i, 2i, 3i, 4i3. Every point in the image is a complex number like 2 + 3i. The long tiles along the top are called shafts, and the half-circles at the bottom are called balls4.

Now look at the colored shaft in the middle. That’s the main shaft. Everything else is a copy of it. Once you know what a modular form does in the main shaft, you know what it does everywhere by applying a series of transformations.

What transformations? Suppose you have an Atari controller. When you move the joystick left or right, it shifts the original copy left or right by 1. When you press the red button, it flips the shaft into the ball below it. Pressing the button again flips the ball back into a shaft.

Now you can mash any combo you like. Left, left, flip, flip, right, flip, right, flip, Hadouken. Whatever you do, you’re still getting the same modular form. The modular form has so much symmetry that it doesn’t give a damn.

Mathematically, shift means f(z) = z + 1, and flip means f(z) = −1/z. Shift and flip can also be written as matrices5. And mashing a combo just means multiplying the matrices together:

shift: | 1 1 |  flip: | 0 −1 |
       | 0 1 |        | 1  0 |

So the stars in the image aren’t really different stars. They’re all the same star. Do not try to find the star. That’s impossible. Instead, only try to realize the truth: there is no star…

Ahem, now does the modular form really not give a damn? Every possible combo sounds like a crazy amount of symmetry. Is this function too good to be true like my burger restaurant?

Well, it is too good to be true. Which is why mathematicians have to introduce 2 knobs to relax the rules a bit. The 2 knobs are called weight and level. And they roughly mean “when you flip, multiply the function by a factor” and “make the main shaft bigger and don’t count all the stars”.

Enough with the balls and shafts and stars. What does a modular form look like when you write it down as 123 and xyz? It looks something like this:

q × (1 − q)2 × (1 − q11)2 × (1 − q2)2 × (1 − q22)2 × (1 − q3)2 × (1 − q33)2 × …6

When you expand it, it looks like this:

q − 2q2 − q3 + 2q4 + q5 + 2q6 − 2q7 − 2q9 − 2q10 + q11 − 2q12 + 4q13 + …

Now, I hope you still remember how we calculate the signature of a pimple curve, because we’re going to count this one next: y2 + y = x3 − x2. How many solutions are there in the mod-5 world? For each x:

x x³ − x² y
0 0 0 and 4
1 0 0 and 4
2 4 none
3 3 none
4 3 none

That’s 4 + girlfriend = 5 solutions. The difference between the mod and the number of solutions is 5 + girlfriend − solutions = 5 + 1 − 5 = 1.

Now go look at the modular form. The number in front of q5 is also 1. In fact, this is the full table for every prime up to 59:

mod 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59
curve −2 −1 1 −2 1 4 −2 0 −1 0 7 3 −8 −6 8 −6 5
form −2 −1 1 −2 1 4 −2 0 −1 0 7 3 −8 −6 8 −6 5

Source: trust me bro.

LIMIT = 60 # increase this if you want

# Multiply the thing by (1 - q^exponent)
def multiply_by_factor(coefficients, exponent)
  return if exponent >= coefficients.length

  (coefficients.length - 1).downto(exponent) do |degree|
    coefficients[degree] -= coefficients[degree - exponent]
  end
end

coefficients = Array.new(LIMIT, 0)
coefficients[1] = 1

(1...LIMIT).each do |exponent|
  # Multiply by 1 - q^exponent twice
  multiply_by_factor(coefficients, exponent)
  multiply_by_factor(coefficients, exponent)

  # Multiply by 1 - q^(11 * exponent) twice
  multiply_by_factor(coefficients, 11 * exponent)
  multiply_by_factor(coefficients, 11 * exponent)
end

# For the curve y² + y = x³ − x²
def count_points(prime)
  points = 0

  (0...prime).each do |x|
    (0...prime).each do |y|
      left = y**2 + y
      right = x**3 - x**2

      if (left - right) % prime == 0
        points += 1
      end
    end
  end

  points + 1 # the girlfriend
end

def prime?(number)
  return false if number < 2

  (2..Integer.sqrt(number)).each do |divisor|
    return false if number % divisor == 0
  end

  true
end

(2...LIMIT).each do |number|
  next unless prime?(number)

  signature = number + 1 - count_points(number)
  coefficient = coefficients[number]

  puts "p = #{number}, curve: #{signature}, form: #{coefficient}"
end

  1. Some dude said modular forms are the 5th basic operation in arithmetic, after +−×÷. What is wrong with these people. ↩

  2. If you want to learn the real math, go read it. ↩

  3. Because writing √−1, √−4, √−9, √−16 is tiring. ↩

  4. Not the actual terminology, but you should know that by now. ↩

  5. The Matrix is everywhere. It is all around us. Even now, in this very room. You can see it whenever you look at higher math. Keep reading and I’ll show you how deep the rabbit hole goes. ↩

  6. q = e2πiz. But that’s not important right now. ↩