Day 26 · 2026.07.18

Mathematics & Music

The integers, irrationals, and expectations hidden inside sound
"Music is the pleasure the human soul experiences from counting without being aware that it is counting." — Leibniz, in a letter to Goldbach

The Overtone Series

An orchestra of integers inside one note
Acoustics · Analysis
Intuition

Pluck a guitar string and you think you hear "one note." In fact you hear a whole stack of notes at once. The string does not merely swing back and forth as a whole — it simultaneously splits into two, three, four segments, each vibrating on its own, at frequencies that are exactly 2×, 3×, 4× … the lowest note (the fundamental). This hidden ladder of higher tones is the overtone series.

You barely notice them, yet your brain always hears them. A violin and a flute play the same A — why can you tell them apart instantly? Because their overtone recipe differs: which overtones are strong, which are weak, is exactly what we call timbre. Pitch comes from the fundamental; timbre from the proportions of the overtones. One note, countless faces.

n=1 f₁ n=2 2f₁ n=3 3f₁ n=4 4f₁ standing waves layered on one string · red dots = fixed nodes
Formal definition

A string of length $L$ fixed at both ends admits only standing waves whose ends stay still, so the allowed wavelengths are sieved into a discrete ladder, $\lambda_n = 2L/n$, giving frequencies

$$f_n = n\,f_1,\qquad n = 1, 2, 3, \ldots$$

$f_1$ is the fundamental (the string vibrating as a whole), $n$ the number of segments. The heart of it is one line: the allowed frequencies are integer multiples of the fundamental. The "integer" is no accident — it is forced by the boundary condition that both ends must be motionless.

Why it's beautiful

A free string could vibrate at any frequency; the moment you pin both ends, a continuous infinity of possibilities is sieved into a clean ladder of integers. This is the purest demonstration of "discreteness born from constraint" — and it is the same mathematics as why the energy levels of a hydrogen atom are discrete (wave equation + boundary conditions = eigenvalue problem). Twenty-five centuries ago Pythagoras found that strings in simple integer ratios sound most consonant — the first translation of "pleasing" into "integer," and the spark for the belief that the universe is written in number.

Applications

An additive synthesizer literally stacks sine overtones by recipe to build a timbre; an organ's stops switch overtones on and off. Cross over to physics: the energy levels $E_n \propto n^2$ of a particle in a 1-D well, or the modes of a microwave cavity, are the same "wave + boundary = discrete spectrum." A violinist's harmonics — lightly touching the string's midpoint so only even harmonics survive — is a performer operating this mathematics by hand.

In one line: a note is never a single note — it is an invisible orchestra conducted by the integers, always present though you can barely hear it.
A question to sit with
Strike a drum and you can hardly name its "pitch"; pluck a string and you can. A drumhead is a two-dimensional vibration, and its overtones are not integer multiples of the fundamental. Why do "non-integer overtones" make pitch go blurry?

Equal Temperament vs Just Intonation

A peace treaty bought with an irrational number
Number Theory · Tuning
Intuition

Just intonation builds intervals from the simplest integer ratios: the pure octave $2{:}1$, the pure fifth $3{:}2$, the major third $5{:}4$ — the simpler the ratio, the more consonant (exactly because overtones coincide). Perfect-sounding, but here comes the trouble.

Start on one note and stack twelve pure fifths; you'd expect to circle cleanly back to the start, seven octaves up. But $(3/2)^{12} \approx 129.75$ while $2^7 = 128$ — off by a sliver, never closing. That gap is the Pythagorean comma. Mathematics delivers its cruel verdict: you cannot have every fifth pure and the octave close. Not both.

start off by a bit stack 12 pure fifths 12 pure fifths (3/2)¹² ≈ 129.75 7 octaves 2⁷ = 128 gap = Pythagorean comma
Formal definition

Equal temperament solves it by brute force: divide one octave (frequency ratio $2$) into 12 equal semitones on a logarithmic scale, each with frequency ratio

$$r = 2^{1/12} \approx 1.05946$$

So the fifth is $2^{7/12} \approx 1.4983$ — close to but not equal to the ideal $1.5$. In the exponent $7/12$, the $7$ is the semitone count of a fifth and $12$ the semitones in an octave. The price is that every interval is slightly out of tune; the reward is that any key sounds equally in tune.

Why it's beautiful

This is the textbook case of mathematical compromise. The beauty of just intonation's $3{:}2$ and a closing octave cannot logically coexist, so humanity chose to spread the error across all twelve tones — none perfect, none ugly. And it works only thanks to a numerical coincidence: $2^{7/12} \approx 3/2$ — in the language of continued fractions, $\log_2(3/2) \approx 7/12$ is its best low-order rational approximation. Bach wrote The Well-Tempered Clavier precisely to celebrate that this compromise let all 24 keys be played at last. Beauty, sometimes, is knowing exactly when to concede.

Applications

Every piano, every MIDI stream, every synth patch today lives in equal temperament. A layer deeper lies the continued fraction: the $12$ is not arbitrary — the convergents of $\log_2(3/2)$ give $7/12$, then $24/41$, $31/53$. So 53-tone equal temperament has near-perfect fifths and is far more accurate than 12, yet has too many keys for anyone to use. Mathematics points to which "divisions" are worth trying; engineering and fingers decided 12 would win.

In one line: twelve-tone equal temperament is a peace treaty humanity signed with mathematics — one irrational number buys out the gap that just intonation could never close.
A question to sit with
Suppose $\log_2(3/2)$ were exactly a rational $p/q$. Then stacking $q$ pure fifths would land exactly on some octave, the comma would vanish, and equal temperament and just intonation would merge into one. Would music history become simpler, or poorer? Is the "imperfection" here a defect — or precisely the source of richness?

Fourier Analysis

Glasses that let you see sound's frequencies
Analysis · Signal Processing
Intuition

A sound's waveform can be complex to the point of chaos — a voice, a piano, a noisy street. Fourier's astonishing claim: however complex, it can be decomposed into a sum of pure sine waves. Give me a waveform and I can report which frequencies it contains and how much of each.

This is a translation: from "what the sound looks like in time" to "which components it has in frequency." One sound, two views. And it is not just a mathematical game — your cochlea really does this: a coiled membrane whose different positions resonate with different frequencies, a biological Fourier transform. Your very act of "hearing pitch" is, physically, frequency decomposition.

sum = the sum of these sine waves ↓ f 2f 3f
Formal definition

Any waveform $f(t)$ of period $T$ can be written as an infinite superposition of sine waves:

$$f(t) = a_0 + \sum_{n=1}^{\infty}\Big[a_n\cos(n\omega t) + b_n\sin(n\omega t)\Big]$$

$\omega = 2\pi/T$ is the fundamental angular frequency and $n$ runs over the harmonics. The coefficients $a_n, b_n$ are the inner product (projection) of $f$ with each sine wave — plainly, "how much of this frequency is in the signal."

Why it's beautiful

Sine waves form an orthogonal basis — like the mutually perpendicular $x,y,z$ axes of space, onto which any vector decomposes uniquely. What Fourier did was fit a coordinate system onto the infinite-dimensional "space of functions." This is the same song as the eigenvectors of linear algebra: sine waves happen to be the eigenfunctions of the "differentiate" and "shift" operators, so in every problem of vibration, waves, and diffusion they are the natural protagonists — pick the right basis, and a hard problem collapses into a pile of simple one-dimensional ones.

Applications

MP3 / AAC compression: move sound into the frequency domain, throw away the frequencies the ear can't hear, and shrink the file tenfold. The FFT (Fast Fourier Transform) is the beating heart of all digital signal processing — from 5G and medical CT to JPEG images. Spectrograms let you "see" sound, denoising trims specific bands, voiceprint ID uses spectral fingerprints. And your cochlea is nature's prototype of it all.

In one line: Fourier hands sound a pair of frequency glasses — put them on and the chaotic waveform snaps into a clear skeleton.
A question to sit with
A short, sharp "click" is very brief, yet its spectrum must be very wide — containing many frequencies; a long, pure sustained tone has a very narrow spectrum. The more "concentrated" in time, the more "spread out" in frequency, and vice versa. Why is this "can't be both short and pure" constraint the very same mathematical theorem as Heisenberg's uncertainty principle?

Why Music Moves Us

Consonance, expectation, and the edge of order and chaos
Cognitive Math · Complexity
Intuition

Why does the octave ($2{:}1$) sound "fused into one," while two adjacent semitones together sound "harsh and clashing"? One explanation: the simpler the frequency ratio, the more the two notes' overtones coincide, the less effort for the ear — the more consonant; the more complex the ratio, the closer the overtones crowd, producing rough beating — dissonance. Consonance traces right back to the integers of Concept 1.

But music's magic goes far beyond "harmony." Truly moving music walks a tightrope between the expected and the unexpected: too predictable = boring, too random = noise. A melody keeps building expectations and then breaking them just enough — that sliver of suspense, satisfied or violated, is emotion.

most pleasing pure order (boring) 1/f · the edge pure randomness (noise) pleasure →
Semi-formal definition

Consonance correlates roughly with the simplicity of the frequency ratio $p{:}q$ (the Plomp–Levelt roughness curve quantifies this). And musical "surprise" can be captured with information theory: how unexpected a note is, in context, is

$$\text{surprise}(x) = -\log P(x \mid \text{context})$$

$P(x\mid\text{context})$ is the listener's expected probability for the next note given the melody so far. The more unexpected, the larger $-\log P$. The brain's response to this "prediction error" is the very source of aesthetic tension.

Why it's beautiful

Much pleasing music has a power spectrum of loudness and pitch fluctuation that is $1/f$ noise — sitting squarely between "purely regular $1/f^2$" and "purely random white noise." And the same fractal statistics show up in heartbeat intervals, river levels, and DNA sequences. The hint is profound: aesthetic pleasure may be the reward signal the brain issues for "just the right amount of predictability" — not order itself, nor chaos itself, but that narrow edge where the two meet.

Applications

The core of algorithmic composition is modeling the conditional probability $P(\text{next note}\mid\text{context})$ — from early Markov chains to today's Transformers. MusicLM and Suno essentially learn this distribution, then sample from it while controlling the "surprise" so it is neither flat nor chaotic. Music recommendation, affective computing, even using music for anxiety intervention, all rest on this "expectation–violation–reward" mathematical chain.

In one line: music is mathematics playing a game with expectation — feeding the brain exactly enough surprise, and not one bit too much.
A question to sit with
If a melody were perfectly predictable — entropy zero, every note guessable with certainty — then by the formula its "surprise" is identically zero. Is it still music? Conversely, what about a maximally random sound of highest entropy? Does "music" exist only in some entropy band between the two extremes?

Deeper Questions

Open problems · pushing the concepts to their edges
Consonant integer ratios are adopted independently across nearly every culture — is that the universality of mathematics, or of auditory physiology?
The octave is treated as "the same note" in nearly every tradition — hard to call coincidence. Consonance arises from overtone coincidence, and overtones are a physical inevitability of strings and pipes, so any civilization using such instruments runs into the same integer ratios — like a case of convergent evolution. Yet scales (pentatonic, heptatonic, microtonal) are highly culture-dependent. The likely dividing line: the "physical skeleton" of consonance is universal, the "cultural flesh" of specific scales is diverse.
The cochlea does a Fourier transform but has physical limits — does that explain why some chords "smear into mush"?
The basilar membrane is laid out by frequency, and each spot has a certain critical bandwidth: two frequencies falling inside the same band can't be told apart and interfere, producing roughness. This is the physiological basis of Plomp–Levelt roughness — dissonance isn't abstract numerical ugliness but two frequencies crowded onto the same stretch of membrane. It also means consonance depends on absolute pitch: the same interval sounds muddier low and clearer high.
Time–frequency uncertainty sets a hard wall for music: can we know precisely both "what note" and "when it happens"?
Pinning a frequency accurately requires observing enough periods — enough time; yet music changes over time. So there is a fundamental trade-off: the more precisely you fix "the pitch right now," the less you can say about "when," and vice versa — this is the Fourier version of Heisenberg's uncertainty. It limits spectrogram resolution and explains why very short percussion "has no pitch."
$1/f$ fractal statistics span music, heartbeats, and rivers — is that a deep law, or a circular definition of "beauty"?
$1/f$ noise appears in a startling number of systems; one account is that it reflects the universal dynamics of "multi-scale weak coupling": no single characteristic scale, fluctuations self-similar across all scales. But there's a warning: perhaps we first find certain sounds pleasing and then measure that they happen to be $1/f$, mistaking correlation for cause. To test causation you'd need prediction — synthesize sounds of varying spectral exponent and check whether preference truly peaks at $1/f$. So far supported, but not settled.