# Spectrum of squared signal? Why is spectrum bandlimited for squaring modulus of a bandlimited signal?

Approximately bandlimiting, or maybe exactly if x is exactly - example:

rfft(abs(x)**2)[210]

(-7.993605777301127e-15+0j)


I notice the original signal must be bandlimited by a certain amount for this to happen, and there appears to be a definite relationship.

Is there a formula that relates fft(|x|^2) and |fft(x)|^2 or fft(x) (DFT or CFT)?

Code minus plots:

import numpy as np
from numpy.fft import fft, ifft, rfft

N = 500
np.random.seed(0)
_x = np.random.randn(N) + 1j*np.random.randn(N)
_xf = fft(_x)
# force a certain bandlimit
_xf[:150] = 0
_xf[-150:] = 0
x = ifft(_xf)

print(rfft(np.abs(x)**2)[210])

• Have you tried longdouble? It might be a numerical artefact Mar 6, 2023 at 14:25
• At any rate, you are convoluting the spectra with itself in frequency domain for the squared signal, which here has approximately a triangular distribution, so zero at high freq. is reasonable. For the absolute value I suspect the equivalent convolution in frequency domain has several factors (i.e. a power series approximation), so I think the distribution will have much wider support, that is, not go to zero at high freq. Mar 6, 2023 at 14:36
• @Arnfinn Well it's not numerics, though I think someone here may answer. May want to check in later! Mar 6, 2023 at 14:47
• hmm it's clear for real-valued x, the |x| was a distraction Mar 6, 2023 at 15:10

The relationship is convolution: the magnitude squared in the time domain is the complex conjugate product as demonstrated below for the case of continuous time $$x(t)$$:

$$|x(t)|^2 = x(t)x^*(t)$$

Such a product in time is convolution in frequency. The spectrum of $$x^*(t)$$ for the CTFT (or $$x^*[n]$$ for the DFT) is mirrored of that for $$x(t)$$ and $$x[n]$$ but otherwise identical in terms of spectral occupancy. For this reason the resulting spectrum will be bounded to twice the bandwidth of time domain waveform (for the case of the DFT, this means the spectrum of $$x[n]$$ must have a spectral occupancy that is less than $$N/2$$ samples otherwise the result will fully occupy the DFT with additional distortions due to the spectral overlap.)

That said the relationship for the DFT (FFT) would be:

$$\texttt{FFT}\{ x[n] x^*[n] \} = X[k] \circledast X^*[-k]$$

Where the symbol $$\circledast$$ above represents a circular convolution, which conveniently can be determined from the FFT and IFFT using the following well known relationship (this is used for “fast convolution” or equivalently when one of the FFT results is itself conjugated “fast correlation”):

$$C[k] =\texttt {IFFT} \big[\,\texttt{FFT}(X[k])\,\texttt{FFT}(X^*[-k])\,\big]$$

Note- that if we rewrite the above known relationship to equivalently be the fft of the product of the inverse fft’s we get the original time domain result further showing this relationship!

$$\texttt{FFT}\{ x[n] x^*[n] \} =\texttt {FFT}\big[\,\texttt{IFFT}(X[k])\,\texttt{IFFT}(X^*[-k])\big]$$

• I'm not very smart Mar 6, 2023 at 15:17
• I think it is a very “convoluted” DSP trick Mar 6, 2023 at 15:33
• too used to |x|'s spectrum in discussing |x|, good to save rediscovery time Mar 6, 2023 at 15:36
• This is also a very blatant example of "not bandlimited (or $f_s$ < Nyquist) just means sinc interpolation alone can't recover it". Mar 6, 2023 at 15:50
• Dan, in some of your equations you seem to equate $x^*[n]$ with IFFT$(X^*[k])$. Is that right? It should be IFFT$(X^*[-k])$. Mar 6, 2023 at 21:18