The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math

Math and Musical Scales

Date: 02/10/97 at 16:32:44
From: Amanda Benson
Subject: Musical scales

Hi Dr. Math,  

I am interested in music. I wrote you once before and asked where 
math in music was. I got a response that helped me some, but I still 
would like a little more information. I'm looking at musical scales 
now. What exactly is the space between half steps? Where did they 
come up with octaves and why did they choose eighth notes? Why do 
certain notes sound good together and others don't? And are these 
questions even math-related?  

Thank you for your time in reading my question!  

Date: 02/10/97 at 20:23:06
From: Doctor Toby
Subject: Re: Musical scales

These questions are definitely math related! Pythagoras, the ancient 
Greek philosopher who thought all of science and art could be reduced 
to mathematical equations, studied the mathematical basis of scales 
very carefully.

Pythagoras' theory was that pleasing sounds resulted from frequencies 
with simple ratios. What we now call octaves, perfect fifths, and 
major thirds have ratios of 2 to 1, 3 to 2, and 5 to 4. For example, 
if a note is tuned to a frequency of 440 hertz (which is how the A 
above middle C is usually tuned nowadays), then a perfect fifth above 
that note has a frequency of 660 hertz, because the ratio of 660 hertz 
to 440 hertz is 3 to 2. (In symbols, 660 Hz : 440 Hz :: 3 : 2.)

Pythagoras, of course, didn't know that sound was a vibration, much 
less that different pitches were different frequencies. (One hertz is 
a vibration that cycles once every second.) He interpreted these 
ratios in terms of the lengths of strings in stringed instruments. 
From the mathematics of wave theory, we know today that the 
combination of waves with different frequencies produces a simple 
pattern only if the frequencies have a simple ratio. Apparently, 
people find simple wave patterns beautiful and complicated wave 
patterns ugly.

Using Pythagoras' ratios of 2:1, 3:2, and 5:4, you can tune most of 
the notes on a scale. Suppose you start with 256 Hz for middle C 
(which is how some computer speakers are tuned). Then an octave above 
middle C is 2 * 256 Hz = 512 Hz, and an octave below middle C is 
1/2 * 256 Hz = 128 Hz.

G is a perfect fifth above C at 384 Hz,
F is a perfect fifth below C at 170 2/3 Hz,
E is a major third above C at 320 Hz,
and Ab (A flat) is a major third below C at 204 4/5 Hz.

Starting from G, you can calculate D, B, and Eb;
starting from F, you can calculate Bb, A, and Db.
Now you have every note on the piano except Gb.

C   256 Hz
Db  273 1/15 Hz
D   288 Hz
Eb  307 1/5 Hz
E   320 Hz
F   341 1/3 Hz
Gb  ???
G   384 Hz
Ab  409 3/5 Hz
A   426 2/3 Hz (close to the 440 Hz usually used)
Bb  455 1/9 Hz
B   480 Hz
C   512 Hz

There's just one problem with this system: it's not internally 
consistent. As long as you stick to the key of C, occasionally 
drifting into G or F, the tuning calculated above will work just fine.
But suppose you move into keys like E and Ab? A major third above 
E = 320 Hz is G# = 400 Hz. This is very close to Ab = 409 3/5 Hz, but 
not the same. If you try to switch from Ab to E, the switch will sound 
ugly, because the ratio Ab : G# :: 409 3/5 Hz : 400 Hz :: 128 : 125 
is ugly. We like to think that Ab and G# are the same note, but that's 
not how it works with the Pythagorean system. This wasn't a big 
problem for most of history, since people rarely switched from Ab to 
E, but by the 1600s, it was causing some problems.

People gradually started coming up with tuning systems that sounded
pretty good in all (or most) keys, rather than sounding great in some
keys and horrible in others keys.  One such system is the
"well-tempered" scale that Johann Sebastian Bach got all excited
about, and wrote music for in "Das Wohltemperierte Klavier (The
Well-Tempered Clavier)", a collection in two parts of 48 pairs of
preludes and fugues.  In each part, there is a prelude and fugue in
each of the 12 major and minor keys: 2*2*12=48.  Many of the keys
these pieces were written in would not have been good keys for pieces
using the previous tuning systems.

After Bach died, people took this thinking even further, creating the
"even-tempered" scale, in which every half step is exactly the same
size.  Since an octave must have the raio 2:1 and there are 12
half-steps in an octave, each half-step must therefore have a ratio of
2^(1/12), 2 raised to the 1/12th power, or the 12th root of 2.

The well-tempered scale is a compromise between the desire to have one 
key sound beautiful and the freedom to move between keys easily. The 
chord C-E-G will sound a little bit better if you use the Pythagorean 
frequencies calculated above. But the chord on the well-tempered scale 
is pretty close and doesn't sound very bad.

-Doctors Toby and Ken,  The Math Forum
 Check out our web site!   

Date: 01/22/98 at 21:16:18
Subject: Why 8 notes?  Why 12 notes?

In your answer to the above question, I noticed that during your 
extensive explanation, you didn't answer the question about the 
reasons for chosing eight basic notes (independent of the intervals or 
intonation used). Once eight were chosen (C to C), why were five (black 
keys) added (again, independent of Pythagorean, Just Intonation or 
Equal-Tempered intervals)?

Thanks for your time and patience.

Carlos A. Altgelt

Date: 01/23/98 at 17:40:35
From: Doctor Ceeks
Subject: Re: Why 8 notes?  Why 12 notes?


First, it must be said that this question is not a mathematics question, 
but a question about music theory.

The evolution of the modern keyboard came about because of the needs of 
(European) composers.

Note that in other cultures, such as in India, there occur notes that 
are not obtainable on a piano.

The relation of the fifth (C-G) plays a fundamental role in European 
tonal music. The inversion of the fifth gives the perfect fourth, or the 
relation (C-F). The major triads built on C, F, and G yield additional 
notes which are all closely approximated by the notes 
{C,E,G,  F,A,C,  G,B,D} = {C,E,G,F,A,B,D} on the modern keyboard, i.e. 
the white notes.

Much early music uses only these eight tones.

But as composers grew in ambition and sophistication, they began to want 
to establish temporary moments in a different key, so that in a piece 
in C major, there might be a section in G major. To establish a key, the 
"tritone" dissonance (F-B), becomes important because of the tendency to 
hear its resolution as natural ((F-B) resolving to (E-C)).  Establishing 
G major, then, requires use of the notes C and F sharp. In fact, it was 
found helpful to "tonicize" the "dominant of G" a little in order to 
firmly establish G, and so it helps to have the tones G and C sharp. 
Many pieces of tonal music only use the white notes and C sharp and F sharp 
(after appropriate transposition if necessary).

Tonicizing the subdominant to C or F requires B flat, and if you wish 
to go one step further around the "cycle of fifths" to B flat, you need 
the E flat too.

Going just one step further up the cycle of fifths makes you sometimes
want G sharp, as the "leading tone" of A major, the dominant of D.

You could write a lot of interesting music at this stage... and then
Bach came along and with him came "well-tempered" tuning.

There was plenty to master involving just those notes, but perhaps 
in this century and the next composers will desire new "halftones" and 
justify their addition by writing some new, wonderful music! (There 
certainly are many pieces written which use such notes already.)

-Doctor Ceeks,  The Math Forum
 Check out our web site!   

Date: 01/24/98 at 11:27:36
Subject: Re: Why 8 notes?  Why 12 notes?

Thank you for your prompt reply.

Date: 11/06/99 at 03:18:54
From: Joel Ellis Rea
Subject: Musical scales

 [Note from the archivists: Joel Rea noticed some problems with the
 original version of our first answer, and wrote in to correct it.  the
 problem was a blurring of the distinction between well-tempered and
 even-tempered tunings.]

The "Well-tempered scale" that Bach demoed with his "The Well-Tempered 
Clavier" is not at all the same thing as the modern EVEN-tempered scale.  
Even-temperament (using powers of 2 to divide octaves into even steps at 
the cost of the precise harmonic ratios of Pythagorean and other Just 
Intonation systems) was a MUCH later invention, not much older than 
the USA. The scale Bach used may have been any of several "well-tempered" 
scales popular in his day, but was most likely one of Kirnberger's 
(probably Kirnberger III). Unlike even-temperament, well-temperament 
retains pure or nearly pure fifths and thirds in several keys, while 
sacrificing some of the purity in other keys.

As a result, each key has different "qualities" which are lost with
the homogenization effect of even temperament.  There was a reason
that, for instance, Bach's famous "Toccata and Fugue in D Minor" was
in D Minor and not in, say, C Minor or C# Minor or Eb Minor. None of
those would've had the effect he was trying to produce. And, more to
the point, today's even-tempered scale does not have the effect he
was trying to produce. Relatively few people have ever heard any of
Bach's (or numerous other composers', for that matter) music the way
they intended it to be heard. Today, playing the Toccata and Fugue
in another key would sound the same, only "transposed."  But in
Bach's day, the quality of that piece and its harmonies, and the
resulting emotional resonances, would also change.

The well-tempered scales demonstrated by Bach led to but are not the
same as today's even-temperament.

Actually, the math behind all of this is fascinating. Why DO pitches
in perfect harmony in one key become out-of-tune in another? The
answer lies in the fact that going all the way around the Circle of
Fifths by starting with one pitch and multiplying it by 3/2 (1.5)
twelve times with octave shifts to keep the result in the same octave
does NOT produce the same pitch as the note with which you started.
Using the concert starting pitch of A 4 = 440Hz, we get:

 A 4  440Hz
 E 4  330                 (down 1 octave from E 5 = 660Hz)
 B 4  495
 F#4  371.25              (down 1 octave from F#5 = 742.5)
 C#4  278.4375            (down 1 octave from C#5 = 556.875)
 G#4  417.65625
 D#4  313.2421875         (down 1 octave from D#5 = 626.484375)
 A#4  469.86328125
 F 4  352.3974609375      (down 1 octave from F 5 = 704.794921875)
 C 4  264.298095703125    (down 1 octave from C 5 = 352.3974609375)
 G 4  396.4471435546875
 D 4  297.335357666015625 (dwn 1 octave frm D 5 = 594.67071533203125)
 A 4  446.0030364990234375  (should be 440Hz!)

This discrepancy is called the "ditonic comma." Its size is about 24
"cents" (a cent is 1/100 of an Even Tempered semitone, thus a
logarithmic scale that remains the same regardless of the base pitch,
which Hz would not do). There is also a "syntonic comma" based on the
fact that going up four fifths around the Circle of Fifths does NOT
produce a true harmonic major third (look at the "C#" line above: it
should have been 275, down an octave from 550, which would be the
precise 5/4 multiple of A = 440Hz).

Resolving these "commas" so that octaves remain octaves meant slight
compromises to the fifths (since the ~24 "cents" of the ditonic comma
was for the whole Circle of Fifths - Even Temperament, for instance,
subtracts about two cents [~24/12] from each fifth to bring all the
octaves into tune) and more substantial compromises to thirds.  Some
tuning methods sacrificed fifths for purer thirds, or kept some keys
in tune while creating bad-sounding "wolf intervals" in other keys
(for instance, some resolved the ditonic comma by keeping all but one
of the fifths pure and piling the whole ~24-cent discrepancy on that
one "wolf fifth," while others kept eight of the fifths pure while
putting a less-bad sounding ~6-cent [~24/4] on the remaining four
fifths spread either evenly around the Circle, or placed so that keys
related to C sounded pure at the expense of those further away -
another method kept six fifths pure and put a ~4-cent offset on the
other six, again accounting for the full ~24 [~6*4]).  These latter
methods are the "well-temperament" tunings that Bach and others were
familiar with - the ones that did not result in "wolf" intervals.

Prior to Kirnberger and others, the common tuning system for pipe
organs and other hard-to-retune instruments was Mean Tone, which was
an attempt to average out the comma using arithmetic mean. Again,
some keys would sound different from others using this method, but
there would also be the occasional "wolf". The most common of these
was the "1/4 comma mean tone." This system is still used on some of
the European classic pipe organs.

There has been in recent years a resurgence of interest in tunings
other than the Even Temperament we've been stuck with for the past
couple of centuries, not only by organizations such as SPEBSQSA (the
Society for the Preservation and Encouragement of BarberShop Quartet
Singing in America), but also by "purists" who want to hear the music
of Bach, Pachelbel, etc. the way they intended it, and those who are
interested in various non-Western ethnic scales. Go to any Web
search engine and type in "just intonation" for a sample.

Justonic, Inc. is a software company that has patented a method
for doing true dynamic just intonation using modern microtunable MIDI
instruments.  (I'm not associated with them - I am a non-card-carrying 
hanger-around of SPEBSQSA, though.)

- Joel Ellis Rea

Editor's note: for "Pitch and Temperment," see   

Date: 06/23/99 at 23:29:11
From: Doctor Ken
Subject: Re: Musical scales

Hi Joel,

Thanks for your corrections to our archived answer. We're incorporating 
your great discussion of the even-tempered scale. I'm a bit of an acoustics 
nut myself, so I certainly wouldn't want acoustics misinformation in our 

Regarding your mention of Bach's Toccata and Fugue in d, I feel compelled to 
point out that the latest wisdom from Bach scholars is that that piece 
probably wasn't by Bach at all. Also, it probably wasn't written for the 
organ originally - it was a solo violin piece. And here's the kicker - it 
probably wasn't originally in d! If I recall correctly, I think it was 
originally in a, but I'm not sure if that's known.

There's a small discussion of the issue by Tom Parsons; the original paper 
by Peter Williams is mentioned there:    

I also feel compelled to point out that in Bach's day, there were many more 
considerations in choosing a key for a piece than just the simple emotional 
effect a certain key would produce in the listener.  For starters, the 
instrument a piece was intended for played a large role - trumpets had no 
valves, so there were really only a couple of keys they could play in.  
Certain notes were badly out of tune on recorders, and had to be avoided.  
One can be much flashier on a violin in certain keys than in others. The 
hunting horn traditionally played in F, and as a consequence one could often 
write a piece in F to evoke an outdoorsy feel, even without using horns 
(because the keys all sounded different, as you point out, people could 
perceive these subtleties).  Lots of later composers, Mozart and Beethoven 
among them, used specific associations like these to great effect.

Bach often took these key "constraints" a step further. For instance, there 
are pieces in which Bach made trumpets play in keys that trumpets didn't 
typically play in. Thus the trumpeter has to struggle quite a bit to just 
play the correct notes, or tune them well. It's no coincidence that these 
sections of music are often in vocal works where the text is about someone 
struggling. What better way to depict struggle than to make one of the 
instrumentalists sweat a little!

Bach also chose keys for his works based on fairly complicated organizational 
structures within works. It's not quite accurate to say that he encoded 
secret messages in his large-scale forms, but the key relationships in a 
piece of music might reveal certain interpretations of the music. For 
instance, they might suggest the form of a cross, or they might complete a 
"hexachord," suggesting completeness of form.

The notion of choosing a certain key purely for its emotional impact 
certainly happened a lot in music, but I think it came a bit later.

This discussion has gone pretty far afield, but it's an interesting one.  
Thanks again for writing in.

- Doctor Ken, The Math Forum   

Date: Thu, 24 Jun 1999 01:37:49 -0500
From: Joel Ellis Rea
Subject: Musical scales

Thanks for the further information and Web site. I've been doing much
research on harmony lately. Today's even-tempered scale as we know it
wasn't even perfected until THIS century, simply because the human ear alone
and unaided can not possibly tune to irrational pitch relationships. The
closest that can happen is like piano tuners who first tune one note to a
reference pitch (say, A=440Hz), then tune the lowest A to have a pure octave
relationship, then produce the notes within one octave up of that A by
playing both them and the next-lower key (starting with A#/Bb and the
previously tuned lowest A, which [not entirely coincidentally] is the
lowest note period on an 88-key piano) and counting the BEATS that result
from the ERRORONEOUS harmonic relationship that is the Even Tempered scale
between those two notes. Once that whole lowest octave is tuned, each
higher note is tuned by tuning it to a pure octave relationship to its
counterpart in that lowest octave. But even that won't be exact.

The CONCEPT of even-tempered dates back quite a bit further (330 BCE to
be precise, by Aristoxenus of Tarentum, a student of Aristotle), but
couldn't be calculated properly until calculus was invented, as it required
exponentials and logarithms instead of simple ratios. Several amazingly
close attempts were made by the Chinese, with Ho Tcheng-tien (370-447 CE)
creating a series of string lengths for a scale of twelve approximately
equal semitones - the maximum deviation from today's Even Temperament was
less than 0.1 semitone! Even better was Chinese prince Chu Tsai-yu in 1596
CE (over a millennium later), who calculated even semitones to a correct 
accuracy of nine decimal places, a feat that without calculus required 
extracting the 12th root of numbers containing as many as 108 digits!

Much of this info can be found in the excellent book _The Story of
Harmony_, available from Justonic (it comes with their Pitch Palette
software, but can be purchased separately).

- Joel Ellis Rea

Date: 05/09/2003 at 09:32:15
From: David Kantor
Subject: Musical Scales

Joel Ellis Rea wrote about musical scales and the "Cycle of Fifths."  
I would like to point out that from a theoretical standpoint, there is 
no cycle - just a never-ending sequence. It only becomes a cycle when 
you impose enharmonic equivalence. And that, in turn, compels us to 
adopt even-tempered tuning.

To illustrate, Mr. Rea demonstrated that if you go along the "cycle" 
from A to A, using perfect fifths, you don't come back to where you 
started. But his "Cycle of Fifths" included one interval from A# to 
F, which is not a fifth at all; it is a diminished minor sixth or 
something like that. A true fifth from A# is E#. And then you complete 
the "cycle" going to B# to C## to G##. Thus, you really don't end up 
back at A; you end up at G##.

Tonal nomenclature intrinsically accounts for this. The tone is, if I 
recall correctly, 24 cents off from A, but properly speaking, it isn't 
A at all, so in a sense, it isn't "off" from where it is supposed to be.

The other side of the need for tempered tuning is that the alternative 
is to have a great multitude of different tones: A# different from 
B-flat, C# different from D-flat, E# different from F, and so on. 
When you sing or play the violin, you are supposed to make these 
distinctions, but it is impossible on a discretely tuned instrument 
such as a keyboard instrument. As I understand, it has been tried 
(long ago) - a keyboard with many more than 12 keys per octave, but 
it became too cumbersome.

Thanks for listening.
- David K.
Associated Topics:
High School History/Biography
Middle School History/Biography

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.