Purpose
Understanding Parseval’s identity

Parseval’s Identity establishes the relation between the energy of a signal in the time domain and the frequency domain. The identity simply states that there is no loss of information between the time and frequency domain.

\noindent Intention here is to see this in the discrete setting

The derivation flows from autocorrelation function with lag 0 . In the discrete setting it boils down to inverse FFT of $|F[s]|^2$. In the discrete setting, inverse FFT always has a $1/N$ factor and hence the discrete formula appears like the above one.

\textbf{Rectangular Function}

> x <- seq(-5, 5, length.out = 2000)
> y <- ifelse(abs(x) < 1, 1, 0)
> n <- length(y)
> z <- fft(y)/n
> sum(Mod(y)^2)/n
[1] 0.2
> sum(Mod(z)^2)
[1] 0.2

\textbf{Triangular Function}

> x <- seq(-5, 5, length.out = 2000)
> y <- ifelse(x < 0, 5 + x, 5 - x)
> n <- length(y)
> z <- fft(y)/n
> sum(Mod(y)^2)/n
[1] 8.329165
> sum(Mod(z)^2)
[1] 8.329165

\noindent Another little thing to notice is the division by n in FFT. This is done mainly because we are moving from Continous setting to Discrete setting. Refer to Prof Osgoods notes on Discrete FFT derivation.