Mathwords logoMathwords

Triangle Function — Definition, Formula & Examples

The triangle function (also called the triangular function) is a piecewise linear function that rises linearly from 0 to 1, then falls linearly back to 0, forming a triangle shape. It appears frequently in signal processing and Fourier analysis as a basic waveform.

The triangle function tri⁡(t)\operatorname{tri}(t) is defined as tri⁡(t)=max⁡(1−∣t∣, 0)\operatorname{tri}(t) = \max(1 - |t|,\, 0), which equals 1−∣t∣1 - |t| for ∣t∣≤1|t| \leq 1 and 00 otherwise. Equivalently, it is the convolution of the rectangular function with itself.

Key Formula

tri⁡(t)={1−∣t∣,∣t∣≤10,∣t∣>1\operatorname{tri}(t) = \begin{cases} 1 - |t|, & |t| \leq 1 \\ 0, & |t| > 1 \end{cases}
Where:
  • tt = The input variable (often representing time or a normalized coordinate)
  • ∣t∣|t| = The absolute value of t, ensuring symmetry about the origin

How It Works

The triangle function peaks at t=0t = 0 with a value of 1 and decreases linearly to 0 at t=−1t = -1 and t=1t = 1. Outside the interval [−1,1][-1, 1], it is identically zero. You can scale and shift it: tri⁡ ⁣(t−t0τ)\operatorname{tri}\!\left(\frac{t - t_0}{\tau}\right) centers the peak at t0t_0 and stretches the base to width 2τ2\tau. In Fourier analysis, the triangle function's transform is sinc⁡2(f)\operatorname{sinc}^2(f), making it a natural window function for smoothing spectral data.

Worked Example

Problem: Evaluate tri(t) at t = −0.5, t = 0, and t = 1.5.
At t = −0.5: Since |−0.5| = 0.5 ≤ 1, use the formula 1 − |t|.
tri⁡(−0.5)=1−0.5=0.5\operatorname{tri}(-0.5) = 1 - 0.5 = 0.5
At t = 0: Since |0| = 0 ≤ 1, substitute directly.
tri⁡(0)=1−0=1\operatorname{tri}(0) = 1 - 0 = 1
At t = 1.5: Since |1.5| = 1.5 > 1, the function equals zero.
tri⁡(1.5)=0\operatorname{tri}(1.5) = 0
Answer: tri(−0.5) = 0.5, tri(0) = 1, and tri(1.5) = 0.

Why It Matters

The triangle function serves as a standard window and interpolation kernel in digital signal processing courses. Engineers use it when designing filters, performing linear interpolation between sampled data points, and analyzing bandwidth through its Fourier transform sinc⁡2(f)\operatorname{sinc}^2(f).

Common Mistakes

Mistake: Confusing the triangle function with a periodic triangle wave.
Correction: The triangle function tri(t) is a single, finite-duration pulse defined on [−1, 1]. A triangle wave is a periodic repetition of triangular segments extending over all t. They are related but distinct objects.

Related Terms

  • Cosine — Smooth periodic waveform often compared to triangle waves
  • Circle Trig Definitions — Foundation for trigonometric waveform concepts
  • Cosecant — Reciprocal trig function used in Fourier contexts
  • Cotangent — Trig function appearing in waveform analysis
  • Law of Cosines — Triangle-related formula in trigonometry