Pick any note and climb by perfect fifths, the gap you hear when a power chord is played. Twelve fifths later you have visited every note on the keyboard and should be back where you began, seven octaves higher. With a pure fifth, you are not. You overshoot by a sliver, about a quarter of a semitone, and no amount of care can fix it. Every keyboard you have ever heard is a compromise about where to hide that sliver.

Two ways to climb the same mountain

A pure fifth is a frequency ratio of 3 to 2. Stack twelve of them and the ratios multiply: (3/2)12 is about 129.75. Stack seven octaves, each a ratio of 2, and you get 27 = 128. Those two numbers are supposed to describe the same note. They do not. The ratio between them, 1.0136, is called the Pythagorean comma.

Musicians measure small pitch gaps in cents, where 100 cents is one piano semitone and 1,200 cents is an octave. A pure fifth is 701.96 cents. Twelve of them make 8,423.46 cents; seven octaves make 8,400. The leftover is 23.46 cents, nearly a quarter of a semitone: small, but plainly audible when two notes sound together.

Close the circle yourself

The dial below is the clock face of the twelve notes. Each dot is where the next fifth lands, and the lines join them in order. Drag the slider to change how wide every fifth is. Watch the last dot try to reach the first one.

Gap after 12 fifths
Fifth needed to close
Major third (4 fifths)
Pure third is386.31 ¢

Slide to 701.96 and the path spirals past the start with a visible gap. Slide to 700 and it closes exactly, but every fifth is now about 2 cents narrower than pure. That is the deal a modern piano makes: it shaves a hair off every fifth so the circle shuts, and spreads the 23.46 cents over twelve places where nobody notices.

The price is in the thirds

Notes also have a second natural interval, the major third, a pure ratio of 5 to 4 (386.31 cents). Stack four fifths and drop two octaves and you land on a third, but its size depends on the fifth you chose. With pure fifths it is 407.82 cents, which is 21.5 cents too wide, and sounds harsh and busy. On an equal-tempered piano it is exactly 400 cents, still 13.69 cents sharp of pure. Your ear is hearing that when a piano chord has a faint wobble that unaccompanied singers can avoid.

Try the meantone button. Shrink each fifth to 696.58 cents and the third becomes pure at 386.31. That was the trade made on many keyboards of the Renaissance and Baroque: sweet thirds in common keys. But now twelve fifths fall 41 cents short, so the last fifth must be 737.64 cents, a howl musicians called the wolf. Play in the wrong key and you meet it.

Why you can't have everything

The reason is arithmetic, not craft. A pure fifth is built from the number 3 and an octave from the number 2, and no power of 3 ever equals a power of 2, because powers of 3 are odd and powers of 2 are even. So no stack of fifths can ever land exactly on an octave. The gap is not a flaw in pianos; it is a fact about whole numbers. Equal temperament, which divides the octave into twelve identical steps of 100 cents, is simply the choice that makes every key equally usable and equally slightly out of tune.

Real piano tuners go a step further and stretch the octaves very slightly, because stiff piano strings produce overtones a little sharp of the ideal. But the principle you just played with is the same: somewhere, a small amount of mathematics has to be hidden.