{
  "id": "triangle-wave",
  "title": "Triangle Wave",
  "lang": "en",
  "source_lang": "en",
  "summary": "A triangle wave is a continuous periodic waveform with alternating linear rises and falls, whose symmetric form contains only odd harmonics.",
  "category": "mathematics",
  "subcategory": "analysis",
  "type": "concept",
  "aliases": [
    "Triangular wave",
    "Triangular waveform"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/triangle-wave/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/triangle-wave/",
      "json": "https://aiwiki.page/zh/triangle-wave.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "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."
    },
    {
      "heading": "Mathematical definition",
      "text": "Let \\(A>0\\) be the peak amplitude relative to the mean, and let \\(T>0\\) be the period. A zero-mean symmetric triangle wave can be defined over one period by\n\n\\[x(t)= \\begin{cases} -A+\\dfrac{4A}{T}t, &0\\leq t<\\dfrac{T}{2},\\\\[6pt] 3A-\\dfrac{4A}{T}t, &\\dfrac{T}{2}\\leq t<T, \\end{cases}\\]\n\nand extended to all real \\(t\\) by the periodicity condition\n\n\\[x(t+T)=x(t).\\]\n\nWith this choice of phase, the signal starts at \\(-A\\), reaches \\(+A\\) at \\(t=T/2\\), and returns to \\(-A\\) at \\(t=T\\). Its fundamental frequency is\n\n\\[f_0=\\frac{1}{T},\\]\n\nand its peak-to-peak amplitude is \\(2A\\).\n\nA compact equivalent expression uses the fractional part \\(\\{u\\}=u-\\lfloor u\\rfloor\\):\n\n\\[x(t)=A\\left(1-4\\left|\\left\\{\\frac{t}{T}\\right\\}-\\frac12\\right|\\right).\\]\n\nThe absolute value produces the two linear segments, while the fractional-part operation makes them repeat.\n\nA different, frequently used phase convention is\n\n\\[y(t)=\\frac{2A}{\\pi} \\arcsin\\!\\left(\\sin\\frac{2\\pi t}{T}\\right).\\]\n\nHere \\(\\arcsin\\) denotes its principal branch, with values between \\(-\\pi/2\\) and \\(\\pi/2\\). This waveform begins at zero with positive slope and is a time-shifted version of the preceding definition:\n\n\\[y(t)=x\\!\\left(t+\\frac{T}{4}\\right).\\]\n\nA constant offset and an arbitrary phase shift can be added without changing the triangular shape."
    },
    {
      "heading": "Continuity, slopes, and symmetry",
      "text": "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,\n\n\\[x'(t)= \\begin{cases} \\dfrac{4A}{T}, &0<t<\\dfrac{T}{2},\\\\[6pt] -\\dfrac{4A}{T}, &\\dfrac{T}{2}<t<T, \\end{cases}\\]\n\nwith the pattern repeated every period.\n\nThus, 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.\n\nThe triangle wave is globally Lipschitz continuous, with a Lipschitz constant \\(4A/T\\). Its lack of differentiability is confined to the discrete set of corner times.\n\nThe standard symmetric waveform has half-wave antisymmetry:\n\n\\[x\\!\\left(t+\\frac{T}{2}\\right)=-x(t).\\]\n\nIts 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."
    },
    {
      "heading": "Fourier representation",
      "text": "For the minimum-at-zero convention, the Fourier series is\n\n\\[x(t)= -\\frac{8A}{\\pi^2} \\sum_{k=0}^{\\infty} \\frac{ \\cos\\!\\left(2\\pi(2k+1)t/T\\right) }{ (2k+1)^2 }.\\]\n\nFor the zero-crossing convention, it is\n\n\\[y(t)= \\frac{8A}{\\pi^2} \\sum_{k=0}^{\\infty} \\frac{(-1)^k}{(2k+1)^2} \\sin\\!\\left(2\\pi(2k+1)t/T\\right).\\]\n\nBoth forms show that:\n\n- Only odd multiples of the fundamental frequency occur.\n- The fundamental component has peak amplitude \\(8A/\\pi^2\\).\n- Harmonic amplitudes decrease as the inverse square of harmonic number.\n\nThe 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.\n\nThe 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.\n\nAn 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."
    },
    {
      "heading": "Mean, RMS value, and amplitude distribution",
      "text": "The mean of a symmetric triangle wave over a complete period is zero:\n\n\\[\\frac{1}{T}\\int_0^T x(t)\\,dt=0.\\]\n\nIts root-mean-square value is\n\n\\[x_{\\mathrm{RMS}} = \\sqrt{\\frac{1}{T}\\int_0^T x(t)^2\\,dt} = \\frac{A}{\\sqrt{3}}.\\]\n\nIts mean absolute value is \\(A/2\\), and its crest factor—the ratio of peak magnitude to RMS value—is \\(\\sqrt{3}\\).\n\nFor a waveform with constant offset \\(C\\), the mean is \\(C\\), while the RMS value becomes\n\n\\[\\sqrt{C^2+\\frac{A^2}{3}}.\\]\n\nIf time is sampled uniformly over one period, the resulting instantaneous amplitude follows a uniform distribution on \\([-A,A]\\). 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."
    },
    {
      "heading": "Asymmetric triangle waves",
      "text": "The term triangle wave can also include waveforms whose rise and fall times differ. Let \\(d\\), with \\(0<d<1\\), be the fraction of the period occupied by the rising segment. An asymmetric version is\n\n\\[x_d(t)= \\begin{cases} -A+\\dfrac{2A}{dT}t, &0\\leq t<dT,\\\\[6pt] A-\\dfrac{2A}{(1-d)T}(t-dT), &dT\\leq t<T, \\end{cases}\\]\n\nagain extended periodically.\n\nThe symmetric case is \\(d=1/2\\). 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 \\(A/\\sqrt{3}\\), provided both segments are linear and connect the same extrema.\n\nAs \\(d\\) approaches zero or one, one ramp becomes increasingly steep, approaching a sawtooth-like limiting shape."
    },
    {
      "heading": "Generation and applications",
      "text": "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.\n\nDigital 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.\n\nSound 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.\n\nPulse-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.\n\nSweeps 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."
    }
  ],
  "links": [
    "mathematical-function",
    "absolute-value",
    "continuous-function",
    "derivative",
    "square-wave",
    "lipschitz-continuity",
    "fourier-series",
    "sawtooth-wave",
    "uniform-convergence",
    "root-mean-square",
    "uniform-distribution",
    "aliasing"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}