My interest in the relations between music and mathematics started at an early age. My grandfather played his violin for me when I was about five years old, and I still remember it clearly. Later he explained to me various topics in his physics book, from which he himself had studied when he was young. In the chapter on sound there was a musical staff with the note A, and next to it the number 440, the frequency of that note. That image must have engraved itself on my mind – my first glimpse into the role that numbers play in music. While my grandfather’s violin is no more with us, his tuning fork did survive; although rusted, it still faithfully vibrates at 440 cycles per second. I recently gave it to my percussionist grandson. I hope he will one day pass it on to his grandchildren.

But it is not enough just to study music: one must play it. I started my musical journey playing a recorder. There are numerous Baroque-era works for this simple instrument, but for an appreciation of classical music (‘classical’ here meaning the era of Haydn, Mozart and Beethoven, roughly 1750 to 1830), a recorder just won’t do, so I took up the clarinet. This instrument was Mozart’s favourite wind instrument, and he wrote for it – or rather for his friend, the clarinetist Anton Stadler – some of his most sublime music. The clarinet has the unusual feature that when you open the thumb hole on the back of the instrument, the sound goes up not by an octave, as with most woodwinds, but by a twelfth – an octave and a fifth. This greatly intrigued me and made me dwell into the acoustics of wind instruments. I was fascinated – and still am – by the fact that a column of air can vibrate and produce a musical sound just like a violin string, even though the vibrations are totally invisible: you can hear them, but you cannot see them.

Music and mathematics have always been intimately intertwined. Anyone who has ever played a musical instrument is aware of the presence of mathematics on every page of the score – from the time signature that sets a piece’s rhythm, to the metronome number that determines the speed at which the piece should be played; and, of course, the very act of playing music requires us to count 1, 2, 3… and arrange these numbers into groups, called bars or measures. So it comes as no surprise that mathematics has had a significant influence on music. Much less known is that the influence extends both ways.

The Greek philosopher Pythagoras, active during the 6th century BCE, might have been the first to uncover a quantitative relation between music and mathematics. Experimenting with taut strings, he found that shortening the effective length of a string to one-half its original length raises the pitch of its sound by an agreeable interval, an octave. Other ratios of string lengths produce smaller intervals: 2:3 corresponds to the musical interval of a fifth (so called because it is the fifth note up the scale from the base note); 3:4 corresponded to a fourth; and so on. Pythagoras also discovered that multiplying two ratios is equivalent to adding their intervals: (2:3) x (3:4) = 1:2, so a fifth plus a fourth equals an octave. In doing so, he unknowingly came up with the first logarithmic law in history.

The octave, the fifth and the fourth produced pleasing combinations of tones, or consonants, whereas more complicated ratios, such as 9:8 or 15:16, led to dissonances. This revelation made a deep impression on the Pythagoreans, prompting their belief that everything in the Universe – from the laws of musical harmony to the motion of the Sun, Moon and the five planets – was governed by simple ratios of whole numbers. Number rules the Universe was the Pythagorean motto. It would dominate scientific thought for the next two millennia.

In Greek tradition, music ranked equal in status to arithmetic, geometry and spherics (astronomy), which together comprised the quadrivium, the core curriculum of four disciplines that a learned person was expected to master. We should note, however, that the word ‘arithmetic’ had a different meaning to the Pythagoreans than it has today: it meant number theory, the study of the properties of integers, rather than the practical skills needed to compute with numbers. Likewise, Pythagoreans regarded the music component of the quadrivium as referring to music theory – the study of harmony – rather than the practice of playing music. This was typical of the aloof attitude of the Pythagoreans to all things practical. Theirs was a perfect universe, governed by notions of beauty, symmetry and harmony, but removed from mundane considerations. It might have been one reason why they kept all their discussions secret, fearing that they would be ridiculed by their fellow citizens, the vast majority of whom had to toil daily to eke out a living.

Though no Pythagorean writings survive – if they left any at all (everything we know about them comes from much later writers) – the Pythagorean legacy lasted well over 2,000 years. Number rules the Universe became a rallying motto to generations of scientists and philosophers, who sought to explain the mysteries of the cosmos on the basis of musical ratios or simple, elegant geometric figures. The planets, for example, had to move around the Earth in perfect circular orbits; it was inconceivable to the Greeks that any shape other than the perfectly symmetric circle could rule. It was all part of their grand view of a Universe ruled by beauty and harmony – their musica universalis, or music of the spheres.

Among the last Pythagoreans was the eminent German astronomer Johannes Kepler (1571-1630), considered one of the fathers of modern astronomy. At once a devout mystic and an ardent believer in Copernicus’s heliocentric system, Kepler spent more than half his life trying to derive the laws of planetary motion from those of musical harmony. He believed that each planet, in its motion around the Sun, plays a melody that our ears are unable to hear, being below the range of audible frequencies (not to mention that it was produced in the vacuum of space, where sound cannot propagate). He even assigned each planet a celestial tune and wrote it down on the musical staff – resurrecting the celebrated musica universalis. It was only after decades of following this blind path that Kepler finally abandoned the Greek circular orbits and replaced them with ellipses.

Every periodic function can be written as an infinite sum of pure sine waves

Half a century after Kepler, Isaac Newton formulated his universal law of gravitation, thereby providing a rational, mathematical explanation for the planetary orbits, and adding the parabola and hyperbola to the possible orbits of the celestial bodies. But he too was obsessed with musical ratios, devising a ‘palindromic scale’ in which the intervals were the same whether you went up or down: 9:8, 16:15, 10:9, 9:8, 10:9, 16:15, 9:8. He compared it to the seven rainbow colours of the spectrum.

The newly invented differential and integral calculus, developed independently by Newton and G W Leibniz in the decade 1666-1676, made it finally possible to put the relations between numerical ratios and musical harmony on a firm mathematical basis. One of the outstanding problems that the calculus was able to tackle was to find the exact shape of a vibrating string and the nature of the sound it produces. Was it the sum of many – perhaps infinitely many – sine waves or pure tones, each with its own frequency and amplitude? Or was it a combination of waves propagating back and forth along the string’s length? In what became known as the ‘Great String Debate’, four of Europe’s foremost mathematicians – Daniel Bernoulli, Leonhard Euler, Jean le Rond D’Alembert and Joseph Louis Lagrange – argued passionately over this issue, and laid the foundation of post-calculus analysis along the way.

But the definitive solution to the string problem had to wait another half-century, when the eminent French mathematical physicist Jean Baptiste Joseph Fourier (1768-1830) showed that every periodic function, subject to certain restrictions, can be written as an infinite sum of pure sine waves, whose frequencies are integral multiples of the fundamental, lowest frequency of the function. These individual sine waves are known as overtones or harmonics; they are the building blocks of all sound, and they give each sound its characteristic tone colour, or timbre – the quality that distinguished the sound of a violin from that of a clarinet, even when they play the same note.

As my musical interests expanded, I gradually ventured beyond the Baroque-Classical-Romantic period (roughly 1600 to 1900), and turned to modern music. In the 1960s there was still much talk about Arnold Schoenberg and his atonal or serial music. He devised it in the early 1900s, convinced that it should replace a sacred cornerstone of classical music: the principle of tonality. Tonality required that a piece of music should centre around a given key, called the tonic, such as C major or G minor. Granted, as the piece developed, it could stray from its designated key to related or even remote keys, but ultimately it would return to its home key, the tonic. The key thus served as a musical frame of reference, in which every note had a specific relation to the tonic; for example, in the key of C major, the note G (a fifth above C) was the ‘dominant’ note, while the note F below C was the ‘subdominant’.

But in the second half of the 19th century, composers gradually began to deviate from a strict adherence to the principle of tonality, making it difficult to sense where the music stood in relation to the tonic. Schoenberg, believing that tonality had run its course, was determined to supplant it with the series, or tone row. In a series, each of the 12 notes of the chromatic scale of semitones appears exactly once; a note could be repeated only after the series had been completed. This gave a composer a staggering number of combinations to choose from: 1 x 2 x 3 x … x 12 = 479,001,600, to be exact (not counting shifts by octaves, which Schoenberg allowed). In serial music, complete democracy ruled: no single note held any preferred status over the others. Every note was related only to its immediate predecessor in the series; gone were the roles that different notes had played in relation to the tonic. At its heart it was a mathematical system, and Schoenberg was determined to impose it on music.

Leopold Godowsky, Albert Einstein and Arnold Schönberg at Carnegie Hall, New York, 1 April 1934. Photo courtesy the Arnold Schonberg Centre, Vienna

As a mathematician, I see a striking similarity between Schoenberg’s serial music and Albert Einstein’s general theory of relativity, as though a parallel dismantling of the canonical structures of music and physics were happening simultaneously. In 1905, Einstein gave the ether its coup de grâce: there is no ether, no single universal frame of reference at absolute rest; rather, every observer has his or her own reference system, related only to its infinitesimally close neighbouring system in spacetime. One cannot fail to note the similarity to Schoenberg’s atonal music, in which each note is related only to its immediate predecessor in the series. You might call it relativistic music.

Schoenberg worked on the design of a musical typewriter; Einstein invented a refrigerator

Schoenberg and Einstein were almost exact contemporaries, born within five years of each other to middle-class Jewish families. Their mothers, both named Pauline, were steeped in classical music, so the two youngsters were raised in music-loving homes. They started their careers as low-level employees – Schoenberg as a bank clerk in Vienna, Einstein as a clerk at the Swiss Patent Office in Bern. At a young age, both turned their backs on traditional Judaism, only to return to it late in life, having been deeply affected by the rise of anti-Semitism and the Holocaust that followed. Both men were essentially self-taught: Schoenberg never got a formal musical education, while Einstein (though he graduated from the University of Zurich) got his education by studying the great physics treatises of the 19th century on his own.

Following the Nazi rise to power in 1933, both men emigrated to the United States. Schoenberg immediately got rid of the German umlaut of his original name, Schönberg, while Einstein had to get used to the American pronunciation of his name (pronounced ‘Einshtein’ in German). Both passionately pursued their hobbies – Schoenberg as a painter and avid tennis player, Einstein playing his iconic violin and enjoying an outing on his little sailboat. They also liked to tinker with gadgets: Schoenberg worked on the design of a musical typewriter, while Einstein, with his fellow physicist Leo Szilard, invented and patented a refrigerator. Following the Nazi dismissal of all Jewish professors from German universities, both men worked tirelessly to help displaced academics find jobs in their countries of refuge. Neither Schoenberg nor Einstein ever set foot on European soil again (although Schoenberg’s remains were buried in his native Vienna), and they died within the same time-span that separated them at birth, in their 76th year.

The revolutionary ideas of Einstein and Schoenberg came against the backdrop of groundbreaking changes in other fields, all happening as the 19th century turned into the 20th. Gustav Mahler premiered his First Symphony, Titan (1889), conducted by the composer himself. Sigmund Freud published his first major work, The Interpretation of Dreams (1900), Pablo Picasso entered his ‘Blue Period’ (1901-1904), and Max Planck introduced into physics a new concept that would soon revolutionise all of science: the quantum of energy. If all that weren’t enough, David Hilbert, Germany’s foremost mathematician at the turn of the century, challenged the Second International Congress of Mathematicians, held in Paris in 1900, with a list of 23 unsolved problems whose solutions he regarded as of utmost importance to the future growth of mathematics – as indeed they would prove to be.

Whether these developments had any effect on Einstein’s and Schoenberg’s work is difficult to say, but it is revealing that several of the actors in this new world were actively involved with music: Einstein’s violin immediately comes to mind; Planck was an accomplished pianist; and the Nobel Prize-winning physicist Werner Heisenberg seriously considered pursuing a career in music before turning to quantum mechanics.

In his quest to unify music and mathematics under a single universal umbrella, perhaps Pythagoras was right after all.

Music By The Numbers: From Pythagoras to Schoenberg by Eli Maor is out now via Princeton University Press.