⚠ Learning tool: waveforms are drawn by a browser script and may be imperfect
(floating-point rounding, finite-term truncation/Gibbs, rendering quirks). Treat as a visual aid, not an
authoritative reference; cross-check against a textbook or established software (Wolfram, MATLAB, SciPy).
only odd harmonicsamplitude decays as 1/n² ⇒ very fast convergencepractically no Gibbs overshoot visible
Reference: Wikipedia — Triangle wave.
Derivation in Bracewell, R. N. (2000). The Fourier Transform and Its Applications, 3rd ed.,
McGraw-Hill, Ch. 4.
Compare to the square wave: with just 4 terms the triangle is already almost perfect, because each harmonic is
squared-down in size. This is why audio engineers say triangle waves sound "softer" — most of their energy
sits in the fundamental.
Frequently asked questions
Why does the triangle wave converge so fast?
Because it is continuous — it has no instant jumps, only changes of slope. That smoothness makes its harmonics decay as 1/n² instead of 1/n, so just a handful of terms already looks almost perfect. Set N low here and you will see it is convincing with very few harmonics.
Why does a triangle wave sound so soft?
Almost all of its energy sits in the fundamental and the next couple of odd harmonics, which drop off quickly. With little high-frequency content it sounds mellow and flute-like — the opposite of the bright, harsh sawtooth. It is a favourite for soft synth pads and sub-bass.
Does the triangle wave show the Gibbs overshoot?
No — and that is the key lesson. Because it has no discontinuity, there is no overshoot to fight. Compare it with the square wave tab: the square never stops overshooting at its edges, while the triangle settles cleanly. Continuity is what kills Gibbs.
Where are triangle waves used?
They generate smooth sweeps and modulation signals in electronics, drive some class-D amplifier and PWM schemes, and appear in audio as gentle LFO (low-frequency oscillator) shapes that sweep filters and volume up and down evenly.
Why does the formula use (2k+1) and a 1/n² term?
The (2k+1) means only odd harmonics appear (like the square wave), but the 1/(2k+1)² makes them die away as the square of the harmonic number. Odd-only gives the symmetry; the squared decay gives the speed. Together they explain the triangle's clean, fast convergence.