Mathwords logoMathwords

Rectangle Function — Definition, Formula & Examples

The rectangle function (often written rect) is a piecewise function that equals 1 inside a specified interval and 0 outside it. It models ideal on/off signals and serves as a building block in Fourier analysis and signal processing.

The rectangle function rect(t)\operatorname{rect}(t) is defined as rect(t)=1\operatorname{rect}(t) = 1 for t<12|t| < \tfrac{1}{2}, rect(t)=12\operatorname{rect}(t) = \tfrac{1}{2} for t=12|t| = \tfrac{1}{2}, and rect(t)=0\operatorname{rect}(t) = 0 for t>12|t| > \tfrac{1}{2}. It can equivalently be expressed using Heaviside step functions as rect(t)=H ⁣(t+12)H ⁣(t12)\operatorname{rect}(t) = H\!\left(t + \tfrac{1}{2}\right) - H\!\left(t - \tfrac{1}{2}\right).

Key Formula

rect(t)={0,t>1212,t=121,t<12\operatorname{rect}(t) = \begin{cases} 0, & |t| > \tfrac{1}{2} \\[4pt] \tfrac{1}{2}, & |t| = \tfrac{1}{2} \\[4pt] 1, & |t| < \tfrac{1}{2} \end{cases}
Where:
  • tt = The independent variable (often time or a normalized coordinate)

How It Works

To create a rectangular pulse of width τ\tau centered at t0t_0, substitute rect ⁣(tt0τ)\operatorname{rect}\!\left(\frac{t - t_0}{\tau}\right). The argument scaling stretches the unit-width pulse to width τ\tau, and the shift moves its center to t0t_0. Because the function has sharp transitions, its Fourier transform is a sinc function: F{rect(t)}=sinc(f)\mathcal{F}\{\operatorname{rect}(t)\} = \operatorname{sinc}(f). This rect–sinc duality is one of the most important pairs in Fourier analysis.

Worked Example

Problem: A radar system transmits a pulse that is on from t=2μst = 2\,\mu s to t=6μst = 6\,\mu s and off elsewhere. Express this pulse using the rectangle function.
Find center and width: The pulse runs from 2 to 6, so its center is the midpoint and its width is the difference.
t0=2+62=4μs,τ=62=4μst_0 = \frac{2 + 6}{2} = 4\,\mu s, \quad \tau = 6 - 2 = 4\,\mu s
Write the rect expression: Substitute into the shifted and scaled rectangle function.
p(t)=rect ⁣(t44)p(t) = \operatorname{rect}\!\left(\frac{t - 4}{4}\right)
Verify: At t=3μst = 3\,\mu s: the argument is (34)/4=0.25(3-4)/4 = -0.25. Since 0.25<0.5|-0.25| < 0.5, the function equals 1. At t=0t = 0: the argument is 1-1, and 1>0.5|-1| > 0.5, so the function equals 0.
Answer: The radar pulse is p(t)=rect ⁣(t4μs4μs)p(t) = \operatorname{rect}\!\left(\dfrac{t - 4\,\mu s}{4\,\mu s}\right).

Why It Matters

In electrical engineering and physics courses, the rectangle function is the standard model for ideal pulses and finite-duration signals. Its Fourier transform (the sinc function) explains bandwidth limitations in communication systems and the ringing artifacts seen in signal reconstruction.

Common Mistakes

Mistake: Forgetting that the width parameter goes in the denominator, not the numerator, of the argument.
Correction: To get a pulse of width τ\tau, write rect(t/τ)\operatorname{rect}(t/\tau). Placing τ\tau in the numerator would compress the pulse instead of stretching it.