Euler’s Formula

e = cos θ + i·sin θ

The hidden engine inside every Transformer in modern AI

The Fourier Square-Wave Formula
f(t)=4π[sin(t)+sin(3t)3+sin(5t)5+]=4πk=1Re ⁣[ei(2k1)t]2k1f(t) = \frac{4}{\pi} \left[ \sin(t) + \frac{\sin(3t)}{3} + \frac{\sin(5t)}{5} + \cdots \right] = \frac{4}{\pi} \sum_{k=1}^{\infty} \frac{\operatorname{Re}\!\left[e^{\,i(2k-1)t}\right]}{2k-1}
Breaking Down the Formula
f(t)f(t)
The output signal: the shape you see in the gold waveform panel. It’s what you get when you add up all the spinning circles.
4π\tfrac{4}{\pi}
A scaling constant that adjusts the height so the result becomes a proper square wave. Think of it as a volume knob.
sin(t),  sin(3t),  sin(5t),  \sin(t),\;\sin(3t),\;\sin(5t),\;\ldots
Individual waves, each vibrating faster than the last. The first one is slow and smooth; the third is three times faster; the fifth, five times. These are the spinning circles in the phasor panel, each one representing a different wave.
13,  15,  17,  \tfrac{1}{3},\;\tfrac{1}{5},\;\tfrac{1}{7},\;\ldots
Each faster wave is quieter. The third harmonic is one-third as strong, the fifth is one-fifth, and so on. That’s why the smaller circles in the animation are smaller. They contribute less.
\sum
Means “add them all up.” Stack all the waves on top of each other. The more you add, the sharper the square wave gets. Drag the harmonics slider to see this in action.
eiθe^{\,i\theta}
Euler’s formula, a compact way to describe a point spinning around a circle. Instead of separately tracking the horizontal position (cosine) and the vertical position (sine), this single expression captures both at once. Each spinning arrow in the animation is eiθe^{\,i\theta} at a different speed.
Re[]\operatorname{Re}[\,\cdot\,]
Means “take the horizontal part.” A spinning circle traces both a horizontal and vertical path. We only care about the horizontal projection. That’s the actual wave we hear or see.

In plain English: you can build any shape, even a sharp square wave, by stacking smooth, spinning circles of different sizes and speeds. That’s the core insight of Fourier analysis, and Euler’s formula is the mathematical shorthand that makes it all work.

Why this matters for AI: an AI model like GPT, Gemini, or Claude needs to understand the position of every word in a sentence. To do that, it assigns each position a unique pattern made of waves at different frequencies, exactly the way the formula above stacks sine waves. Because waves at different speeds never repeat the same way twice, every position gets a one-of-a-kind fingerprint the model can recognize. Without this trick, the model would have no idea whether “not” came before or after “good” in a sentence, and meaning would collapse entirely. This is all to say that Fourier analysis is essential for AI.

What You’re Watching

Every spinning arrow represents a simple wave. When you stack several of them, each spinning at a different speed, their tips trace out a complex shape.

Add more arrows (drag the Harmonics slider) and the messy wobble sharpens into a crisp square wave. Complexity emerges from simplicity.

Why Should I Care?

This goes way beyond a math curiosity. Every digital signal around you (audio, images, Wi-Fi, MRI scans) is broken down into simple waves exactly like these. Your phone does this thousands of times per second.

Understanding this one idea unlocks how compression works (MP3, JPEG), how noise-cancelling headphones work, and how AI models understand language.

The AI Connection, Simply Put

When ChatGPT reads a sentence, it needs to know that “bank” in position 3 is different from “bank” in position 12. To encode this, it uses the exact same sine and cosine waves you see spinning here.

Different positions get different wave patterns, like giving each word a unique fingerprint made of overlapping ripples. The model reads these ripples to know where each word is.

The Big Picture

Euler’s formula is over 275 years old, yet it sits at the heart of the most advanced AI systems ever built. A mathematician in the 1700s introduced a mathematical tool that machines use today to read your words.

That’s what “AI Unmasked” is about: showing you that the magic behind AI is the magic of mathematics. Beautiful, centuries-old ideas working in ways their creators never imagined.