\documentclass[11pt]{article}

\usepackage{fullpage}
%\usepackage{epic}
%\usepackage{eepic}
\usepackage{psfig}

%\newcommand{\proof}[1]{
%{\noindent {\it Proof.} {#1} \rule{2mm}{2mm} \vskip \belowdisplayskip}
%}


%\newtheorem{lemma}{Lemma}[section]
%\newtheorem{theorem}[lemma]{Theorem}
%\newtheorem{claim}[lemma]{Claim}
%\newtheorem{definition}[lemma]{Definition}
%\newtheorem{corollary}[lemma]{Corollary}

%Theorems and likes
\newtheorem{assumption}{Assumption}[section]
\newtheorem{theorem}{Theorem}[section]
\newtheorem{fact}{Fact}[section]
\newtheorem{claim}{Claim}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{definition}{Definition}[section]
\newtheorem{corollary}{Corollary}[section]


\newcommand{\bproof}{\noindent{\it Proof}}
%\newcommand{\eproof}{\hspace*{\fill}$\Box$~~~~~\bigskip}
\newcommand{\eproof}{\hspace*{\fill}\rule{2mm}{2mm}~~~~~\bigskip}
\newenvironment{proof}{\bproof: }{\eproof}

% symbols and notation
\newcommand{\defeq}{\stackrel{\rm def}{=}}


\setlength{\oddsidemargin}{0in}
\setlength{\topmargin}{0in}
\setlength{\textwidth}{6in}
\setlength{\textheight}{8in}

\begin{document}

\setlength{\fboxrule}{.5mm}\setlength{\fboxsep}{1.2mm}
\newlength{\boxlength}\setlength{\boxlength}{\textwidth}
\addtolength{\boxlength}{-4mm}
\begin{center}\framebox{\parbox{\boxlength}{\bf
CS 681: Computational Number Theory and Algebra \hfill
Lecture 5
\\
Lecturer: Manindra Agrawal
\hfill
Notes by: Ashwini Aroskar
%\\
\begin{flushright}
%date
August 11, 2004.
\end{flushright}
}}\end{center}
\vspace{5mm}

\section{Discrete Fourier Transform}
%The text of the notes goes here.
Let $f:[0,n-1]\rightarrow F$ be a function. $F$ is a field.
\begin{definition}

The Discrete Fourier Transform of $f$ is defined as \[DFT_f(j) =
\sum_{i=0}^{n-1} f(i)\omega^{ij} ; \quad 0\leq j<n  \]
 where $\omega$ is
a principal $n^{th}$ root of unity, i.e., $\omega^n = 1$ and
$\omega^m\not=1$ for $ 0 < m < n$

\label{first-definition}
\end{definition}

So, $DFT_f:[0,n-1]\rightarrow F[\omega]$, in general.

\subsection{Evaluating $DFT_f$}
Given $f = (c_0,c_1,\ldots,c_{n-1})$, compute
$(d_0,d_1,\ldots,d_{n-1})$ with $d_j = DFT_f(j)$
\\
\\
Time complexity of na\"{\i}ve algorithm $= \bigcirc(n^2)$
operations over $F$. \subsection{Computing Inverse DFT}
\begin{theorem}
$\frac{1}{n}DFT[\omega^{-1}]_{DFT[\omega]_f} = f$
\label{first-theroem}
\end{theorem}

\begin{proof}
Suppose $DFT[\omega](c_0,c_1,\ldots,c_{n-1}) =
(d_0,d_1,\ldots,d_{n-1})$\\
Then $ d_j = \sum_{i=0}^{n-1} c_i\omega^{ij} $\\
\\
Let $DFT[\omega^{-1}](d_0,d_1,\ldots,d_{n-1}) =
(e_0,e_1,\ldots,e_{n-1})$\\

\begin{eqnarray*} e_j &=& \sum_{i=0}^{n-1} d_i\omega^{-ij} \\
&=& \sum_{i=0}^{n-1} (\sum_{t=0}^{n-1} c_t\omega^{ti})\omega^{-ij}\\
&=& \sum_{t=0}^{n-1} \sum_{i=0}^{n-1} (\omega^{(t-j)})^i \\
&=& n c_j
\end{eqnarray*}
as \begin{eqnarray*} \sum_{i=0}^{n-1} (\omega^{(t-j)})^i &=& 0
 \quad \forall t \not= j\\
&=& n  \quad t=j
\end{eqnarray*}
\end{proof}
\\

%To include a theorem with proof, use the following format.

%\begin{theorem}
%This is a theorem statement.
%\label{first-theorem}
%\end{theorem}

%\begin{proof}
%Here goes the proof of the theorem which follows from
%Fact \ref{first-fact} and Lemma \ref{first-lemma}.
%\end{proof}

\section{Fast Fourier Transform}
Proposed by Gauss in the 1800's, Fast Fourier Transforms employ
the Divide-and-Conquer technique.
\\
Assume $n=2^m$ for some $m>0$
\begin{eqnarray*}
d_j & = & \sum_{i=0}^{2^m-1}c_i\omega^{ij} \\
    & = & \sum_{i=0}^{2^{m-1}-1} c_{2i}\omega^{2ij} +
    c_{2i+1}\omega^{(2i+1)j} \\
    & = & \sum_{i=0}^{2^{m-1}-1} c_{2i}\omega^{2ij} + \omega^j\sum_{i=0}^{2^{m-1}-1} c_{2i+1}(\omega^2)^{ij}
\end{eqnarray*}
\\
Let $f_0 = (c_0,c_2,\ldots,c_{n-2})$ and
$f_1=(c_1,c_3,\ldots,c_{n-1})$\\
Let $(e_0,e_1,\ldots,e_{\frac{n}{2}-1}) = DFT_{f_0}$ and
$(e^{\prime}_0,e^{\prime}_1,\ldots,e^{\prime}_{\frac{n}{2}-1}) =
DFT_{f_1}$ \\
\\
Then \begin{eqnarray*} d_j &=& e_j + \omega^je^{\prime}_j  \quad  \quad 0 <j < \frac{n}{2}\\
    &=& e_{j-\frac{n}{2}} +\omega^je^{\prime}_{j-\frac{n}{2}}  \quad  j\geq \frac{n}{2}
 \end{eqnarray*}
\\
Time Complexity of $FFT = T(n)$ \\$T(n) = 2T(\frac{n}{2}) +
\bigcirc(n) = \bigcirc(n\log n)$ \\

Therefore, time complexity of computing $DFT$ or $Inverse DFT$
$=\bigcirc (n log n)$
\\
\subsection{Polynomial Multiplication}
Given polynomials $P(x)$ and $Q(x)$, both of degree $n-1$, compute
$P*Q(x)$\\
Obvious time complexity $= \bigcirc(n^2)$\\
\\
Let $DFT_P=(d_0,d_1,\ldots,d_{n-1})$ where $d_j=P(\omega^j)$ \\
and $DFT_Q=(e_0,e_1,\ldots,e_{n-1})$ where $e_j=Q(\omega^j)$\\
\\
$P*Q(\omega^j) = P(\omega^j) Q(\omega^j) = d_j e_j$\\
$DFT_{P*Q} = (d_0e_0,d_1e_1,\ldots,d_{n-1}e_{n-1})$ and can be
computed using $\bigcirc(n)$ operations if $DFT_P$ and $DFT_Q$ are
known.\\
\\
$\deg P*Q = 2n-2$\\
Pretend that $P$ and $Q$ are $\deg l$ polynomials with $l \geq
n-2$ and $l=2^k-1$ for some $k$. So, use $\omega$, a principal $2^k th$ root of unity.\\
$P*Q$ is also a $\deg l$ polynomial.\\
\\
Time complexity of computing $P*Q$ via $DFT$\\$ = \bigcirc(l \log
l) + \bigcirc(l) + \bigcirc(l \log l)$\\
$= \bigcirc(n log n)$   \quad \quad as $ l = \bigcirc(n)$\\

\subsection{Integer Multiplication}
Given integers $a$ and $b$, both $n$ bit long, compute $a*b$.\\
Obvious Time Complexity $= \bigcirc(n^2)$\\
\\
Let $ a = a_0a_1\ldots a_{n-1} $ \quad and \quad $ b =
b_0b_1\ldots b_{n-1}$.\\
$ a = \sum_{i=0}^{n-1}a_i2^i$ \quad and \quad $ b = \sum_{i=0}^{n-1}b_i2^i$\\
\\
Assume $n=2^k$. Let $ l \mid n$. Let $n= l*t$.\\ Split $a$ and $b$
into $t$ blocks of $l$ bits each.\\
\\Let $a=\hat{a}_0\hat{a}_1\ldots\hat{a}_{t-1}$ \quad and \quad
$b=\hat{b}_0\hat{b}_1\ldots\hat{b}_{t-1}$.\\
\\
Then $a = \sum_{i=0}^{t-1}\hat{a}_i2^{il}$ \quad and \quad $b =
\sum_{i=0}^{t-1}\hat{b}_i2^{il}$.\\
\\
Let $a(x) =\sum_{i=0}^{t-1}\hat{a}_i x^i$ \quad and \quad $b(x) =
\sum_{i=0}^{t-1}\hat{b}_i x^i$.\\




%\begin{theorem}
%Theorem of this section.
%\end{theorem}
%\begin{proof}
%Follows from Lemma \ref{first-lemma} and Theorem \ref{first-theorem}.
%And that completes the proof.
%\end{proof}


\end{document}
