If all art aspires to the condition of music, all the sciences aspire to the condition of mathematics. - George Santanaya
Music is the pleasure of the human soul experiences from counting without being aware that it is counting. - Gottfried Leibniz
Mathematics and music have a strange connection. Music is the only art form, where the form and the medium are the same. Mathematics is the only science where the methods and the subject are the same. Mathematics is the study of mathematics using mathematics. Music is only created and experienced as music. Thus, there is a natural connection between mathematics and music: Both are experienced as pure objects of the brain, and both have meaning outside of the brain only by artificial connections.
Back when I was teaching High School Algebra, I had a student who was gifted in music, but not so gifted with mathematics. "If you really want to understand music," I told him, "you really must understand math, and the connection between them." I then presented him with some of the following. A brief lesson on the connection between music and mathematics.
"Give me an A" = 440hz
Some basics: Music is made up of sound. Sound is made from repeating sound waves. The musical pitch of each note has a corresponding frequency measured physically in hz (hertz) or cycles per second. There are some important mathematical relationships between the notes played in music and the frequency of those notes.
There are two constant values in music. The first is that the A note that is 9 white keys below middle C has a frequency of 440 hz. The second constant value in music is the 12th root of 2 (1.0594630943593...) which is the ratio of the frequencies between half tones. So, the frequency of A# is 440 × 1.059... = 466.16376... The frequency of B is 466.1637 × 1.0594 = 493.8833. After you do this 12 times you end up with A an octave higher which equals 880hz. Doubling the frequency creates a note an octave higher. Reversely, dividing the frequency in half creates a note an octave lower. click Here to hear a 440 Hz tone*
Here is a complete list of 8 octaves in the audible range and their corresponding frequencies.
Pythagoras
The first person to make the connection between math and music was Pythagoras of Samos, a famous philosopher and cult leader who lived most of the time in southern Italy in 5th century BC. Among his claims to fame is the oldest known proof of what we call the "Pythagorean Theorem". If you have never heard of this guy, he is one of western civilizations strangest, but most influential thinkers. For Pythagoras, ratios were everything. He believed every value could be expressed as a fraction (he was wrong, but that is a whole different story). He also is the first to believe in the idea that mathematics is everywhere.
One bit of evidence of underlying rational numbers was in Greek music. At the time, music was not as complicated as it is today. The Greek octave had a mere five notes. Pythagoras pointed out that each note was a fraction of a string. Lets say you had a string that played an A. The next note is 4/5 the length (or 5/4 the frequency) which is approximately a C. The rest of the octave has the fractions 3/4 (approximately D), 2/3 (approximately E), and 3/5 (approximately F), before you run into 1/2 which is the octave A. Click Here to hear the Greek scale
Many of the ancient Greek harps (kitharas) had six strings corresponding to these notes. (Kitharas, like all things preindustrial, were hand made and string lengths and count were never standardized, but six strings based on these simple ratios were probably popular choices.) Also, for you music experts, note that the scale is a "minor" scale, which we associate today with sounding sad or tragic. A perfect scale to accompany most Greek plays. It makes me wonder if the Greeks would have invented the more cheerful sounding "major" scale, would Greek poems and plays be more upbeat?
Pythagoras was excited by the idea that these ratios were made up of the numbers 1,2,3,4, and 5, and that there were five planets that moved along similar ratios and that all this meant something (ultimately the universe turns out to be irrational, which may explain a lot). Pythagoras imagined a "music of the spheres" that was created by the universe. A wonderful idea that inspired many composers. The 18th century music of J. S. Bach, has mathematical undertones, so does the 20th century music of Philip Glass. (Whenever I hear the expression "music of the spheres", I start hearing Glass's "The Grid" from Koyaanisqatsi in my brain.)
So, how did we get the 12 notes scale out of these six notes? Basically, some unknown follower of Pythagoras tried applying these ratios to the other notes on the scale. For example, B is the result of the 2/3 ratio note (E) applied to itself. 2/3 * 2/3 = 4/9 which lies between octave A (1/2) and octave C (4/10). To put B in the same octave we multiply 4/9 by two to arrive at 8/9. G is produced backward from A. As B is a full tone above A at a string ratio of 8/9, we can create a missing tone below A by lenthening the string to a ratio of 9/8. To add G to the same octave we apply 9/8 to 1/2 (octave A) and by multiplication we get 9/16 as the ratio to G. (A complete and very verbose explanation of the ratios to generate the sharps and flats can be found at http://www.medieval.org/emfaq/harmony/pyth4.html )
There was a problem, however, if you performed this transformation a third time. The 12 tone octave created by starting with an A was different than the 12 tone octave created when you started with an A#. Two harps (or pianos, or any other instrument) tuned to different keys would sound out of tune with one another. Also, music written in one scale could not be transposed easily into another because it would sound quite different.
The solution was created around the time of Bach. A "well tempered" scale was created by using the 2 to the 1/12th power ratio mentioned above. Using an irrational number to fix music based on ratios, Pythagoras probably rolled over in his grave.
Scales
There are numerous advantages to the well tempered scale besides the ability to transcribe. It gives new tools to the composer, such as the ability to change keys in the middle of the music. More than half of all songs use this technique today. Classical composer Gustav Mahler changed keys every few bars, as a result his symphonies sound like they are constantly evolving into something else. Composer Arnold Schoenberg created a "12 tone row" technique that changed keys every few notes, this creates a disturbing feel to the music. His technique is used often in soundtracks of horror movies.
The well tempered scale also has the advantage of creating new scales that feel different. Play the white keys between C and octave C, and you have a "major" scale which sounds pleasant to the ear. Hear the C Major scale The same white keys from A to octave A produce a "minor" scale that sounds tragic. Hear the C Minor scale From B to octave B generates a "blues" scale for the melancholy jazz sound. While D to octave D creates a bright scale often used in Spanish guitar music.
Why can the same notes produce so many feels to them? Is it a cultural thing? It is actually more basic than that. To understand why different combinations of notes feel different, we go full circle back to the underlying mathematics.
Harmonics
Why does a flute and a violin sound different when they play the same note? The answer is harmonics. Harmonics is also why scales have different feels to them. Most of what follows was discovered by German scientist Hermann Helmholtz in the 19th century, but surprisingly many musicians are unaware of this hidden connection between math and music.
When you play a note on a flute, you are only producing that particular tone. On an old Moog synthesizer, you can do the same thing by using a sine wave to produce the note. When you play a note on a violin, you are not only producing that tone, but numerous harmonic tones as well. The Moog synthesizer uses a sawtooth wave to do the same thing. Hear a scale with no harmonics and full harmonics*
In Physics, harmonics are waves at proportional frequencies, and at inversely proportional amplitudes. If we play an "A" (440hz) with full harmonics we will not only hear the 440hz tone, but also an 880hz tone at half the volume (first harmonic), a 1320hz tone at a third the volume (second harmonic), a 1760hz tone at a quarter of the volume (third harmonic), etc., until the frequencies get too high or the volume gets too low to be heard. Hear the first seven harmonic tones of "A"
Lets look at those harmonics from a note perspective. Remember that with the tempered scale nothing is exact. for simplicity sake we will play an "A" at 110hz. The first harmonic is another "A" an octave up at 220hz. The second harmonic is at 330hz which corresponds to a "E" on the second octave. The third harmonic is also "A" two octaves up at 440hz. The fourth harmonic is 550hz which is a "C#" on the third octave, and the fifth harmonic is another "E" on the same octave. You music know-it-all's should understand the significance of this right off the bat. A, C#, and E are the notes that make up the A major chord. The notes sound natural and pleasant together because they emphasize one another's harmonic patterns. (The sixth harmonic is between F# and G, and the seventh is A again three octaves up.)
Here is a chart of the harmonics of a C Major chord (C-E-G) and how the harmonics emphasize one another:
| C | 261.62 | 523.24 | 784.86 | 1046.48 | 1308.1 | 1569.72 |
| E | 329.62 | 659.24 | 988.86 | 1318.48 | 1648.1 | 1977.72 |
| G | 391.99 | 783.98 | 1175.97 | 1567.96 | 1959.95 | 2351.94 |
Here is a similar chart of a C minor chord, the missing harmonic correspondence creates a darker "feel" to the chord:
| C | 261.62 | 523.24 | 784.86 | 1046.48 | 1308.1 | 1569.72 |
| D# | 311.13 | 622.25 | 933.38 | 1244.50 | 1555.63 | 1866.75 |
| G | 391.99 | 783.98 | 1175.97 | 1567.96 | 1959.95 | 2351.94 |
When harmonics emphasize one another, the chord sounds pleasant. Chords in different scales create different harmonic patterns. The more divergent they are, the more disturbing they seem. In a well tempered scale there is enough correspondence to sound OK. When someone is singing off key they are creating harmonics for notes that do not exist, thus the painful feeling we encounter.
The next big question is why do certain notes and chords make us "feel" differently? That is a question I am not smart enough to answer.
P.S. Thirds and Fifths
I know I am going to get this question, so I may as well answer it now. What is the mathematical meaning when musicians say "raise a third" or go "up a fifth"? This has nothing to do with fractions, they are talking ordinal numbers in relation to the scale. So, Raising "C" a third means go to the third note in the C major scale and arrive at E. "Up a fifth" mean the fifth note or G. The opposite is "lower a fifth", while "Down a fifth" has more relevance in drinking alcohol.
Further Math and Music Links (in order of difficulty):
Musical-Theory.com - Good beginners guide to music theory.
The Tonal Centre - All about scales and chords.
An Atlas of Consonance - A more advanced discussion on harmonics.
Alternate Temperaments - Mathematical analysis of various tuning methods from Pythagoras to today.
Pythagorean Tuning and Medieval Polyphony - A complete history lesson on scales.