“Strength of mind rests in sobriety; for this keeps your reason unclouded by passion” Pythagoras

### Pythagoras (urn) integers

We hear sounds every day but not all sounds are pleasant or can be called music. A child can press keys on a piano to make a sound, but is that music? What is it that converts sound to music? Could there be some pattern at play? Whenever there is a pattern, perhaps there is interesting math going on behind the scenes. We can get insight into these questions by going back in time to a person who thought deeply about this concept and consider the math he developed.

Like all concepts in math, there is a foundation that needs to be laid before jumping into a topic. We have already developed some of the concepts that we need to see how math connects to music. In the last section, we identified the value of curves, specifically the sine curve. The sine curve formed a wave that we use to model how many hours of sunlight we observe each day. In this section, we will continue to review curves, starting with a wave curve that makes beautiful music. One of the first to do this was Pythagoras. Remember the Pythagoreans loved their numbers.

The story goes that Pythagoras would fill an urn with water and bang it to make a sound. If he found the sound pleasing, then he emptied half the water out of the urn and banged it again. Another pleasant sound. He would empty more water so there was only a third remaining. Bang. Another pleasant sound. But, if he banged the urn with water in it that wasn’t part of this pattern, it didn’t have a pleasant sound. Rather, it was a dissonant sound. What’s going on? What was Pythagoras thinking?

Pythagoras was discovering that music sounds better if it is part of a pattern, $1, \frac{1}{2}, \frac{1}{3}, \frac{1}{4}...$, where the denominator are integers. It seemed like two pleasant sounds were somehow connected by integers. That seems like an odd idea. How and why would good music be connected to integers?

### Frequencies

If we want to hear good music, we can consider a finely tuned piano. Each key on the piano plays a pleasant sound. But how does a sound from a piano connect to an urn? The sounds from a piano are made by strings that are connected to the keys of a piano. When we play a key, the strings vibrate. We have a similar vibrating concept when we beat on an urn. So let’s investigate how a finely tuned piano plays good music and see how it is connected to integers.

Let’s say you play the key A4 on the piano. First, let’s find A4 on a piano. A standard piano keyboard has 88 keys, counting both the white and black keys as you see in Figure 1. The most popular key on a piano is middle C. From middle C, count the white keys to the right. It progresses from C to G using letters only, then it starts over with A. Thus, A4 is the 5th white key to the right of middle C.

When we think of sound, we often think of the term pitch. In general, a male’s voice has a lower pitch than a female’s voice, for example. A more technical way we measure pitch is with the term frequency. We use frequency because, in short, sound is created by vibrations. Here we have a string that is vibrating. We will hear a different sound based on the rate the string is vibrating. One way we measure how fast a string is vibrating is using the metric hertz. We can notate hertz with Hz. A frequency of 100 Hz means that the string is making 100 complete cycles of vibration per second. Every key on the piano sounds different because each key vibrates at a different rate. We covered a lot of technical detail, but the main concept is we measure the pitch of a sound using the unit hertz and the higher the hertz (frequency), the higher the pitch.

Actually, the sound generated from a single piano key is more complicated. We tend to focus on the primary sound, which we refer to as the fundamental frequency. The fundamental frequency for A4 is $440 Hz$. That means there are 440 complete cycles of vibration per second. But when we play an A4, we also play other frequencies besides the fundamental frequency. These other frequencies are called overtones. Overtones are softer in volume than the fundamental so they are not as noticeable, but they still exist. The overtone frequencies are multiples of the fundamental frequency. Since the fundamental frequency for A4 is 440 (we will drop the *H**z* notation when referring to frequencies), the overtone frequencies for A4 are 880, 1320, 1760, etc. We can generalize and state the frequencies of the overtones are $n$ times the frequency of the fundamental, where $n$ is 2, 3, 4, and so on. You may notice that as we move farther right on a piano keyboard, the keys play a sound with a higher pitch. This is because the fundamental frequency, and the overtones, increase as we play a key farther to the right on a keyboard.

Remember we stated at the core of a sound is a wave. One property of all waves is the wavelength. The wavelength is related to the frequency. Specifically, the wavelength is the inverse of the frequency. What this means is if the frequency is multiplied by $n$, then the wavelength changes by $\frac{1}{n}$. Thus, the wavelength for the first overtone is $\frac{1}{2}$ times the wavelength of the fundamental, the wavelength for the second overtone is $\frac{1}{3}$ times the wavelength of the fundamental, and so on. As a result, the ratios for the successive overtones starting from the fundamental are 1, $\frac{1}{2}$, $\frac{1}{3}$, $\frac{1}{4}$,... Notice the concept of an overtone is how integers are connected to sounds we hear when we play just a single key on a piano. Thus, we can see how playing a single piano key is connected to the pleasant music Pythagoras created by using his urn. If the urn is full, Pythagoras is playing the fundamental. The other sounds Pythagoras was playing were the overtones. However, that doesn’t answer the questions of why it sounds good. Why do the overtones sound good? To gain insight into why overtones sound good when paired with the fundamental, let’s review some of the math of a wave.

### Why do integers make pleasing sounds?

Recall we studied the sine and cosine waves when we examined the unit circle. The waves from music are the same sine and cosine waves. For music, we won’t dig into the specifics of the wave types, but rather the general features of a wave. Here is a simple wave for the fundamental and the first two overtones.

The solid line is the fundamental wave, and it completes one cycle. If we play an A4, there will be 440 of these cycles per second. The dashed red line is the first overtone, and it completes 2 cycles during 1 cycle of the fundamental. Thus, the frequency of the overtone is twice the frequency of the fundamental, but the wavelength of the overtone is one-half the wavelength of the fundamental. Notice the waves intersect at several places but specifically halfway through the cycle for the fundamental.

The dashed teal line is the second overtone. Notice it also intersects at the same halfway point of the fundamental wave.

Because when you play the A4 key, you not only get the fundamental wave but also the overtone waves, the sound has more depth or richness to it than if you heard a pure 440Hz sound. Playing a single key on a piano has a depth and richness because it is not just one frequency but a chorus of frequencies. You can go to this website and play different notes with different overtones to experience the difference. https://www.szynalski.com/tone-generator/__.__

The overtones provide the depth and richness of the sound. But what makes them pleasing together is the intersection of the curves at a regular interval. In this example, it is halfway into the cycle for the fundamental wave. Of course, there is a lot of complexity we are not discussing, but at a simplified level, the symmetry that makes this graph pleasing to view is also what makes it pleasing to hear when we convert these waves to their corresponding sounds. Isn’t it interesting how our sense of good sound is connected to this symmetrical wave pattern? In other words, all the overtones will intersect the fundamental at the halfway point creating a symmetrical looking series of waves. I think the entire concept of sound is fascinating, but the fact that combinations of waves that have a symmetrical pattern produce good sound is amazing. I’ve always admired how good musicians can have an “ear” for good music. Even though they likely are not aware of it, they are doing wonderful math in the background! To see this wonderful music, let’s consider how we can create pleasant sound by playing more than one key on a piano.

### Multiple keys

Analyzing how the math works when we play multiple keys is the primary focus for our study of music. That means our goal is to analyze the math of the fundamentals and overtones when we play more than one key.

We can get a glimpse of why some combination of notes sound better than others by identifying how their waves are connected. Since we enjoyed the sound of the single key A4, what could be a good second key to play that will sound pleasing and pair well with A4?

We just learned that A4 has a pleasant sound on a piano because the overtones for A4 match well with the fundamental wave for A4. When we play another key with A4, we can identify if it will sound good by matching the fundamental wave for this other key with the overtones of A4. Thus, we must find other keys that have a fundamental frequency that is an integer multiple of the A4 fundamental frequency. To find keys that pair well with A4, it will help to understand the concept of an octave.

The jump from one A to the next A is called an octave. That means the jump from A4 to A5 is one octave and the jump from A4 to A6 is two octaves. We mentioned that A4 has a fundamental frequency of 440 and its first overtone is 880. So we will have a pleasant sound if we play another key with A4 that has a fundamental frequency of 880.

Is there a pattern to the frequencies as we jump an octave? Yes, there is. The frequency doubles as we increase our notes by one octave. Since A5 is one octave above A4, the fundamental frequency for A5 is $2\times 440=880$. So playing A4 and A5 together will sound good since the fundamental frequency for A5 is the first overtone for A4. If you play an A4 and A5 separately and compare the sounds, you should notice that they sound similar. This is because the fundamental frequency of A5 matches the first overtone of A4. This is true of any two keys that are one octave apart.

We identified a good sound that was 2 times the A4 fundamental frequency. The next frequency we need is 3 times 440 or 1320. Is there a key that plays at 1320Hz? A logical guess is A6 because that fits the pattern of A4, A5, and A6. But it fits the pattern of addition. However, the frequency of keys between octaves does not increase by addition. Remember I mentioned that frequencies double every octave, which means we multiply by 2. Thus, frequencies increase by multiplication. That means the fundamental frequency for A6 is $2\times 880=1,760$. Therefore, as we navigate to the right from A to A on the piano, we double the frequency at each stop.

### Problem with octaves

What is the underlying math problem we are trying to solve? Do you see the interesting math at play?

The frequency of overtones increase by addition. For A4, each overtone is 440 more than the previous overtone. However, the frequency of octaves increase by multiplication. Thus, we jump from one A to the next A by multiplying the frequency by 2. That means the second overtone for A4, with frequency 1,320, is not the fundamental frequency for A6. The fundamental frequency for A6 matches A4’s third overtone but we are missing the second overtone. So, A6 would still be a pleasing sound to play with A4 and A5 but we are missing the key that plays a fundamental at 1320. Is there a key that plays a frequency at 1320, and if so, what is it?

### Matching the second overtone

We know we double the frequency every octave, or every time we move to the right from an A to the next A. But the key we are searching for must be between the A5 and A6 keys, so we need to know how the frequency changes from key to key within an octave.

To answer this, we need to take a step back and understand the keys within an octave. On a piano, there are 12 keys—white and black—in an octave. How do we identify the frequency for each key between the two A’s? In order to answer that question, we have two questions we must consider regarding how the frequency increases within an octave.

- How many keys should we count within an octave?
- For each important key, what is the pattern, if there is one, for the increase in frequency?

Let’s start with the first question.

### The number of keys we should count within an octave

If you review the 4th octave from Figure 1, you can observe that the octave begins with the middle C, which is a white key and ends with B, another white key. There are a total of 7 white keys (C, D, E, F, G, A, and B). Notice the white keys are evenly spaced on a piano. In trying to understand the math of the frequencies within an octave, we want to identify evenly spaced frequencies. It may appear the white keys are good candidates because they are evenly spaced physically on a keyboard. When there is a black key between two white keys, then perhaps the frequency for the black key is halfway between the two white keys. Thus, if we are looking for evenly spaced frequency, it may seem logical to only consider the white keys.

However, this intuition is false. How the frequency increases within an octave is different from how the keys appear physically on a keyboard. If you just play the white keys, the increase in pitch from an A to a B will be different from the increase in pitch from a B to a C. The reason is there is a black key between the A and B but not between the B and C. In fact, the 12 keys of an octave are evenly spaced with regard to the increase in pitch. Thus, as you play through all 12 keys of an octave in order, you should hear a smooth progression in pitch going from one key to another. But, if you just play the white keys in order, you should hear an extra jump in pitch if there was a black key between the two. What seems counterintuitive is that even though the 12 keys in an octave are not equally spaced physically, they are equally “spaced” mathematically with respect to the change in frequency. This will make more sense as we answer the second question.

### The math pattern of the frequency within an octave

We have identified that the frequency doubles as we jump a single octave. So, if we consider the octave from A5 to A6, the frequency starts at 880 and ends at 1,760. Our goal is to identify the frequency for each note within the octave. In our first question, we identified we have 12 keys to consider, and we also stated that we can consider them equally spaced. In other words, if we play the 12 keys from A5 to A6, we should hear a smooth increase in pitch for each key. So our second question is: what is this increase?

If I were to ask you to guess the pattern between the keys, I likely would get two primary answers. One answer would be the frequency increases the same amount as we move from one key to the next. If we have a constant increase by amount, this would produce a linear curve. A second common answer would be the frequency increases the same rate as we move from one key to the next. If we have a constant increase in rate, this would produce an exponential curve.

You may recall we have already discussed linear and exponential curves. We encountered both of these curves in the Foundation part of Lazarus Math when we invested money that doubled. Remember we considered a scenario where we double our money in one year. We began by considering two scenarios. One scenario is to double the money with simple interest. The second scenario doubles the money with compound interest. We represented the fund growing with simple interest using a straight line and the fund growing with compound interest using an exponential curve.

We are considering both of these types of curves when we consider how frequency increases as we move to the next key to the right on a piano. Because we are revisiting similar math, let’s recycle our graph (see Figure 3) and update it for our music problem. Before, our money doubled from 100 to 200. Here, our frequency increases from 880 to 1,760. Our vertical axis now represents frequency rather than the fund value. Our horizontal axis are the steps within an octave. We can choose any range we want, so let’s use the same range we used before where the horizontal axis ranged from 0 to 1. That means we plot our first point, A5, at (0, 880) and our last point, A6, at (1, 1760). Then, because we have 12 keys in our octave that are equally spaced, the next key after A5 is A#5 (A sharp 5) and would be at $\frac{1}{12}$ on the horizontal axis. The next key is B5, which would be at $\frac{2}{12}$ on the horizontal axis, and so forth. Again, the actual scale we use for the horizontal axis is not important. The important part is each of the 12 keys are equally spaced apart.

If the frequency increases at a constant amount, then we could graph the frequency with a straight line. In other words, the frequency increases the same amount as we jump from one key to the next key on the right. If this was the pattern, then the middle frequency, 1320, would occur at the 6th step in our keys, or D#6. You can see this pattern with the gray dotted line in Figure 3.

But, if the frequency increases at a constant rate, we create the exponential curve in red. This is the same exponential curve we used to graph a fund increasing at compound interest that doubled each year.

So which curve is the correct curve? The linear curve or the exponential curve? We actually can answer this question if we noticed some previous hints. Remember I mentioned that the frequency doubles every octave. If growth doubles every period, it is following an exponential curve. We can also think of it as the value at the end of the period is 2 times the value at the beginning of the period. It is true that both the linear curve and exponential curve double in the first period. But, if we projected to the next period using the same pattern, the value for the exponential curve would double again. In this example, if we extend it one more octave, we get a frequency of $2\times 1,760=3,520$, which is the frequency for A7 in the next octave. That means the curve that connects octaves is an exponential curve, so it is only logical that the curve within the octave is also exponential

That leads us to the conclusion that the red graph in Figure 3 is the correct curve to graph the frequency within an octave. Also, this same curve would model the frequency for the entire keyboard from the first key to the last key.

Now the stage is set to clearly state our goal. Our goal is to find the point on the exponential curve that has a 1,320 frequency and then find the key that corresponds to that point. Remember 1,320 is halfway between 880 and 1,760 on the vertical axis.

We can find that point simply by drawing a horizontal line that intersects the horizontal axis at 1,320. What are the coordinates of this point? We know the vertical value is 1,320, but we don’t know the horizontal value. We could estimate the horizontal value by viewing the graph. But let’s be more precise and calculate it. How can we calculate this value exactly? If you’re like me, this problem is easier to solve if we consider it as an investment.

If we think about it from an investment perspective, we can think about it as investing $880 at time 0 and we want to know at what time the fund value will equal 1,320 given money doubles every year at compound interest. The way we solve this is first create an accumulation factor. The accumulation factor is what we multiply by the initial investment to create the accumulated value. In other words, the formula is:

Initial investment $\times$ accumulation factor = Accumulated value

The initial investment is a constant 880. What is the accumulation factor? The accumulation factor depends on the interest rate, the time invested, and whether money increases by compound interest or some other method. Here we are only concerned with the compound interest method. Since the fund doubles each year, that means the interest rate is 100%. Since the decimal equivalent of 100% is 1, then the accumulation factor for money growing at 100% for 1 year is 1+1. But we are not accumulating for 1 year but an unknown $t$ period. Thus, we raise the accumulation factor to the exponent $t$ for compound growth. Therefore, our formula for the accumulation factor is $(1+1)^t=(2)^t$

Now, substitute our initial investment and accumulation factor into our formula to produce $880(2)^t=1,320$.

Then, solve for $t$ by dividing both sides by 880 and taking the natural log of both sides to get $ln(2^t)=ln(\frac{1,320}{880})$. We know $\frac{1,320}{880}=1.5$. Also, we can use the law of logs to write the exponent $t$ as a multiplicative factor: $t\times ln(2)=ln(1.5)$. Thus, we can solve for $t$ as $t=\frac{ln(1.5)}{ln(2)}=0.58496$.

This gives us the coordinates for the point on the graph as (0.58496, 1,320). But our goal is to identify what key, if any, has a fundamental frequency of 1,320. Recall our keys increase by steps of $\frac{1}{12}$ on the horizontal axis. We know the value for the 6th key is $\frac{6}{12}=0.5$ on the horizontal axis. Since 0.5 is less than 0.58496, we need to consider keys to the right of the 6th key. Let’s consider the 7th key. It’s position on the horizontal axis is $\frac{7}{12}=0.58333$ to 5 decimal place accuracy. Thus, it is very close to the value we want, 0.58496. That means the 7th key is the answer to our next overtone match. The 7th key to the right of A5 is E6.

I’m not a music expert at all, but I enjoy seeing how the math connects to music. From a “non-musical” perspective, it seems that E6 is a “perfect fit” since the difference between the two numbers is $0.58496-0.58333=0.00163$, which is a small number. But trained musicians can recognize the difference in frequency of this small amount. So can we say that E6 is a perfect fit? Actually, the answer depends on how the piano is tuned. One method to tune a piano is to follow this exponential curve exactly. Following this method, we calculate the frequency for E6 by substituting $\frac{7}{12}=0.58333$ for $t$ in our formula. Thus, we get:

$E6 \text{ frequency}=880(2)^{0.58333}=1,318.51$

Notice this is slightly less than the perfect sound of 1,320. The second method would tune the E6 key to have a frequency of 1,320 so it is exactly 1.5 times the frequency of 880. In other words, E6 would be tuned to match the 3rd overtone of A4. Is this small difference noticeable to us? I have never heard the two played right next to each other, but I would be surprised if I could notice a difference. However, I am not a trained musician. I am told that trained musicians can identify the difference between an E6 tuned to 1,318.51 and one that is tuned to 1,320. I find that impressive!

### Why 12 keys to an octave

Now that you understand the math of the frequency for an octave, you may wonder why there are 12 keys to an octave. I always assumed there were 12 keys to an octave just because that is how “music works.” I never gave much thought to it. However, as I was researching this topic, I discovered an amazing fact. The reason there are 12 keys to an octave is because of the math that we just talked about. In other words, the properties of an exponential curve when divided into 12 equal parts is the reason. We can appreciate the benefit of a 12-key octave with some simple math.

Recall the accumulation factor we created. The factor is $2^t$ where $t$ is the fraction of the jump we make from our starting point. We used the base 2 because we are doubling every period, where every period is one octave. So, if we move one key to the right, $t=\frac{1}{12}$. If we move two keys to the right, $t=\frac{2}{12}$, etc. To 4-decimal place accuracy, here are the factors to calculate the frequency of the next key on a piano.

### Frequency Factors for an Octave

Interval | Factors |

1 | 1.0595 |

2 | 1.1225 |

3 | 1.1892 |

4 | 1.2599 |

5 | 1.3348 |

6 | 1.4142 |

7 | 1.4983 |

8 | 1.5874 |

9 | 1.6818 |

10 | 1.7818 |

11 | 1.8877 |

12 | 2 |

Notice we can use these factors to calculate the frequency of keys within any octave. For example, if we wanted to find the frequency for the keys between A4 and A5, we would use these factors and multiply by the A4 frequency 440 to produce the frequencies for the other keys. Remember the 7th key produced a factor of almost 1.5, which is 1.4983. Recall from Pythagoras that we want to produce the fractions $\frac{1}{2}$, $\frac{1}{3}$, and $\frac{1}{4}$. Since the accumulation factor is 1 plus the fraction, an accumulation factor of 1.5 is the same as Pythagoras filling his urn halfway. An accumulation factor of 1.3333 is the same as filling one third of his urn, and an accumulation factor of 1.2500 is the same as filling one fourth of his urn. Notice when we have 12 keys to an octave, we not only are close to 1.5, but we are also close to 1.3333 (see 1.3348) and 1.25 (see 1.2599). Because the exponential curve with 12 steps closely approximates the key fractions $\frac{1}{2}$, $\frac{1}{3}$, and $\frac{1}{4}$, music people have chosen 12 keys for an octave. The number 12 does not have any special properties; it just happens to be how the curve works.

### Summary

If you’re lost in the math, remember the important concept is the frequency for keys on a piano increase at an exponential rate, doubling for every octave. However, the sounds that are pleasant, the overtones, increase at an arithmetic rate. We learned from Pythagoras that the key to good music is the integers 1, 2, 3, 4, or the key fractions $\frac{1}{2}$, $\frac{1}{3}$, $\frac{1}{4}$, and so on. Since we only have 12 keys in an octave, we don’t hit the key fractions exactly but we are quite close.

After understanding how the math in music follows patterns similar to the math in finance, I changed my perspective on music. Now, I consider the keys on a keyboard like money growing at compound interest. This is because how money grows at compound interest and how the frequencies for keys increase are both exponential functions.

However, the frequencies for the overtones increase at an arithmetic rate, which makes me think of money increasing at simple interest, which also increases at an arithmetic rate. The important takeaway is I didn’t have to learn new math to go from being an actuary to understanding how the keys and overtones connect in music. Perhaps you are like me and understand the math of compound interest and now can understand the math of music. Or, perhaps you understand how the math of music works but don’t understand the math of compound and simple interest. You already know the math; it is just a matter of applying the math to finance rather than music. At the heart of the math are linear and exponential functions. Once you learn the basics of these functions, you can apply them to so many different situations.

🌱 One of the main goals in this section is to understand the different perspectives of what it means to be “in the middle.” Our Wave team created a video “Middle: a musical approach” that digs into this idea in more detail. You can watch this 10 minute video here.