6.1. Linearity#

The first major property of the DFT that we’ll cover is linearity. We’ve already seen linearity in the context of LSI systems, where we used it to understand what happens when you convolve a filter \(h\) with a mixture of signals.

Here, we’ll use linearity slightly differently, but the basic idea is the same.

Property 6.1 (DFT Linearity)

For any pair of signals \(\blue{x_1[n]}\) and \(\blue{x_2[n]}\) of the same length, and real numbers \({\red{c_1, c_2}}\), the following holds:

\[\text{DFT}(\red{c_1} \cdot \blue{x_1} + \red{c_2} \cdot \blue{x_2}) = \red{c_1} \cdot \text{DFT}(\blue{x_1}) + \red{c_2} \cdot \text{DFT}(\blue{x_2}).\]

We’ll prove this property algebraically, starting from the definition of the DFT (5.12):

\[\darkblue{X[m]} = \sum_{n=0}^{N-1} \blue{x[n]} \cdot \purple{\exp\left(-\mathrm{j}\cdot 2\pi \cdot \frac{m}{N} \cdot n\right)}\]

Proof. Let \(0 \leq m < N\) be any frequency index. Using \(x=\red{c_1} \cdot \blue{x_1} + \red{c_2} \cdot \blue{x_2}\) as our input signal, its \(m\)th DFT component is

\[\begin{align*} \sum_{n=0}^{N-1} \left(\red{c_1} \cdot \blue{x_1[n]} + \red{c_2} \cdot \blue{x_2[n]}\right) \cdot \purple{\exp\left(-\mathrm{j}\cdot 2\pi \cdot \frac{m}{N} \cdot n\right)} &= \sum_{n=0}^{N-1} \left(\red{c_1} \cdot \blue{x_1[n]} \cdot \purple{\exp\left(-\mathrm{j}\cdot 2\pi \cdot \frac{m}{N} \cdot n\right)} \right.\\ &\;\;\left.+ \red{c_2} \cdot \blue{x_2[n]} \cdot \purple{\exp\left(-\mathrm{j}\cdot 2\pi \cdot \frac{m}{N} \cdot n\right)}\vphantom{\frac{m}{n}}\right)\\ &= \red{c_1} \cdot \sum_{n=0}^{N-1} \blue{x_1[n]} \cdot \purple{\exp\left(-\mathrm{j}\cdot 2\pi \cdot \frac{m}{N} \cdot n\right)} \\ &\;\;+ \red{c_2} \cdot \sum_{n=0}^{N-1} \blue{x_2[n]} \cdot \purple{\exp\left(-\mathrm{j}\cdot 2\pi \cdot \frac{m}{N} \cdot n\right)}\\ &= \red{c_1} \cdot \darkblue{X_1[m]} + \red{c_2} \cdot \darkblue{X_2[m]}. \end{align*}\]

So if we scale and mix two input signals, the resulting DFT component is the same scaling and mixing of their individual DFT components \(\darkblue{X_1[m]}\) and \(\darkblue{X_2[m]}\). Since this holds for any \(m\) it must hold for all \(m\), so the entire DFT sequence of the mixture is the mixture of the DFT sequences. This is what we set out to prove.

What does linearity buy us?

DFT linearity is important because most interesting signals are not just simple sinusoids. What DFT linearity says is that if we can represent an arbitrary signal \(x\) as a weighted combination of sinusoids, then we can reason about its DFT in terms of its constituent sinusoids.

As we will see in the next chapter (and as we’ve hinted at earlier), it turns out that all signals can be represented as a weighted combination of sinusoids.

6.1.1. Magnitude is not linear#

Note that DFT linearity applies to the complex numbers \(\darkblue{X[m]}\) which encode both magnitude and phase. There is nothing wrong with adding complex numbers, provided it is done correctly, keeping the real and imaginary parts separate.

However, it is a common mistake to add magnitudes rather than the full complex numbers.

Magnitude is not linear.

If signals \(\blue{x_1[n]}\) and \(\blue{x_2[n]}\) have DFT series \(\darkblue{X_1[m]}\) and \(\darkblue{X_2[m]}\), then the sum \(\purple{y[n]} = \blue{x_1[n] + x_2[n]}\) has DFT series \(\darkblue{Y[m] = X_1[m] + X_2[m]}\).

But remember,

\[\begin{align*} \left|\darkblue{Y[m]}\right| &= \left|\darkblue{X_1[m] + X_2[m]}\right|\\ &\neq \left|\darkblue{X_1[m]}\right| + \left|\darkblue{X_2[m]}\right|. \end{align*}\]

Example

For an extreme case, consider \(\purple{x_2[n]} = -\blue{x_1[n]}\) for some arbitrary, non-empty signal \(\blue{x_1}\). DFT linearity says that \(\darkblue{X_2[m] = -1 \cdot X_1[m]}\), so the spectra \(\darkblue{X_1}\) and \(\darkblue{X_2}\) are opposites. However, the spectral magnitudes are identical:

\[\darkblue{X_2[m] = -X_1[m]} \quad \Rightarrow \quad \darkblue{|X_2[m]| = |-1 \cdot X_1[m]| = |X_1[m]|}.\]

If we were to add the magnitude spectra, we’d get

\[|\darkblue{X_1[m]}| + |\darkblue{X_2[m]}| = |\darkblue{X_1[m]}| + |\darkblue{X_1[m]}| = 2\cdot |\darkblue{X_1[m]}|.\]

However, if we mix the two signals in the time domain, we get the empty signal:

\[y[n] = \blue{x_1[n]} + \purple{x_2[n]} = \blue{x_1[n] - x_1[n]} = 0.\]

The empty signal has an empty spectrum: \(\darkblue{Y[m] = 0}\) for all \(m\), but

\[|\darkblue{Y[m]}| = 0 \neq 2 \cdot |\darkblue{X_1[m]}|\]

in general.

What this says is that mixing signals does not equate to mixing DFT magnitudes.

../../_images/1f05e6164ecb060c879ba36805f536d0974272c942e376918454072310aee84c.svg

Fig. 6.1 Complex numbers \(\purple{z}\) and \(\purple{w=-z}\) have the same magnitude \(\darkblue{|z| = |w|}\) but different phase. The sum of their magnitudes \(\blue{|z| + |w|}\) is not the same as the magnitude of their sum \(\red{|z + w| = 0}\).#