Erasure Coding is a fundamental part of many algorithms and have a variety of use cases like securing data availability in blockchains and STARKs. And one of the key building blocks of Erasure Coding is **Fast Fourier Transforms**. Life is a full circle, right? I ran away from the course teaching Fourier Transforms as far as possible and here I am, trying to learn it again. But this time it’s different as *curiosity* has appeared wildly.

But you’re a dirty little liar with a message of obsession to come

You got your head in the clouds

And your world’s upside down

Get away from the life you’re living

Song time baby!! This time it’s Dirty Little Thing by Velvet Revolver. Oooooh, it’s a wild song. I couldn’t get the tune out of my head when I first listened to it.

## DFT

Process to convert sequence of complex numbers ${x_{n}}:=x_{0},x_{1},…,x_{n−1}$ to another sequence of complex numbers ${X_{n}}:=X_{0},X_{1},…,X_{n−1}$.^{1}

## IDFT

## Interpolation

### Vandermode

Vandermode matrix: $O(n_{3})$

$ 11⋮1 x_{0}x_{1}⋮x_{n−1} x_{0}x_{1}⋮x_{n−1} ………… x_{0}x_{1}⋮x_{n−1} a_{0}a_{1}⋮a_{n−1} = y_{0}y_{1}⋮y_{n−1} $### Working With Polynomials

Tldr

DFT: Coefficient representation → point-valueInverse DFT: Point-value → coefficient

An $n$-degree polynomial is represented in coefficient form:

$A(x)=j=0∑n−1 a_{j}x_{j}$Lagrange coefficients:

$A(x)=k=0∑n−1 y_{k}∏_{j=k}x_{k}−x_{j}∏_{j=k}(x−x_{j}) $Algorithms and Time Complexity:

- Addition/Subtraction: $O(n)$ in coefficient and point-value
- Multiplication: $O(n_{2})$ in coefficient and $O(n)$ in point-value and converting between the two can be done in $O(ngn)$

Let the polynomial $A$ be defined with coefficients $a=a_{0},a_{1},…,a_{n−1}$, with results $y_{k}$ for $k=0,1,…,n−1$.

$y_{k} =A(ω_{n})=j=0∑n−1 a_{j}ω_{n} $Above equation is the DFT equation, represented as $DFT_{n}(a)$.

## FFT

Lemma’s that help in understanding FFT:

- Cancellation Lemma: $ω_{dn}=ω_{n}$
- Halving Lemma: squares of nth complex root of unity are n/2 complex n/2th root of unity. $(ω_{n})_{2}=(ω_{n})_{2}$
- Summation Lemma: $∑_{j=0}(ω_{n})_{j}=0$

Uses the following relation: $A(x)=A_{even}(x_{2})+xA_{odd}(x_{2})$.

$y_{even,k}=A_{even}(ω_{n})y_{odd,k}=A_{odd}(ω_{n}) $Domain should be power of 2, and complex roots of unity, $ω_{n}$.

Why does it need to be power of 2?

It actually depends upon the algorithm used, the most optimised Cooley-Tukey algorithm runs in $O(nlogn)$ time, and uses roots of unity as the domain. And Cooley-Tuckey uses $ω$ properties to divide into length $k$, mostly 2. This is the radix property of the algorithm, thus it requires domain to order of length $k_{r}$.

Let’s understand radix-2 Cooley-Tukey FFT algorithm

### Cooley-Tukey Algorithm

## Resources

- CLRS, Introduction to Algorithms, Chapter 30
- Radix-4 FFT
- FFT
- CP algorithms: FFT
- FFT over Finite Fields
- Ingonyama’s NTT 201
- Cryptography Caffe’s NTT: Part 1 & Part 2