Ph · Physics

What Is the Fourier Series of a Square Wave?

Updated 13 October 2026

At a glance

  1. 1. Set the convention

    Specify the wave's amplitude, period, and starting phase; these determine its Fourier coefficients.

  2. 2. Use symmetry

    A zero-mean square wave centered on the time origin is odd, so it has sine terms only.

  3. 3. Find the coefficients

    Integrating over one half-cycle gives nonzero coefficients for odd harmonics, decreasing in proportion to one over harmonic number.

  4. 4. Check the result

    Evaluate the series away from jumps, and remember that at each jump it converges to the midpoint of the two levels.

A square wave is not described by a single sine wave: its sharp transitions require a sum of harmonics. The exact Fourier series depends on the wave’s amplitude, period, offset, and phase. The standard zero-mean square wave has a particularly simple series: it contains only odd sine harmonics.

The standard square-wave convention

Let the wave alternate between +A and −A, with period T. Choose its phase so it is positive during the first half of each cycle and negative during the second:

f(t)={A,0<t<T/2,−A,T/2<t<T,f(t)=\begin{cases} A, & 0<t<T/2,\\ -A, & T/2<t<T, \end{cases}

with the pattern repeating every T. Its fundamental angular frequency is ω0=2π/T\omega_0=2\pi/T. Equivalently, the wave can be centered on the origin so that it is odd: f(−t)=−f(t)f(-t)=-f(t), except at its jump points.

With this convention, the Fourier series is

f(t)=4Aπ[sin⁡(ω0t)+13sin⁡(3ω0t)+15sin⁡(5ω0t)+⋯ ].f(t)=\frac{4A}{\pi}\left[\sin(\omega_0t)+\frac{1}{3}\sin(3\omega_0t)+\frac{1}{5}\sin(5\omega_0t)+\cdots\right].

In summation notation,

f(t)=4Aπ∑k=0∞sin⁡((2k+1)ω0t)2k+1.f(t)=\frac{4A}{\pi}\sum_{k=0}^{\infty}\frac{\sin\big((2k+1)\omega_0t\big)}{2k+1}.

Only odd multiples of the fundamental frequency occur. The amplitude of the harmonic at frequency (2k+1)ω0(2k+1)\omega_0 is 4A/[π(2k+1)]4A/[\pi(2k+1)].

Why only odd sine terms appear

A Fourier series can include a constant term, cosine terms, and sine terms. This wave has zero average, so its constant term is zero. Its odd symmetry means all cosine coefficients are zero as well. To find the remaining sine coefficients, integrate over one period using the standard formula

bn=2T∫−T/2T/2f(t)sin⁡(nω0t) dt.b_n=\frac{2}{T}\int_{-T/2}^{T/2} f(t)\sin(n\omega_0t)\,dt.

Both f(t)f(t) and sin⁡(nω0t)\sin(n\omega_0t) are odd, so their product is even. On the interval 0<t<T/20<t<T/2, the wave equals A, giving

bn=4AT∫0T/2sin⁡(nω0t) dt=4AT1−cos⁡(nω0T/2)nω0=2Anπ(1−(−1)n).\begin{aligned} b_n&=\frac{4A}{T}\int_0^{T/2}\sin(n\omega_0t)\,dt\\ &=\frac{4A}{T}\frac{1-\cos(n\omega_0T/2)}{n\omega_0}\\ &=\frac{2A}{n\pi}\big(1-(-1)^n\big). \end{aligned}

If n is even, (−1)n=1(-1)^n=1 and bn=0b_n=0. If n is odd, (−1)n=−1(-1)^n=-1 and bn=4A/(nπ)b_n=4A/(n\pi). That produces the odd-harmonic series above.

Worked example: a 500 Hz square wave

Suppose a voltage switches between +3 V and −3 V, completing a cycle every 2 ms. Its period is T=0.002T=0.002 s, so its fundamental frequency is 500 Hz and its angular frequency is ω0=1000π\omega_0=1000\pi rad/s. Substituting A=3A=3 V gives

f(t)=12π[sin⁡(1000πt)+13sin⁡(3000πt)+15sin⁡(5000πt)+⋯ ] V.f(t)=\frac{12}{\pi}\left[\sin(1000\pi t)+\frac{1}{3}\sin(3000\pi t)+\frac{1}{5}\sin(5000\pi t)+\cdots\right]\text{ V}.

The first three terms have frequencies 500 Hz, 1500 Hz, and 2500 Hz. Keeping only these terms gives an approximation to the square wave; adding more odd harmonics makes the flat portions and sharp edges increasingly recognizable. The approximation still rings near each transition.

If the square wave goes from zero to A

A common alternative is a unipolar wave that is A for half of each period and 0 for the other half. It is not zero-mean: its average value is A/2A/2. For the phase where it is high during the first half-cycle, its series is

f(t)=A2+2Aπ[sin⁡(ω0t)+13sin⁡(3ω0t)+15sin⁡(5ω0t)+⋯ ].f(t)=\frac{A}{2}+\frac{2A}{\pi}\left[\sin(\omega_0t)+\frac{1}{3}\sin(3\omega_0t)+\frac{1}{5}\sin(5\omega_0t)+\cdots\right].

The added constant term supplies the offset. A different phase shifts the waveform and changes the sine and cosine coefficients, but not the underlying harmonic frequencies.

Values at jumps and common mistakes

At a discontinuity, a Fourier series converges to the average of the left- and right-hand limits. For the symmetric wave, that average is zero; for the unipolar wave, it is A/2A/2. The value you assign to the signal at the single jump point does not change its Fourier coefficients.

A finite sum does not reproduce a discontinuous edge exactly. It oscillates near the jump, with an overshoot that persists as more terms are added, even though the oscillations become confined closer to the transition. This is the Gibbs phenomenon.

Common errors include using A for the peak-to-peak value when the wave actually ranges from −A to +A (its peak-to-peak value is 2A2A), including even harmonics for the standard symmetric wave, and forgetting the average-value term for a unipolar wave. State the amplitude convention, offset, and phase before applying a formula.

References

  1. Fourier Series and Boundary Value Problems — Richard V. Churchill and James Ward Brown
  2. Advanced Engineering Mathematics — Erwin Kreyszig

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.