Pattern and structure are essential to music, which involves pitch, melody, and rhythm. This article explores the mathematics of musical composition, and is based on a talk which was given as part of a series of public lectures at Gresham College, which has been providing free lectures for over 400 years.

## Repetition in Music

A very common technique in musical composition is repetition. This is one of the simplest ways to give structure, and can also be one of the most basic mathematical patterns found in music. Most songs have repeated verses (with different words) and often a repeated chorus with the words repeated too, such as in the song *Happy Birthday to You *(and many others). In classical piano we often find the one hand playing a repeated broken chord to anchor a melody in the other hand. A famous instance of repeated broken chords is in the first movement of Beethoven’s *Moonlight Sonata*, the first two bars of which are shown.

The reappearance of a melody can send a signal to the listener. It can also act as a link or bridge in music. Whole melodies can be repeated by different voices, with a delay, such as when we sing rounds like *Frère Jacques*. Repetition is an almost defining feature of some of the most popular work of modern minimalist composers such as Philip Glass and Arvo Pärt.

## Other Patterns

Beyond strict repetition, composers often play with a theme, repeating phrases and then introducing modifications. Many of the possible modifications are highly mathematical by nature.

- Translation – where the melody is moved up or down in pitch.
- Inversion – similar to reflection in a horizontal line.
- Retrogression – similar to reflection in a vertical line.
- Rotation – this is through 180 degrees.

### Translation

A well-known example of the translation of a theme is in the first repeated phrase of Beethoven’s 5th Symphony. Another example is the progression of chords in the blues.

### Inversion

Anyone who has ever played scales in contrary motion has experienced inversion – one hand is essentially playing the mirror image of the other.

### Retrogression

There are many examples of the use of retrogression, although it’s almost impossible to detect by ear – really it is more in the nature of a musical challenge for the composer, or a clever device for the players to appreciate. An early, and ingenious, example, is the palindromic rondeau *Ma fin est mon commencement*, written in the fourteenth century by Guillaume de Machaut. It is a song for three voices; the tenor part is a palindrome, while the two other voices are retrogrades of each other.

### Rotation

There is a final type of symmetry – rotation through 180 degrees. This is of a different category from the others because it really does depend on a physical transformation, rather than a notional mirror. Perhaps the most spectacular instance of this is in the famous violin duet *Der Spiegel*, attributed to Mozart. In this piece, the same score is played simultaneously by two players, each viewing it from opposite sides. So, the notes played by the first player are the same as those played by the second, except rotated through 180 degrees.

## Musical Groups

Iannis Xenakis was Gresham Professor of Music from 1975-8. He had this to say in 1987: “*Now, music is steeped in the problem of symmetry, and symmetry is made accessible by the theory of groups. [..]”*

Xenakis was talking about a profoundly mathematical way to describe these types of patterns using a branch of Pure Mathematics called Group Theory. To introduce the idea of mathematical *Groups*, we must think more carefully about the possible transformations which can be performed.

### Translation

A translation (up) by semitones is written as for any integer . For instance is a translation up two semitones (one whole tone) and is a translation down three semitones. Note that is a translation up zero semitones – leaving everything identically the same. We call this the ‘identity’ transformation.

### Inversion

Inversion about a particular pitch 𝑝 is written as . It is not enough to define inversion as reflection in ‘a’ horizontal line, because the choice of line will change the outcome.

### Retrogression

This is simply playing the tune backwards.

### Combinations

We can combine our inversions, retrogressions and translations in any way to produce more musical transformations. The set, let’s call it 𝑀, of musical transformations, forms what is known mathematically as a *Group*. A *Group *is a non-empty set with the property that any pair of its elements can be combined with some defined operation, to produce another element of the set (subject to three rules, or axioms which we won’t list here).

### Deliberate use of mathematical forms in music

There is clearly a lot of mathematics to be found in music, but we have not yet addressed the question of whether composers deliberately use mathematical structures like Groups in their compositions. The answer is that yes, some do.

### Babbitt’s Theorem

The American composer Milton Babbitt deserves a mention purely because he is the only composer who also has a mathematical theorem named after him: Babbitt’s Theorem.

Babbitt’s Theorem says that if you have a musical phrase, and you look at the collection of intervals between all possible pairs 𝑝 and 𝑞 of pitches in that phrase, then if an interval of, say, 5 semitones occurs between three pairs of pitches, you can deduce that transposing the phrase by 5 semitones will create a phrase that has exactly three tones in common with the original phrase.

### Magic Squares

In another example, the British composer Peter Maxwell Davies made extensive use of magic squares in works such as *Ave maris stella *(1975) and *A mirror of whitening light *(1976-7). In these compositions, the starting points were Gregorian chants, which were ‘processed’ through magic squares.

### Infinite Sequences

The Danish composer Per Nørgård found a way to create potentially infinitely long sequences of tones, from a starting point of just two tones. He called such sequences his ‘infinity series’.

### Fractals

The idea of the same things being replicated at both large and small scale is reminiscent of the mathematical idea of a fractal. One composer who has used what are called fractal generators in her music is the Finnish composer Kaija Saariaho. Fractal music in essence is music that has this self-similarity at different scales.

### Probability and Randomness

Several composers have used elements of chance in either the composition or the instructions for playing their works. In his work *Music of Changes*, John Cage introduced randomness by tossing coins, interpreting the results using twenty-six different charts to determine various aspects of the music.

## Summary

The use of mathematics in musical composition is the continuation of what has always happened in music – the voluntary imposition of structure to act as a creative spur. Mathematical structures are ever-present in music, but the composer should always have the upper hand!

### Further Information

The full one hour Gresham Lecture ‘The Mathematics of Musical Composition’ is available here.

Professor Sarah Hart

Gresham Professor of Geometry and Professor of Mathematics at Birkbeck, University of London

#### Image Credits

Featured Image naobim from Pixabay

Mixing Desk Image by Free-Photos from Pixabay