In this post I will talk about an analogue between the Riemann zeta function and the tuning system used in Western music. But whereas the thing they have in common provides the necessary ingredient for proving the analyticity of the Riemann zeta function it renders all attempts of finding a "perfect tuning" futile. Don't you think it's remarkable what one's mind drifts off to when studying for a number theory exam? :)

A glance of number theory

Let's start with the Riemann zeta function, which in its most familiar form looks like $$ \sum_{n=1}^{+\infty}\frac{1}{n^s}. $$

Introduced in 1859 by Bernhard Riemann in his paper Ueber die Anzahl der Primzahlen unter einer gegebenen Grösse, generalizing the work of Euler and Chebyshev who considered this series for positive integers and real values respectively, it is an omnipresent object in mathematics. It's a powerful tool in proving many facts about prime numbers (most notably the prime number theorem), but it still defies the ultimate insight in its behaviour: the location of its non-trivial zeroes. Riemann's hypothesis states that these all have real part equal to 1/2, which would have vast consequences in number theory but so far it is still unsolved.

What is easy to prove though is its analyticity. I will give a (partial) proof now, based on Serge Lang's Algebraic Number Theory, so that we will be able to see where the connection with musical tunings comes from. You can skip to the italic text, marked as the important part, where the conclusions necessary for the analogue are given, but I didn't want to give these without a little background and a sketch of the proof.

Theorem The Riemann zeta function is analytically everywhere, except for a simple pole at $s=1$.

Proof: Using Theorem 2 on page 156 from Lang's ANT we obtain analyticity in the half-plane $\mathrm{Re}\,s>1$. By considering the inequalities $$ \frac{1}{s-1}\leq\int_1^{+\infty}\frac{1}{x^s}\,\mathrm{d}s\leq\zeta(s)\leq 1+\frac{1}{s-1} $$ we get $1\leq(s-1)\zeta(s)\leq s$ which gives us the unique simple pole after considering the following argument. Using the alternating Riemann zeta function, also known as Dirichlet eta function $$ \eta(s)=\zeta_2(s)=\sum_{n=1}^{+\infty}\frac{(-1)^{n-1}}{n^s} $$ and applying the aforementioned Theorem 2 we get analyticity in the half-plane $\mathrm{Re}\,s>0$ for this new function. But we can write $$ \frac{2}{2^s}\zeta_2(s)+\zeta_2(s)=\zeta(s)\quad\Longleftrightarrow\quad\zeta_2(s)=\left( 1-\frac{1}{2^{s-1}} \right)\zeta(s) $$ which gives a possible analytic continuation of the Riemann zeta function to a slightly bigger half-plane, but we might get new poles.

Now define $$ \zeta_r(s)=\frac{1}{1^s}+\frac{1}{2^s}+\dotsc+\frac{1}{(r-1)^s}-\frac{r-1}{r^s}+\frac{1}{(r+1)^s}+\dotsc $$ which is a generalization of the Dirichlet eta function or alternating Riemann zeta function from before. Again by invoking Theorem 2 from Lang's ANT we get analyticity for $\mathrm{Re}\,s>0$, hence again $$ \zeta(s)=\frac{\zeta_r(s)}{1-\displaystyle\frac{1}{r^{s-1}}} $$ a possible analytic continuation. The only poles for $r=2$ are located at $s=1$ and $2^{s-1}=1$ or $s=2\pi\mathrm{i}n/\log 2+1$ while for $r=3$ there are located at $s=2\pi\textrm{i}/\log 3+1$.

The important part: The linear independence over the rationals of the logarithms says that these cannot be equal, so the only possible pole is located at $s=1$. In layman terms: if there was another pole we would see $2^m=3^n$ but as the left-hand side is even and the right-hand side is odd this equality is impossible for integral exponents.

A dive into tuning theory

Let's shift our attention to music. Jeff Buckley sings

Well I heard there was a secret chord
That David played, and it pleased the Lord
But you don't really care for music, do ya?
Well it goes like this
The fourth, the fifth
The minor fall and the major lift

which might seem like nonsense gibberish about ordinal numbers, but he is actually singing about musical intervals (and he actually takes the melodic steps he sings!), of which the fifth is the most important one. Without it there would be no punk music, but its importance is all encompassing: from ABBA to Bach to ZZ Top.

If you take two free intonation instruments (which means you can play all frequencies in its range, not hampered by frets, holes or keys) like for instance a violin or a trombone and let one play a constant frequency while the other is slowly sliding upwards, some frequencies will match while others won't. Pythagoras already did this experiment and based his Pythagorean tuning on the outcome: the most pleasant sounding frequencies, apart from the octave which is a doubling of the base frequency, is the fifth which is located at 1.5 times the base frequency. I'm no psycho-acoustician so I can't give a reasonable explanation, but somehow the human ear likes superparticular numbers. This is also related to his philosophy about the universe and numbers, with planets corresponding to harmonies etc. But I'll try to avoid the crack-pottery :).

Performing this experiment to its full extent, or doing some calculations, you'll get the 12 notes which constitute our musical system, and in the naive way of doing this you'll get more nice fractions, such as 4/3, 9/8, 16/9 or 81/64. The resulting tuning is called just intonation.

But if you were to go up 7 octaves (which is the entire piano keyboard) or 12 fifths, you expect to end up on the same note. But $2^7\neq(3/2)^{12}$, or $128\neq 129.7463\ldots$! This discrepancy is the root of all evil: there is no perfect tuning system. One needs to get 7 octaves equal to 12 fifths so you have to compensate in between: a fifth must be a little bit lower than you would actually like it to be.

Our current tuning system, which is called equal temperament, avoids this problem by dividing the logarithm of 2 in 12 even parts, which approximates the natural ratios. You get an extremely versatile and uniform system, all musical keys are treated equal, but the downside is a loss of natural harmonies. It only sounds good because you're used to it, but in reality it is horrendous. A fact only known to an incrowd of musicians and you.

Morale

Not the least mathematicians have drawn analogues between the Riemann zeta function and music, stating that

"The music of the primes is a chord."

But what makes the analyticity work for the mathematical object makes the music that might come out of it inherently out of tune.

And there are more relations between the Riemann zeta function and musical tunings, as noticed by Gene Ward Smith, as in these mailing list posts: a first one and a second one. Maybe I will delve further into this subject, drawing the parallels with Diophantine approximation more explicitly.

Gene Smith himself gave me the following link about the Riemann zeta function and tuning, which is part of a much larger and really interesting wiki. Go check it out!