takes only the sign of the sine , giving a square wave whose value alternates between and 1.
The sign function is defined as follows.
Applying it to gives the function considered here.
The domain is all real numbers, and the range consists of just three values: , and .
| Interval | ||
|---|---|---|
| positive | ||
| negative |
The period is , the same as that of . Since , the function is odd, with point symmetry about the origin.
At each the value jumps discontinuously between and . The jump has size , and the value at that instant is . Against the smooth wave of , this graph is made only of horizontal segments and vertical jumps.
There are two jumps in each period, and everywhere else the derivative is . The value switches without ever having a slope, a structure typical of the step functions.
A square wave can be written as a sum of odd-numbered sines.
The coefficients fall off only as , so the convergence is slow and a good approximation needs many terms. Truncating the series leaves an overshoot near each jump, known as the Gibbs phenomenon2. Adding terms does not reduce the height of that overshoot, which stays at about ; only its width narrows.
| Waveform | Harmonics present | Decay of the coefficients |
|---|---|---|
| Square wave | odd | |
| Triangle wave | odd |
The general rule shows through: a waveform with jumps has slowly decaying coefficients, while one with mere corners has fast decaying ones.