# Triangular function

Triangular function
Triangle function (alternate)

The triangular function (also known as the triangle function, hat function, or tent function) is defined either as:

\begin{align} \operatorname{tri}(t) = \and (t) \quad &\overset{\underset{\mathrm{def}}{}}{=} \ \max(1 - |t|, 0) \\ &= \begin{cases} 1 - |t|, & |t| < 1 \\ 0, & \mbox{otherwise} \end{cases} \end{align}

or, equivalently, as the convolution of two identical unit rectangular functions:

\begin{align} \operatorname{tri}(t) = \operatorname{rect}(t) * \operatorname{rect}(t) \quad &\overset{\underset{\mathrm{def}}{}}{=} \int_{-\infty}^\infty \mathrm{rect}(\tau) \cdot \mathrm{rect}(t-\tau)\ d\tau\\ &= \int_{-\infty}^\infty \mathrm{rect}(\tau) \cdot \mathrm{rect}(\tau-t)\ d\tau . \end{align}

The triangular function can also be represented as the product of the rectangular and absolute value functions:

$\operatorname{tri}(t) = \operatorname{rect}(t/2) \left ( 1 - \left |t \right | \right )$

The function is useful in signal processing and communication systems engineering as a representation of an idealized signal, and as a prototype or kernel from which more realistic signals can be derived. It also has applications in pulse code modulation as a pulse shape for transmitting digital signals and as a matched filter for receiving the signals. It is also equivalent to the triangular window sometimes called the Bartlett window.

Note that in some cases the triangle function may be defined to have a base of length 1 instead of length 2:

\begin{align} \operatorname{tri}(t) = \and (t) \quad &\overset{\underset{\mathrm{def}}{}}{=} \ \max(1 - |2t|, 0) \\ &= \begin{cases} 1 - |2t|, & |2t| < 1 \\ 0, & \mbox{otherwise} \end{cases} \end{align}

## Scaling

For any parameter, $a \ne 0\,$ :

\begin{align} \operatorname{tri}(t/a) &= \int_{-\infty}^\infty \mathrm{rect}(\tau) \cdot \mathrm{rect}(\tau - t/a)\ d\tau \\ &= \begin{cases} 1 - |t/a|, & |t| < |a| \\ 0, & \mbox{otherwise} . \end{cases} \end{align}

## Fourier transform

The transform is easily determined using the convolution property of Fourier transforms and the Fourier transform of the rectangular function:

\begin{align} \mathcal{F}\{\operatorname{tri}(t)\} &= \mathcal{F}\{\operatorname{rect}(t) * \operatorname{rect}(t)\}\\ &= \mathcal{F}\{\operatorname{rect}(t)\}\cdot \mathcal{F}\{\operatorname{rect}(t)\}\\ &= \mathcal{F}\{\operatorname{rect}(t)\}^2\\ &= \mathrm{sinc}^2(f), \end{align}

where $\operatorname{sinc}(x) = \sin(\pi x) / (\pi x)$ is the normalized sinc function.