## Prelude: A curiosity about the Riemann $\zeta$ function If you're like me and have a passing interest in analytic number theory, you already know that the Riemann $\zeta$ function is intimately connected to the distribution of prime numbers. But did you know that the $\zeta$ function also has [deep connections to the theory of musical tuning](https://en.xen.wiki/w/The_Riemann_zeta_function_and_tuning)? In some sense, this shouldn't come as much of a surprise if you know a thing or two about tuning theory. Roughly speaking, a tuning system generally sounds more harmonious to our ears the better it approximates simple integer ratios between frequencies; and since such ratios can be constructed multiplicatively out of prime harmonics, we can essentially reduce the problem of measuring a tuning system's "harmonicity" to measuring its ability to approximate prime harmonics. So it stands to reason that, if the $\zeta$ function encodes information about the distribution of prime numbers, it should also be possible to extract information about the harmonicity of tuning systems from it. However, the precise manner in which this harmonic information is made apparent by the $\zeta$ function is striking in its simplicity, and reveals fascinating patterns in the structure of music as it relates to analytic number theory. **Some preliminaries:** in some sense the simplest type of tuning system, which we currently use in modern Western music, is an *equal temperament system,* or *equal division of the octave* (EDO). An *octave* corresponds to a frequency ratio of $2 : 1$ or a *doubling* of frequency, and we typically hear such doubled frequencies as "the same note, but higher." So an *equal division of the octave* into $n$ parts splits this interval into $n$ equal divisions, measuring logarithmically. E.g. in our common 12-tone equal-tempered system, a *semitone* (the smallest division of the octave) corresponds to a ratio of $2^{1/12}$. A tuning system based on division of the octave into $n$ equal parts is referred to as $n$-EDO—so our common system of 12-tone equal temperament can succinctly be referred to as 12-EDO. However, we need not limit ourselves to whole number values of $n$—fractional values are also possible. For instance, $12/\log_2(3)$-EDO divides a ratio of $2^{\log_2(3)} = 3$ (i.e. a tripling of frequency, corresponding to the third harmonic above a base frequency) into twelve equally spaces intervals. More generally, we could have $t$-EDO for *any* real number $t$. Hence we have an entire *continuum* of EDO-tunings to explore. But now comes something amazing: if we take the whole continuum of such $t$-values, and plot the graph of their distribution under the following, carefully-defined function involving the critical line of the Riemann $\zeta$-function: $ f(t) = \left| \zeta \left( \frac{1}{2} + \frac{2 \pi i t}{\ln(2)} \right) \right| $ then we get a graph that looks like this: ![[zeta-peaks.png|360]] If we look at the peak values (local maxima) of this graph, we find that the largest ones tend to coincide with EDO-values which yield good approximations of prime harmonics, e.g. $12, 19, 31$, etc. So, in a sense, the $\zeta$ function acts a generalized measure of the *harmonicity* of EDO values! But then, looking at the EDO values which attain successively larger peak values on this graph, some interesting patterns begin to emerge. (N.B. there are several different ways of measuring which peak values are "best" within a given region, detailed in the above-linked Xenharmonic wiki page; however, these all largely share the same patterns outlined below.) For instance, looking at OEIS [A117538](https://oeis.org/A117538), which consists of peak values with successively larger areas underneath the curve of the function, we see the following: $ 2, ~ 5, ~ 7, ~ 12, ~ 19, ~ 31, ~ 41, ~ 53, ~ 72, ~ 130, ~ 171, ~ 224, ~ 270, ~ \dots $ we see that the first 6 entries follow a Fibonacci-like progression: * $2 + 5 = 7$ * $5 + 7 = 12$ * $7 + 12 = 19$ * $12 + 19 = 31$. The pattern breaks down after that, but looking further in the sequence, it becomes apparent that later entries can also often be decomposed as *additive combinations* of entries earlier in the sequence (even if not necessarily those *immediately* preceding them). E.g. * $12 + 41 = 53$ * $31 + 41 = 72$ * $41 + 130 = 171$ * etc. Also, the list of peak EDO values doesn't just include 12-tone and other EDOs beloved by microtonalists: it also includes numbers such as $7$ and $5$ corresponding to the number of notes in typical scales such as the major and pentatonic scales—which we typically represent as *embedded* in larger EDOs such as 12 or 19-EDO. What is going on here? Is there some kind of deeper structure behind these patterns, or are they just coincidences? This question has been bothering me ever since I learned about this connection between the $\zeta$ function and tuning years ago. And after climbing the tower of mathematical abstraction, I think I've finally found somewhat of an answer, which I'll try to describe in this post. IMO it reveals some very pleasing structural connections between topics in music theory, algebra, and analysis, and for that reason I'm excited to finally share it! ## Just intonation and the Algebra of Music Moving away from EDOs, which only ever *approximate* rational values of frequency ratios other than powers of 2/octaves (since notes in an EDO are scaled logarithmically), let's turn our attention for the time being to *just intonation*, where we assemble a scale directly out of such a combination of ratios, or *intervals* in musical terminology. For instance, the typical just major scale can be built from a root note (which can be thought of as the unison ratio $1/1$) with the following ratios: $ \begin{array}{c|c|c|c|c|c|c} \text{Unison} & \text{Major 2nd} & \text{Major 3rd} & \text{Perfect 4th} & \text{Perfect 5th} & \text{Major 6th} & \text{Major 7th}\\ \hline 1/1 & 10/9 & 5/4 & 4/3 & 3/2 & 5/3 & 15/8 \end{array} $ Note that the integers appearing in these ratios are all multiplicative combinations of $2$, $3$, and $5$. In this case, we say that the just major scale is a *$5$-limit* scale, since $5$ is the largest prime factor appearing in it. Another typical such scale is the 5-limit chromatic scale, which consists of the following ratios: $ \mathbf{1/1}, ~~ 16/15, ~~ \mathbf{10/9}, ~~ 6/5, ~~ \mathbf{5/4}, ~~ \mathbf{4/3}, ~~ 36/25, ~~ \mathbf{3/2}, ~~ 8/5, ~ \mathbf{5/3}, ~~ 9/5, ~~ \mathbf{15/8} $ The ratios that also occur in the just major scale are highlighted in **bold,** demonstrating how the just major scale is *embedded* in the 5-limit chromatic scale (this may start to give you a hint as to what the answer to our previous question about *embeddings* of $\zeta$-peak EDOs might look like...) Although these scales consist of a total of 7 and 12 ratios, respectively, both can be *built* from a much smaller set of ratios. If we look at the ratio *between* any two successive intervals in the just major scale, we have the following: $ 10/9, ~~ 9/8, ~~ 16/15, ~~ 9/8, ~~ 10/9, ~~ 9/8, ~~ 16/15 $ So the whole scale is built by stacking multiplicative combinations of the intervals $ 9/8, ~~ 10/9, ~~ 16/15 $ Similarly, the "scalar differential" of the 5-limit chromatic scale is: $ 16/15, ~~ 25/24, ~~ 27/25, ~~ 25/24, ~~ 16/15, ~~ 27/25, ~~ 25/24, ~~ 16/15, ~~ 25/24, ~~ 27/25, ~~ 25/24, ~~ 16/15 $ And so again the scale as a whole can be built from just 3 intervals $ 27/25, ~~ 16/15, ~~ 25/24 $ The fact that both the just major scale and the 5-limit chromatic are 5-limit scales, and 5 is the *3rd* prime number, and these scales can both be generated from three intervals, is no accident. Indeed, if we tug on this thread, we find some beautiful connections between just intonation and linear algebra. ### From Notes to Vectors, from Scales to Matrices Let's specify a given $p_n$-limit, e.g. $p_3 = 5$. Then any 5-limit interval can be written as a 3-dimensional integer vector, consisting of the powers to which each of the prime factors $2$, $3$, and $5$ are raised in its prime factorization. E.g. $ \begin{array}{rcccl} 9/8 & = & 2^{-3} \cdot 3^2 \cdot 5^0 & = & \left[ \begin{array}{ccc} -3 & 2 & 0 \end{array} \right>\\ 10/9 & = & 2^1 \cdot 3^{-2} \cdot 5^1 & = & \left[ \begin{array}{ccc} 1 & -2 & 1 \end{array} \right>\\ 27/25 & = & 2^0 \cdot 3^3 \cdot 5^{-2} & = & \left[ \begin{array}{ccc} 0 & 3 & -2 \end{array} \right>\\ 16/15 & = & 2^4 \cdot 3^{-1} \cdot 5^{-1} & = & \left[ \begin{array}{ccc} 4 & -1 & -1 \end{array} \right>\\ 25/24 & = & 2^{-3} \cdot 3^{-1} \cdot 5^2 & = & \left[ \begin{array}{ccc} -3 & -1 & 2 \end{array} \right>\\ & \vdots & & \vdots \end{array} $ If we have three such vectors, for instance the ones corresponding to our 3 generating intervals for the just major scale: $\left[ \begin{array}{ccc} -3 & 2 & 0 \end{array} \right>$, $\left[ \begin{array}{ccc} 1 & -2 & 1 \end{array} \right>$, and $\left[ \begin{array}{ccc} 4 & -1 & -1 \end{array} \right>$, we can stack them together to make a $3 \times 3$ integer matrix: $ \left[ \begin{array}{ccc} -3 & 2 & 0\\ 1 & -2 & 1\\ 4 & -1 & -1 \end{array} \right] $ And then we can apply the usual tools of linear algebra to study the properties of this matrix! **For instance:** the determinant of this matrix is $1$; therefore it has an inverse matrix, which is also an integer matrix. Calculating this inverse gives us: $ \left[ \begin{array}{ccc} 3 & 2 & 2\\ 5 & 3 & 3\\ 7 & 5 & 4 \end{array} \right] $ About which we can additionally observe the following: * The elements of the inverse matrix are all non-negative integers (an invertible matrix with the property that its inverse has all nonnegative entries is called *monotone*) * The sum of the first row of the inverse matrix is $3 + 2 + 2 = 7$, the number of notes in the major scale! (and a $\zeta$-peak EDO...) The fact that the sum of the first row of the inverse is equal to the number of notes in the scale from which it was derived is actually not as mysterious as it may at first seem. We can think of the original matrix as a *change of basis* matrix that converts the *standard basis*, consisting of the vectors $\left[ \begin{array}{ccc} 1 & 0 & 0 \end{array} \right>$, $\left[ \begin{array}{ccc} 0 & 1 & 0 \end{array} \right>$, and $\left[ \begin{array}{ccc} 0 & 0 & 1 \end{array} \right>$, to a new basis given by the 3 generating intervals $\left[ \begin{array}{ccc} -3 & 2 & 0 \end{array} \right>$, $\left[ \begin{array}{ccc} 1 & -2 & 1 \end{array} \right>$, and $\left[ \begin{array}{ccc} 4 & -1 & -1 \end{array} \right>$ for the just major scale. It follows, then, that each row of the inverse matrix tells us *how many* of each new basis vector need to be added together in order to get back to the corresponding original basis vector. For the case of $\left[ \begin{array}{ccc} 1 & 0 & 0 \end{array} \right>$, which corresponds to the octave, this tells us how many of each interval are needed to fill the octave, which is equivalent to building a scale out of these intervals within the octave. Indeed, if we look back at the sequence of generating intervals for the just major scale, we see that there are exactly three occurrences of $9/8$, and two occurrences each of $10/9$ and $16/15$. If we do the same thing for the generating intervals of the 5-limit chromatic scale, we have the following matrix: $ \left[ \begin{array}{ccc} 0 & 3 & -2\\ 4 & -1 & -1\\ -3 & -1 & 2 \end{array} \right] $ In this case, the determinant of this matrix is $-1$, rather than $1$ as above but this still implies that the matrix is invertible and its inverse is an integer matrix (technically speaking, a matrix with determinant $\pm 1$ is called *unimodular.* For integer matrices, being unimodular is equivalent to being invertible over $\mathbb{Z}$, the ring of integers). Calculating this inverse gives us: $ \left[ \begin{array}{ccc} 3 & 4 & 5\\ 5 & 6 & 8\\ 7 & 9 & 12 \end{array} \right] $ and again we see that all the elements of the inverse matrix are non-negative, and the sum of the first row is $3 + 4 + 5 = 12$—the number of notes in the chromatic scale! ### Scale Embeddings Can we also make sense of the *embedding* we noted earlier of the just major scale into the 5-limit chromatic scale using the above matrix algebra? It turns out we can! Much like the inverse matrix of the matrix of generating intervals for the just major scale told us how to express the *standard basis* consisting of the prime harmonics as combinations of generating intervals for the scale, so we can similarly find a *change-of-basis* matrix whose inverse expresses each of the generating intervals for the just major scale as combinations of generating intervals from the 5-limit chromatic scale, namely, if we solve for a matrix $\mathbf{A}$ such that $ \mathbf{A} \cdot \left[ \begin{array}{ccc} -3 & 2 & 0\\ 1 & -2 & 1\\ 4 & -1 & -1 \end{array} \right] = \left[ \begin{array}{ccc} 0 & 3 & -2\\ 4 & -1 & -1\\ -3 & -1 & 2 \end{array} \right] $ Applying some matrix algebra, we see that: $ \begin{array}{rcl} \mathbf{A} & = & \left[ \begin{array}{ccc} 0 & 3 & -2\\ 4 & -1 & -1\\ -3 & -1 & 2 \end{array} \right] \cdot \left[ \begin{array}{ccc} -3 & 2 & 0\\ 1 & -2 & 1\\ 4 & -1 & -1 \end{array} \right]^{-1}\\ & = & \left[ \begin{array}{ccc} 0 & 3 & -2\\ 4 & -1 & -1\\ -3 & -1 & 2 \end{array} \right] \cdot \left[ \begin{array}{ccc} 3 & 2 & 2\\ 5 & 3 & 3\\ 7 & 5 & 4 \end{array} \right]\\ & = & \left[ \begin{array}{ccc} 1 & -1 & 1\\ 0 & 0 & 1\\ 0 & 1 & -1 \end{array} \right] \end{array} $ And $ \mathbf{A}^{-1} = \left[ \begin{array}{ccc} 1 & 0 & 1\\ 0 & 1 & 1\\ 0 & 1 & 0 \end{array} \right] $ And indeed, $\mathbf{A}^{-1}$ tells us how to express each of the generating intervals of the just major scale as combinations of those for the 5-limit chromatic scale: * $9/8 = 27/25 \times 25/24$ * $10/9 = 16/15 \times 25/24$ * $16/15 = 16/15$ This corresponds to the way in which, working in equal temperament, we typically define a "whole step" as made up of two half steps; the two intervals 9/8 and 10/9 function as "whole steps" in the just major scale, and are both made up of two "half step" generating intervals when embedded in the 5-limit chromatic scale. The "half step" interval 16/15 from the just major scale, on the other hand, is carried over unchanged. Also, like both the matrices of generating intervals for the just major and 5-limit chromatic scales, our change of basis matrix $\mathbf{A}$ also has the property of being unimodular (i.e. invertible over $\mathbb{Z}$), and monotone (its inverse has all entries non-negative). For another example, consider the scale generated by the intervals $135/128,$ $25/24$, and $128/125$, and its corresponding matrix: $ \left[ \begin{array}{ccc} -7 & 3 & 1\\ -3 & -1 & 2\\ 7 & 0 & -3 \end{array} \right] $ which is again invertible over the integers with inverse $ \left[ \begin{array}{ccc} 3 & 9 & 7\\ 5 & 14 & 11\\ 7 & 21 & 16 \end{array} \right] $ adding up the first row yields $3 + 9 + 7 = 19$—so this scale is a 5-limit form of 19-EDO! And as is well known by microtonalists, the major scale also embeds in 19-EDO (by treating a "whole step" as 3 steps in 19-EDO and a "half step" as 2). Can we exhibit this embedding in the same way as above? If we factor the above matrix as before, we get: $ \mathbf{A} = \left[ \begin{array}{ccc} -7 & 3 & 1\\ -3 & -1 & 2\\ 7 & 0 & -3 \end{array} \right] \cdot \left[ \begin{array}{ccc} 3 & 2 & 2\\ 5 & 3 & 3\\ 7 & 5 & 4 \end{array} \right] = \left[ \begin{array}{ccc} 1 & 0 & -1\\ 0 & 1 & -1\\ 0 & -1 & 2 \end{array} \right] $ which has inverse $ \mathbf{A}^{-1} = \left[ \begin{array}{ccc} 1 & 1 & 1\\ 0 & 2 & 1\\ 0 & 1 & 1 \end{array} \right] $ demonstrating that, indeed, the two "whole step" intervals of the just major scale get decomposed as three "steps" of the 5-limit 19-tone scale, and the "half step" interval as two. And yet again, the matrix $\mathbf{A}$ has both properties noted above: invertibility over the integers (unimodularity), and all non-negative entries in its inverse (monotonicity). **Definition:** Let's call an integer square matrix $\mathbf{A}$ as above with these two properties—unimodularity and monotonicity—a **scale embedding.** We say that a scale with generating matrix $\mathbf{X}$ is *embedded* in another scale with generating matrix $\mathbf{Y}$, if we can factor $\mathbf{Y}$ through $\mathbf{X}$ via a scale embedding $\mathbf{A}$, i.e. $ \mathbf{A} \cdot \mathbf{X} = \mathbf{Y} $ Or equivalently (assuming $\mathbf{X}$ and $\mathbf{Y}$ are both invertible) if the matrix $ \mathbf{A} = \mathbf{Y} \cdot \mathbf{X}^{-1} $ is a scale embedding. #### The Category of Scales and Embeddings We still have to nail down the requirements for a (square integer) matrix $\mathbf{X}$ to be the *generating matrix* of a scale (in some $p_n$-limit). Here is an attempted axiomatization, based on the previous examples: 1. *unimodularity:* $\mathbf{X}$ i.e. invertible over the integers. * This essentially boils down to the requirement that one can build each of the prime harmonics up to $p_n$ as integer combinations of the generating intervals in $\mathbf{X}$. 2. *monotonicity:* $\mathbf{X}^{-1}$ has all non-negative entries * In conjunction with the above, this means that not only can the prime harmonics be built as integer combinations of the generating intervals in $\mathbf{X}$, but moreover as *non-negative* integer combinations, i.e. only by "stacking" intervals. 3. *orientation:* Every generating vector $\mathbf{x}$ in $\mathbf{X}$ is positive under the map $\mathbf{x} \mapsto \log_2\left( \prod_{i=1}^n p_i^{\mathbf{x}_i} \right)$. * This means that, interpreting each generating vector as a frequency ratio in pitch space, the ratio is gt; 1$, i.e. the intervals themselves are oriented *upward* rather than downward. In other words, a matrix $\mathbf{X}$ is the generating matrix of a scale if it is an *oriented scale embedding.* We can then define a category $\mathcal{S}_n$ of $p_n$-limit scales and scale embeddings as follows: * **Objects:** oriented scale embeddings * **Morphisms $\mathbf{X} \to \mathbf{Y}$:** scale embeddings $\mathbf{A}$ such that $\mathbf{A} \cdot \mathbf{X} = \mathbf{Y}$, with composition given by matrix multiplication. By construction, this category is *thin*, i.e. a preorder, since for any invertible $\mathbf{X}, \mathbf{Y}$, there exists at most one scale embedding $\mathbf{A} : \mathbf{X} \to \mathbf{Y}$. An additional requirement we may wish to impose on scale matrices $\mathbf{X}$ is that no interval in $\mathbf{x}$ is too large, e.g. greater than an octave. However, we can easily accommodate an additional requirement such as this in the above setup. Note that for any $p_n$-limit, we can define an *initial octave-reduced scale* $\mathbf{I}_n$ where all prime harmonics are reduced by powers of 2 to lie within the octave, given by the matrix $ \left[ \begin{array}{c} 1 & 0 & 0 & \dots & 0\\ -\lfloor \log_2(3) \rfloor & 1 & 0 & \dots & 0\\ -\lfloor \log_2(5) \rfloor & 0 & 1 & \dots & 0\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ -\lfloor \log_2(p_n) \rfloor & 0 & 0 & \dots & 1 \end{array} \right] $ For example, in the case where $p_n = p_3 = 5$, this yields a scale generated by the intervals $ 5/4, ~~ 3/2, ~~ 2/1 $ i.e. the just major 3rd, perfect 5th, and octave. Any scale matrix $\mathbf{Y}$ into which this scale embeds must be able to build all of these *reduced prime harmonics* as non-negative combinations of each of its generating intervals, which implies that these generating intervals must all lie within the octave. Hence we can enforce the restriction that all generating intervals must lie within the octave by working in the coslice category $\mathbf{I}_n/\mathcal{S}_n$. An additional requirement we may have is that prime harmonics whose octave-reduced forms are "higher" within the octave should "factor through" prime harmonics with whose octave-reduced forms are "lower" in the octave. E.g. in the above example, we may wish for the perfect 5th ($3/2$) to be expressible as a positive linear combination of generating intervals, such that some subset of these intervals also sum to the just major 3rd ($5/4$). However, once again we can solve this by defining a new *initial* matrix and working in the coslice over that matrix. Specifically, if we take the scale defined by $\mathbf{I}_n$ within the octave, e.g. for $\mathbf{I_3}$ $ 1/1, ~~ 5/4, ~~ 3/2, ~~ 2/1 $ And compute its "scalar differential" as above by taking ratios of successive intervals, this yields the following set of generating intervals $ 6/5, ~~ 5/4, ~~ 4/3 $ Which yields the following scale matrix and its inverse (called $\mathbf{Arp}_n$ since the scale it generates is effectively an *arpeggio* generated by the prime harmonics up to $p_n$): $ \mathbf{Arp}_3 = \left[ \begin{array}{ccc} 2 & -1 & 0\\ -2 & 0 & 1\\ 1 & 1 & -1 \end{array} \right] \qquad \mathbf{Arp}_3^{-1} = \left[ \begin{array}{ccc} 1 & 1 & 1\\ 1 & 2 & 2\\ 2 & 3 & 2 \end{array} \right] $ and by inspection we see that, in the inverse matrix, each higher row factors through a positive linear combination of the lower rows, such that the remainder is also nonnegative. Hence this scale matrix, and any other into which it embeds, must also have this property, so we can enforce this by working in the coslice $\mathbf{Arp}_n/\mathcal{S}_n$. For a further example: in the case where $p_n = p_4 = 7$, we have the following scale of octave-reduced prime harmonics $ 1/1, ~~ 5/4, ~~ 3/2, ~~ 7/4, ~~ 2/1 $ and computing the "scalar differential" yields the following generating intervals: $ 5/4, ~~ 6/5, ~~ 8/7, ~~ 7/6 $ and corresponding matrices $ \mathbf{Arp}_4 = \left[ \begin{array}{cccc} -2 & 0 & 1 & 0\\ 1 & 1 & -1 & 0\\ 3 & 0 & 0 & -1\\ -1 & -1 & 0 & 1 \end{array} \right] \qquad \mathbf{Arp}_4^{-1} = \left[ \begin{array}{cccc} 1 & 1 & 1 & 1\\ 2 & 2 & 1 & 1\\ 3 & 2 & 2 & 2\\ 3 & 3 & 2 & 3 \end{array} \right] $ ## Pythagorean Tuning Pythagorean tuning is the special case of $p_n$-limit tuning for $n = 2$, i.e. using only the prime harmonics $p_1 = 2$ and $p_2 = 3$. Applying the above-developed framework in this simplified setting can help us better understand what's going on in it. If we start from initial prime arpeggio $\mathbf{Arp}_2$ defined above, in Pythagorean tuning, this is the scale generated by the intervals $3/2$ (perfect 5th) and $4/3$ (perfect 4th), i.e. $ P_1 = \mathbf{Arp}_2 = \left[ \begin{array}{cc} 1 & 0\\ -1 & 1 \end{array} \right] $ The most basic scale embeddings we can define in this setting are the two elementary row operation matrices: $ E_1 = P_1 = \left[ \begin{array}{c} 1 & 0\\ -1 & 1 \end{array} \right] \qquad E_2 = \left[ \begin{array}{cc} 1 & -1\\ 0 & 1 \end{array} \right] $ corresponding to subtracting the top row from the bottom row, and vice versa. Musically, this corresponds to *subdividing* one generating interval by another in order to generate a finer scale. Note that only the first of these, $E_1$ is itself a valid scale matrix, due to the orientation condition, since the first row of $E_2$ corresponds to an interval of $2/3 < 1$. We can therefore generate a chain of scale matrices in $\mathbf{Arp}_2/\mathcal{S}_2$, starting from $P_1$, by repeatedly choosing one of $E_1, E_2$ to multiply by the previous $P_i$. And moreover, at each step of the process, only *one* of $E_1$ or $E_2$ will produce a valid scale matrix when multiplied with $P_i$, since one of the two intervals represented by the rows of $P_i$ will be larger than the other, so subtracting it from the other would result in an interval of size lt; 1$, violating the orientation condition (and conversely, subtracting the smaller interval preserves this invariant). Applying this process for a few steps, we get the following sequence of matrices (and their inverses): $ \begin{array}{rclcrcl} P_1 & = & \left[ \begin{array}{cc} 1 & 0\\ -1 & 1 \end{array} \right] & \quad & P_1^{-1} & = & \left[ \begin{array}{cc} 1 & 0\\ 1 & 1 \end{array} \right]\\ P_2 & = & \left[ \begin{array}{cc} 2 & -1\\ -1 & 1 \end{array} \right] & & P_2^{-1} & = & \left[ \begin{array}{cc} 1 & 1\\ 1 & 2 \end{array} \right]\\ P_3 & = & \left[ \begin{array}{cc} 2 & -1\\ -3 & 2 \end{array} \right] & & P_3^{-1} & = & \left[ \begin{array}{cc} 2 & 1\\ 3 & 2 \end{array} \right]\\ P_4 & = & \left[ \begin{array}{cc} 5 & -3\\ -3 & 2 \end{array} \right] & & P_4^{-1} & = & \left[ \begin{array}{cc} 2 & 3\\ 3 & 5 \end{array} \right]\\ P_5 & = & \left[ \begin{array}{cc} 8 & -5\\ -3 & 2 \end{array} \right] & & P_5^{-1} & = & \left[ \begin{array}{cc} 2 & 5\\ 3 & 8 \end{array} \right]\\ P_6 & = & \left[ \begin{array}{cc} 8 & -5\\ -11 & 7 \end{array} \right] & & P_6^{-1} & = & \left[ \begin{array}{cc} 7 & 5\\ 11 & 8 \end{array} \right]\\ P_7 & = & \left[ \begin{array}{cc} 8 & -5\\ -19 & 12 \end{array} \right] & & P_7^{-1} & = & \left[ \begin{array}{cc} 12 & 5\\ 19 & 8 \end{array} \right]\\ P_8 & = & \left[ \begin{array}{cc} 27 & -17\\ -19 & 12 \end{array} \right] & & P_8^{-1} & = & \left[ \begin{array}{cc} 12 & 17\\ 19 & 27 \end{array} \right]\\ P_9 & = & \left[ \begin{array}{cc} 46 & -29\\ -19 & 12 \end{array} \right] & & P_9^{-1} & = & \left[ \begin{array}{cc} 12 & 29\\ 19 & 46 \end{array} \right]\\ P_{10} & = & \left[ \begin{array}{cc} 65 & -41\\ -19 & 12 \end{array} \begin{array}{cc} \end{array} \right] & & P_{10}^{-1} & = & \left[ \begin{array}{cc} 12 & 41\\ 19 & 65 \end{array} \right]\\ & \vdots & & & & \vdots & \end{array} $ If we then take the sums of the rows of each of the inverse matrices and write them as fractions (with the numerator given by the sum of the bottom row and the denominator by the sum of the top row), we see the following: $ \mathbf{\frac{2}{1}} \quad \mathbf{\frac{3}{2}} \quad \frac{5}{3} \quad \mathbf{\frac{8}{5}} \quad \frac{11}{7} \quad \mathbf{\frac{19}{12}} \quad \frac{27}{17} \quad \frac{46}{29} \quad \mathbf{\frac{65}{41}} \quad \mathbf{\frac{84}{53}} \quad \dots $ The fractions highlighted in **bold** in the above sequence have a special property: they are *convergents* of $\log_2(3)$. That is, roughly speaking, they approximate $\log_2(3) \approx 1.58\dots$ better than any simpler fraction. This is no accident. When we successively divide the larger ratio in a Pythagorean scale matrix by the smaller ratio, we are effectively computing values $n,m$ such that $2^n \cdot 3^m$ is progressively closer to $1$, i.e. for which $2^n \approx 3^{-m}$, or in other words $\frac{n}{-m} \approx \log_2(3)$. So, in this mathematical setting, we can view Pythagorean tuning as providing an algorithm for computing rational approximations to $\log_2(3)$, and conversely, the *denominators* of these rational approximations yield EDO values with good approximations to the 3rd harmonic. (Moreover, one might notice that several of the denominators in the above list, namely $2, 5, 7, 12, 41$, and $53$ are $\zeta$-peak EDOs...) ## Tonality in Higher Dimensions Returning now to the general case of $p_n$-limit tuning, the situation is more complex, even for the case of $n = 3$. On the one hand, we *can* still view the ratios of sums of rows of inverses of scale matrices as approximations to logarithms of prime numbers, e.g., looking at the inverse matrix for the just major scale $ \left[ \begin{array}{ccc} 3 & 2 & 2\\ 5 & 3 & 3\\ 7 & 5 & 4 \end{array} \right] $ we see that the sums of the rows are, respectively $7, ~ 11,$ and $16$, which have ratios $ 11/7 \approx \log_2(3) \qquad 16/7 \approx \log_2(5) \qquad 16/11 \approx \log_3(5) $ However, finding a triple $(n_1, n_2, n_3)$ of numbers that somehow *jointly* approximate the logarithms of $2,3,$ and $5$ as above is more complicated than simply finding a ratio that approximates $\log_2(3)$. For instance, how are we to compare two such triples $(k_1,k_2,k_3)$ and $(m_1, m_2, m_3)$ such that $k_2/k_1$ is a better approximation to $\log_2(3)$ than $m_2/m_1$ but $m_3/m_1$ is a better approximation to $\log_2(5)$ than $k_3/k_1$? It would be better if we could somehow associate to each $n \times n$ scale matrix a quantity which somehow measures its ability to approximate logarithms of prime numbers up to $p_n$, in a relatively natural and unbiased way. In the case of $n = 2$, we had such a measure, since we could take $|\log_2(3) - n_2/n_1|$ where $n_1$ and $n_2$ are the sum of the 1st and 2nd rows of the inverse scale matrix, respectively. Is there such a quantity we can similarly associate to higher-dimensional scale matrices? In fact, this last question takes us to the heart of the matter, and reveals at least some of the connections to the $\zeta$-function we sought at the start of this post. For this purpose, it will be necessary to introduce one final key definition: the *smoothness* of a scale matrix. ### Smooth Scales Take another look at the generating intervals for the just major scale $ 9/8, ~~ 10/9, ~~ 16/15 $ Observe that the (base 2) logarithms of these intervals all lie fairly close to $1/7 \approx 0.14$ $ \log_2(9/8) \approx 0.17 \qquad \log_2(10/9) \approx 0.15 \qquad \log_2(16/15) \approx 0.09 $ That is, measuring logarithmically, the average deviation from any generating interval in the scale and the average distance spanned by each interval (weighted by number of occurrences of each interval in the scale) is relatively low. More generally, we can use the above observation to bound the error between any note in the scale and the corresponding "equal-tempered approximation" given by dividing the octave into $s$ equal divisions, where $s$ is the sum of the first row of the inverse to the scale matrix. Specifically, given an $n \times n$ scale matrix, corresponding to a collection of $n$ generating intervals $ q_1, \dots, q_n $ let $(x_1, \dots, x_n)$ be the first row of the corresponding inverse matrix, and $s = \sum_{i=1}^n x_i$. Let $I_{<} = \{i \in \{1, \dots, n\} \mid \log_2(q_i) < 1/s\} \qquad I_{>} = \{i \in \{1, \dots, n\} \mid \log_2(q_i) > 1/s\}$ i.e. $I_<$ is the set of indices $i$ such that $\log_2(q_i) < 1/s$ and $I_{>}$ is the set of indices $i$ such that $\log_2(q_i) > 1/s$. Then define $ E_< = \sum_{i \in I_<} x_i (1/s - \log_2(q_i)) \qquad E_> = \sum_{i \in I_>} x_i(\log_2(q_i) - 1/s) $ For any interval $k$ in the scale, since $k$ is expressible as a nonnegative linear combination of generating intervals $q_1^{a_1} * \dots * q_n^{a_n}$, let $E_k$ be the absolute error between $\log_2(k) = a_1 \log_2(q_1) + \dots + a_n \log_2(q_n)$ and the corresponding "equal-tempered approximation" to $k$ given by replacing all generating intervals in the scale with $s$ divisions of the octave, i.e. $a_1/s + \dots + a_n/s$. Since $a_1 \leq x_1, \dots, a_n < x_n$, $E_k$ is maximized if either $a_i = x_i$ for all $i \in I_<$ and $a_i = 0$ for all $i \in I_>$, in which case $E_k = E_<$, or vice versa, in which case $E_k = E_>$. But in fact, $E_<$ and $E_>$ must be equal. To see why, note that we must have $ \sum_{i = 1}^n x_i \log_2(q_i) = 1 $ i.e. $E_{2/1} = 0$, and since $E_{2/1} = E_> - E_<$ by construction, if follows that $E_> = E_<$. So the logarithmic error between any note in the scale and its corresponding equal-tempered approximation is at most $E = E_< = E_>$. Call this quantity the **roughness** of the scale (and likewise, call a scale with low roughness **smooth**) Moreover, if the scale admits an embedding of $\mathbf{Arp}_n$ (i.e. if we are working in the category $\mathbf{Arp}_n/\mathcal{S}_n$ as described above), then as observed previously, every prime harmonic up to $p_n$ can be decomposed as an octave transposition of some interval lying within the octave. Then since, as noted above, $E_{2/1} = 0$, i.e. the octave is exactly approximated, it follows that the absolute error in approximation for any prime harmonic up to $p_n$ is *also* bounded by the smoothness of the scale! This provides a link between the algebraic world of just intoned scales and their matrices, and the analytic world of equal-tempered scales and the $\zeta$-function. In particular, since the $\zeta$-function effectively measures the joint accuracy of an EDO's approximation of prime harmonics, it follows that, for EDOs with the same number of steps as scales whose roughness value is low, i.e. smooth scales, this accuracy will be high, at least for lower prime harmonics, which are weighted more heavily by the $\zeta$-function. Hence, as we have already seen, $\zeta$-peak EDO values tend to coincide with the number of steps (i.e. sum of the first row of the inverse matrix) of in scales generated by smooth scale matrices. Moreover, a rationale for the "additive" patterns we noticed in $\zeta$-peak values previously is that these are reflections of the matrix algebra of such scale matrices, whereby one such scale may be obtained by subdividing another, etc. This is as far as my mathematical investigations of the fascinating worlds of tuning and microtonality have taken me, but there remains much to explore! I have sketched above the beginnings of a relationship between the algebra of just intoned scales and the approximation of prime harmonics by equal divisions of the octave, but it would be nice to back this up with some proper theorems, rather than the more impressionistic account given above. Nonetheless, even what I have found so far through these explorations has been eye-opening for me as to the deep mathematical structure behind music and harmony. And for you, reader, I hope it's been the same!