# Linearity

## Contents

# 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.

(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:

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

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

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,

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:

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

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

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

in general.

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