\documentclass{article} \usepackage[utf8]{inputenc} \usepackage{amsfonts} \usepackage{amsthm} \usepackage{amsmath} \usepackage{enumerate} \usepackage{hyperref} \hypersetup{ colorlinks, citecolor=black, filecolor=black, linkcolor=black, urlcolor=blue } \newcommand{\Zq}{\mathbb{Z}_q} \newcommand{\Rq}{\mathbb{Z}_q[X]/(X^n+1)} \title{NTT for Negacyclic Polynomial Multiplication} \author{arnaucube} \date{January 2025} \begin{document} \maketitle \begin{abstract} Notes taken while studying the NTT, mostly from \cite{10177902}. Usually while reading books and papers I take handwritten notes in a notebook, this document contains some of them re-written to $LaTeX$. The notes are not complete, don't include all the steps neither all the proofs. An implementation of the NTT can be found at\\ \href{https://github.com/arnaucube/fhe-study/blob/main/arithmetic/src/ntt.rs}{https://github.com/arnaucube/fhe-study/blob/main/arithmetic/src/ntt.rs}. \end{abstract} \tableofcontents \section{Main idea} For doing multiplications in the \emph{negacyclic polynomial ring} ($\Rq$), rather than doing it in a naive way, it is more efficient to do it through the NTT. This is, let $a(X), b(X) \in \Rq$, and suppose we want to obtain $a(X) \cdot b(X)$. First apply the NTT to the two ring elements that we want to multiply, $$\hat{a}(X) = NTT(a(X)),~~ \hat{b}(X)=NTT(b(X))$$ then multiply the result element-wise, % $$\hat{c}(X) = \sum \hat{a}_i \cdot \hat{b}_i$$ $$c= \hat{a} \circ \hat{b}$$ where $\circ$ means the element-wise vector multiplication in $\Zq$. Then apply the NTT$^{-1}$ to the result, obtaining the actual value of multiplying $a(X) \cdot b(X)$. \section{Cyclotomic vs Negacyclic} \subsection{Cyclotomic: \texorpdfstring{$\mathbb{Z}_q[X]/(X^n-1)$}{Zq[X]/(X**n-1)}} In the cyclotomic case, the primitive n-th root of unity in $Z_q$ is $w^n \equiv 1 \pmod q$ (and $w^k \not\equiv 1 \pmod q ~~ for k