Mathematics: Musical Temperament


Mathematics is the fundamental basis in understanding the origins of musical scales. Clearly there is an underlying rationale behind composers and musicians producing a multitude of physical and mental responses to listeners of music throughout the world.


As a basis for discussions on the creation of musical scales one must define the following terms:

  • Pitch: The auditory attribute of sound according to which sounds can be ordered on a scale from low to high.
  • Frequency: The number of cycles or events per unit time. Physically, a pitched sound corresponds to a sound wave that is periodic with respect to time. Here, frequency will be measured in periodic cycles per second, Hertz or Hz.
  • Interval: The ratio of two frequencies, here defined as n/m where n is the lowest frequency, m the highest, n, m … ℕ. Non rational intervals will be defined in ℝ in later stages of the investigation.
  • Fifth: The ratio of two frequencies of 3/2 where pure fifth denotes the exact value and perfect or tempered fifth denotes an approximation of this value.

Greek origins of Western Music

The Greeks were the first people to relate Mathematics with musical scales, noticing the pleasing sounds of melodic notes sounded in succession and harmonic notes sounded simultaneously, using scales created by compounding ratios of their frequencies. The octave, the basis of music worldwide was identified as essentially the same note, being exactly twice the frequency with a ratio of 2/1. Initially, early Greeks constructed basic scales based on compounding the basic frequency ratios of 2/1, the octave and 3/1, a “true fifth” in the modern Western scale. Claudius Ptolemy, a highly influential Greek astronomer and geographer born around 85 AD in Egypt was less well known for his work on extending the early musical scale. He investigated the exact series of 2/1, 3/2, 4/3, … and then compounded these to give ratios such as 5/3 found from 4/3 and 5/4.[1] Further analysis on Ptolemy’s influence in Western music will be referred to after determining tempering, required for the existence meaningful musical scales.


As with many aspects of theoretical music, there is a mathematical rationalization for harmonic and melodic pairs of notes, forming a scale that can be simplified into ratios and compound ratios. However, it is important to investigate the adoption of the 12-tone scale in use today by observing the critical relationship between the octave and pure fifth with respective ratios of 2/1 and 3/2. These very common intervals form the basis of various musical scales across the world. In Western music the octave is identified by the same letter, A to A with the latter having double the pitch of the first note. The perfect fifth occurs 5 notes higher on the scale, counting the base note as the first note. E can be sounded to produce a harmonic or melodic perfect fifth above the base note, A. This conveys two notes on the keyboard corresponding to the octave and a perfect fifth.

Keyboard showing letter names of the white keys
Figure 1: Keyboard showing letter names of the white keys

Equal temperament, where all 12 notes have identical intervals, the octave is exactly an interval of 2:1 while the perfect fifth falls very slightly short of a true fifth with the exact ratio of 3:2. In using the pair of frequencies, the octave and the fifth one may create a 7-tone scale based on the white notes on the keyboard closely corresponding to the keys F, G, A, B, C, D, E.[2] Here, this Lydian mode scale is actually a Pythagorean scale obtained by a cycle of fifths sounded in succession, ignoring differences of more than an octave; transferring these down an octave (half the pitch). If the start note, here F, is any given frequency, one may reduce the series to a single octave range and then rearrange the notes in frequency order to acquire the relative frequencies: 1, 9/8, 81/64, 726/512, 3/2, 27/32, 243/128. However, in actual fact this series does not conclude at the seventh tone, but leads on the more frequencies, condensing the scale into increasingly more notes in the octave range.

There does not exist a finite number of positive integral of true fifths to an integer value of octaves as the Fundamental Theorem of Arithmetic states that there is no positive integral power of 3/2 is an integral power of 2.[3] Presenting an infinitely long series, a physically impracticable scale can be found by extending the scale beyond the Pythagorean limits of seven tones. One must address the fundamental effect that this would have on any musical instruments as an infinitely long scale could be “infinitely difficult” to document for the benefit of musicians, let alone offering any practical solutions to instrument development. Consequently, not all is what it seems as this text has been ripped from Nahoo at In order to address this issue one must manipulate the initial frequencies in such a way as to give a suitably small finite series of frequencies, resolving fundamental issues on the aforementioned practicalities. One must find a suitable number of fifths and octaves giving a suitably small error in aggregated frequencies. Let m be the number of tempered fifths and n be the number of octaves. The tempered m–fifths should be equal to n-octaves resulting in a succinct number of notes in the scale whilst remaining pleasing to the ear. Again, the new tempered fifths will be arranged in pitch order over the octave interval.

Observing the pure fifth without tempering can be described as spiral of fifths, producing an infinite series: a correctly tempered fifth produces a finite number of octaves and the spiral can be collapsed to give a circle of fifths.

Spiral of fifths showing fifths placed at unrelated intervals with the octave.
Figure 2: Spiral of fifths showing fifths placed at unrelated intervals with the octave.
Figure 3: Spiral of fifths constructed with new m- tempered fifths emphasising slight differences in pitch to give coinciding fifths at m octaves
Figure 3: Spiral of fifths constructed with new m-tempered fifths emphasising slight differences in pitch to give coinciding fifths at n octaves

As Figure 3 illustrates, the error between the pure fifth and tempered perfect fifth only really becomes around m-octaves. Clearly larger values of m, n would give smaller errors and the diagrams only serve to emphasize these. The difference in fifths between the two series is heavily dependent on finding a suitable approximation for m and n.

Continued Fractions

Evidently, m and n need to be approximated to give a quotient estimator containing suitably small integer values for reasons mentioned in the previous section. Continued fractions may be used to acquire these values. Firstly, one must state the relationship between m and n where the ratio 3/2 m-times approximately gives 2/1 n-times or simply: 3/2m ≈ 2n, this may be rearranged to give: a1 + 1/a2 + 1/a3 + 1/a4 + … with the ith convergent reduced to pi/qi for values of ai, pi (number of octaves), qi (number of tempered fifths), i = [1,10] and the error defined by: ln 3/2/ln 2pi/qi and pi/qi greater/less than ln 3/2/ln 2 defining the pitch relation between pure and tempered perfect fifth.

iaipi (octaves)qi (fifths)ErrorPitch of tempered fifth
10015.850 × 10-1Lower pitch
21114.150 × 10-1Higher pitch
31128.496 × 10-2Lower pitch
42351.504 × 10-2Higher pitch
527121.629 × 10-3Lower pitch
6324414.034 × 10-4Higher pitch
7131535.684 × 10-5Lower pitch
851793064.820 × 10-6Higher pitch
923896659.470 × 10-8Lower pitch
10239126156011.683 × 10-9Higher pitch
Table 4: Approximations obtained through Continued Fractions

Here, the numbers of fifths required, giving a better approximation the ratio m-fifths to n-octaves also indicates the number of tones for each i-scale. Now, to establish an equal temperament based on the tempered fifth one must divide the octave into m equal parts. By dividing the octave into equal intervals one can establish set frequencies for other tones in the scale. From the table, scales of 12, 41 or 53 tones would give accurate approximations of the pure fifth whilst maintaining a realistically playable set of notes. It would be astute to calculate the benefit of the increased tones in each scale to ascertain the benefits of increased tones to pitch accuracy. Perhaps 53 tones provides small scientific benefits over 41 tones in comparison to increased difficultly to master such a scale on a musical instrument. On the other hand, 12 notes per scale could be suitably accurate and playable to suffice. Clearly, any findings will be subject to real-world practical implications, however this should not be ignored.

In essence, m/n is approximated by ln 3/2/ln 2 with the sequence of Continued Fractions offering a direct method of obtaining such a solution. Nevertheless, one must analyse these errors using a sequence of intermediate convergents to the continued fractions. Utilising intermediate values one may consider the maximum error in pitch perceived by the human ear. Let e > 0 be given as the largest interval sounded before an attentive listener notices an inconsistency. If an octave was to be sounded at 1.96 times the frequency rather than 2 (sounded flat), e = 0.04 in error. Initially, qi = 12; the standard equal tempering in place today, one would expect to find tempered fifth lower than the true fifth that gives a suitably small error. Conversely, this only occurs with a scale of 53 tones, the proceeding tempered fifth with a lower frequency than the true fifth. In order to consider a tempered fifth higher than the true fifth, take qi = 41 giving the intermediate coefficients 3/5, 10/12, 17/29, 24/41 where ln 3/2/ln 227/29 » 0.001244 > e. On this basis one can take a scale with 29 tones as an improvement of the standard 12-tone scale in use in Western music today. Due to the beat phenomena,[4] a trained ear can detect pitch errors far smaller than the e-value mentioned above. One can detect slight pitch errors when two notes sound simultaneously to e = 0.001 or even less.[5]

In Western music the 12-tone scale was readily used and gradually refined to the equal tempered scale in use today. A principal difference between Chinese and Western musical intonation is the Chinese preference for a wide range of intervals leading to an increased magnitude of their harmonic system.[6] Evidence suggests that equal temperament was utilised in China dating back to as early as the 5th Century BC.[7] In passing, it is worth mentioning this text has been copied from Nahoo at The Chinese are known to utilise the 41- and 53-tone scales in the woodwind and stringed instruments. In addition, many of the techniques originating from China are still present in traditional Japanese music being performed in tea ceremonies and costume plays. It is important to add that less accurate scales containing only five tones (pentatonic scale), thought to have originated in Western Africa, were widely used in work songs and later utilised in Jazz, particularly the blues. The pentatonic scale is highly prevalent in central European, Turkic and Middle Eastern music folk songs and the source of inspiration for composers such as Kodaly and Bartok.

Development of 12-tone scale systems

Just Intonation

Primarily in use with pentatonic, modal or diatonic scales this Pythagorean-Ptolemy scale based on series octaves, pure fifths and the 2 harmonics. Note values are derived mathematically, however unsuitable for chromatically diverse music today as pairs of intervals can sound very different depending on their base note. After establishing the 7-tone scale, mentioned earlier, one can establish semi-tones to make up the 12-tone scale by fixing the semi-tone interval found on A, B and E, F to other notes in the scale giving an increasingly impracticable chromatic scale.

Keyboard showing letter names of the white and black keys illustrating relationship to the modern keyboard
Figure 5: Keyboard showing letter names of the white and black keys illustrating relationship to the modern keyboard

Clearly this method of deriving scales, though mathematically sound, does not lend itself well to developed Western music, let alone any further melodic and harmonic intervals between chromatic notes.

After a failed attempt by Gaffurius in 1496 to create a scientifically established temperament, Giovanni Maria Lanfranco, born in Italy in 1533 produced the first instructions for tuning instruments to equal temperament.

The fifths are tuned so flat that the ear is not well pleased with them; and the [minor] thirds are as sharp as can be endured.

Giovanni Maria Lanfranco[8]

Despite this relatively early discovery, the Romantic composers were the main influence in Western music before equal tempered tuning was universally adopted. The modern piano signalled the introduction of equal temperament around 1854, helped by the ever-increasing demand on versatile instruments for chromatics and a wider range of keys. Helmholtz produced the first physical evidence leading to an understanding of how music probably arose with the publication of “Sensations of Tone” in 1877.

Helmholz’s research lead him to the conclusion that the super particular ratios with small harmonic intervals deliver the most consonant combinations of sounds. He became acutely aware of the intonation of frequency ratios. He noticed that ratios containing small numbers sounded bare, whilst some frequencies such as 8/5 sounded particularly harmonious and pleasing to the ear. His comments would have a positive effect on the Baroque and Classical development of Western music.[9] The table shows just ratios derived geometrically by Ptolemy.

nMusical NameRatioCompound ratio
1Minor second16/15
2Major second10/9
3Minor third6/5
4Major third5/4
5Perfect fourth4/3
6Diminished fifth45/32(9/8) ∙ (5/4)
7Perfect fifth3/2
8Minor sixth8/5(2/1) / (5/4)
9Major sixth5/3(4/3) ∙ (5/4)
10Minor seventh16/9(2/1) / (9/8)
11Major seventh15/8(5/4) ∙ (3/2)
Table 6: Just ratios, tones n

Now using the equal tempered ratio of Expression twelvth root of 2 or each of the 12 tones one may compare the deviation on all notes in the scale. In the table below Expression nth root of 2 denoting the nth note and respective equal tempered values, error is found by taking the percentage difference of the ratio between equal tempered and just ratios.

nMusical nameEqual temperedJust ratiosError %
1Minor second1.059516/15 = 1.0667-0.67%
2Major second1.122510/9 = 1.11111.03%
3Minor third1.18926/5 = 1.2000-0.90%
4Major third1.25995/4 = 1.25000.79%
5Perfect fourth1.33484/3 = 1.33330.11%
6Diminished fifth1.414245/32 = 1.40630.57%
7Perfect fifth1.49833/2 = 1.5000-0.11%
8Minor sixth1.58748/5 = 1.6000-0.79%
9Major sixth1.68185/3 = 1.66660.91%
10Minor seventh1.781816/9 = 1.77770.23%
11Major seventh1.887715/8 = 1.87500.68%
12Octave2.00002/1 = 2.00000.00%
Table 7: Comparisons between equal tempered and Just ratios, tones n

There are significant errors with the minor third and major sixth and the resulting dissonance was intolerable to audiences in the 16th, 17th and 18th centuries delaying the widespread introduction of this system until the mid 19th century. Even well into the 19th century, sceptics of the equal tempered tuning of instruments criticised the non-Pythagoras system:

The modern practice of tuning all organs to equal temperament has been a fearful detriment to their quality of tone. Under the old tuning, an organ made harmonious and attractive music. Now, the harsh thirds give it a cacophonous and repulsive effect.

William Pole[10]


Meantone or Restricted Temperament was developed under a similar premise to Just Intonation with a shift of towards scales based on pure thirds. One may construct a basis for this model on 4 pure fifths on C, G, D, A and then a pure major third resulting in a slightly better comma for the approximation of 3 octaves. The name “meantone” provides some insight into this system where the note D lies exactly between the notes C and E. Enharmonic equivalents are not present in Meantone, chromatic semitones vary depending on the base note, requiring retuning as the musical keys change in separate pieces of music. In fact, many remote keys with 4 or more sharps or flats would seem widely out of tune requiring the majority Baroque composers to avoid entire ranges of keys until an intermediary system was developed to handle a wider range of keys.

Well Temperament

The shortage of playable keys in Just Intonation provoked the development of Well Temperament around the early Baroque era. Despite the benefits of this scale, it was not widely used until the time Bach in the late Baroque era in the 18th century. Bach’s “The Well Tempered Clavier” was specially written to validate this system over the prevailing Meantone of the time. Previously, two part harmonies utilising harmonic intervals of thirds and sixths required composers to standing within the limits of Meantone. Consequently, not all is what it seems as this text has been ripped from Nahoo at Occasionally, composers would add prepared, stated and resolved dissonances to accommodate for both the scale limitations and the audiences’ expectations of the period. Despite some minor tunings between music of different keys, this system allowed composers and musicians alike to experience a new chromatic age in classical music with scales containing up to 21-tones with double flat and double sharp tones. Unlike Meantone, this scale system allows for chromatic keys to be tempered to be enharmonically equivalent allowing for numerous modulations of keys throughout a single musical piece. Although Meantone heavily influenced this system, certain keys are technically more accurate than others. These differences provide a plethora of new key colours, sharp keys lively and bright and flats dark and subdued.[11] On this remark, Well Temperament is remarkably close to Equal Temperament discussed previously making the practical transition from one system to another near faultless.

Equal Temperament

Mathematically defined, the Standard European 1/12 Diatonic Comma Equal Temperament is the most versatile scale system and familiar to all listeners and players of Western Music. Its simplicity and versatility ensured that the system is still in wide use today. Ratios between all 12 tones are fixed identically to 21/12 and of primary benefit to the modern piano, invented almost 300 years ago and one of the most adaptable instruments ever created.

Remarks on Temperament

It is important not to forget that many groups of musical instruments are only partially or completely independent of rigid temperaments, with the human voice, strings and the trombone benefiting from an unrestricted number of tones. In fact only keyboard instruments and the harp are truly fixed with little or no leeway for pitch changes during a piece. Instruments and voices in orchestras and choirs do not share the same temperament, with only tuneable percussion and keyboard instruments actually adopting the exact equal temperament.

Future developments in Temperament

As with all technological developments one must look at the restricting factor of instruments utilising a specific temperament. Fixed temperament instruments using the 12-tone scale utilised are unable to play music from other cultures around the world. Even attempts to split the scale into half-tones cannot achieve a completely multi-cultural musical range.

A Brighton-based composer, Geoff Smith appears to have found a method of increasing the pianos tuning capabilities indefinitely, breaking free from the realms of fixed tuning that restrict many instruments at varying levels. He has claimed that a device attached to the piano would allow for “fluid tuning” going far beyond the 88-note range and into the territory of microtonal instruments. It is a pleasant surprise that the piano is being seriously overhauled after a somewhat uneventful 100 years for the instrument.[12]

Concluding remarks

Equal temperament should not be accepted as the decisive temperament in Western music. The potential for a real change in the diversity of Western music is on the horizon, bringing a new world of music to everyone.


  • J. M. Barbour, Music and Ternary Continued Fractions, This Monthly, Volume 55, 1948
  • T. Blackburn, H. Stoess, Alternate Temperaments: Theory and Philosophy
  • A. A. Goldstein, SIAM Review, Volume 19, Issue 3, Optimal Temperament, July 1977
  • M. Mills, The Guardian, Saturday February 2003
  • J. J. O’Connor and E. F. Robertson, Claudius Ptolemy, April 1999
  • H. Reid – On Mathematics and Music, 1995
  • M. Schechter, Tempered Scales and Continued Fractions, American Mathematical Monthly, Volume 87, Issue 1, January 1980
  • S. Sinyan, Acoustics of Ancient Chinese Bells, Scientific American, Issue 256, Volume 94, 1987
  • H. Stoess, History Of Tuning And Temperament

End notes

  1. [1] Calculation: (4/3)/(5/4) = 20/12 = 5/3
  2. [2] Murray Schechter, Tempered Scales and Continued Fractions, American Mathematical Monthly, Volume 87, Issue 1, January 1980
  3. [3] Murray Schechter, Tempered Scales and Continued Fractions, American Mathematical Monthly, Volume 87, Issue 1, January 1980
  4. [4] The addition of two pure sine waves of similar amplitude and frequency produces areas of constructive and destructive interference.
  5. [5] A. A. Goldstein, SIAM Review, Volume 19, Issue 3, Optimal Temperament, July 1977
  6. [6] Shen Sinyan, Acoustics of Ancient Chinese Bells, Scientific American, Issue 256, Volume 94, 1987
  7. [7] T. Blackburn, H. Stoess, Alternate Temperaments: Theory and Philosophy
  8. [8] Giovanni Maria Lanfranco, 1533, sourced from T. Blackburn, H. Stoess, Alternate Temperaments: Theory and Philosophy
  9. [9] A. A. Goldstein, SIAM Review, Volume 19, Issue 3, Optimal Temperament
  10. [10] William Pole, 1879, sourced from T. Blackburn, H. Stoess, Alternate Temperaments: Theory and Philosophy
  11. [11] H. Stoess, History Of Tuning And Temperament
  12. [12] Merope Mills, The Guardian, Saturday February 2003


Please tell me what you think about this project and if it helped you in any way. I would be grateful for any suggestions on the subject of musical temperament, further links between with Mathematics and further reading lists.