## Mathematics in Music

Leaving aside the topic of$p$-adic numbers (I feel as though I should learn more about it myself before I make any mistakes), I’m going to get back to a subject I hinted at a couple of posts back: the role of mathematics in music.  When I tell people that I studied music before switching to mathematics, they often say something along the lines of that the subjects are very similar/interconnected/both use “the left side of the brain”.   This isn’t really quite as true as seems to be commonly thought: you can certainly find a lot of mathematical patterns and structure in music; but so can you in any art, and indeed – arguably – in anything if you look hard enough!  And while I am personally averse to “side of the brain” arguments, if we are stooping to that level then I would argue that there is a creative right-side element integral to the creation and appreciation of music which is largely absent from mathematics.

However, it is true that many mathematicians are also involved in music – especially classical music – to some degree .  And it is true that the mathematical and logical structure of music is much more apparent and easier to appreciate than with other art-forms.   One of the best ways to see this is to look at tuning systems.

Every musical note has its own unique pitch, and for the purposes of this post I will consider perceived pitch and frequency to be one and the same thing (having studied the psychology of music perception, I can assure you that this is by no means actually the case!).  While there are many different tuning systems in use, one thing that seems to stay constant is the division of the frequency spectrum into octaves.  To move up an octave in pitch is to move up to the next occurrence of the “same” note, and results from a doubling of frequency.  So for example the note A above Middle C has a frequency of 440 Hz, and the next higher A has a frequency of 880Hz.  So the ratio of the frequency of a note to that of the same note an octave below is 2:1.  Other pleasing intervals are given by other simple ratios of whole numbers: a perfect fifth (eg. A to E) has a frequency ratio of 3:2; a minor third (A to C) a ratio of 5:4.

This in itself is quite fascinating to me…it is a great testament to the significance of the integers to our world-view that the most beautiful harmonies are produced by these simplest of numbers.  Before equal-tempering (see later) became standard in the western world, instruments were tuned so as to produce these exact ratios of frequencies, in a system called “just intonation”.  While this guaranteed perfect purity of sound if composers followed certain rules, it was also very restrictive.  For example, suppose a piece were written for a keyboard instrument in the key of A major, and included the “accidental” (note that is not part of the key) – F.  The interval between the A above Middle C and the next occurring F is a minor sixth, which has a ratio of 8:5.  So the F on the keyboard would need to be tuned to 440 x 8/5 = 704 Hz.  Now suppose the composer wanted to transpose the piece up to C# major.   From A to C# is a major third, so the C# on the keyboard would have originally been tuned to 440 x 5/4 = 550 Hz.  But the interval between this C# and the aforementioned F is a major third, and so in the context of C# major the F should be tuned to 550 x 5/4 =687.5 Hz.  Even the most over-compensating of ears could not help but notice the difference in pitch between 687.5 and 704 Hz, and so this transposition would have been impossible in this tuning system.  Conflicts like this meant that composers were restricted to writing in certain keys, and only including certain accidentals.

Needless to say, “just intonation” is not the system we use today.  We can split each octave into 12 (logarithmically) equally-spaced semitones, with the frequency ratio between adjacent semitones being$\sqrt[12]{2};$this will produce the desired octave interval of 2:1 in 12 steps, as$(\sqrt[12]{2})^{12}=2.$This is called “equal-tempering “, and imposes a uniform structure on the octave, enabling transposition without loss of proportion.   But what happens to our pleasing harmonic intervals?  Well, the distance from the A above Middle C to the next E is now 7 semi-tones, and so the frequency of that E becomes: 440 x$(\sqrt[12]{2})^{7}\approx$659.26 Hz.  660 is the number that would provide the 3:2 ratio we require for a perfect fifth, and 659.26 is close enough that the human ear cannot discern any discrepancy.  Similarly, the next up C has a frequency of roughly 523.25 Hz; close enough to the desired 528 that the interval between it and the A will sound like a nice minor third.

It is incredibly fortunate – some would say surely more than sheer coincidence – that each step up by a power of$\sqrt[12]{2}$produces a frequency difference close enough that our minds can fool us into hearing the desired harmony (remember: frequency is not pitch!), and this system has enabled musicians to freely move between keys and include whichever accidentals they wish.  I am sure that there are purists who are disgusted with this practical-minded dilution of perfection…but it is the best we’ve got.  Of course, there are a vast array of alternative tuning systems, including divisions of the octave into 19 and 43 parts, but I am not going to go into that.  I am beginning to veer into musicology, and this is supposed to be a mathematical blog!

So here is some interesting musical group theory.  Define an equivalence relation on notes in the equal-tempered tuning system, such that two notes are equivalent if their frequencies are (roughly!) multiples of each other.  Then we can label the 12 equivalence classes of this relation with the numbers 0 to 11 to get the integers mod 12 (this just means that when we get to the next octave the sequence of notes starts again).  We can then find mathematical analogies for typical musical operations.  For example any transposition can be defined to be the action of an element of the cyclic group of order 12 ($\mathbb{Z}_{12}$), generated by the permutation (0 1 2 3 4 5 6 7 8 9 10 11).  Or take a trick often used by Bach: inversion.  This is the technique of taking a musical figure and “turning it upside-down” on the score.  Given an appropriate labelling of the notes, we can think of any inversion as an action of the permutation group of order 2 generated by (0 6)(1 7)(2 8)(3 9)(4 10)(5 11).  The group generated by both of these permutations is the dihedral group$D_{12}$– that is the group of symmetries of a flat 12-sided shape.  Where the musician says inversion, the mathematician says reflection.   And where the musician says transposition, the mathematician says translation.

Unfortunately, following this musico-mathematical path to the point where one is actually creating music from mathematics leads to some pretty (in my opinion) awful serial/12-tone modern compositions.  However there is one area of music in which permutations are used to great effect: change-ringing, which is a form of bell-ringing.  My aunt is a bell-ringer in her local church, and I was interested to see that her instruction manual (book of changes?) was basically a list of permutations.  Each bell is labelled with a number, and the aim is often to ring every combination of them without repeating.  This is called an “extent” or “peal”, and the practicality of performing one depends on the number of bells involved – often only a half- or quarter-peal will be undertaken.  Apparently the last time a full peal was performed with 8 bells it took 17 hours, which is not bad considering there were 8!=40,320 permutations to ring through – each sequence will have taken only 1.5 seconds at that rate.  I’d imagine that the performers’ arms and ears took a while to recover after that.

### 10 Responses to Mathematics in Music

1. Lucy says:

hey Adam. i was only able to read the first sentence of this before my brain crashed. but there is a lecture i’m going to on Tuesday that you might be interested in – it’s about music and the brain and wll be covering Bach, one of the other few words I was able to digest from your post. it’s at the Royal Institution http://www.rigb.org/contentControl?action=displayEvent&id=964

Lucy, Your brain can’t have crashed too badly if you got to the word Bach! Or did you just reboot and start again?
Anyway, that lecture sounds amazing…unfortunately I am tutoring on Tuesday evening, or I would surely join you. Perhaps you could write me a summary of the best bits?

3. cousin h says:

hurrah, i just skim read this but noted the bell ringing points, will read the rest when I’m not sitting at a thai bus station…you read mine and i’ll read yours! http://www.emejourneying.blog.co.uk

Done! I already read yours anyway, so you have some catching up to do….

4. MINA says:

Yo Adam. Good idea for the blog. Was just reading a book about pythogorean comma, a guy who has spent his life ranting about the evils of tuning system now – how it goes directly against the mathematical laws and naturally occuring acoustics. Hmm, am going to think and get back to you more in a bit, but its so fascinating. Happy Birthday by the way, sorry so late… and hope you had a good time in that cottage, come and see you soon??xxx

Hi Mina,
Yes – Pythagoras would have been very upset about this sort of thing. There are lots of rumours about people being getting killed in Ancient Greece for declaring the square root of two to be irrational (like some of these frequencies are). Don’t let it affect your playing though! My advice is to not worry about it….

Thanks for the birthday wishes, see you soon I hope.

5. Amy L says:

Wow, fascinating stuff Adam. It’s been a long time since I’ve thought about maths (or music for that matter) but this has got me trying to stretch my noggin again.
(P.S. I’ve linked to here from my twitter – hope that’s ok)