Sunday, December 5, 2021

Music, mathematics, and physics

Johann Sebastian Bach

Part 1: why 12 notes?

Although the picture at the top of this article is of my musical hero, J.S. Bach, I want to start by talking about a more contemporary figure, Jack White of the White Stripes. At the start of the video Play it Loud, White builds a simple guitar by using a piece of wire, a block of wood, two nails, and an old guitar pickup. Then he plays it through an amplifier using a coke bottle! In what follows, I want to take Jack’s guitar string and try to explain what music is all about from a scientific perspective. That string is shown in the figure below, attached to two nails and with a length (L).

Jack White’s guitar string stretched between two nails.

When that guitar string is plucked, it will produce a sound wave that travels through the air to our ears. We call the resulting sound a musical note. Different notes can be created by either lengthening or shortening the string, as in a harp, or by pressing down on a point on the string, as with a guitar. The actual sound is determined by the frequency of the string’s vibration, which, in turn, is determined by its length, thickness, and density. The physics of a vibration is illustrated below through a string vibrating with a single frequency. Mathematically, this is called a pure sine wave. The length of the vibration is called the wavelength, written as λ (a Greek character known as lambda), and the frequency of the vibration is equal to the velocity, ν (another Greek character called nu), divided by the wavelength. If we let v = 1, we call this the relative, rather than the absolute, frequency.

Music, mathematics, and physics

A single-frequency sine wave.

Before getting deeper into this basic level, let’s look at the big picture, as seen on a piano keyboard. The sounds from a piano are also made by strings, but the strings are hidden from view and are hammered, rather than plucked. The figure below shows two octaves of a piano keyboard, with middle C shown as the white note in the centre, which is defined as the tonic note, the note to which all other notes are referenced, although any note on the keyboard can be made into the tonic. Middle C is defined as having a frequency of 264 vibrations per second, or hertz (Hz). The octave is defined as a doubling or halving of the original note and has the “same” sound. By “same”, I mean that the ear senses this as the same note but with a lower or higher frequency (why this is so is a question of physiology, and is still not fully understood). Thus, the C an octave lower has half the frequency of middle C, or 132 Hz, and the C an octave higher has double the frequency, or 528 Hz.

Music, mathematics, and physics

Two octaves on a piano keyboard.

Notice that on a piano there are seven white notes in an octave, called A, B, C, D, E, F, and G, and there are five black notes, each of which has two names. For example, the black note above middle C is called C# (C-sharp) or Db (D-flat). The reason for this is that the musical distance between C and D is called a full tone, and the musical distance from C to C#/Db is called a semi-tone. Therefore, C#/Db can be thought of as being a semi-tone above C (hence, C#) or, equivalently, a semi-tone below D (hence, Db).  The reason there is no black key between E and F, and B and C will become clearer later when we look at how the notes are created. (I’ve talked about the White Stripes, but this reminds me of the Black Keys, another popular rock group.)

All western music is created by only 12 notes, which is incredible to ponder. By western music, I mean all forms that evolved from music developed in Europe in the Middle Ages, often called classical music. This includes most of the music that we listen to on our devices: rock and roll, blues, country, jazz, folk, etc. Other music forms, such as Indian ragas, contain notes that are much more closely spaced than a semi-tone. In this article, I am going to focus on western music and answer the fundamental questions: why are there 12 notes, and why are they named the way they are?

Let’s get back to White’s guitar string. To get a pure sine wave, you would need an infinitely long string. When you fix the two ends of the string with nails, you create what is called a standing wave due to the reflections of the wave from these two end points. Plucking the string will therefore create more than a single frequency. The combination of frequencies created with a single pluck can be predicted using calculus, a sophisticated mathematical method invented by Isaac Newton. This can be solved as a differential equation with the two nails as boundary conditions where the vibrations equal zero. The results give us an infinite harmonic series of multiples of the fundamental wavelength of the string, of which the first four are shown below. The entire infinite series is combined in the sound we hear!

Music, mathematics, and physics

The first four harmonics of a guitar string.

To make things simpler, let’s assume that L is equal to 1. The first harmonic has a wavelength of 2, or a relative frequency of 1/2. The second harmonic has a wavelength and relative frequency of 1, the third harmonic has a wavelength of 2/3 and a relative frequency of 1.5, and the fourth harmonic has a wavelength of 1/2 and a relative frequency of 2. Notice that the first, second, and fourth harmonics are all the same note, but in different octaves. For example, if the real frequency of the second harmonic is 264 Hz, then it equals middle C and the first and fourth harmonics are C an octave lower and higher, respectively. But the third harmonic is a new note, called the dominant. (If the second harmonic is middle C, the dominant is the G above middle C, and therefore another name for the dominant is the fifth since G is the fifth note in the C major scale – more about this later.) As we will see when we get to harmony in the second part of this series of articles, the dominant plays a very important role in western music.

From now on, let’s restrict ourselves to a single octave. That is, we will only consider the notes between middle C and C an octave higher on the piano. This is also represented by the second, third, and fourth harmonics on the guitar string. The next figure shows a different way of drawing this, as a three-string harp. The vertical axis is the length of the string, or the relative wavelength, and the horizontal axis is the relative frequency of the string. Notice that the dominant is halfway between the tonic and octave in terms of frequency, but not in terms of wavelength.

Music, mathematics, and physics

The three-string harp, consisting of the tonic, dominant, and octave.

Notice that we could multiply the dominant by either 2 or 1/2 to get the same note an octave higher or lower, but this would still leave us with only two notes. How do we find the best third note? Since we know the dominant is the “best” sound after the tonic, let’s proceed by finding the dominant of the dominant. To do this, we multiply 2/3 by 2/3 to get 4/9.  But now we have moved outside our octave, which we want to restrict to between 0.5 and 1 on the vertical, or relative wavelength, axis. This is easy to fix, and we simply multiply the new note by 2 to get it into the same octave, giving 8/9 for the relative wavelength and 9/8 for the relative frequency. The new four-string harp is shown below. As we will see shortly, the “dominant of the dominant” corresponds to the musical note D, if C is the tonic, and G is the first dominant. This makes sense if we see on the figure how close this note is to the tonic.

Music, mathematics, and physics

The four-string harp, consisting of the tonic, dominant, second dominant, and octave.

I think you can guess the rest of the procedure. To add new notes, we keep adding “dominants of dominants” by multiplying by 2/3. Each time we get a ratio that is less than ½, we multiply by 2 to raise the note by an octave. By the time you have done this 12 times, you almost get back to the octave, which gives you the 12 unique notes in one octave on the piano. I say almost because it doesn’t quite work, and the final ratio is 2.027, a 1.35% error. If you create the notes this way, they don’t sound quite right. This issue bothered musicians in the Middle Ages, and mathematically minded musicians searched for what was called the even-tempered scale. In Europe, the even-tempered scale was discovered by Simon Stevin in 1585. He proposed that the correct interval between each note should be given by the 1/12th power of 2, or:

Music, mathematics, and physics

This is equivalent to what I called a semi-tone earlier. It was later found that this relationship had been first derived by the Chinese mathematician and musician Zhu Zaiyu in China in 1580. J.S. Bach was so impressed with this new even-tempered, or well-tempered, set of notes that he wrote a famous set of 24 fugues called the Well-Tempered Clavier, one fugue for each of the 12 tonic notes in both major and minor keys. I will discuss major and minor keys in the next article.  I should point out that a minority of musicians still prefer the old tuning method.  I guess it has something to do with their physiology.

The figure below shows the 13-string harp in even-tempered tuning, using relative wavelength as the vertical axis and relative frequency as the horizontal axis. I started on the tonic note C and stopped at C an octave higher, which I call C’. Note that the frequency intervals get larger as we move to the right, but that the dominant is still the centre frequency. The numbers at the top of the plot represent the ordering of the dominants, and you can see that G is the second note added after C and therefore represents the first dominant. As mentioned, the fact that G is the fifth note in the C major scale, and D, which is the next dominant, is the fifth note in the G major scale (scales will discussed in the next article) is why the dominant is often called the fifth. The order in which the dominants appear also suggests why there are not black notes between E and F, and B and C. Notice that the intervals between these pairs of notes is a semi-tone already.

Music, mathematics, and physics

The 13-string harp, consisting of all 12 dominants.

This process of adding notes suggests an alternate way of ordering them, based on the sequence of the dominants, or fifths. This is called the circle of fifths and is shown below. As you can see, it looks like a musical clock, where the fifths are formed by moving clockwise around the face of the clock. If you move counterclockwise around the clock, you get the fourths, which are the fourth whole note from the previous note. Another name for the fourth is the sub-dominant, which is the third most important note in western music, after the tonic and the dominant. This is the first time I have mentioned the fourth, because I did not want to complicate things in this introduction. But if you go back to the picture of the four-string harp, you will see that if you change the dominant in that figure to the tonic, then by referring to the circle of fifths below you are now centring the tonic G between its dominant D and subdominant C. You can do this for any cluster of three notes on the circle. I will get back to this point in the next article, as it is one of the most fundamental ideas in music. If this sounds too complex, listen to Sweet Home Alabama by Lynyrd Skynyrd. The whole song is based on the chords D major to C major to G major. But I am getting ahead of myself again.

The circle of fifths.

Although the circle of fifths may seem like a strange way of ordering our 12 notes compared with what we are used to seeing on the piano, it opens the path to a much deeper understanding of music than the standard keyboard layout. In my next article, I will show first how the circle of fifths leads to the concept of musical scales, from which all melodies are derived, and then to the concept of musical chords, which are the underpinnings of virtually all western music. Harmony, which is the formal name for chords, is what truly distinguishes western music from other forms of music around the world.

Brian Russell
Brian Russell co-founded HampsonRussell Software with Dan Hampson in 1987. HampsonRussell is now a subsidiary of CGG, where Brian is VP GeoSoftware. He is involved in the research of new AVO (amplitude versus offset), rock physics, inversion, and machine learning techniques. He gives presentations on seismic theory and software throughout the world. Brian has a PhD in geophysics and is an adjunct professor in the Department of Geoscience at the University of Calgary.


  1. Perhaps science will solve why guitarists have had issues since…well, forever! in the tuning of the 3rd, or G string – it is the problem child of the six-stringed world, and electronic tuners have not solved the issue. I know what my tuner says, to the hertz…but I also know what my ear tells me, and therefore my G string is often tuned slightly flat.

  2. Thou shalt not mess with the Master.

    To have JSB as a hook is not right. I sense rumblings from his grave.

    Aside from that: yes, I comprehend the article.

    Nothing really new and exciting, though. So far.
    And no, I am not a qualified musician. Physics, yes. Some.

BIG Wrap

‘Metaverse’ hype fuels booming digital property market

The idea of spending millions on non-existent land may sound ludicrous, but feverish predictions of a virtual reality future are pushing investors to bet...

Particle physics – Higgs boson’s lifetime not even close to being long enough to say ‘YOLO’

The Higgs boson doesn't stick around for long. Once it is created in particle collisions, the famed particle lives for less than a trillionth...