The PianoLab v Clock arithmetic

Lab v · the piano

Twelve notes, then it starts again

A keyboard counts the way a clock counts — twelve, then round to the start. Which turns the circle of fifths into a question about common factors, and the piano's own step into a number that can never be written as a fraction.

works for:Ages 6–9Ages 10–13Ages 14+

Twelve notes, then it starts again. Walk up the white and black keys, naming as you go, and after twelve you are back at C — a different, higher C, but the same name, the same letter, the same place in the pattern. That is not a musical quirk. That is arithmetic modulo 12, the same maths as a clock face, and once you see the keyboard that way, one of music's oldest diagrams turns out to be a puzzle about common factors.

i

The musical clock — counting mod 12

Past B there is no thirteenth note. You go back to C. A keyboard counts the way a clock counts: round and round, twelve at a time.

Number theoryArithmetic
C0C#1D2D#3E4F5F#6G7G#8A9A#10B11

Tap a note to hear it. The small numbers are the note's address, 0 to 11.

Give every note a number instead of a letter: C is 0, C# is 1, all the way to B at 11. There is no 12 — 12 is 0, one octave up, the same note name in a higher voice. Mathematicians write that 12 ≡ 0 (mod 12), and it is exactly what your watch does when 13 o'clock quietly becomes 1.

Now the useful part. Transposing a tune — playing the same melody starting on a different note, so a singer can reach it — is nothing more than adding the same number to every note, and wrapping round when you go past 11. One addition, done four times. Nothing about the tune changes except where it sits.

move it up by+0 semitones
as writtenC0D2E4C0
+0 mod 12C0+0=0D2+0=2E4+0=4C0+0=0

Same tune, higher shelf. The rust-coloured boxes are the notes that went past 11 and wrapped round to the beginning — 11 o'clock plus two hours is 1 o'clock, not 13.

ii

The circle of fifths is a gcd puzzle

Keep adding 7 and you visit all twelve notes before you get home. Keep adding 4 and you only ever see three. The difference is one number: the greatest common divisor of your step and 12.

Number theoryGeometry

start on C, keep adding the same number, and see where you get

notes visited = 12 / gcd(s, 12)
step size s:
C0C#1D2D#3E4F5F#6G7G#8A9A#10B11

stepping by 7a perfect fifth

gcd(7, 12) = 112 / 1 = 12 notes

7 and 12 share no factor bigger than 1 — they are coprime — so the walk cannot settle into a short loop. It has to touch every one of the twelve notes before it can arrive home at C. That is why musicians draw a circle of fifths: s = 7 is coprime to 12, so it is a complete tour of the keys.

the notes it visits, in order

→ back to C

12 distinct notes — and 12 / gcd(7, 12) = 12. The count always matches.

sgcd(s, 12)12 / gcdtours all twelve?
1112yes — coprime
226no — stops at 6
334no — stops at 4
443no — stops at 3
5112yes — coprime
662no — stops at 2
7112yes — coprime
843no — stops at 3
934no — stops at 4
1026no — stops at 6
11112yes — coprime

Only four step sizes make it all the way round: 1, 5, 7 and 11 — precisely the numbers below 12 that share no factor with it. Notice they come in pairs that add to 12: stepping up by 7 is the same tour as stepping down by 5, walked backwards. Music uses 7, the fifth, because it moves in the friendliest-sounding jump of the four.

iii

The piano is an irrational compromise

Pure harmony is built from simple fractions. The piano's keys are built from a number that can never be written as a fraction at all. Every note you play is the join between the two.

Number theoryIndices & powers

what harmony wants — a fraction

3 / 2

= 1.500000 exactly

Two strings sound sweet together when one vibrates a simple whole-number multiple against the other. Three wiggles against two is the sweetest after the octave — the perfect fifth. Three and two: two whole numbers, one on top of the other. A rational number, and a short one.

what the keyboard is built from — an irrational

21/12

= 1.059463

Twelve equal keys have to multiply up to a doubling, so one key must be the twelfth root of 2 — and that number cannot be written as any fraction whatsoever. Its decimals run forever without repeating. Every black and white key is a step of an irrational number.

where the two meet — the piano's fifth

the fifth, C up to Gas a numberkind of numberfrequency from C
pure — 3 : 21.500000rational392.44 Hz
the piano — 2^(7/12)1.498307irrational392.00 Hz

1.498307 against 1.500000. The piano's fifth sits just under the pure one — about 2 cents flat (-1.96 cents, where 100 cents is one key). That is a gap of roughly one part in a thousand, and it is the price of admission: give up the exact fraction, and in exchange every one of the twelve keys works in every one of the twelve keys. Give up an irrational hair, keep the whole instrument.

For the classroom

Learning goals

  • The twelve pitch classes are the integers mod 12: after 11 you wrap to 0, exactly as on a clock face. Transposing a melody is adding a constant to every note and reducing mod 12.
  • Repeatedly adding a step s mod 12 visits exactly 12 / gcd(s, 12) distinct notes, and reaches all twelve precisely when s is coprime to 12 — that is, s ∈ {1, 5, 7, 11}. Students can predict the count from the gcd before they ever hear it.
  • 2^(1/12) is irrational, so the piano's fifth (2^(7/12) = 1.498307) can never equal the pure 3/2 = 1.5. It falls about 2 cents short — the deliberate, permanent compromise that lets one keyboard play in every key.

Try this

  1. 1.Before touching the buttons, have the class compute gcd(s, 12) for s = 1 to 11 and predict how many notes each step visits. Then walk each one on the clock and check. The two surprises are always s = 5 (all twelve, like the fifth) and s = 6 (only two — C and F#).
  2. 2.Ask why there is no circle of major thirds. Step by 4 from C: C, E, G#, and home. Then ask what would happen on an imaginary instrument with 10 notes per octave — which steps would tour it? (Those coprime to 10: 1, 3, 7, 9.) The music changes; the number theory does not.