# The holy grail of mathematics: animated visualization of the Riemann Zeta zeros

Perceived as the "holy grail" of mathematics, the **Riemann Hypothesis** which revolves around
the **Riemann Zeta** function provokes fascination and admiration. Its solution paves the way
in predicting the pattern in which the prime numbers occur, the building block of mathematics.

The **Riemann Zeta** function is quite simple. It is defined as:

where \( s = \sigma + t \times i \) is any complex number, while \( n \) is any natural number.

## Riemann Hypothesis: where the magic happens

When the real part of the complex number \( s \equiv \sigma \) is greater than one, the sum always converges.
However, with a technique called analytic continuation,
it is possible to extend the *domain of definition* for cases when the real part \( \sigma \) is less than 1.

And here is where the magic happens! Riemann hypothesized that all non-trivial zeros of the zeta function lie on the line \( s = 1/2 + t \times i \), as illustrated in Figure 1 below.

Using a computer simulation this has been verified for 10,000,000,000,000 (ten trillion) solutions. However, a bulletproof mathematical demonstration is still missing, for which the Clay Mathematics Institute is giving a million-dollar prize.

If this hypothesis shows to be correct, the *Riemann Zeta* zeros can be used to approximate the density of the
prime numbers almost perfectly. It means we will know the pattern in which the prime numbers occur.

**Note:** It doesn't mean that for all values on the vertical line 1/2, the zeta function outputs 0. The real
part \( \sigma \) might still be equal to 1/2 and the value of the zeta function to be different than 0. But
if the zeta function output is 0, then \( \sigma \) should be equal to 1/2.

## Visualizing the zeros

Even though it is still a hypothesis, nothing prevents us from visualizing how the function behaves on the
critical line. Using *Python* and the *Matplotlib Animation API* it is quite straightforward to
do this.

In this specific example, first we set \( s = \sigma + t \times i = 1/2 + t \times i \). Then, we generate 10,000 equidistant values for \( t \) in the space between 0 and 100 and calculate \( s \) for all of them. We plug these values inside the zeta function, which will result in another series of complex numbers. We take the real and imaginary parts of this zeta function output and plot them against each other. The resulting trajectory is animated below:

It is interesting to see how the zeta function is oscillating in the same region around the coordinate center
forming an *onion-like* pattern.

The source code for this animation of the zeros of the Riemann Zeta function can be found in this Jupyter Notebook. For more information, please follow me on LinkedIn or Twitter.

If this is something interesting to you, feel free to share it on social media. Also, it would help if you subscribe to the mailing list below. You will get cool animations like this one from time to time. And finally, thanks for reading this article!

## Appendix: Absurd or not?

Using the analytic continuation of the Riemann Zeta function, we can plug \( s = -1 \) and get the sum of all natural numbers:

One might expect that this sum will be infinite, but in this realm of analytic continuation, it holds that:

Pretty absurd, right?