# Why does an octave on a piano have the divisions of 8 white keys and 5 black keys?

An octave corresponds to a doubling or halving of the frequency. Each octave on a piano and in classical music score is broken downs into 8 white keys and 5 black keys. Is there a physics explanation for that division?

-
The assignment of notes as white or black keys has nothing to do with physics or acoustics. In the equal temperament tuning system typically used for e.g. pianos, each note has a frequency a factor of $\sqrt[12]{2}$ greater than the next lower note, regardless of whether it’s black or white. –  bdesham Oct 29 '11 at 22:45

Modern keyboards are tuned with each of the 12 half-step intervals between one octave and the next being equal, so a half-step is a ratio of the 12th root of 2 (about 1.059), and a whole-step is a ratio of the 6th root of 2 (about 1.122).

But the ratios that "sound nice" musically tend to be ratios of small integers. 2:1 is an octave, of course. 3:2 is a "fifth". In older tuning systems, a fifth was exactly a 3:2 ratio (which made transposing from one key to another difficult). The modern "equal temperament" system approximates this to 7 half-steps, a ratio of about 1.498. We've traded off those exact small integer ratios for consistency.

The ratios represented by the white keys on a piano are generally chosen as the ones that are close to small integer ratios. A 6-half-step interval (C natural to F sharp) is a ratio of sqrt(2), about 1.414, which sounds dissonant.

See here for more details -- or find and read an entire book on musical theory.

-

Keith Thompson's answer, while good, makes it seem that there is some intrinsic difference between the black keys and white keys, and that only the white keys approximate integer harmonies. This is not really true. The white keys are just the C major scale, and the most important purpose the black-key/white-key distinction serves is to make it easy to see where your fingers are, because the underlying structure is too symmetric, and without a pattern, it is easy to get lost.

The integer ratio stuff is mostly for the three notes CFG, which are adjacent on the circle of fifths. These tones do have an integer ratio, with no qualification. There is a very weak integer ratio on E:C of 5:4, but this ratio is

• badly approximated in the 12 tone system
• unusable by the ear for purposes of extrapolation of a fundamental frequency, because the putative fundamental frequency is 2 octaves away
• Has an exact counterpart in the ratio of C to G#, which is 4:5. But G# is a black key.

All the 5:4 tone (major third) does, when played with C, regarding the percieved C tone is modify the timbre somewhat. similarly, C modifies the timbre of the G# tone in the same way. The lower tone sets the fundamental frequency you tend to hear, but if the higher tone is part of a melody, the ear will mostly separate it out.

The white key corresponding to B is maximally discordant with C, has the largest denominator ratio to C of all the keys in a rational approximation, while the black key corresponding to B-flat/A-sharp is as about as harmonious with C as the white key corresponding to D. So even relative to C, white-key black-key does not indicate special harmoniousness.

The key for B-flat/A-sharp is omitted from the major scale by a scale convention, which is fixed by requiring good relative harmonies between different tones in the scale overall, not just relative to C. You also require that you contain the major chords of the F and G in the C scale, and that fixes the major scale. The C minor scale is more rationally harmonious relative to C than the major scale (it is basically the major scale going down, so the ratios are the reciprocals of the major scale frequencies, except for that the most discordant note is omitted and replaced with a less discordant one), and it includes A-sharp/B-flat. B is included in the major scale because it is a leading-tone, you traditionally use it only to signify a transition to C, and, more significantly because it is the fifth of the major third, and the major third of the fifth.

Although this stuff is trivial, it looks complicated in the usual language musicians use, because this is full of ponderous historical cruft.

-
Thanks for the detailed clarification. –  Keith Thompson Oct 30 '11 at 9:06
To be musically pedantic: surely you mean that the E-to-C ratio has an exact counterpart in C-to-A flat! –  Ant Oct 30 '11 at 22:20
G-sharp and A-flat are the same on the piano, so I don't see your point. I never make a distinction between G-sharp and A-flat, because it doesn't exist on the piano, my ear does not hear it, it is so small it is smaller than the natural detuning on stringed instruments, and it is of the same order as the integer-ratio errors in the standard 12 tone scale. The music-theorist's distinction between the two is absurd, and pointlessly obscures the simple Z/12 structure of the tones. I actually wrote a pages-long answer, which was a diatribe on music theory, but I erased it at the last minute. –  Ron Maimon Oct 31 '11 at 6:28

There is no easy answer for this. It happens to be a good arrangement for many reasons. Several factors would have contributed to the original design.

Western music is based on the diatonic scale.

C D E F G A B is the diatonic scale on C.

Musical staves, created by Gregorian monks to record their plainchants before the existence of keyboards, and still in use in today's notation, represented this diatonic scale. Other notes and scales to be achieved by kludging this notation with accidentals and key signatures.

So notationally, and hence conceptually, everything is seen in terms of a distorted diatonic C scale.

The most early and primitive musical instruments played diatonic scales.

Hence there is some logic behind the decision to start the piano keyboard off with a diatonic scale in C and arrange the enharmonic (out of scale) notes around this.

It is in some way a mirroring of the pre-existing notation.

The layout of the piano keyboard was finalised before 12-TET (equal temperament where the ratio of each note to the next is the same, i.e. 12th root of 2)

Before 12-TET, the instrument would be tuned perfectly to C, but the further the tonal centre moves, the more out of tune it will sound. Instruments would have to be tuned for individual pieces. Some instruments you can use multiple rows of keys. It was a mess. But 12-TET cannot use as an argument for the existence of this layout -- it came much later!

This question should be migrated to the music stack exchange site. It will accrue misinformation on a physics site. I can see from the existing answers that this is already the case.

-