Bach as mathematician

Johann Sebastian Bach; credit Wikimedia

OK. Johann Sebastian Bach (1685-1750) was not a mathematician in a strict sense of the word. There is no “Bach convergence theorem” in real analysis, nor is there a “Bach isomorphism theorem” in algebra. Bach had no formal training in mathematics beyond elementary arithmetic.

But, as we will see, Bach was definitely a mathematician in a more general sense, as a composer whose works are replete with patterns, structures, recursions and other precisely crafted features. There are even hints of Fibonacci numbers and the golden ratio in Bach’s music (see below). Indeed, in this larger sense, Bach arguably reigns supreme over all classical composers as a “mathematician,” although Mozart is a close second.

Certainly in terms of sheer volume of compositions (or even the sheer volume of “mathematical” compositions), Bach reigns supreme. The Bach-Werke-Verzeichnis (BWV) catalogue lists 1128 compositions, from short solo pieces to the magnificent Mass in B Minor (BWV 232) and Christmas Oratorio (BWV 248), far more than any other classical composer. Bach regularly garners the top spot in listings of the greatest composers, typically followed by Mozart and Beethoven.

Further, Bach’s clever, syncopated style led the way to twentieth century musical innovations, notably jazz. Contemporary pianist Glenn Gould, for instance, is equally comfortable and adept playing modern jazz and Bach’s The Well-Tempered Clavier.

Mathematics and music

Just as some of the best musicians and composers are “mathematical,” so too many of the best mathematicians are quite musical. It is quite common at evening receptions of large mathematical conferences to be serenaded by concert-quality musical performers, who, in their day jobs, are accomplished mathematicians of some renown.

Albert Einstein playing his violin

Albert Einstein playing his violin


Perhaps the best real-life example of a mathematician-musician was Albert Einstein, who was also an accomplished pianist and violinist. His second wife Elsa recalled how Albert, during deep concentration on a mathematical problem, would often sit down with a piano or violin and play for a while, then return to his work. Once, after a two-week period of intense research interspersed with random music playing, Einstein emerged with the first working draft of his paper on general relativity. He later said, “If … I were not a physicist, I would probably be a musician. I often think in music. I live my daydreams in music. I see my life in terms of music.”

So who were Einstein’s two favorite composers? You guessed it — Bach and Mozart.

There does seem to be a credible connection between the sort of mental gymnastics done by a mathematician and by a musician. To begin with, there are well-known mathematical relationships between the pitch of various notes on the musical keyboard. An octave is separated by a factor of two; a fifth interval (say C to G) by the ratio 3/2. A significant innovation in the 17th and 18th century was the rise of the “tempered” musical scale, where two adjacent notes on the keyboard are separated in ratio by the twelfth root of two = 1.059463… Bach himself was the first major composer to employ this tempered scale, a feature he exploited with gusto in The Well-Tempered Clavier (BWV 846-893).

But beyond mere analysis of pitches, it is clear that the arena of musical syntax and structure has a very deep connection to the sorts of syntax, structure and other regularities that are studied in mathematical research. Bach and Mozart are particularly well-known for music that is both beautiful and structurally impeccable. As Salieri explained in the musical “Amadeus,” referring to Mozart’s music, “Displace one note and there would be diminishment. Displace one phrase and the structure would fall.”

Examples of Bach’s “mathematics”

Bach was a master of musical structures. His works typically start with a fairly simple theme. In the case of the Brandenburg Concerto #5 (BWV 1050), it is a simple four-note pattern. He then typically combined the theme with offsets (think of a chorus singing “rounds”), reversals, inversions and other variations, all presented with multiple overlapping “voices,” producing a stunning polyphonic effect.

Andrew Qian illustrates Bach’s methods by analyzing Fugue #16 from Book I of The Well-Tempered Clavier, BWV 861 (note however that Qian erroneously says Book II):

Note here that the third bar of the bass clef is merely an inversion of the main theme in the first two bars. In fact, this inversion is a second theme. These three bars (and two themes) are repeated, with variations, six times in the piece, by four voices, which in analogy to a chorus, may be labeled soprano, alto, tenor and bass. Why six? Because the number of combinations of four items taken two at a time is six! In particular, the fugue features the two themes as alto + soprano, then bass + tenor, then tenor + alto, then bass + soprano, then bass + alto, then soprano + tenor. See Qian’s article for additional details.

Another example, visualized using a very nice online tool, is Bach’s Great Fantasia and Fugue in G minor (BWV 542) for the organ. In the fugue movement, the theme is introduced immediately, and then developed into countless polyphonic variations. A third example is Bach’s Prelude and Fugue in E minor (BWV 548), an organ work known as the “Wedge.” It is so named for a strong theme that develops as an expanding sequence of notes in the shape of a wedge in the printed score (in the fugue movement), and then is repeated in polyphonic variations in a sophisticated high-level structure.

The golden ratio and Fibonacci numbers in Bach’s music

Perhaps the most remarkable “mathematics” in Bach’s music are the instances of the golden ratio, usually denoted with the Greek letter ø = (1 + sqrt(5))/2 = 1.6180339887…, together with the Fibonacci numbers, whose limiting ratio is equal to ø (i.e., the Greek letter phi).

Loic Sylvestre and Marco Costa pursue this topic at length in a 2010 paper (also available here). They focus on Bach’s The Art of Fugue (BWV 1080), which was composed in the last decade of Bach’s life and was clearly designed as an ultimate expression of Bach’s “mathematical” style. Its partner, The Musical Offering (BWV 1079), which has a similar objective and style, was named by musicologist Charles Rosen as the most significant piano work of the millennium.

Sylvestre and Costa tabulated the number of bars in each of the 19 movements of The Art of Fugue, then carefully analyzed different groupings of the movements. They found a number of intriguing patterns, including the following:

  • The total number of bars for counterpoint movements 1 through 7 is 602. Of these, 372 are in counterpoint movements 1 through 4 and 230 in counterpoint movements 5 through 7. Note that 602/372 = ø very closely, and also 372/230 is very close to ø.
  • Counterpoint movements 8 through 14 (988 bars in total) can be divided into double and mirror fugues (377 bars) and triple fugues (611 in total). Note that 611/377 and 988/611 are each very close to ø.

Note that in each case, the ratios mentioned above are as close as possible to ø as an integer ratio, given the respective denominator. Several other examples of this sort are given in the Sylvestre-Costa paper (also available here).

Sylvestre and Costa conclude, “we report a mathematical architecture of The Art of Fugue, based on bar counts, which shows that the whole work was conceived on the basis of the Fibonacci series and the golden ratio.”

However, as a word of caution, it should be kept in mind that the evidence cited by Sylvestre and Costa is a bit on the weak side. For example, their observation of the partial Fibonacci sequence 2,3,5,8,13 in the bar counts could be just a coincidence. Even the instances of the golden ratio could simply be due to Bach’s innate sense of natural balance, instead of deliberate numerical design (which itself is rather remarkable). Hopefully additional research in this arena will clarify this matter. See, for example, this this article on difficulties in observations of Fibonacci and the golden ratio in biology.

Summary

In short, while it is problematic to claim any equivalence between mathematics and music, it is clear that the two disciplines have a deep commonality in syntax, structure and recursion. Bach, arguably more than any other composer before or since, clearly championed this “mathematical” style, even though Bach never had any formal mathematical training beyond the basics (except that he may have been aware of the golden ratio and Fibonacci numbers).

Some of the more interesting current research work in this area is to program computers to actually compose music in a given style. David Cope, for instance, has written computer programs that can analyze a corpus of music, say by a particular composer, and then create new works in a similar style. He was most successful in replicating and producing variations of the music of Bach and Mozart, which is perhaps not surprising given the sophisticated structures used by these composers.

With the rapid rise of computer technology in general, and artificial intelligence in particular, we may well see some even more astonishing connections between music and mathematics. We may even be able to “resurrect,” in a virtual sense, composers such as Bach and enjoy new musical works that are truly in their style. May your mathematical future also be a musical one!

For further reading

For further details, see these articles:

  1. Qian’s article on Bach’s techniques.
  2. The Sylvestre-Costa paper (also available here).
  3. Rosen’s article on The Musical Offering.
  4. Article on Einstein, emphasizing his love of Bach and Mozart.
  5. Article on Bach and Glen Gould.

For further listening

Here are a few notable examples of Bach’s music for those who wish to explore further. Each of these is available on CD or download from various sources, such as Amazon.com or Apple Music. Two highly recommended complete collections of Bach’s works are: Bach Edition: Complete Works (155 CDs) and The Complete Bach Edition (153 CDs).

One very nice online source of much of Bach’s music is the GeruBach project, which provides YouTube videos of many of Bach works, combined with the musical score scrolling on the screen as the music is performed. In many cases, the respective GeruBach link is included in the list below. Note, however, that in several cases, the listed GeruBach link is for a single item in the indicated set; others in the set can usually be found by a Google search with “GeruBach” and the listed BWV catalog number:

  1. Major choral-orchestral works:
    • Mass in B Minor (BWV 232). This is regarded as one of the greatest musical works of all time; GeruBach.
    • Christmas Oratorio (BWV 248). Three hours of great choral-orchestral music; GeruBach.
    • Easter Oratorio (BWV 249). A shorter but highly listenable piece; GeruBach.
  2. Cantatas (choral-orchestral works typically 30-45 minutes in length):
    • Cantata #29 (BWV 29). The first movement was featured in Disney’s Fantasia.
    • Cantata #32 (BWV 32). A very listenable cantata, particularly movement 5.
    • Cantata #51 (BWV 51). Includes several soprano/alto solos and duets.
    • Cantata #102 (BWV 102). Has an eerie quality reminiscent of contemporary movie score composer Danny Elfman.
    • Cantata #110 (BWV 110). Arguably Bach’s most thrilling cantata.
    • Cantata #146 (BWV 146). The first movement is one of Bach’s greatest organ concertos.
    • Cantata #147 (BWV 147). An excellent choral example of Bach’s polyphonic style.
  3. Keyboard compositions (for harpsichord or clavichord, but often played on piano today):
    • The Well-Tempered Clavier (BWV 846-893). This collection of 24 pairs of preludes and fugues is an excellent introduction to Bach’s style; GeruBach.
    • The English Suites (BWV 806–811). These are among Bach’s most popular keyboard works; GeruBach.
    • The French Suites (BWV 812-817). These are a bit more intricate than the English Suites, but still very listenable and interesting; GeruBach.
    • The Art of Fugue (BWV 1080). This is a single work of 19 movements that represents the epitome of Bach’s “mathematical” style; GeruBach.
    • Two- and Three-Part Inventions (BWV 772-801). A collection of 30 short keyboard compositions; GeruBach.
  4. Instrumental and orchestral works:
    • The Brandenburg Concertos (BWV 1046–1051). These are among Bach’s most popular works today. Concerto #5 (BWV 1050) has a long, sophisticated harpsichord solo; GeruBach.
    • The Orchestral Suites (BWV 1066–1069). Four very listenable orchestral works, which were the foundations for later composers’ symphonies; GeruBach.
    • Harpsichord Concerto in D minor (BWV 1052). One of Bach’s most thrilling instrumental compositions; GeruBach.
    • Concertos for 2, 3 and 4 Harpsichords (BWV 1060-1065). A highly listenable set of instrumental-orchestral works with harpsichords; GeruBach.
    • The Musical Offering (BWV 1079). As noted above, this is similar to The Art of Fugue, except for an instrumental ensemble, and is regarded as among Bach’s greatest works; GeruBach.
  5. Organ works:
    • Trio Sonatas (BWV 525-530). Six very cheerful, listenable organ works; GeruBach.
    • Fantasia & Fugue in G Minor, “Great G Minor” (BWV 542). See description above; GeruBach.
    • Prelude & Fugue in B Minor (BWV 544). One of Bach’s grandest organ works; GeruBach.
    • Prelude & Fugue in E Minor, “Wedge” (BWV 548). See description above; GeruBach.
    • Toccata & Fugue In D Minor (BWV 565). One of Bach’s most popular organ works; GeruBach.
    • Passacaglia & Fugue In C Minor (BWV 582). A popular piece that has been featured in movies; GeruBach.
    • Organ Concertos in A Minor and D Minor (BWV 593, 596). Eerie pieces that are among Bach’s most memorable works; GeruBach.

Comments are closed.