Music often feels like a purely emotional visitation, a “ghost” that haunts our senses and stirs our souls. Yet, stripped of its lyricism, sound is a calculation performed by the biology of the ear. When vibrations strike the eardrum, they are translated into electrical impulses that our brain interprets as pitch, timbre, and melody. To a mathematician, however, these vibrations are not merely noise; they are “periodic signals”—repeating patterns that form the structural skeleton of every song. We view these signals as the bridge between abstract sequences and the physical sensation of art. To build a sound, we must first learn to speak the language of its mathematical skeleton.
How a Simple Straight Line Becomes a Song
It is a profound, almost counter-intuitive truth that a complex melody is essentially an “infinite polynomial” masquerading as a wave. We demonstrate this through a special sequence of polynomials that “bend” a static linear equation into a shimmering sine wave.
IImagine a graph of the simplest function: . It is a rigid, diagonal line extending forever. But when we begin adding specific harmonic terms, a visual transformation occurs:
The line develops a subtle “hump” at the origin, losing its rigid linearity.
: The curve begins to oscillate, creating the first hints of a ripple.
: By the time we reach higher orders, the graph has “rippled” outward, mimicking the periodic rise and fall of a pure tone.

This is the power series expansion of . As we add terms, the function sheds its polynomial skin and becomes a wave.
“A power series is an infinite polynomial.”
When you listen to a clean note, you are hearing the auditory manifestation of this infinite mathematical progression.
The “Magic Ratio” Hiding in Your Octaves
The beauty of a scale is not a matter of chance; it is a strict adherence to geometric progression. In Western music, the “Octave” is the gold standard—an interval where the higher note vibrates at exactly twice the frequency of the lower note ().
To divide this octave into the twelve familiar semitones of a piano (C, C#, D, etc.), mathematicians use a constant ratio, a. Since we must reach after twelve steps, the relationship is , which simplifies to the “Magic Ratio”: .
The frequency of any note semitones away from a reference is:
For instance, if we set our reference frequency to (a common baseline in our demonstrations), we can precisely calculate the note ‘E’, which is 7 semitones away. The result,, provides a frequency that sounds perfectly “in tune” to the human ear. Musical harmony, then, is simply the sound of numbers moving in perfect, calculated steps.
Coding “Happy Birthday” with Sine Waves
Transitioning from theory to performance requires digital synthesis. Using Matlab, we can transform a computer into a literal instrument by sequencing sine functions. By assigning specific frequencies to the notes of a melody, we “compute” the music rather than recording it.
Consider the opening of “Happy Birthday.” According to this methodology, we assign the following frequencies from the standard Octave 3 and 4 scales:
- A:
- B:
- D:
- C#:
The sequence for the first line of the song becomes a series of mathematical instructions: A, A, B, A, D, C#. In this environment, the “musician” is a coder, and the “instrument” is the function, proving that even our most cherished celebratory melodies are built from the same numerical blocks as a calculus problem.
The Sine Wave isn’t the Only Soloist
While the wave is the “purest” building block, the mathematical orchestra is vast. Is the only function capable of music? Certainly not. Texture and “color” in sound come from exploring different periodic signals.
Mathematics offers alternatives like or the “sawtooth” wave. Unlike the smooth, rounded oscillations of a sine wave, the sawtooth wave—visualized as a series of jagged, linear ramps that reset abruptly—creates a harsher, “buzzier” timbre. While the wave provides the foundation, these alternative functions allow us to synthesize the diverse “voices” of different instruments. In the world of synthesis, changing the equation is equivalent to switching from a flute to a violin.
A Language for Scientific Wonders
I strongly believe that mathematics is “a language to most scientific and technical problems.” Music is perhaps the most beautiful of these problems. When we apply this language to the “ghost” in our eardrums, we find that what we once perceived as pure emotion is actually a series of beautifully solved equations.
If a simple polynomial can be bent and rippled into a musical masterpiece, what other “art” is currently hiding in your data? The next time you hit play on your favorite playlist, listen closely—you aren’t just hearing a song; you are hearing the elegant resonance of a geometric progression.
