Fourier Series Building a square wave
Can smooth waves add up to a shape with sharp corners? Keep adding sine waves and watch a square wave take shape.
1Try it
Build the wave, one term at a time
2Look closer
Watch what changes
- Start with 1 wave. You have a smooth sine curve, still far from the square target.
- Increase the count to 8. The shape looks more square. Now look near a jump: the bump gets narrower, but it does not disappear.
3Where it shows up
Looking inside a signal
- MP3 and streaming music. Split sound into frequency components and leave out what you cannot hear: the file gets smaller.
- Equalizers (EQ). When you adjust the bass or treble in a music app, you change the strength of frequency components in the sound.
- JPEG images. The same broad idea applies to pictures: split an image into frequency components, then compress it by discarding high-frequency detail your eyes are less sensitive to.
- Power and circuits. Square-wave signals and motor noise are made up of harmonics, components at whole-number multiples of a base frequency. Engineers use the sum to identify which sine-wave component is contributing interference.
4The equation
The sum behind the shape
Explore the equation
square wave(t) ≈ (4/π)·[ sin(ωt) + ⅓sin(3ωt) + ⅕sin(5ωt) + … ]
Hover over a symbol, or tap it, to see what it contributes to the sum.
Each term inside the brackets is a sine wave. N is the slider setting: keep the first N terms.
- ω
- The fundamental angular frequency sets the rate of the first, slowest sine wave. It also determines the period of the square wave.
- 1, ⅓, ⅕, …
- The frequencies are 1, 3, 5, … times the fundamental: only odd multiples. The fractions make each successive wave smaller, so the higher-frequency terms help sharpen the corners.
- 4/π
- The overall scale corresponds to the target square wave at ±1. A finite sum is not confined to those levels. With N = 1, for example, its peak is 4/π ≈ 1.273.
- N
- Your slider chooses how many terms to keep. Increasing N adds higher-frequency terms and makes the corners look sharper.
As you add more terms, the overshoot near a jump approaches 8.949% of the jump size. This is the Gibbs phenomenon. Here the wave jumps from −1 to +1, a change of 2, so the peak approaches 1.179: about 17.9% above the +1 level. The canvas label “+18%” uses that level as its reference. A finite sum gives a slightly different percentage. More terms move the bump closer to the jump; they do not remove the limiting overshoot.
Sources and scope
MIT: Gibbs’ phenomenon and overshoot as a fraction of the jump
This interactive model works within the conditions described here. Use the picture to explore the equation, keeping those conditions in view.
Connections
Follow the connection
You can find this topic within Fourier Analysis in the Neblux graph. Fourier series are one part of that wider subject.
Open the graph node