The Mathematics of Harmony

Strike a piano key and you’re not hearing one thing — you’re hearing a stack of invisible relationships, a chord hidden inside a single note. The fundamental pitch is just the loudest layer. Beneath it, and above it, and woven through it, are overtones — fainter copies of the original, each vibrating at exact integer multiples of the base frequency. This is where harmony comes from. Not from tradition or taste, but from physics. The reason a major third sounds bright and a minor second sounds tense is written into the structure of sound itself, long before any composer decided to use them.

The story of how humans discovered this — and then spent centuries arguing about what to do with it — is one of the stranger threads in music history. It involves a Greek philosopher with a stretched string, a tuning system that makes perfect mathematical sense and is almost unusable in practice, and a compromise so elegant that most musicians today have never noticed they’re using it.

Pythagoras and the String

Around 500 BCE, Pythagoras — or more likely his followers, since attribution gets murky at this distance — performed what may be the first documented experiment in acoustics. They stretched a string across a resonating box called a monochord, then placed a moveable bridge underneath it to divide the string into different length ratios. What they found was that simple ratios produced intervals that sounded harmonious together, while complicated ratios produced intervals that clashed.

Divide the string exactly in half — a 2:1 ratio — and the shorter segment vibrates at exactly twice the frequency of the full string. The interval is an octave. It’s so consonant that most cultures treat the two notes as the same pitch at different heights. Divide the string in a 3:2 ratio and you get a perfect fifth — the interval between C and G, the backbone of Western harmony. A 4:3 ratio gives you a perfect fourth. These ratios, built from the smallest whole numbers, produce the most stable-sounding intervals in music.

The Pythagoreans drew a philosophical conclusion that feels almost mystical from a modern vantage point: number governs harmony, and therefore number governs the cosmos. They called the underlying order the musica universalis — the music of the spheres. This wasn’t metaphor for them. It was physics theology, a belief that the same ratios structuring consonance also structured planetary orbits and the nature of beauty itself.

Strip away the cosmology and the core observation holds up perfectly. Frequency ratios do determine consonance. The question is why.

The Harmonic Series

When a string vibrates, it doesn’t just vibrate along its full length. It also vibrates in halves, in thirds, in quarters, in fifths — simultaneously, all at once. These are called harmonics or overtones, and together they form the harmonic series: a sequence of frequencies at 1×, 2×, 3×, 4×, 5× the fundamental, continuing upward in principle forever, though the higher partials fade quickly into inaudibility.

Play a low C on a piano and the string is producing, among others, the C an octave up, then the G above that, then another C, then an E, then a G again. That E — the tenth harmonic — is a major third above the fourth octave of the fundamental. The major triad is literally built into a single vibrating string. Debussy had a point when he said the chord of nature was the major chord.

Consonance and dissonance map almost directly onto this series. Intervals that appear early in the harmonic series — octaves, fifths, fourths, major thirds — sound stable because the overtones of the two notes align and reinforce each other. When you play a C and a G together, several of C’s overtones land on the same frequencies as G’s overtones. The sound waves cooperate. Play a C and a C-sharp together and the overtones clash — they nearly coincide but don’t, creating the rapid fluctuation in amplitude we hear as beating, which the ear interprets as tension.

This is why dissonance isn’t culturally arbitrary, even if its use is. The physical phenomenon of beating is measurable. Different cultures have different tolerances and expectations for how much tension is desirable, and different styles resolve dissonance in different ways — but the underlying acoustics are universal.

Just Intonation: The Perfect System That Doesn’t Work

If harmony comes from simple frequency ratios, the logical step is to build a tuning system from those ratios directly. This is called just intonation, and it produces intervals of extraordinary clarity and resonance. A just perfect fifth has a ratio of exactly 3:2. A just major third is exactly 5:4. When you tune a string quartet this way — as string players instinctively do when playing without accompaniment — the chords seem to lock into place with an almost physical solidity. The overtones stack perfectly. The sound blooms.

The problem emerges the moment you try to move between keys.

Stack twelve just perfect fifths on top of each other — going from C up through G, D, A, E, B, and so on around the circle — and you should, in theory, arrive back at C seven octaves higher. The math says you’d reach a frequency of C multiplied by (3/2)¹², which works out to roughly 129.75 times the original frequency. But seven octaves is exactly 2⁷ = 128 times the original frequency. The difference between 129.75 and 128 is small but audible. It’s called the Pythagorean comma, and it means the circle of fifths doesn’t actually close.

This is not a rounding error. It is a fundamental mathematical fact about the relationship between the ratios 3:2 and 2:1. They cannot be reconciled perfectly. You can tune your C major scale to be acoustically pure, or you can tune your F-sharp major scale to be acoustically pure, but you cannot have both at once. Every key you gain will be slightly impure compared to some other key you could have tuned cleanly.

For much of Western music history, this was managed by choosing a few “good” keys and accepting that others would sound rough. Keyboard instruments in the Renaissance and Baroque periods were often tuned in meantone temperament, which made thirds purer at the expense of making some fifths slightly narrow. Certain key combinations were avoided because the tuning made them genuinely unpleasant. The keys weren’t interchangeable — they had different characters, different degrees of roughness, which composers like Rameau and Buxtehude exploited deliberately.

Equal Temperament: The Elegant Compromise

Equal temperament solves the problem by distributing the error evenly across all twelve semitones. Instead of building intervals from pure frequency ratios, it divides the octave into twelve perfectly equal steps, each one the twelfth root of 2 — approximately 1.05946 — times the frequency of the previous one. Multiply that number by itself twelve times and you get exactly 2: the octave closes perfectly.

The consequence is that every interval except the octave is slightly out of tune. The equal-tempered perfect fifth isn’t 3:2 — it’s 2^(7/12), which is about 1.4983 instead of 1.5. That’s a difference of roughly two cents, where a cent is one hundredth of a semitone. The major third is further off: just intonation gives 5:4 = 1.25, equal temperament gives 2^(4/12) ≈ 1.2599. About fourteen cents sharp. If you’ve ever noticed that a piano’s major thirds sound slightly bright compared to a cappella vocal harmonies, this is why.

But every key sounds equally impure — which is to say, equally usable. A C major scale and an F-sharp major scale have identical interval relationships in equal temperament. The keyboard becomes a completely symmetric object. Modulation becomes frictionless. Bach’s Well-Tempered Clavier — preludes and fugues in all twenty-four major and minor keys — was an argument for some version of this approach, demonstrating that a keyboard could traverse the full chromatic spectrum without any key becoming a dead zone.

The adoption of equal temperament wasn’t instant. It was contested throughout the eighteenth and nineteenth centuries by musicians who could hear the difference, who felt that the purity of just intervals was worth the constraints it imposed. It became standard gradually, consolidated partly by the industrial manufacture of pianos, which needed a single, stable tuning that would hold across any music a customer might choose to play.

What We Gave Up and What We Gained

The interesting question isn’t which system is correct — they’re solving different problems — but what the choice to standardize on equal temperament has cost in terms of perception. Most listeners today have spent their entire lives hearing equal-tempered harmony. The slightly sharp major thirds are the sound of “in tune” to them. The locked, bloom-like purity of a just major chord can actually sound strange — almost too smooth, like a synthesizer patch — to ears calibrated on pianos and electric guitars.

String players and singers, unconstrained by fixed pitches, still drift toward just intonation when the music allows it. Barbershop quartets tune their chords by ear in ways that deviate measurably from equal temperament, chasing that acoustically pure lock-in. Jazz horn sections adjust pitch microtonally in ways that have more to do with harmonic context than any fixed scale. The body knows what pure intervals feel like, even when the surrounding musical culture doesn’t always ask for them.

This is worth sitting with: the tuning system that underlies almost all Western music is a deliberate approximation. The frequencies our instruments produce are slightly wrong by any pure mathematical standard. We made a practical deal — we traded perfection in any single key for adequacy in every key. And from that compromise came the ability to modulate freely, to write music that wanders through distant tonal regions and returns home, to treat all twelve keys as equals.

Pythagoras heard the ratios in the string and heard order in the universe. He wasn’t wrong about the ratios. He couldn’t have anticipated that we’d eventually choose to blur them, systematically, in the service of flexibility. There’s something fitting about that — the mathematics of harmony turning out to be not a fixed truth but a negotiation, redrawn in every era according to what music needed to become.

Explore the frequency relationships between notes and experiment with tuning reference tones using the Resonillator Tuning Reference module.

Resonillator is free and always will be. If this was useful, consider supporting on Patreon or Buy Me a Coffee.

← All Transmissions