A triangle wave is a periodic function whose graph consists of alternating straight-line rises and falls. In its standard symmetric form, it takes equal time to rise from its minimum to its maximum and to return to its minimum. It is continuous but has sharp corners where its slope changes abruptly. Triangle waves are used in mathematical analysis, electronic signal generation, sound synthesis, and modulation.
Mathematical definition
Let be the peak amplitude relative to the mean, and let be the period. A zero-mean symmetric triangle wave can be defined over one period by
and extended to all real by the periodicity condition
With this choice of phase, the signal starts at , reaches at , and returns to at . Its fundamental frequency is
and its peak-to-peak amplitude is .
A compact equivalent expression uses the fractional part :
The absolute value produces the two linear segments, while the fractional-part operation makes them repeat.
A different, frequently used phase convention is
Here denotes its principal branch, with values between and . This waveform begins at zero with positive slope and is a time-shifted version of the preceding definition:
A constant offset and an arbitrary phase shift can be added without changing the triangular shape.
Continuity, slopes, and symmetry
A triangle wave is a continuous function: its rising and falling segments meet without jumps. Its derivative exists except at the peaks and troughs. For the first definition,
with the pattern repeated every period.
Thus, away from the corners, the derivative is a square wave. Conversely, integrating a symmetric, zero-mean square wave produces a triangle wave, up to an integration constant and a scale factor. A nonzero mean in the square wave instead produces an additional drifting component.
The triangle wave is globally Lipschitz continuous, with a Lipschitz constant . Its lack of differentiability is confined to the discrete set of corner times.
The standard symmetric waveform has half-wave antisymmetry:
Its second half-cycle is therefore an inverted copy of its first. This symmetry explains why its frequency spectrum contains no even harmonics. Whether the function is even or odd about the time origin depends on the chosen phase: the minimum-at-zero definition is even, while the zero-crossing definition is odd.
Fourier representation
For the minimum-at-zero convention, the Fourier series is
For the zero-crossing convention, it is
Both forms show that:
- Only odd multiples of the fundamental frequency occur.
- The fundamental component has peak amplitude .
- Harmonic amplitudes decrease as the inverse square of harmonic number.
The third harmonic therefore has one ninth of the fundamental’s amplitude, and the fifth has one twenty-fifth. This decay is faster than the inverse-first-power decay of the harmonics of ideal square and sawtooth waves.
The coefficients are absolutely summable, so the series has uniform convergence. It represents the waveform at every time, including its corners. Differentiating the series formally gives square-wave coefficients that decrease only inversely with harmonic number; convergence of the differentiated series must be treated separately, particularly at slope discontinuities.
An ideal triangle wave has infinitely many harmonics and is not band-limited. Finite harmonic sums approximate its shape but cannot reproduce an exact sharp corner.
Mean, RMS value, and amplitude distribution
The mean of a symmetric triangle wave over a complete period is zero:
Its root-mean-square value is
Its mean absolute value is , and its crest factor—the ratio of peak magnitude to RMS value—is .
For a waveform with constant offset , the mean is , while the RMS value becomes
If time is sampled uniformly over one period, the resulting instantaneous amplitude follows a uniform distribution on . Equal-width amplitude intervals take equal amounts of time to traverse because each ramp has constant slope. In particular, the amplitude distribution is not triangular despite the waveform’s name.
Asymmetric triangle waves
The term triangle wave can also include waveforms whose rise and fall times differ. Let , with , be the fraction of the period occupied by the rising segment. An asymmetric version is
again extended periodically.
The symmetric case is . Other values give unequal rising and falling slopes and generally introduce even harmonics because half-wave antisymmetry is lost. Nevertheless, the mean remains zero and the RMS value remains , provided both segments are linear and connect the same extrema.
As approaches zero or one, one ramp becomes increasingly steep, approaching a sawtooth-like limiting shape.
Generation and applications
Analog signal generation. A triangle-wave oscillator can charge and discharge a capacitor with approximately constant currents. The capacitor voltage changes linearly until it reaches a threshold, where a switching circuit reverses the current. Equal charging and discharging currents produce a symmetric triangle wave.
Digital generation. Software can evaluate a piecewise formula, fold a repeating phase ramp, read a lookup table, or sum a finite number of harmonics. Directly sampling an ideal triangle wave can produce aliasing, because its spectrum extends beyond any finite sampling limit. Band-limited synthesis restricts or suppresses harmonics above the usable frequency range.
Sound synthesis. Triangle waves serve as oscillator signals in electronic musical instruments. Their relatively weak upper harmonics give them a less bright timbre than square or sawtooth waves at the same fundamental frequency, although the sound also depends on filtering and playback conditions.
Pulse-width modulation. In pulse-width modulation, comparing a control signal with a triangle carrier generates switching pulses. When the control signal varies slowly relative to the carrier, its level determines the fraction of each carrier cycle for which the comparator output is high.
Sweeps and testing. The constant-slope segments provide repeated linear sweeps of voltage or another controlled quantity. Unlike a sawtooth sweep, which has a rapid reset, a triangle sweep traverses the range in both directions. Real generators depart from the ideal because of finite bandwidth, switching delays, current-source imperfections, and limited rates of voltage change.