In a letter to a German princess on “the twelve tones of the harpsichord” penned by Leonhard Euler on the 3rd of May 1760 (coincidentally exactly 213 years before my birth day (coincidentally 213 is the smallest number that is part of a consecutive triple, each a product of a pair of distinct prime numbers; 213=3×71, 214=2×107, 215=5×43)), the tension between equal temperament and harmony is highlighted as a central issue in music. Euler wrote “It is evident, therefore, that in fact all semitones are not equal, whatever efforts may be made by musicians to render them such; because true harmony resists the execution of a design contrary to its nature”.

**What was Euler talking about?**

Music is relative. With the exception of a handful of individuals who possess perfect pitch (as an aside, the genetics are interesting), we perceive music relatively. This is very similar to an RNA-Seq experiment. Transcript abundances are measured only relatively to each other (by comparing read counts), although of course a very relatively abundant transcript can also be inferred to be absolutely abundant, as one has prior knowledge about the abundances of housekeeping and other yardstick genes. So it is with music. We know when we are listening to high vs. low pitch, but within a register we hear combinations of notes as concordant or discordant, as melodic or not, based on the relative frequencies of the pitches.

*Harmony *is the use of simultaneous sounds in music, and is closely associated with the notion of *consonance. *Specifically, the *perfect fifth* is the consonant sound of two frequencies at a ratio of *3/2* (the question of why this ratio sounds “good” is an interesting one, and I recommend Helmholtz‘s “On the sensations of tone” as an excellent starting point for exploration). Harmony leads to a “rational” requirement of musical scales: for example, the ability to produce a perfect fifth requires that among notes corresponding to sounds at pre-specified frequencies, there are a pair at a frequency ratio of *3/2*. Other consonant harmonies correspond to other rational numbers with small denominators (e.g. *4/3). **Equal **temperament* is a relative requirement: in a musical scale composed of *N* notes, it is desirable that any pair of consecutive notes are at the same frequency ratio, say *r*. This allows for a music to begin on any note.

The tension Euler described between harmony and equal temperament is the mathematical observation that if and , then *k* should be chosen so that . This is because the first equation leads to so that , and the second equation then leads to . However is irrational. This is because if it were rational then would be rational, and that would mean that for some positive integers , which in turn would be mean that , which is impossible because powers of two are always even, and powers of three always odd. Ergo a problem.

The mathematics above shows that harmony is fundamental incompatible with equal temperament, but so what? If a very good rational *approximation* can be found for then music might not be *perfect*, but perfect should not be the enemy of the good. For example, in a 12 note scale, we find that the seventh note (e.g. G if we are in C major) produces a frequency ratio with the first of , which is awfully close to *1.5*. Does the difference in the third decimal really matter when one is listening to Rammstein?

Is 12 special? What about an 11 note scale? The following math provides the answer:

A (simple) continued fraction representation for an irrational number *x *is an infinite expression of the form

The convergents of *x *are the rational numbers obtained by truncating the continued fraction expression at successively increasing finite points, i.e. the sequence

** Theorem**: Let be the convergents of a number

*x.*Then the rational number is the best rational approximation to

*x*with denominator .

The theorem is saying that if one approximates an irrational number with its continued fractions, then the denominators of those fractions are optimal in the sense that they provide rational approximations that improve on all lower denominators (an elementary proof is written up here). For example, the continued fraction approximation of is given by the sequence which translates to the expansion

and leads to to the rational approximations

The fourth denominator is 5, and its interpretation in light of the theorem is that no rational number with *1,2,3 *or *4 *in the denominator can provide an approximation as good as *3/5 *to . Similarly, with *12 *being the next denominator, the theorem implies that no rational number with a denominator between *1 *and *11* can provide an approximation to as good as *7/12*. In fact, to improve on the accuracy of the perfect fifth a 29 note scale is required, a number which is much less practical than 12.There are of course other “rational” considerations in choosing a scale. Not only the perfect 5th must be approximated well, but also thirds and fourths. It turns out 12 provides a reasonably good approximation for all of these. In other words, the 12 note scale is not just a historical accident, it is a mathematical inevitability.

The question is did Princess Friederike Charlotte of Brandenburg-Schwedt realize that underlying the principle Euler was writing to her about was the key to understanding not only the theory of music, but also a fundamental design in *nature*?

**The number of petals in flowers**

An obvious question not addressed by the theorem stated above is *how good are the rational approximations of irrational numbers? *Obviously a rational number can always be chosen to be arbitrarily close to any irrational number (e.g. by truncating the decimal expansion arbitrarily far along). But the question is interesting when considered, in light of the theorem above, in terms of the accuracy of approximation *as a function of its denominator*. Hurwitz‘s theorem provides the answer:

*Theorem [Hurwitz, 1891]:** *For every irrational number *x*, there are *infinitely* many rational approximations *n/d* such that

.

Moreover, the constant is best possible.

In other words, the approximation can be as good as the inverse of the square of the denominator (this should be contrasted with using the decimal expansion to approximate, which provides accuracy only proportional to the inverse of the denominator). The fact that is the best possible constant means that there is some irrational number such that if one sets the constant to be smaller, then there are only *finitely* many rational approximations achieving the improved accuracy. One cannot get more accurate than infinitely often, and it turns out that the irrational number that is the extremal example is the *golden ratio *. In a sense made precise by the theorem above, the golden ratio is *the hardest irrational number to approximate by rationals. *

Who would care about irrational numbers that are hard to approximate by rational numbers? Mothers of newborn twins?! However as whimsical as Ehud Friedgut‘s Murphy’s law sounds, evolution appears to have appropriated the principle of offsetting cycles to optimize branching patterns in plants and trees.

Tree branches around a trunk, or of flower petals around a stem, demand sunlight and ideally do not line up with each other. Suppose that they are equally spaced, separated by a fixed angle . If is rational, then the branches or petals will line up perfectly creating a pattern, viewed from above, of lines emanating from the trunk or main stem. An irrational angle ensures that branches never line up perfectly, however *if the irrational number is well approximated by a rational number* then the overlap will be extensive. That is, the branches will almost line up. The solution? Choose an irrational angle that is as hard as possible to approximate by rationals. The golden ratio! The angle turns out to be 137.5 degrees.

With the golden ratio, the branching pattern when viewed from above looks like a series of spirals. Depending on the time between the appearance of branches (or seeds at the center of a flower), the number of spirals varies. The numbers though will always correspond to one of the convergents of the (continued fraction expansion of the) golden ratio. These are

.

Note that the denominators are the Fibonacci numbers. Since flower petals typically form at the tips of the spirals, one frequently finds a Fibonacci number of petals on flowers. Fibonacci numbers are all over plants. Nature is irrational.

Georgia O’Keeffe: Music Pink and Blue No. 2 (1918). Next time you are pondering what her flowers truly represent, think also of the tension between the rational and the irrational in music, and in nature.

## 3 comments

Comments feed for this article

December 29, 2013 at 4:37 am

François R.It’s very interesting to get a perspective on this from someone skilled both as a mathematician and as a musician.

I would add that culture plays a dominant role as well. The perfect fifth is no cultural accident, it has real significance in math, psycho-acoustics, in the wavefronts of air reaching our ears. But also, we live in a society that decided to follow that particular trail of clues, look for other potent ratios, and develop an entire system of music around that. Other trails could have been followed.

In The Joke, Milan Kundera identifies folk rhythms that cannot be written in classical notation. They are real rhythms, performers always last and pause by the same amounts, but they come at times dictated by lyrics or gestures, and make for measures of different lengths. Their irregularity is beautiful to the audience.

Thanks for a great post, I got a great kick out of it, many good explanations =)

March 1, 2015 at 2:57 pm

Félix BalazardI had been under the impression that there was a lot of golden ratio in math vulgarisation while not much could be said of interest about it. The fact that it is the irrational hardest to approximate with rationals makes it very interesting.

This is a great post. I love your blog. Especially how you always manage to have a nice intro about something random before going into good math.

November 9, 2015 at 9:47 am

Bill KannenThanks for the interesting post! If you’re interested to hear if there’s anything melodic or rhythmic embedded in some of math’s irrational numbers, take a listen to the tracks below that I created recently. (Headphones recommended)

The first 64 digits of Phi (1.61803…) mapped to the whole notes of the C major scale. (0=C, 1=D, etc.)

The first 32 digits of Pi (3.14…) mapped to the whole notes of the C major scale:

The first 64 prime numbers (after doing modulus 14 on each number), then mapped to the C scale: