Piano key dimensions are a math puzzle

skybrian
2025-07-13T05:25:10Z

Piano keys are familiar and easy enough to draw if you're not trying to be exact, but if you want label the dimensions with their exact measurements (like in a CAD drawing), it turns into a math puzzle. The problem comes from the groups of two and three black keys.

This article explains it like this:

If you've ever looked closely at a piano keyboard you may have
noticed that the widths of the white keys are not all the same
at the back ends (where they pass between the black keys). Of
course, if you think about it for a minute, it's clear they
couldn't possibly all be the same width, assuming the black keys
are all identical (with non-zero width) and the white keys all
have equal widths at the front ends, because the only simultaneous
solution of 3W=3w+2b and 4W=4w+3b is with b=0.

To unpack that a bit: in that equation, 'W' is the width of each white key at the front (which should all be the same), 'w' is the width of a white key at the back, and 'b' is the width of a black key.) The first equation is for the group of two black keys (separating C, D, and E) and the second equation is for the three black keys separating F through B.

Since it's mathematically impossible, a constraint needs to be relaxed. The article describes ways to make the white keys have slightly different widths at the back.

If we set c=e=(W-5B/8) and a=b=d=f=g=(W-3B/4) we have a maximum
discrepancy of only B/8, and quite a few actual pianos use this
pattern as well. However, the absolute optimum arrangement is to
set c=d=e=(W-2B/3) and f=g=a=b=(W-3B/4), which gives a maximum
discrepancy of just B/12. This pattern is used on many keyboards,
e.g. the Roland PC-100.

When actually building a musical instrument (instead of just drawing the keyboard), there is a further constraint, described in this article:

The black keys on a piano keyboard, instead of always being centered on the dividing line between the two white keys they lie between, are spaced so that the twelve keys which make up an octave are spaced equally as they enter the internal mechanism of the instrument.

But this means that the "key caps" for the white keys should be slightly off-center compared to whatever rod or lever they're attached to. The author speculates about how to divide this up using various units.

(They seem quite annoying to 3D print.)

Comments URL: https://tildes.net/~design/1p24/piano_key_dimensions_are_a_math_puzzle

Votes: 19

Comments: 4