# The harmony of numbers

‘Musical form is close to mathematics – not perhaps to mathematics itself, but certainly to something like mathematical thinking and relationship’.

Igor Stravinsky

The Russian composer Stravinsky found similarities between maths and music and many others have commented on the links. Both musicians and mathematicians work with special symbols, follow certain rules and play with patterns. Pythagoras was the first to make the connection between maths and music. The story goes that one day, probably deep in thought about the nature of triangles, the Greek philosopher was walking past a blacksmith’s when he heard something strange. As the blacksmith’s hammers struck the anvil, some of the hammers would produce harmonious sounds while others sounded discordant.

He decided to investigate and found that there was a mathematical relationship between the weight of the hammers and the sounds they produced. If two hammers’ weights formed a whole-number ratio, striking them produced pleasant tones. The story is likely a myth, but the relationship Pythagoras found is true.

### A certain ratio

When it comes to ratios, the simplest of all is 2:1. Combining the sound of a hammer with another half its weight produces the simplest musical interval, the octave – the interval between one musical pitch and another with half or double its frequency.
Two notes that are an octave apart sound the same, just higher or lower in pitch. Other ratios produce additional intervals; 3:2, 4:3, 5:4 and 6:5 correspond to the perfect fifth, perfect fourth, major third, and minor third respectively.

It turns out that these ratios relate to the frequency of the sounds produced. We hear sounds because of vibrations in the air, and the rate of these vibrations is called the frequency, which is measured in hertz (Hz). Higher frequencies correspond to higher pitched notes. For example, a tone of 440 Hz corresponds to the musical note A above the middle C of a piano. Doubling the frequency to 880 Hz in the ratio 2:1 corresponds to the A an octave higher.

The Greeks didn’t know about the mathematics of frequencies, but could still use ratios to construct their musical scale. They found that plucking a string produces a note, and plucking a string half the length produces the same note an octave higher. Dividing a string according to any of the other whole-number ratios also produces the related interval.

### The perfect tune? Pythagorean tuning, as the Greek musical scale is known, is built on a series of perfect fifth intervals using the ratio 3:2. For example, suppose we start on A at 440 Hz. A fifth above is E, at 3/2 · 440 = 660 Hz. The next fifth gives us B, at 3/2 · 660 = 990 Hz, but this note is more than an octave above our original A. To bring it back down an octave to the correct range, we use the ratio 2:1 and halve the frequency to 495 Hz, a ratio of 9:8 above the original A. Continuing this sequence for a total of 12 steps eventually gives all 12 notes of the musical scale, and returns you to the starting A.

There’s just one problem – it doesn’t work. The numbers don’t add up! Repeatedly applying the ratio of 3:2 is like multiplying by 3/2, so our sequence of 12 steps is equivalent to multiplying the initial frequency by (3/2)12. This covers seven octaves, which is the same as multiplying the initial frequency by 27. And that’s the catch, because while 27 = 128, (3/2)12 is about 129.75. Our two methods for defining the musical scale don’t agree.

This didn’t matter to the Greeks. Their music was based on perfect fifths, so the slightly out of tune notes could be avoided. However, when people started to create music that was more complicated, the system fell apart. Chords sounded disharmonious, it was difficult to change key and it was clear musicians had to abandon the Greek whole-number ratios.

### A new method

In their place came the method of equal temperament. As the name suggests, this system of tuning balances the musical scale so that 12 notes are equal to an octave. It works by effectively spreading out the tuning error of the Greek system, so that every note is slightly (but acceptably) out of tune.

How does it work? We want a ratio that when multiplied by itself 12 times results in a ratio of 2:1, the octave. In other words, we need the solution to x12 = 2. Thus, equal temperament is built from multiples of the twelfth root of two.

This solution would have horrified Pythagoras. He believed that all numbers could be described as the ratio of two whole numbers, or integers. These numbers are known as rational, from the word ‘ratio’. The square root of two is an irrational number; it cannot be expressed as the ratio of any integers. Legend has it that Pythagoras drowned one of his students for revealing this fact to the world!

Thankfully, we are more accepting of irrational numbers these days. The twelfth root of two is the same as the sixth root of root two (work it out!), thus is also irrational. Without this number, musicians would have been stuck with just a few basic chords and we wouldn’t have the wide variety of music we enjoy today. Next time you listen to the radio or your MP3 player, remember the twelfth root of two!