% !TEX root = ../main.tex
\newpage
\section{\theory Mean Field Reductions} \label{sec:MFRs}
The \textsl{mean-field reduction} (\MFR) is a theory that can predict the dynamics of the order parameter \eqref{eq:orderparameter}. In \cite{OttAntonsen2008, OttAntonsen2009, OttAntonsen2010} such a method was published for fully connected networks of indistinguishable oscillators with harmonic coupling. In \cite{Restrepo2014} the authors extended their work to include networks with arbitrary degree distributions, applied to the Kuramoto model. Later this analysis was extended to networks of the Theta Neuron model \cite{OttAntonsen2017}. We will now consider the limit $N \gg 1$ and formulate an exact \MFR for different types of networks, following the method in \cite{OttAntonsen2017}.

\subsection{The Ott-Antonsen manifold}
To simplify notation, the authors incorporate the network size in to $P$ so that $\sum_{\k \in \K} P(\k) = N$. To specify the probability of a link from a node of degree $\kacc$ to one of degree $\k$ we can define an assortativity function:
\begin{align}
a\left(\k_j \rightarrow \k_i \right) = 0 \leq \frac{k^{\rm{out}^{\prime}}_j k^{\rm{in}}_i}{N \kmean} \leq 1 \label{eq:assortativityfunction}
\end{align}
where we have chosen a neutral assortativity \cite{OttAntonsen2017}. \eqref{eq:assortativityfunction} is constrained so that the number of links in the network, $N \kmean$, remains constant \cite{Restrepo2014}:
\begin{align*}
\sum_{\kacc \in \K} \sum_{\k \in \K} P\left( \kacc \right) \: a\left(\kacc \rightarrow \k\right) P\left(\k\right) = N \kmean
\end{align*}
We can now assume that the state of all neurons can be represented by a probability density function $f(\theta, \eta | \k, t)$. Hence, the marginal distribution
\begin{align*}
    \int_{\R} \int_{\mathbb{I}} f(\vartheta, \eta^{\prime} | \k, t) \mathop{d \vartheta} \mathop{d \eta^{\prime}}
\end{align*}
gives the fraction of nodes of degree $\k$ with a phase in $\mathbb{I} \subset \T$ at time $t$. Also, we assume $\eta_i$ do not change over time, so that $\int_{\T} f(\vartheta, \eta^{\prime} | \k, t) \: \mathop{d \vartheta}$ yields the excitability distribution $g(\eta | \k)$. \\

To describe the global synchronisation of the network of theta neurons \eqref{eq:thetaneuronnetwork} we have introduced the order parameter $Z(t)$ in \eqref{eq:orderparameter}. It is now hypothesized that $Z(t)$ can be approximated by a mean-field order parameter, defined by the continuum limit:
\begin{align}
\bar{Z}(t)= \frac{1}{N} \sum_{\k \in \K}P(\k) \int_{\R} \int_{\T} f\left(\vartheta, \eta^{\prime} | \k, t\right) e^{\ic \vartheta} \mathop{d \vartheta} \mathop{d \eta^{\prime}} \label{eq:meanfieldorderparameter}
\end{align}
Here, $f$ is constrained by a continuity equation, as the number of oscillators is conserved:
\begin{align}
\frac{\partial f}{\partial t}+\frac{\partial}{\partial \theta}\left(v_{\theta} f\right) = 0 \label{eq:transportequation}
\end{align}
with $v_{\theta}$ a continuum version of \eqref{eq:thetaneuronnetwork}:
\begin{align*}
v_{\theta} &= (1-\cos \theta)+(1+\cos \theta) \left[\eta + I(\k,t) \right]\\
I(\k,t) &= \frac{\kappa}{\kmean}\sum_{\kacc \in \K} P(\kacc ) \:a\left(\kacc \rightarrow \k \right) \times \left[ \int_{\R} \int_{\T} f\left(\vartheta, \eta^{\prime} | \kacc, t\right) \: a_{2} \left(1-\cos \vartheta\right)^{2} \mathop{d \vartheta} \mathop{d \eta^{\prime}} \right] &
\end{align*}
In \cite{OttAntonsen2008} it is shown that there exists a manifold of invariant probability densities for the continuity equation. The exact \MFR is obtained by expanding $f$ as a Fourier series, and expanding the pulse $\mathcal{P}_s$ using the binomial theorem. When assuming $\eta_i$ is distributed according to a Lorenz distribution:
\begin{align}
g(\eta |\k)=\frac{1}{\pi} \frac{\sigma(\k)}{(\eta-\eta_{0}(\k))^{2}+\sigma(\k)^{2}} \label{eq:Lorentzpdf}
\end{align}
the set of reduced equations then takes a particularly simple form, as \eqref{eq:meanfieldorderparameter} can be evaluated at the poles of $g$ using the Cauchy residue theorem for the integration of complex variables and we find a closed form expression. We can now capture the dynamics by $z(\k,t)$, the mean-field variable for nodes of degree $\k$:
\begin{align}
\frac{\partial z(\k, t)}{\partial t} &= -\ic \frac{(z(\k, t)-1)^{2}}{2} + \frac{(z(\k, t)+1)^{2}}{2} \cdot I(\k, t) \qquad \qquad z \in \C^{M_\k} \nonumber \\
I(\k, t) &= -\sigma(\k) + \ic \eta_{0}(\k) + \ic H_2(\k,t) \label{eq:OttAntonsenSystemFull} \\
H_2(\k,t) &= \frac{\kappa}{\kmean} \sum_{\kacc \in \K} P\left(\kacc\right) \: a\left(\kacc \rightarrow \k\right)  \left( 1 + \frac{z(\kacc, t)^2 + (z(\kacc, t)^c )^2}{6} - \frac{4}{3} \Re(z(\kacc, t)) \right) \nonumber
\end{align}
with $z^c$ the complex conjugate. $H$ is a legacy term and has been computed in \cite{Martens2020}.
The mean-field order parameter can now be expressed in terms of $z(\k,t)$: using the constraints on $f$ and $g$ we can solve \eqref{eq:meanfieldorderparameter} as:
\begin{align}
\bar{Z}(t) &= \frac{1}{N} \sum_{\k \in \K} P(\k) z(\k, t) \qquad \bar{Z} \in \C \label{eq:OttAntonsenMeanField}
\end{align}
which clearly reflects the network architecture through $P(\k)$, as in the limit, this is the number of neurons of degree $\k$ that are present in the network. The mean-field dynamics of the whole network are thus equal to a weighed average of the degree dynamics of each node with unique degree $\k \in \K$.

We have now formulated the evolution on the invariant manifold by a reduced set of ordinary differential equations. The \MFR is computationally efficient, and in \cite{OttAntonsen2017} many methods for improving this efficiency further are treated.

\subsection{Simplifications for fixed-degree networks}
In the case of a fixed-degree network, every node has $\deg (\theta_i) = (\kmean, \kmean)$ so:
\begin{align*}
    \frac{1}{\kmean} \sum_{\kacc \in \K} P\left(\kacc\right) \: a\left(\kacc \rightarrow \k\right) = \frac{1}{\kmean} N \left( \frac{\kmean \kmean}{N \kmean} \right) = 1
\end{align*}
For any fixed-degree network, \cref{eq:OttAntonsenSystemFull,eq:OttAntonsenMeanField} reduce to a single complex differential equation:
\begin{align}
\dot{Z}(t)= -\ic \frac{(Z-1)^2}{2}+\frac{(Z+1)^2}{2} \left(-\sigma+ \ic\eta_{0}
+ \ic \kappa \left(1+\frac{Z^{2} + (Z^c)^{2} }{6} - \frac{4}{3} \Re(Z)\right)\right) \label{eq:MeanField}
\end{align}
This is an identical formulation as in \cite{Luke2013} and \cite{Martens2020}. For any fixed-degree network, the reduced system is thus a complex (two-dimensional) system with three bifurcation parameters $\eta_0, \sigma$ and $\kappa$, \cite{Luke2013, Martens2020}. We will start our analysis with \eqref{eq:MeanField}.\\

Three distinct macroscopic states can be identified. In the partially synchronous rest state (\PSR) we can observe in Figure \ref{fig:MFRPSR}, $Z$ settles onto a stable node. Most neurons can be found in a resting state $\eta_0 + \sigma \lesssim 0$, and inhibit one another through $\kappa < 0$. Most neurons are therefore inactive, though some spiking neurons from the tail of $g$ are present but have a neglegible effect. \\

In Figure \ref{fig:MFRPSS} we can observe the partially synchronous spiking (\PSS) state, where we can see how $Z$ settles onto a stable focus. This happens predominantly when $\eta_0 - \sigma \gtrsim 0$ and most neurons inherently spike, with the coupling being either excitatory or weakly inhibitory. Although most neurons are active, the network is partially synchronous and organized such that phase cancellation occurs by continuous spiking among the neurons.\\

Lastly, in the collective periodic wave state (\CPW) we can observe a limit cycle of the mean field, in Figure \ref{fig:MFRCPW}. Most neurons are active and inhibitory: $\eta_0 > 0$ and $\kappa < 0$. The collective oscillation emerges from the interplay between the neurons’ inherent tendency to spike and the strong suppressive network interaction. \CPW states are mediated through Hopf bifurcations and homoclinic bifurcations of $Z$. We can also see the occurrence of a saddle-node bifurcation in the lower hand corner, for low $\sigma$. We will continue to study the \CPW due to its interesting properties.\\

A more detailed discussion of the different regimes and bifurcations can be found in \cite{Luke2013}.

% \textcolor{red}{QUESTION}: \textsl{I have worked on the analysis presented in \cite{Luke2013} to make my own figures on the bifurcations. However, I cannot seem to get them plotted. Should I continue on this?}

\begin{figure}[H]
\centering
\begin{subfigure}[b]{0.32\linewidth}
   \centering
  \includegraphics[width=\linewidth]{../Figures/PhaseSpace/MFRPSR.pdf}
   \caption{PSR state for $\eta_0 = -0.9, \sigma = 0.8$ and $\kappa= -2$. The mean field settles onto a stable node.}
   \label{fig:MFRPSR}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.32\linewidth}
   \centering
  \includegraphics[width=\linewidth]{../Figures/PhaseSpace/MFRPSS.pdf}
   \caption{PSS state for $\eta_0 = 0.5, \sigma = 0.7$ and $\kappa= 2$. The mean field settles onto a stable focus.}
   \label{fig:MFRPSS}
\end{subfigure} \hfill
\begin{subfigure}[b]{0.32\linewidth}
   \centering
  \includegraphics[width=\linewidth]{../Figures/PhaseSpace/MFRCPW.pdf}
   \caption{CPW state for $\eta_0 = 10.75, \sigma = 0.5$ and $\kappa= -9$. The mean field settles onto a stable limit cycle.}
   \label{fig:MFRCPW}
\end{subfigure}
   \caption{Three macroscopic states observed in the \MFR inside the imaginary unit circle $|Z(t)| \leqslant 1$. Green arrows mark the phase space vector field and blue trails mark solution curves. Red points indicate equilibrium points, with black arrows marking the direction of the eigenvectors in that point, scaled according to the magnitude of the corresponding eigenvalues. This information is found from the Jacobian, which we will discuss in Chapter \ref{sec:MFRSUndirected}.}
   \label{fig:macroscopicstatesfixeddegree}
\end{figure}

\subsection{Implications and challenges of the \MFR}
The advantages of using the \MFR can be found in the number of equations we now have left to investigate. As there are $M_{\k}$ equations in \eqref{eq:OttAntonsenSystemFull}, instead of $N$ equations for $N$ neurons, the reduction becomes more and more efficient for larger networks. As we have seen in \eqref{eq:MeanField} this yields a single equation for a fixed-degree network, as all neurons have the same degree.\\

While the \MFR gives us the opportunity to use any arbitray univariate distribution $P(k)$ for undirected, symmetric networks or any bivariate distribution $P(\k)$ for directed, asymmetric networks, none of the publications on the \MFR have treated directed networks. The challenge there is that the support $\K$ is a much larger set, as $\K = \koutb \times \kinb$. For example, the scale-free distribution \eqref{eq:scalefreepdf} has $M_{\k} = \kmax - \kmin$ number of degrees in its support. An example would be $M_{\k} = $ 1250, \cite{OttAntonsen2017}. For 10.000 neurons, that is a reduction of 87,5\%. When we wish to extend \eqref{eq:scalefreepdf} to a bivariate distribution, $M_{\k}$ grows to $\left( \kmax - \kmin \right)^2$. A bivariate distribution would therefore need about $1.56 \times 10^6$ equations for 10.000 neurons. It is not feasible to solve this many equations at once. Even though it is reported that solving only 10\% of the equations and then interpolating across $z$ and $t$ yields a very good approximation of the whole system, \cite{OttAntonsen2017}, the sheer number of equations remains too high.


\chapter{Multiscale Methods on the Sphere}
\label{ch_mms}

In this chapter, many multiscale decompositions will be built
based on the spherical harmonics and/or the HEALPix representation.

\section{Orthogonal Haar Wavelets on the Sphere}
\label{mrs_haar}
\index{wavelet!Haar on sphere}
\index{sphere!Haar}

The Haar wavelet transform on the sphere \citep{wave:sweldens95a} at each resolution $j$ and pixel $\bk=(k_x,k_y)$ on the sphere
is based on a scaling function $\phi_{j,\bk}$ ($\phi_{j,\bk}(\bx) = \phi\parenth{2^{-j}(\bx-\bk)}$, where $\bx$ is the vector of
Cartesian coordinates on the sphere, and $\phi$ is the Haar scaling function) and three Haar wavelet functions $\psi^{d}_{j,\bk}$ (see~\eqref{def_whaar1})
with $d \in\{1,2,3\}$. It uses the idea that a given pixel on the sphere at a given resolution $j$ in the HEALPix representation
is directly related to four pixels at the next resolution $j-1$.
% For Healpix  pixelisation, resolution of the map is related
% to the  $N_{side}$ parameter,
% which corresponds to the square root of number of pixels in each face.
% $ N_{side} = 2^{j-1}$.  At a given resolution  $j$ we have $n_j=12 \times 4^{j-1}$ pixels with a surface size $\mu_j$.

Noting, $\bk_0$, the pixel. The scaling function $\phi$ and three wavelet functions $\psi$ are defined by:
\begin{eqnarray}
\label{def_whaar1}
\phi_{j,\bk}(\bx) & = & \left\{  \begin{array}{ll}
1 & \textrm{if $t \in S_{j,\bk}$ }\\
0 & \textrm{otherwise}
   \end{array} \right.  \nonumber \\
\psi_{1,j+1,\bk} & = & \frac{\phi_{j,\bk_0} +\phi_{j,\bk_2}-\phi_{j,\bk_1}-\phi_{j,\bk_3} }{4}  \nonumber \\
\psi_{2,j+1,\bk} & = & \frac{\phi_{j,\bk_0} +\phi_{j,\bk_1}-\phi_{j,\bk_2}-\phi_{j,\bk_3} }{4}  \nonumber \\
\psi_{3,j+1,\bk} & = & \frac{\phi_{j,\bk_0} +\phi_{j,\bk_3}-\phi_{j,\bk_1}-\phi_{j,\bk_2} }{4}
\end{eqnarray}

% \begin{figure}[htb]
%\centering
%\includegraphics[width=10cm]{fig_haar_decomp.pdf}
%\label{fig_haar_decomp}
%\caption{On resolution to next using Haar.}
%\end{figure}

% \begin{figure*}
% \vbox{
% \centerline{
% \hbox{
% \includegraphics[angle=180,width=7cm]{haar0.pdf}
% \includegraphics[angle=180,width=7cm]{haar1.pdf}
% }}\centerline{
% \hbox{
% \includegraphics[angle=180,width=7cm]{haar2.pdf}
% \includegraphics[angle=180,width=7cm]{haar3.pdf}
% }}
% \centerline{
% \hbox{
% \includegraphics[angle=180,width=7cm]{haar4.pdf}
% \includegraphics[angle=180,width=7cm]{haar5.pdf}
% }}
% }
% \label{fig_haar_decomp2}
% \caption{Haar wavelet  coefficents.}
% \end{figure*}

Denoting $\bk_0,\bk_1,\bk_2,\bk_3$ the four pixels at scale $j$, hierarchically related to the pixel $\bk$ at scale $j+1$,
scaling coefficients $c_{j+1,\bk}$ at scale $j+1$ are derived from those at scale $j$ by:
\begin{eqnarray}
\label{def_haar1}
c_{j+1}[\bk] &=& \frac{1}{4} \sum_{d=0}^3 c_{j} [\bk_d],
\end{eqnarray}
and wavelet coefficients at scale $j+1$ from coefficients at scale $j$ by:
\begin{eqnarray}
\label{def_haar2}
w^{1}_{j+1} [\bk] &=& \frac{1}{4} (c_{j}[\bk_0]+c_{j} [\bk_2] - c_{j} [\bk_1]-c_{j}[\bk_3])  \nonumber  \\
w^{2}_{j+1} [\bk] &=& \frac{1}{4} (c_{j}[\bk_0]+c_{j} [\bk_1] - c_{j} [\bk_2]-c_{j}[\bk_3])  \nonumber  \\
w^{3}_{j+1} [\bk] &=& \frac{1}{4} (c_{j}[\bk_0]+c_{j} [\bk_3] - c_{j} [\bk_1]-c_{j}[\bk_2]) .
\end{eqnarray}

% Fig. \ref{fig_haar_decomp} shows the calculation scheme of haar coefficients, from one resolution to the next.
% Haar wavelet coefficients for the astronomical WMAP data set are shown in Fig. \ref{fig_haar_decomp2}.

The Haar wavelet transform on the sphere is orthogonal and its reconstruction is exact. The inverse transformation is obtained by:
\begin{eqnarray}
\label{def_recons_haar}
c_0[\bx] = \sum_{\bk}  c_{J}[\bk]  \phi_{J,\bk}(\bx) + \sum_{j=1}^{J} \sum_{d=1}^3 \sum_{\bk} w^{d}_{j}[\bk]  \psi^d_{j}(\bx) .
\end{eqnarray}

This transform is very fast but its interest is relatively limited. Indeed, it is not rotation invariant, and more importantly
the Haar wavelet shape is not well adapted for most applications, because of the non-regular shape of the wavelet function.

% ===============================================

\section{Continuous Wavelets on the Sphere}

\subsection{Stereoscopic Projection}
\label{chap_mex_hat}

\index{wavelet!axisymmetrical wavelets}
\index{wavelet!stereoscopic projection}

\begin{figure}[htb]
\centering
\includegraphics[width=15cm]{proj_stereo_inverse.pdf}
\caption{Inverse stereographic projections of a radial function from plane to the sphere.}
\label{figprojstereo_direct}
\end{figure}

In order to have more choice to design the wavelet function, we may want to use wavelets defined for regular 2D images to the sphere.
This is possible by using inverse stereographic projections of radial wavelet functions such the Mexican hat \citep{wave:cayon01}.
Defining the stereographic projection operator, $\bR: {\bf t} \mapsto \ {\boldsymbol \omega}$, with ${\boldsymbol \omega} = (\theta(r),\vartheta)$,
$\theta(r) = 2 \arctan(r/2)$, the radial wavelets $\psi_{\mathrm{plane}}$ can be projected on the sphere by a unique rotation,
${\boldsymbol \omega}_0 =(\theta_0,\vartheta_0)$, respectively around the two axes $O_y$ and $O_z$. Fig.~\ref{figprojstereo_direct} shows
the projection of radial functions from the plane to the sphere.

The convolution on the sphere between a radial wavelet function $\psi(\theta)$ and a function $f({\boldsymbol \omega})$ is:
 \begin{eqnarray}
\label{convol_sph}
(\psi \ast f)(\theta,\vartheta)= \int_{S^2} \psi_{\mathrm{plane}}^* (\bR^{-1}  {\boldsymbol \omega}) f({\boldsymbol \omega}) d{\boldsymbol \omega} .
\end{eqnarray}

Such wavelets are axisymmetric by construction. This property can be used to derive fast transformation algorithms using spherical harmonics.
Indeed spherical harmonics coefficients $\hat{\psi}[l,m]$ of the wavelet function $\psi$ on the sphere are equal to zero when $m \neq 0$,
and by the Funk-Hecke theorem, the convolution can be written using spherical harmonics by:
\begin{eqnarray}
\label{convol_sph_harm}
(\psi \ast f)(\theta,\vartheta)  =  \sum_{l=0}^{\infty} \sum_{m=-l}^{l} \sqrt{\frac{2l+1}{4\pi} }\hat{f}[l,m] \hat{ \psi}[l,0] Y_{lm}(\theta,\vartheta) ~.
\end{eqnarray}
where $\hat{f}[l,m]$ are the spherical harmonics coefficients of the function $f$,\\
i.e. $f = \sum_{l=0}^{\infty}\sum_{m=-l}^{l} \hat{f}[l,m] Y_{lm}$ and similary for $\hat{\psi}$.

Classical wavelet dilations can also be derived on the sphere using the dilation operator $\mathscr{D}_a$ by a factor $a > 0$ \citep{wiaux07}:
\begin{eqnarray}
\label{proj_stereo}
\mathscr{D}_a(f)({\boldsymbol \omega}) = \chi_a^{1/2} (a,\theta)  f(D^{-1}_a {\boldsymbol \omega}) ,
\end{eqnarray}
where $D_a(\theta,\vartheta)=(\theta_a(\theta),\vartheta)$ with the linear relation $\tan\theta_a(\theta)/2=a\tan\theta/2$,
and $D_a$ is the dilation operator that maps a sphere without its South pole on itself. $\chi_a^{1/2}(a,\theta)$ is a norm
preservation term (i.e. $\mathscr{D}_a$ is unitary):
\begin{eqnarray}
\label{def_lambda}
\chi_a^{1/2}(a,\theta) = a^{-1}[1+\tan^2(\theta/2)]/[1+a^{-2}\tan^2(\theta/2)] ~.
\end{eqnarray}

% \begin{figure*}
% \centering
% \includegraphics[width=9cm]{proj_stereo.pdf}
% \caption{Projection st\'er\'eographique inverse sur la sphere.}
% \label{figprojstereo}
% \end{figure*}

\subsection{Mexican Hat Wavelet}

\index{sphere!mexican hat}
\index{Mexican hat!on sphere}

\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
\includegraphics[angle=180,width=7.9cm]{wav_mex_hat_0.pdf}
\includegraphics[angle=180,width=7.9cm]{wav_mex_hat_1.pdf}
}}\centerline{
\hbox{
\includegraphics[angle=180,width=7.9cm]{wav_mex_hat_2.pdf}
\includegraphics[angle=180,width=7.9cm]{wav_mex_hat_3.pdf}
}}
}
\caption{Mexican hat on the sphere for the dilation parameter equal to $a = \{1,2,4,8\}$.}
\label{fig_wav_mex_hat}
\end{figure}

% \begin{figure}[htb]
% \vbox{
% \centerline{
% \hbox{
% \includegraphics[angle=180,width=6.5cm]{mex_hat_0.pdf}
% \includegraphics[angle=180,width=6.5cm]{mex_hat_1.pdf}
% }}\centerline{
% \hbox{
% \includegraphics[angle=180,width=6.5cm]{mex_hat_8.pdf}
% \includegraphics[angle=180,width=6.5cm]{mex_hat_20.pdf}
% }}
% }
% \caption{Cosmic Microwave Background (CMB) simulated map and its mexican hat wavelet transform
% with dilation parameter $a = \{1,8,20\}$.}
% \label{fig_trans_cmb_wav_mex_hat}
% \end{figure}

The 2D Mexican hat wavelet transform is the second derivative of a Gaussian:
\begin{equation}
\label{rad_mexhat}
\psi(r) = \frac{1}{\sqrt{2 \pi}} \frac{1}{a} \Big( 2 - \Big( \frac{r}{a} \Big)^2 \Big) e^{- \frac{r^2}{2a^2}}
\end{equation}
where  $a$ is a scale factor parameter and $r$ the distance to the wavelet center.

Using the inverse stereographic projection, it is possible to extend the Mexican hat wavelet
on the sphere  \citep{wave:antoine99,wave:tenerio99,wave:cayon01,wave:holschneider96,wave:vielva04}:
\begin{equation}
\psi_a (r) = \frac{1}{\sqrt{2 \pi} C_a} \Big( 1 +  \Big( \frac{r}{2} \Big)^2 \Big)^2   \Big( 2 - \Big( \frac{r}{a} \Big)^2 \Big) e^{- \frac{r^2}{2a^2}}
\end{equation}
where $a$ is a scale factor, $C_a$ is a normalization term $C_a = a \Big( 1 + \frac{a^2}{2} + \frac{a^4}{4} \Big)^{\frac{1}{2}}$,
and $r$ is the distance on the tangent plane, which is related to the polar angle $\theta$ through $r = 2 \textrm{tan} \frac{\theta}{2}$.
This transform may be useful to analyze the data, but it does not have a reconstruction operator, and can therefore not be used for
restoration applications.

Fig.~\ref{fig_wav_mex_hat} shows the Mexican hat wavelet on the sphere for four different scales.
%  and Fig ~\ref{fig_trans_cmb_wa_mex_hat}  shows four scales for the a simulated CMB map.

\subsection{Directional Wavelets}
\label{dirwavelet}
\index{wavelet!directional wavelets}

% \index{sphere!directionnal wavelet}

\begin{figure}[htb]
\centering
\includegraphics[width=15cm]{projection_stereo_ondelette_directionnelle.pdf}
\caption{Inverse stereographic projections  of a  directional wavelet on the sphere.}
\label{figprojstereo_direct2}
\end{figure}

To study anisotropic structures, the previously described continuous wavelet transform can be extended to directional wavelets \citep{wave:antoine01,vielva06,McEwen08}.
Fig.~\ref{figprojstereo_direct2} shows the projection of an elliptic function from the plane to the sphere.

\subsubsection{Elongated Mexican Hat Wavelet}
\index{wavelet!mexican hat}

\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
\includegraphics[angle=180,width=7.7cm]{dir_mex_hat_0.pdf}
\includegraphics[angle=180,width=7.7cm]{dir_mex_hat_1.pdf}
}}\centerline{
\hbox{
\includegraphics[angle=180,width=7.7cm]{dir_mex_hat_2.pdf}
\includegraphics[angle=180,width=7.7cm]{dir_mex_hat_3.pdf}
}}
\centerline{
\hbox{
\includegraphics[angle=180,width=7.7cm]{dir_mex_hat_4.pdf}
\includegraphics[angle=180,width=7.7cm]{dir_mex_hat_5.pdf}
}}
}
\caption{Elongated Mexican hat on the sphere for the dilation parameter equal to $a_x= 1$ and $a_y = \{0.5,1.,1.25,1.5,2,4\}$.}
\label{fig_dir_mex_hat}
\end{figure}

The elongated Mexican hat wavelet can be written as:
\begin{multline}
\label{directional_hat}
\psi_{a_x, a_y}(\theta, \vartheta) = \sqrt{\frac{2}{\pi}} C(a_x,a_y) \parenth{1+ \tan^2 \frac{\theta}{2}} \bigg( 1- \frac{4 \tan^2 \theta/2 }{a_x^2+a_y^2} \Big(\frac{a_y^2}{a_x^2} \cos^2 \vartheta \\
+  \frac{a_x^2}{a_y^2} \sin^2 \vartheta\Big) \bigg)  e^{-2 \tan \frac{\theta}{2}(\cos^2 \vartheta / a^2_x + \sin^2 \vartheta / a^2_y  )} ~
\end{multline}
where $a_x$ and $a_y$ are the dilation factors along the two axes $O_x$ and $O_y$, $C(a_x,a_y)$ is a normalization constant defined as
\begin{eqnarray}
\label{directional_hat_norm}
C(a_x,a_y)& =& (a_x^2+a_y^2) \parenth{a_x a_y (3a_x^4+ 3a_y^4+2a_xa_y)}^{-1/2} ~
\end{eqnarray}

Fig.~\ref{fig_dir_mex_hat} shows the wavelet functions for different dilation parameters $a_x$ and $a_y$.

\subsubsection{Morlet Wavelet}
\index{wavelet!Morlet}

\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
\includegraphics[angle=180,width=7.9cm]{dir_morlet_0.pdf}
\includegraphics[angle=180,width=7.9cm]{dir_morlet_1.pdf}
}}\centerline{
\hbox{
\includegraphics[angle=180,width=7.9cm]{dir_morlet_2.pdf}
\includegraphics[angle=180,width=7.9cm]{dir_morlet_3.pdf}
}}
}
\caption{Morlet wavelets on the sphere for the parameter  $\bk$ equal to  (2,0), (4,0), (6,6) et (9,1).}
\label{fig_dir_morlet}
\end{figure}

The Morlet wavelet on the sphere, derived from the stereographic projection of the 2D function on the plane, is:
\begin{equation}
\label{real_morlet}
\psi_{a_x, a_y, {\bf k}}(\theta, \vartheta) = \sqrt{\frac{2}{\pi}} C({\bf k}) (1+ \tan^2 \frac{\theta}{2}) \bigg(\cos \frac{ {\bf k} \cdotp R^{-1} {\bf x} }{\sqrt{2}} - e^{- |{\bf k}|^2/4} \bigg) e^{-2 \tan^2(\theta/2)}
\end{equation}
with $R^{-1} {\bf x} = (2 \tan (\theta/2) \cos \vartheta,2 \tan (\theta/2) \sin \vartheta)$, ${\bf k}=(k_x,k_y)$, $|{\bf k}|^2 = k_x^2 + k_y^2$,
and $C({\bf k}) = (1+3e^{-|{\bf k}|^2/2} -4e^{-3 |{\bf k}|^2/8})^{-1/2} $. ${\bf k}$ allows us to control the oscillations of the wavelet functions.\\ \\
Fig.~\ref{fig_dir_morlet} shows the Morlet wavelet for ${\bf k}$ equal respectively to $(2,0)$, $(4,0)$, $(6,6)$ and $(9,1)$.\\

Continuous wavelet transforms have been intensively used in astrophysics, mainly to analyze the Cosmic Microwave Background \citep{wave:vielva04}.
Directional wavelets based on steerable filters were also proposed in \citep{wiaux06,McEwen08}. We present in the following a set of multiscale
decompositions on the sphere which have a fast exact inverse transform, and are therefore suitable for many applications such as restoration.

%===============================================================

\section{Redundant Wavelet Transform on the Sphere with Exact Reconstruction}
\label{sect_wts}
%We show in this section that we can build  wavelet transforms on the sphere, based on the spherical harmonics transform, ewhich have an exact reconstruction and can therefore be easily used in different applications.

\subsection{Isotropic Undecimated Wavelet Transform on the Sphere}
Here an undecimated isotropic transform (UWTS) is described which is similar in many respects to the undecimated isotropic transform
\citep{starck2010,starck:sta06}, and will therefore be a good candidate for restoration applications. Its isotropy is a favorable
property when analyzing isotropic features. This isotropic transform is obtained using a scaling function ${\phi}_{l_c}(\theta, \vartheta)$
with cut-off frequency  $l_c$ and  azimuthal symmetry, meaning that ${\phi}_{l_c}$ does not depend on the azimuth $\vartheta$.
Hence the spherical harmonics coefficients $\hat {\phi}_{l_c} [l,m]$ of ${\phi}_{l_c}$ vanish when $m \ne 0$ so that:
\begin{eqnarray}
{\phi}_{l_c}(\theta, \vartheta)= {\phi}_{l_c}(\theta) = \sum_{l = 0}^{l = l_c} \hat  {\phi}_{l_c} [l,0] Y_{l0}(\theta, \vartheta) .
\end{eqnarray}
Then, convolving a function $f(\theta, \vartheta) \in L_2(S^2)$ with ${\phi}_{l_c}$ is greatly simplified
and the spherical harmonics coefficients of the resulting map $c_0$ are readily given by
\begin{eqnarray}
 \hat c_{0}[l,m] = \widehat{{\phi}_{l_c} * f} [l,m] = \sqrt{\frac{2l+1}{4\pi} } \hat {\phi}_{l_c} [l,0] \hat f[l,m]  .
\end{eqnarray}
\index{sphere!undecimated wavelet}

\subsubsection{From One Resolution to the Next}

A sequence of smoother approximations of $f$ on a dyadic resolution scale can be obtained using the scaling function ${\phi}_{l_c}$ as follows:
\begin{eqnarray}
\begin{split}
c_0   & = &  {\phi}_{ l_{c} }  \ast f        \\
c_1   & = &  {\phi}_{2^{-1} l_{c} }   \ast f    	   \\
&\ldots&\\
c_j    &=&   {\phi}_{2^{-j}  l_{c}  }  \ast f  ,
\end{split}
\end{eqnarray}
where ${\phi}_{2^{-j} l_{c} }$ is a rescaled version of ${\phi}_{l_{c}}$. The above multiresolution sequence can actually  be obtained recursively.

Define a low pass filter $h_{j}$ for each scale $j$  by:
\begin{eqnarray}
 \widehat{H}_{j}[l,m]  & = & \sqrt{\frac{4\pi}{2l+1} }  \hat h_{j}[l,m]   \nonumber  \\
   &  = &
   \begin{cases}
   \frac {   \hat \phi_{\frac{l_{c}}{2^{j+1}} }[l,m]   }   {  \hat  \phi_{  \frac{l_{c}}{2^{j}} }[l,m]   } & \mbox{if }  l  < \frac{ l_{c}} {2^{j+1}} \quad \textrm{and}\quad m = 0 , \\
   0 & \mbox{otherwise } .
  \end{cases}
\end{eqnarray}
It is then easily shown that $c_{j+1}$ derives from $c_j$ by convolution on the sphere with $h_j$:  $c_{j+1} = c_{j} \ast h_j$.

\subsubsection{The Wavelet Coefficients}

Given an axisymmetric  wavelet function $\psi_{l_c}$, we can derive in the same way a
high pass filter $g_j$ on each scale~$j$:
\begin{eqnarray}
 \widehat{G}_{j}[l,m]  & = & \sqrt{\frac{4\pi}{2l+1} }  \hat{g}_{j}[l,m] \nonumber  \\
   & = &
  \begin{cases}
  \frac {   \hat \psi_{\frac{l_{c}}{2^{j+1}} }[l,m]   }   {  \hat  \phi_{  \frac{l_{c}}{2^{j}} }[l,m]   } & \mbox{if }  l  < \frac{ l_{c}} {2^{j+1}} \quad \textrm{and}\quad m = 0 ,\\
1 &\mbox{if }  l  \ge \frac{ l_{c}} {2^{j+1}} \quad \textrm{and}\quad m = 0 ,\\
0&  \mbox{otherwise } .
  \end{cases}
\end{eqnarray}
From this definition, the wavelet coefficients $w_{j+1} $ at scale $j+1$ are obtained from the previous scaling coefficients $c_j$
by a simple convolution on the sphere with $g_j$: $w_{j+1} = c_{j} \ast g_j$.

As in the standard 2D isotropic undecimated transform algorithm, the wavelet coefficients can be defined as the difference between two consecutive resolutions,
$w_{j+1}(\theta, \vartheta) = c_{j}(\theta, \vartheta) - c_{j+1}(\theta, \vartheta)$. This defines a zonal wavelet function $\psi_{l_c}$ as:
\begin{eqnarray}\label{wavelet}
\hat \psi_{\frac{l_c}{2^{j}}}[l,m] = \hat \phi_{\frac{l_c}{2^{j-1}}} [l,m]  - \hat \phi_{\frac{l_c}{2^{j}}}[l,m] .
\end{eqnarray}
The high pass filters $g_j$ associated with this wavelet are expressed as:
\begin{eqnarray}
\begin{split}
\widehat{G}_{j}[l,m]  & = \sqrt{\frac{4\pi}{2l+1} } \hat{g}_{j}[l,m]  \\
                  & = 1 - \sqrt{\frac{4\pi}{2l+1} } \hat{h}_j[l,m]   =   1 - \widehat{H}_j[l,m] .
\end{split}
\end{eqnarray}
Obviously other wavelet functions could be used just as well. For example, we can define the wavelet function as the difference between
the squares of the scaling functions \cite{starck:book98}, i.e. $\hat \psi^2_{\frac{l_c}{2^{j}}}[l,m] = \hat \phi^2_{\frac{l_c}{2^{j-1}}} [l,m]  - \hat \phi^2_{\frac{l_c}{2^{j}}}[l,m]$.

\newpage
\subsubsection{Choice of the Scaling Function}
\index{wavelet!needlet}
\index{wavelet!Meyer}

\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
\includegraphics[width=15cm,height=5cm]{fig_sphere_filterbank1.pdf}
% \includegraphics[width=14cm,height=5cm]{ch1_diff_uv_phi_psi.pdf}
}}}
\caption{On the left, spherical harmonics coefficients $\hat{{\phi}}[l,0]$ of the the scaling function ${{\phi}}$ and, on the right, those of the wavelet function ${\psi}$.}
\label{fig_diff_uv_phi_psi}
\end{figure}

\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
 \includegraphics[width=7.5cm]{fig_splinew.png}%[width=6.5cm,height=3.9cm]
 \includegraphics[width=7.5cm]{fig_needletw.png}
}}
\centerline{
\hbox{
 \includegraphics[width=7.5cm, trim= 2cm 14cm 2cm 2cm, clip=]{fig_splinew_versus_needletw.pdf}
 \includegraphics[width=7.5cm, trim= 2cm 14cm 2cm 2cm, clip=]{fig_abssplinew_versus_absneedletw.pdf}
}}
\centerline{
\hbox{
\includegraphics[width=7.5cm, trim= 2cm 14cm 2cm 2cm, clip=]{fig_meyerw_versus_needletw.pdf}
\includegraphics[width=7.5cm, trim= 2cm 14cm 2cm 2cm, clip=]{fig_absmeyerw_versus_absneedletw.pdf}
}}
}
\caption{Comparaison between spline, needlet, and Meyer wavelet functions on the sphere.}
\label{Figure:cmp_needlet}
\end{figure}

Any function with a cut-off frequency is a possible candidate. The
B-spline function of order 3 \citep{starck2010,starck:sta06} leads to :
\begin{eqnarray}
{\hat{\phi}}_{l_c} [l,m] = \frac{3}{2} B_{3}  \left(  \frac{2l}{l_{c}} \right)
\end{eqnarray}
where $B_3(t)$ is the scaling function:
\begin{equation}
B_3(t) = \frac{1}{12}({\mid{t-2}\mid}^3 - 4 {\mid{t-1}\mid}^3 + 6 {\mid{t}\mid}^3 - 4 {\mid{t+1}\mid}^3 + {\mid{t+2}\mid}^3)
\end{equation}

In Fig.~\ref{fig_diff_uv_phi_psi} the spherical harmonics coefficients of the scaling function derived from a B$_3$-spline,
and those of the associated wavelet function \eqref{wavelet}, are plotted as a function of $l$. Other functions such as
Meyer wavelets or the needlet function \citep{marinucci08} can be used as well.

Meyer and needlet wavelet functions have both a much better frequency localization than the wavelet function derived from the  B$_3$-spline,
and, as nothing is perfect, the price to pay is more oscillations in the direct space. To illustrate this, we
show in Fig.~\ref{Figure:cmp_needlet} different wavelet functions.  Top left and right shows the respectively the spline and the needet wavelet function at a given scale. Fig.~\ref{Figure:cmp_needlet}~middle left shows a cut of the healpix face with contains the previous functions. Middle right is the same functions, but we have plotted the absolute value in order to better visualize their respective ringing.
As it can be seen, for wavelet functions with the same main lob, the needlet wavelet oscillate much more than the spline wavelet.  Fig.~\ref{Figure:cmp_needlet}~bottom left and right compares   Meyer and  needlet functions. They are relatively close and share
the same property of good frequency localization, but with more oscillations than the spline wavelet function.
Hence, the best wavelet choice certainly depends on the final applications. For statistical analysis, detection or restoration applications,
we may prefer to use a wavelet which does not oscillate too much and with a smaller support, and the spline wavelet is clearly the
correct choice. For spectral or bispectral analysis, where the frequency localization is fundamental, then Meyer or needlet shoud be
preferred to the spline wavelet.

\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
 \includegraphics[width=7.5cm]{fig_mars.png}%[width=6.5cm,height=3.9cm]
 \includegraphics[width=7.5cm]{fig_mars_scale1.png}
}}
\centerline{
\hbox{
 \includegraphics[width=7.5cm]{fig_mars_scale2.png}
 \includegraphics[width=7.5cm]{fig_mars_scale3.png}
}}
\centerline{
\hbox{
\includegraphics[width=7.5cm]{fig_mars_scale4.png}
\includegraphics[width=7.5cm]{fig_mars_scale5.png}
}}
}
\caption{Mars topographic map and its UWTS (four wavelet detail scales and the scaling (smooth) band).}
\label{Figure:UWTS}
\index{data!Mars topography}
\end{figure}

The steps of the UWT on the sphere of a discrete image $X$ sampled from $f$ are summarized in Algorithm~\ref{algo_uwts}.
If the wavelet function corresponds to the choice \eqref{wavelet}, Step 3 in this UWTS algorithm reduces to $w_{j+1} = c_{j} - c_{j+1}$.

% Their corresponding conjugate low pass and high pass filters $h$ and $g$ are plotted in Fig.~\ref{fig_diff_uv_ht_gt}.

{\linespread{1}
\begin{algorithm}[h]
\caption{The Undecimated Wavelet Transform on the Sphere.}
\label{algo_uwts}
\noindent{\bf Task:} Compute the UWTS of a discrete $X$.\\
\noindent{\bf Parameters:} Data samples $X$ and number of of wavelet scales $J$.\\
\noindent{\bf Initialization:}
\begin{itemize}
\item $c_0=X$.
\item Compute the B$_3$-spline scaling function and derive $\hat{\psi}$, $\widehat{H}$ and $\widehat{G}$ numerically.
\item Compute the corresponding spherical harmonics transform of $c_0$.
\end{itemize}
\For{$j=0$ to $J-1$} {
\begin{enumerate}[1.]
\item Compute the spherical harmonics transform of the scaling coefficients:  $\hat{c}_{j+1}=\hat{c}_j\widehat{H}_{j}$.
\item Compute the inverse spherical harmonics transform of $\hat{c}_{j+1}$ to get $c_{j+1}$.
\item Compute the spherical harmonics transform of the wavelet coefficients:  $\hat{w}_{j+1}=\hat{c}_j\widehat{G}_{j}$.
\item Compute the inverse spherical harmonics transform of $\hat{w}_{j+1}$ to get $w_{j+1}$.
\end{enumerate}
}
\noindent{\bf Output:} ${\cal W}=\{w_1, w_2, \dots, w_{J}, c_{J}\}$ the UWTS of $X$.
\end{algorithm}
}

Fig.~\ref{Figure:UWTS} shows the Mars topographic map (top left)
\footnote{The Mars Orbiter Laser Altimeter (MOLA) generated altimetry profiles used to create global topographic maps. The MOLA instrument stopped acquiring altimetry data on June 30, 2001, and after that operated in passive radiometry mode until the end of the Mars Global Surveyor mission. MOLA data sets are produced by the MOLA Science Team and archived by the PDS Geosciences Node.} and its wavelet transform, using five scales (four wavelet scales + coarse scale). The sum of the five scales reproduces exactly the original image.
\index{Mars Orbiter Laser Altimeter}

\subsubsection{Inverse Transform}

If the wavelet is the difference between two resolutions, a straightforward reconstruction of an image from its wavelet coefficients ${\cal W} = \{w_1,\dots, w_{J}, c_{J}\}$ is:

\begin{eqnarray}
 c_{0}(\theta, \vartheta) = c_{J}(\theta, \vartheta) + \sum_{j=1}^J  w_j(\theta, \vartheta) .
\end{eqnarray}
This reconstruction formula is the same as with the 2D undecimated isotropic wavelet algorithm (i.e. with \`a trous agorithm).

\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
\includegraphics[width = 15cm, height = 5cm]{fig_sphere_filterbank2.pdf}
% \includegraphics[width=14.5cm,height=5cm]{ch1_diff_uv_ht_gt.pdf}
}}}
\caption{On the left, the filter $\hat{\tilde{h}}$, and on the right the
filter $\hat{\tilde{g}}$.}
\label{fig_diff_uv_ht_gt}
\end{figure}

But since the transform is redundant there is actually no unique way to reconstruct an image from its coefficients see~\citep{starck:sta06}. Indeed, using the relations:
\begin{eqnarray}
\begin{split}
\hat c_{j+1}[l,m] = \widehat H_{j} [l,m]  \hat c_{j} [l,m] \\
\hat w_{j+1}[l,m] = \widehat G_{j} [l,m] \hat c_{j} [l,m]
\end{split}
\end{eqnarray}
a least-squares estimate of $c_j$ from $c_{j+1}$ and $w_{j+1}$ gives:
\begin{eqnarray}
\hat{c}_{j}   = \hat{c}_{j+1}  {\widehat {\tilde H}}_{j}   + \hat{w}_{j+1}  {\widehat {\tilde G}}_{j} ~,
\end{eqnarray}
where the dual filters $\tilde h$ and $\tilde g$ satisfy:
\begin{eqnarray}
\label{eqnht}
\begin{split}
{\widehat {\tilde H}}_j =  \sqrt{\frac{4\pi}{2l+1} } {\hat {\tilde h}}_j & = {\widehat H}_{j}^* /
\parenth{\big|{\widehat H}_{j}\big|^2 + \big|{\widehat G}_j\big|^2} \\
{\widehat {\tilde G}}_j =  \sqrt{\frac{4\pi}{2l+1} } {\hat {\tilde g}}_j & = {\widehat G}_{j}^* /
\parenth{\big|{\widehat H}_j\big|^2 + \big|{\widehat G}_j\big|^2} .
\end{split}
\end{eqnarray}
For the scaling function which is a B$_3$-spline function and a wavelet taken as the difference between two resolutions,
the corresponding conjugate low pass and high pass filters $\widehat {\tilde H}$ and $\widehat {\tilde G}$ are plotted in Fig.~\ref{fig_diff_uv_ht_gt}.
The reconstruction algorithm is given in Algorithm~\ref{algo_iuwts}.

{\linespread{1}
\begin{algorithm}[h]
\caption{Inverse UWT on the sphere.}
\label{algo_iuwts}
\noindent{\bf Task:} Reconstruct an image from its UWTS coefficients.\\
\noindent{\bf Parameters:} UWTS coefficients ${\cal W}=\{w_1, w_2, \dots, w_{J}, c_{J}\}$.\\
\noindent{\bf Initialization:}
\begin{itemize}
\item Compute the B$_3$-spline scaling function and derive $\hat{\psi}$, $\widehat{H}$, $\widehat{G}$, $\widehat{\tilde H}$ and $\widehat{\tilde G}$ numerically.
\item Compute the spherical harmonics transform of $c_J$ to get ${\hat c}_J$.
\end{itemize}
\For{$j=J-1$ to $0$, with step $=-1$} {
\begin{enumerate}[1.]
\item Compute the spherical harmonics transform of the wavelet coefficients $w_{j+1}$ to get $\hat{w}_{j+1}$.
\item Multiply $\hat{c}_{j+1}$ by ${\widehat {\tilde H}}_{j}$.
\item Multiply $\hat{w}_{j+1}$ by ${\widehat {\tilde G}}_{j}$.
\item Get the spherical harmonics of $\hat{c}_j=\hat{c}_{j+1}+\hat{w}_{j+1}$.
\end{enumerate}
}
Compute The inverse Spherical Harmonics transform of $\hat c_0$.\\
\noindent{\bf Output:} $c_0$ is the inverse UWT on the sphere.
\end{algorithm}

\begin{figure}[htb]
\centerline{
\hbox{
\includegraphics[width = 12cm,angle = 90]{fig_backwt_sphere.pdf}
}}
\caption{Reconstruction from a single wavelet coefficient at different scales. Each map is obtained by setting all wavelet coefficients to zero but one, and by applying an inverse UWTS. Depending on the position and scale of the non-zero coefficient, the reconstructed map shows an isotropic feature
at different scales and positions.}
\label{Figure:back_wt}
\end{figure}
}
Fig.~\ref{Figure:back_wt} shows the reconstruction by setting all wavelet coefficients but one at different scales and positions.
Depending on the position and scale of the non-zero coefficient, the reconstructed map shows an isotropic feature at different scales and positions.

%-------------------------

\subsection{Isotropic Pyramidal Wavelet Transform on the Sphere}
\index{wavelet!pyramidal transform}
\index{sphere!pyramidal wavelet}

\subsubsection{Forward Transform}
In the previous algorithm, no down-sampling is performed and each scale of the wavelet decomposition has the same number of pixels
as the original data set. Therefore the number of pixels in the decomposition is equal to the number of pixels in the data multiplied
by the number of scales. For some applications, we may prefer to introduce a decimation in the decomposition so as to reduce the
required memory size and the computation time. This can be done easily by using a specific property of the chosen scaling function.
Indeed, since we are considering here a scaling function with an initial cut-off $l_c$ in spherical harmonic multipole number $l$,
and since the actual cut-off is reduced by a factor of two at each step, the number of significant spherical harmonics coefficients
is then reduced by a factor of four after each convolution with the low pass filter $h$. Therefore, we need less pixels in the direct
space when we compute the inverse spherical harmonics transform. Using the HEALPix pixelization scheme \citep{pixel:healpix},
this can be done easily by dividing by 2 the $N_{\mathrm{side}}$ parameter when calling the inverse spherical harmonics transform routine.
The pyramidal wavelet transform on the sphere algorithm is given in Algorithm~\ref{algo_pwts}.

{\linespread{1}
\begin{algorithm}[h]
\caption{Pyramidal wavelet transform on the sphere.}
\label{algo_pwts}
\noindent{\bf Task:} Compute the pyramidal WT on the sphere of a discrete image $X$.\\
\noindent{\bf Parameters:} Data $X$ and number of of wavelet scales $J$.\\
\noindent{\bf Initialization:}
\begin{itemize}
\item $c_0=X$.
\item Compute the B$_3$-spline scaling function and derive $\hat{\psi}$, $\widehat{H}$ and $\widehat{G}$ numerically.
\item Compute the corresponding spherical harmonics transform of $c_0$.
\end{itemize}
\For{$j=0$ to $J-1$} {
\begin{enumerate}[1.]
\item Compute the spherical harmonics transform of the scaling coefficients:  $\hat{c}_{j+1}=\hat{c}_j\widehat{H}_{j}$.
\item Compute the inverse spherical harmonics transform of $\hat{c}_{j+1}$ to get $c_{j+1}$.
\item Down-sample $c_{j+1}$, since its support in the spherical harmonic domain has been divided by two.
\item Compute the spherical harmonics transform of the wavelet coefficients:  $\hat{w}_{j+1}=\hat{c}_j\widehat{G}_{j}$.
\item Compute the inverse spherical harmonics transform of $\hat{w}_{j+1}$ to get $w_{j+1}$.
\end{enumerate}
}
\noindent{\bf Output:} ${\cal W}=\{w_1, w_2, \dots, w_{J}, c_{J}\}$ the Pyramidal WT on sphere of $X$.
\end{algorithm}
}

\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
 \includegraphics[width=7.5cm]{fig_earth_elevation.png}%[width=6.5cm,height=3.9cm]
 \includegraphics[width=7.5cm]{fig_earth_scale_1.png}
}}
\centerline{
\hbox{
 \includegraphics[width=7.5cm]{fig_earth_scale_2.png}
 \includegraphics[width=7.5cm]{fig_earth_scale_3.png}
}}
\centerline{
\hbox{
\includegraphics[width=7.5cm]{fig_earth_scale_4.png}
\includegraphics[width=7.5cm]{fig_earth_scale_5.png}
}}
}
\caption{Pyramidal wavelet transform on the sphere.}.
\label{Figure:PWTS}
\end{figure}

Fig.~\ref{Figure:PWTS} shows an Earth image and its pyramidal wavelet transform (PWTS) using five scales.
As the scale number increases (i.e.\ the resolution decreases), the pixel size becomes larger. The data are
land and sea-floor elevations obtained from the ETOPO5 5-minute gridded elevation data set. A thorough explanation
of the data set is provided at \texttt{www.ngdc.noaa.gov} \footnote{The ETOPO5 data are credited to ``Data Announcement 88-MGG-02,
Digital relief of the Surface of the Earth. NOAA, National Geophysical Data Center, Boulder, Colorado, 1988''. The HEALPix image
is available at \texttt{http://astro.ic.ac.uk/$\sim$pdineen/earth/index.html\#earthmap}.}.

%\newpage
\subsubsection{Inverse Transform}

This reconstruction is not as straightforward as in the undecimated case, since the different scales do not have the same resolution.
For each resolution level, we have to up-sample the scaling band before co-adding it to the wavelet coefficients. Algorithm \ref{algo_ipwts} describes this.
{\linespread{1}
\begin{algorithm}[h]
\caption{Inverse Pyramidal Wavelet Transform on the sphere.}
\label{algo_ipwts}
{\bf Task:} Reconstruct an image from its pyramidal WT on the sphere.\\
\noindent{\bf Parameters:} Pyramidal WT coefficients ${\cal W}=\{w_1, w_2, \dots, w_{J}, c_{J}\}$.\\
{\bf Initialization:}
\begin{itemize}
\item Compute the B$_3$-spline scaling function and derive $\hat{\psi}$, $\widehat{H}$, $\widehat{G}$, $\widehat{\tilde H}$ and $\widehat{\tilde G}$ numerically.
\item Compute the spherical harmonics transform of $c_J$ to get ${\hat c}_J$.
\end{itemize}
\For{$j=J-1$ to $0$} {
\begin{enumerate}[1.]
\item Upsample $c_{j+1}$ to the resolution of $c_j$.
\item Compute the spherical harmonics transform of the wavelet coefficients $w_{j+1}$ to get $\hat{w}_{j+1}$.
\item Multiply $\hat{c}_{j+1}$ by ${\widehat {\tilde H}}_{j}$.
\item Multiply $\hat{w}_{j+1}$ by ${\widehat {\tilde G}}_{j}$.
\item Get the spherical harmonics of $\hat{c}_j=\hat{c}_{j+1}+\hat{w}_{j+1}$.
\end{enumerate}
}
Compute The inverse spherical harmonics transform of $\hat c_0$.\\
\noindent{\bf Output:} $c_0$ is the inverse pyramidal WT on the sphere.
\end{algorithm}
}

The wavelet transform on the sphere and its pyramidal version have both a reconstruction operator,
so they are very well designed for any restoration application when the data contains isotropic features.
In the following, we present other transforms on the sphere more adapted to the analysis of anisotropic features.

\section{Ridgelet and Curvelet Transform on the Sphere (CTS) }
\label{sect_cur}
\subsection{Introduction.}
\index{curvelet}
\index{curvelet!sphere}
\index{sphere!curvelet}

The 2D curvelet transform, proposed in \citep{cur:donoho99,starck:sta01_3,starck:sta02_3}, enables the directional analysis of an image
in different scales. The fundamental property of the curvelet transform is to analyze the data with functions of length about $2^{-j/2}$
for the $j^{\textrm{th}}$ sub-band $[2^j, 2^{j+1}]$ of the two dimensional wavelet transform. Following the implementation described
in \citep{starck:sta01_3,starck:sta02_3}, the data first undergoes an Isotropic Undecimated Wavelet Transform (i.e. \og{}\`a trous \fg{} algorithm).
Each scale $j$ is then decomposed into smoothly overlapping blocks of side-length $B_j$ pixels in such a way that the overlap between two
vertically adjacent blocks is a rectangular array of size $B_j \times B_j/2$. And finally, the ridgelet transform \citep{cur:candes99_1} is
applied on each individual block. Recall that the ridgelet transform precisely amounts to applying a 1-dimensional wavelet transform to the
slices of the Radon transform. More details on the implementation of the digital curvelet transform can be found in \citep{starck:sta01_3,starck:sta02_3}.
It has been shown that the curvelet transform could be very useful for the detection and the discrimination of non-Gaussianity in CMB \citep{starck:sta02_4}.
The curvelet transform is also redundant, with a redundancy factor of $16J+1$ whenever $J$ scales are employed. Its complexity scales like
that of the ridgelet transform that is as $O(n^2 \log_2n)$. The curvelet transform was shown to sparsely represent anisotropic structures and smooth curves and edges of different lengths.

\subsection{Ridgelets and Curvelets on the Sphere.}
\index{curvelet transform}
The Curvelet transform on the sphere (CTS) can be similar to the 2D digital curvelet transform, but replacing the \og{}\`a trous \fg{} algorithm
by the Isotropic Wavelet Transform on the Sphere previously described. The CTS algorithm consists in the following three steps which
we describe in more details next.
\begin{itemize}
\item {\it Isotropic Wavelet Transform on the Sphere.}
\item {\it Partitioning.} Each scale is decomposed into blocks of an appropriate scale (of side-length $\sim2^{-s}$),using the HEALPix pixelization.
\item {\it Ridgelet Analysis.} Each square is analyzed via the discrete ridgelet transform.
\end{itemize}
We now describe these three steps.

\subsubsection{Partitioning Using the HEALPix Representation}

 \begin{figure}
\centerline{
\hbox{
\includegraphics[width=15cm]{fig_flowgraph_ridgelet_sphere.pdf}
% \includegraphics[width=13.6cm,height=8cm]{fig_flowgraph_ridgelet_sphere.pdf}
}}
\caption{Flowgraph of the ridgelet transform on the sphere.}
\label{Figure:rid_sphere}
\end{figure}

The HEALPix representation is a curvilinear hierarchical partition of the sphere into quadrilateral pixels
of exactly equal area but with varying shape. The base resolution divides the sphere into 12 quadrilateral
faces of equal area placed on three rings around the poles and equator. Each face is subsequently divided
into $N_{\mathrm{side}}^{2}$ pixels following a quadrilateral multiscale tree structure (see Fig.~\ref{pixelhealpix}).
The pixel centers are located on iso-latitude rings, and pixels from the same ring are equispaced in azimuth.
This is critical for computational speed of all operations involving the evaluation of spherical harmonics transforms,
including standard numerical analysis operations such as convolution, and power spectrum estimation.

An important geometrical feature of the HEALPix sampling grid is the hierarchical quadrilateral tree structure.
This defines a natural one-to-one mapping of the sphere sampled according to the HEALPix grid, into twelve
flat images, on all scales. It is then easy to partition a spherical map using HEALPix into quadrilateral blocks
of a specified size. One first extracts the twelve base-resolution faces, and each face is then decomposed into
overlapping blocks of the specified size. This decomposition into blocks is an essential step of the traditional
flat 2D curvelet transform. Based on the reversible warping of the sphere into a set of flat images made possible
by the HEALPix sampling grid, the ridgelet and curvelet transforms can be extended to the sphere.

With the decomposition into blocks described above, there is no overlap between neighboring blocks belonging
to different base-resolution faces. This may result for instance in blocking effects in denoising experiments
via nonlinear filtering. It is possible to overcome this difficulty in some sense by working simultaneously
with various rotations of the data with respect to the sampling grid. This will average out undesirable effects
at edges between base resolution faces.

\subsubsection*{Ridgelet transform}
\index{ridgelet}
\index{ridgelet!sphere}
\index{sphere!ridgelet}
\index{Radon transform}

Once the partitioning is performed, the standard 2D ridgelet transform described in \citep{starck:sta02_3} is applied in each individual block :
\begin{enumerate}
\item Compute the 2D Fourier transform.
\item Extract lines going through the origin in the frequency plane.
\item Compute the 1D inverse Fourier transform of each line. We get the Radon transform.
\item Compute the 1D wavelet transform of the lines of the Radon transform.
\end{enumerate}
The first three steps correspond to a Radon transform method called the {\it linogram}. Other implementations of the Radon transform, such as
the {\it Slant Stack Radon Transform} \citep{cur:donoho_02}, can be used as well, as long as they offer an exact reconstruction.

Fig.~\ref{Figure:rid_sphere} shows the flowgraph of the ridgelet transform
on the sphere and Fig.~\ref{Figure:back_rid} shows the reconstruction from a single ridgelet
coefficient at different scales and orientations.

\begin{figure}[htb]
\centerline{
\hbox{
\includegraphics[width=15cm]{fig_ridssr.pdf}
% \includegraphics[width=9.5cm,height=6cm]{fig_ridssr.pdf}
}}
\caption{Ridgelet atoms on the sphere obtained by reconstruction from a few ridgelet coefficient at different scales and orientations.}
\label{Figure:back_rid}
\end{figure}

 \subsection{Curvelet Transform Algorithm}

The curvelet transform algorithm on the sphere is described in
Algorithm \ref{algo_curts}.
{\linespread{1}
\begin{algorithm}[h]
\caption{Curvelet Transform on the sphere.}
\label{algo_curts}
{\bf Task:} Compute the curvelet transform on the sphere of a discrete image $X$.\\
{\bf Parameters:} Image $X$ and number of scales $J$.\\
{\bf Initialization:}
\begin{itemize}
\item $B_1 = B_{\min}$.
\item Compute the isotropic UWTS of $X$ with $J$ scales, get $\{w_1,\dots,w_J,c_J\}$.
\end{itemize}
\For{$j=0$ to $J-2$} {
\begin{enumerate}[1.]
\item Partition the wavelet subband $w_j$ with a block size $B_j$.
\item Apply the digital ridgelet transform to each block; get the curvelet coefficients at scale $j$.
\end{enumerate}
\lIf{$j \mbox{ modulo } 2 = 1$} $B_{j+1} = 2 B_{j}$,  else $B_{j+1} = B_{j}$.
}
{\bf Output:} The curvelet transform on the sphere of $X$.
\end{algorithm}
}

The sidelength of the localizing windows is doubled {\em at every
other} dyadic subband, hence maintaining the fundamental property of
the curvelet transform which says that elements of length about
$2^{-j/2}$ serve for the analysis and synthesis of the $j^{\textrm{th}}$ subband
$[2^j, 2^{j+1}]$.  We used the default value $B_{\min} = 16$
pixels in our implementation.  Fig.~\ref{Figure:cur_sphere}
gives an overview of the organization of the algorithm.

\begin{figure}[htb]
\vbox{
\centerline{
\hbox{
% \includegraphics[width=9.cm,height=12cm]{fig_flowgraph_curvelet_sphere.pdf}
\includegraphics[width=15cm]{fig_flowgraph_curvelet_sphere.pdf}
}}}
\caption{Flowgraph of the curvelet transform on the sphere.}
\label{Figure:cur_sphere}
\end{figure}

\begin{figure}
\vbox{
\centerline{
\hbox{
% \includegraphics[width=9.cm,height=12cm]{fig_back_cur_sphere.pdf}
\includegraphics[angle=90,width=\textwidth]{fig_back_cur_sphere.pdf}
}}}
\caption{Reconstruction from a single curvelet coefficient at different scales and orientations.}
\label{Figure:back_cur}
\end{figure}
Fig.~\ref{Figure:back_cur} shows the backprojection of  curvelet coefficients at
different scales and orientations.

\subsection{Pyramidal Curvelet Transform on the Sphere (PCTS)}
The CTS is very redundant, which may be a problem for handling huge data sets such as
Planck data (see Section \ref{section:cmb} below).
The redundancy can be reduced by substituting, in the
curvelet transform algorithm, the pyramidal wavelet transform with the undecimated wavelet transform.
The second step which consists of applying the ridgelet transform on the wavelet scale is unchanged.
The pyramidal curvelet transform (PCTS) algorithm is summarized in Algorithm~\ref{algo_pcurts}.
\index{sphere!pyramidal curvelet}

{\linespread{1}
\begin{algorithm}[h]
\caption{Pyramidal Curvelet Transform on the sphere.}
\label{algo_pcurts}
{\bf Task:} Compute the pyramidal curvelet transform on the sphere of a discrete image $X$.\\
{\bf Parameters:} Image $X$ and number of scales $J$.\\
{\bf Initialization:}
\begin{itemize}
\item $B_1 = B_{\min}$.
\item Compute the pyramidal wavelet transform of $X$ with $J$ scales, get $\{w_1,\dots,w_J,c_J\}$.
\end{itemize}
\For{$j=0$ to $J-2$} {
\begin{enumerate}[1.]
\item Partition the wavelet subband $w_j$ with a block size $B_j$.
\item Apply the digital ridgelet transform to each block; get the curvelet coefficients at scale $j$.
\end{enumerate}
\lIf{$j \mbox{ modulo } 2 = 1$} $B_{j+1} = 2 B_{j}$,  else $B_{j+1} = B_{j}$.
}
{\bf Output:} The pyramidal curvelet transform on the sphere of $X$.
\end{algorithm}
}

% In the next section, it is shown how the pyramidal curvelet transform can be used for image filtering.


%% -*- coding:utf-8 -*-
\chapter{Generalities on algebraic extensions}
We introduce the basic notions such as a field extension, algebraic
element, minimal polynomial, finite extension, and study their very
basic properties such as the multiplicativity of degree in towers.

\section{Field extensions: examples}

\subsection{K-algebra}
\begin{definition}[K-algebra]
  \label{def:kalgebra}
  Let $K$ is a \mynameref{def:ring} and $A$ is a
  \mynameref{def:module} over $K$
  \footnote{
    The definition in the lectures is more common and assumes that $K$
    is a ring but later $K$ will be mostly a \mynameref{def:field}. Therefore
    $A$ has to be a \mynameref{def:vectorspace} over $K$ in the case.
  }
  equipped with
  an additional binary operation $A \times A \rightarrow A$ that we
  denote as $\cdot$ here. The $A$ is an algebra over $K$ if the
  following identities hold $\forall x,y,z \in A$ and for every
  elements (often called as scalar) $a, b \in K$
  \begin{itemize}
  \item Right distributivity:
    $(x + y) \cdot z = x \cdot z + y \cdot z$
  \item Left distributivity:
    $z \cdot (x + y) = z \cdot x + z \cdot y$
  \item Compatibility with scalars:
    $(ax) \cdot (by) = (ab) (x \cdot y)$
  \end{itemize}
\end{definition}

\begin{example}[Field of complex numbers $\mathbb{C}$]
  The field of complex numbers $\mathbb{C}$ can be considered as a
  K-algebra over the field of real numbers $\mathbb{R}$.
  \label{ex:complexnumbers}
\end{example}

\subsection{Field extension}

\begin{definition}[Field extension]
  Let $K$ and $L$ are fields.
  $L$ is an extension of $K$ if $L \supset K$
  \label{def:fextension1}
\end{definition}
and another definition
\begin{definition}[Field extension]
  Let $K$ is a field then
  $L$ is an extension of $K$ if $L$ is a K-algebra
  \footnote{
    $L$ in the definition is not the same object with $L$ from
    definition \ref{def:fextension1}. Because $L$ in the definition is
    a $K$-algebra i.e. a ring but $L$ in the definition
    \ref{def:fextension1} is a field.
  }
  \label{def:fextension2}
\end{definition}
Why the 2 definitions are equivalent?

\begin{lemma}[K-algebra and homomorphism]
  Given a K-algebra is the same as
  having \mynameref{def:homomorphism} $f: K \rightarrow A$ of rings.
  \begin{proof}
    Really if I have a K-algebra I can define the
    \mynameref{def:homomorphism} $f(k) = k \cdot 1_A$, where $1_A$ is an
    identity element of $A$. Thus $k \cdot 1_A \in A$.

    And conversely if I have the \mynameref{def:homomorphism}
    $f: K \rightarrow A$
    I can define the K-algebra structure by setting
    $k a = f(k) a$ because $f(k), a \in A$ and there is a multiplication
    defined on $A$. As result I have a rule for multiplication a vector
    ($f(k) \in A$) on a vector ($a \in A$) that is required for
    \mynameref{def:kalgebra} setup.
  \end{proof}
  \label{lem:lec1_homkalgebra}
\end{lemma}

\begin{lemma}[About homomorphism of fields]
  Any \mynameref{def:fieldhomomorphism} is
  \mynameref{def:injection}.
  \footnote{
    But the statement is not valid for groups. In that case the
    homomorphism is injection if and only if the
    kernel is trivial and consists of only one element - identity.
    See theorem \ref{thm:grouphomomorphsim}.
  }
  \label{lem:lec1_homomorphism_is_injection}
  \begin{proof}
    Lets proof by contradiction.
    Really if $f(x) = f(y)$ and $x \ne y$ then
    \begin{eqnarray}
      f(x) - f(y) = 0_A,
      \nonumber \\
      f(x - y) = 0_A,
      \nonumber \\
      f(x - y) f(\left(x - y\right)^{-1}) =
      f\left(\frac{x - y}{x - y}\right) = f(1_K) = 1_A = 0_A
      \nonumber
    \end{eqnarray}
    that is impossible.
  \end{proof}
\end{lemma}

There are some comments on the results. We have got that a
\mynameref{def:homomorphism} can be set between field $K$ and its
K-algebra.
The \mynameref{def:homomorphism} is \mynameref{def:injection}
therefore we can allocate a sub-field $A' \subset A$ for that we will
have the \mynameref{def:homomorphism} is a \mynameref{def:surjection} and
therefore we have an \mynameref{def:isomorphism} between original field $K$
and a sub-field $A'$. This means that we can say that the original
field $K$ is a sub-field for the K-algebra.

\begin{example}[Field extensions]
  $\mathbb{C}$ is a field extension for $\mathbb{R}$.
  $\mathbb{R}$ is a field extension for $\mathbb{Q}$
  \label{ex:fieldextension}
\end{example}

\begin{example}[$K$-algebra is not a field]
  In the example
  \footnote{the example was not present in the lectures}
  I will show
  that $K$ algebra is not a field. Consider
  $K = \mathbb{R}$. \mynameref{def:vectorspace} $A = \mathbb{R}^2$ i.e.
  $A$ consists of vectors of the following form
  \[
  x = \left(
  \begin{array}{c}
    x_1 \\
    x_2
  \end{array}
  \right),
  \]
  where $x_1, x_2 \in \mathbb{R}$.
  I will define the multiplication for $L$ (our $K$ algebra) as
  follows
  \[
  \left(
  \begin{array}{c}
    x_1 \\
    x_2
  \end{array}
  \right)
  \cdot
  \left(
  \begin{array}{c}
    y_1 \\
    y_2
  \end{array}
  \right) =
  \left(
  \begin{array}{c}
    x_1 \cdot y_1 \\
    x_2 \cdot y_2
  \end{array}
  \right)
  \]

  It can be seen that all requirements of \mynameref{def:kalgebra} are
  satisfied
  \begin{eqnarray}
    (x + y) \cdot z =
    \left(
    \left(
    \begin{array}{c}
      x_1 \\
      x_2
    \end{array}
    \right)
    +
    \left(
    \begin{array}{c}
      y_1 \\
      y_2
    \end{array}
    \right)
    \right)
    \left(
    \begin{array}{c}
      z_1 \\
      z_2
    \end{array}
    \right) =
    \nonumber \\
    =
    \left(
    \begin{array}{c}
      (x_1 + y_1)z_1 \\
      (x_2 + y_2)z_2
    \end{array}
    \right) =
    \left(
    \begin{array}{c}
      x_1 z_1 + y_1 z_1 \\
      x_2 z_2 + y_2 z_2
    \end{array}
    \right) =
    x \cdot z + y \cdot z
    \nonumber \\
    z \cdot (x + y) = z \cdot x + z \cdot y
    \nonumber \\
    (ax) \cdot (by) =
    \left(
    \begin{array}{c}
      a x_1 \\
      a x_2
    \end{array}
    \right)
    \left(
    \begin{array}{c}
      b y_1 \\
      b y_2
    \end{array}
    \right) =
    \left(
    \begin{array}{c}
      ab x_1 y_1 \\
      ab x_2 y_2
    \end{array}
    \right)
    (ab) (x \cdot y)
    \nonumber
  \end{eqnarray}
  The multiplication identity element of $L$ is the following
  \[
  1_L =
  \left(
  \begin{array}{c}
    1 \\
    1
  \end{array}
  \right)
  \]
  The zero is the standard one from vector space
  \[
  0_L =
  \left(
  \begin{array}{c}
    0 \\
    0
  \end{array}
  \right)
  \]

  We can see that
  \[
  \left(
  \begin{array}{c}
    1 \\
    0
  \end{array}
  \right)
  \left(
  \begin{array}{c}
    0 \\
    1
  \end{array}
  \right) = 0_L
  \]
  i.e. we have 2 divisor of zero which are not zero itself. The
  elements do not have invert ones and as result the $L$ is
  not a field.

  From other side if we define $L' \subset L$ as follows
  $L' = \left\{
  \left(
  \begin{array}{c}
    r \\
    r
  \end{array}
  \right)
  \right\}$, where $r \in \mathbb{R}$,
  then we will have that $L'$ is a field and $L' \cong \mathbb{R}$.
  \label{ex:kalgebranotfield}
\end{example}

\begin{definition}[Characteristic]
  \label{def:fieldcharacteristic}
  If $L$ is a field there are 2 possibilities
  \begin{enumerate}
  \item $1 + 1 + \dots \ne 0$. In this case
    $\mathbb{Z} \subset L$ but $\mathbb{Z}$ is not a field therefore $L$
    is an extension of $\mathbb{Q}$. In the case $char L = 0$
  \item $1 + 1 + \dots + 1 = \sum_{i = 1}^m 1 = 0$ for some $m \in
    \mathbb{Z}$. The first time when it happens is for a prime number
    i.e. minimal $m$ with the property is prime. In this case $char L
    = p$, where $p = \min m$  - the minimal $m$ (prime) with the
    property. In this
    case $\mathbb{Z}/p\mathbb{Z} \subset L$. The
    $\mathbb{Z}/p\mathbb{Z}$ is a field denoted by $\mathbb{F}_p$. The
    $L$ is an extension of $\mathbb{F}_p$.
  \end{enumerate}
  No other possibilities exist. The $\mathbb{Q}$ and $\mathbb{F}_p$ are
  the prime fields. Any field is an extension of one of those.
\end{definition}

\begin{definition}[Prime field]
  \label{def:primefield}
  If $L$ is a field $\mathbb{Q} \subset L$, i.e. $char L = 0$ then
  $\mathbb{Q}$ is the prime field for $L$. Otherwise, if $char L = p > 0$
  then $\mathbb{F}_p$ is the prime field.
\end{definition}

\begin{claim}
\label{claim:lec1_sec14}
Let $K\left[X\right]$ \mynameref{def:ring} of polynomials.
The $P \in K\left[X\right]$ is an
\mynameref{def:irreducible}. $\left(P\right)$ is an
\mynameref{def:ideal} formed by the polynomial.
\footnote{
  I.e.
  \(
  \left(P\right) = \left\{ Q = G P \right\}
  \)
  where $G \in K\left[X\right]$
}
The set of residues by
the polynomial forms a field that denoted by
$K\left[X\right]/\left(P\right)$.
\begin{proof}
How we can see it?
If $Q \in K\left[X\right]$ is a polynomial that $Q \notin
\left(P\right)$ when $Q$ is prime to $P$.
\footnote{
  As soon as $P$ is irreducible in $K\left[X\right]$ then there is only
  one possibility for $Q$ and $P$ to have common divisors: if $Q = G P$
  where $G \in K\left[X\right]$ but this is in contradiction with
  $Q \notin \left(P\right)$
}
Then with
\mynameref{lem:bezout} we can get $\exists A, B \in K\left[X\right]$
such that
\[
A P + B Q = 1,
\]
or
\[
B Q \equiv 1 \mod P,
\]
thus $B$ is $Q^{-1}$ in $K\left[X\right]/\left(P\right)$.
\end{proof}
\end{claim}

\begin{claim}
  \footnote{
    The claim is not a part of the lectures but it's very usefully in
    future lectures.
  }
  Let $K$ is a field and $a \in K$ then $K\left[X\right]/\left(X -
  a\right)$ is also a field and there exists an
  \mynameref{def:isomorphism} between the field and $K$ i.e.
  \begin{equation}
    K\left[X\right]/\left(X - a\right) \cong K
    \label{eq:lec1_ex1_1}
  \end{equation}
  \label{claim:lec1_fieldquotionisomorphism}
  \begin{proof}
    The $K\left[X\right]/\left(X - a\right)$ is a field just because
    $X-a$ is
    \mynameref{def:irreducible} (see example \ref{ex:irreducible} and
    claim \ref{claim:lec1_sec14}).

    For the proof the main statement (\ref{eq:lec1_ex1_1}) lets consider a
    polynomial $P \in  K\left[X\right]$ and
    define the following \mynameref{def:fieldhomomorphism}:
    \begin{equation}
      \phi: K\left[X\right]/\left(X - a\right)
      \xrightarrow[P(X) \to P(a)]{} K
      \label{eq:lec1_ex1_2}
    \end{equation}

    The $\phi$ defined by (\ref{eq:lec1_ex1_2}) is
    \mynameref{def:fieldhomomorphism}. For the proof of the claim lets take
    $P_1, P_2 \in K\left[X\right]/\left(X - a\right)$. Clear that
    \[
    \phi\left(P_1 + P_2\right) = P_1\left(a\right) + P_2\left(a\right)
    = \phi\left(P_1\right) + \phi\left(P_1\right).
    \]
    The same holds with the multiplication:
    \[
    \phi\left(P_1 \cdot P_2\right) = P_1\left(a\right) \cdot P_2\left(a\right)
    = \phi\left(P_1\right) \cdot \phi\left(P_1\right).
    \]
    %% For the inverse element image lets consider $P \in
    %% K\left[X\right]/\left(X - a\right)$ such that $P \ne 0$ and as
    %% result $\phi\left(P\right) = P\left(a\right) \ne 0$.
    %% There exists $P^{-1} \in K\left[X\right]/\left(X - a\right)$ as
    %% soon as $K\left[X\right]/\left(X - a\right)$ is a field. Therefore
    %% we have
    %% \begin{eqnarray}
    %%   \phi(1) = \phi\left(P P^{-1}\right) =
    %%   \phi\left(P\right)\phi\left(P^{-1}\right) =
    %%   \nonumber \\
    %%   = P\left(a\right) P^{-1}\left(a\right) = 1,
    %%   \nonumber
    %% \end{eqnarray}
    %% i.e.
    %% \[
    %% \phi\left(P^{-1}\right) = \phi\left(P\right)^{-1}.
    %% \]
    That completes the proof of the \mynameref{def:fieldhomomorphism}.
    %% Division is more complex but also can be
    %% shown: if $P_2 \ne 0$ when there exists
    %% $P_2^{-1} \in K\left[X\right]/\left(X - a\right)$ as soon as
    %% $K\left[X\right]/\left(X - a\right)$ is the field then
    %% with $\phi\left(P_2^{-1}\right) = P_2^{-1}\left(a\right) =
    %% \frac{1}{\phi\left(P_2\right)}$ one can get
    %% \[
    %% \phi\left(\frac{P_1}{P_2}\right) =
    %% \phi\left(P_1 P_2^{-1}\right) =
    %% \phi\left(P_1\right) \phi\left(P_2^{-1}\right) =
    %% \frac{\phi\left(P_1\right)}{\phi\left(P_2\right)}
    %% \]

    %% We have $\ker{\phi} = \left(X - a\right)$ because for any polynomial
    %% $P$ that is in the ideal $\left(X - a\right)$ has $P(a) = 0$ i.e. in
    %% the kernel of $\phi$.

    Lemma \mynameref{lem:lec1_homomorphism_is_injection} says that any
    \mynameref{def:fieldhomomorphism} is \mynameref{def:injection},
    i.e. $\phi$ is an injection.

    Next we should show that $\phi$ is \mynameref{def:surjection} it's
    easy because $\forall k \in K$ we can consider constant polynomial
    $P = k$ from $K\left[X\right]$. For the polynomial we will have
    $\phi\left(k\right) = k$.

    As result $\phi$ is \mynameref{def:injection} as well as
    \mynameref{def:surjection} i.e. $\phi$ is
    \mynameref{def:bijection}. With the fact that $\phi$ is
    \mynameref{def:homomorphism} it will gives us that $\phi$ is
    \mynameref{def:isomorphism}.
    %% Now (\ref{eq:lec1_ex1_1}) follows from the
    %% \mynameref{thm:firstisomorphism}.
  \end{proof}
\end{claim}

\section{Algebraic elements. Minimal polynomial}

\subsection{$K\left[X\right]/\left(P\right)$ field}

Alternative proof of claim \ref{claim:lec1_sec14} i.e. the fact that
$K\left[X\right]/\left(P\right)$ is the
\mynameref{def:field} as follows.
The $\left(P\right)$ is a \mynameref{def:maxideal}
\footnote{
  To prove that $\left(P\right)$ is a \mynameref{def:maxideal} we have
  to use \mynameref{lem:bezout}.
}
but a quotient by a  \mynameref{def:maxideal} is a \mynameref{def:field}
(see \mynameref{thm:maxideal}).

We also can say that $K\left[X\right]/\left(P\right)$ is an extension
of $K$ because it's
\mynameref{def:kalgebra}.

\begin{example}[$K = \mathbb{F}_2/\left(X^2+X+1\right)$]
  Lets consider the following field
  $\mathbb{F}_2 = \mathbb{Z}/2\mathbb{Z} = \{0,1\}$ in the
  field polynomial $X^2+X+1$ is irreducible. It's very easy to verify
  it because $\mathbb{F}_2$ has only 2 elements that can be (possible)
  a root:
  \[
  0^2+0+1 = 1\ne 0
  \]
  and
  \[
  1^2+1+1 = 1\ne 0
  \]

  The polynomial has the following
  residues: $\bar{X} = X + \left(X^2+X+1\right)$ and
  $\overline{X + 1} = X + 1 + \left(X^2+X+1\right)$. Thus the field
  $\mathbb{F}_2/\left(X^2+X+1\right)$ consists of 4 elements:
  $\{0, 1, \bar{X}, \overline{X+1}\}$.

  It's easy to see that the third element ($\bar{X}$) is a root of
  $P(X) = X^2+X+1$:
  \[
  \bar{X}^2 + \bar{X} + 1 =
  P(X) + \left(P(X)\right) = \left(P(X)\right) \equiv 0 \mod P.
  \]

  \[
  \bar{X}^2 + \bar{X} + 1 = \bar{0},
  \]
  therefore
  \[
  \bar{X}^2 = - \bar{X} - 1 = \bar{X} + 1 = \overline{X+1}.
  \]
  This is because we are in field $\mathbb{F}_2$ where
  \[
  2 \left(X + 1\right) \mod 2 = 0
  \]
  and thus
  \[
  - \bar{X} - 1 = \bar{X} + 1 = \overline{X + 1}
  \]

  Also
  \[
  \overline{X+1}^2 = \bar{X},
  \]
  and they are inverse each other
  \[
  \overline{X+1} \bar{X} = 1,
  \]

  So this is the structure of a field of four elements.  The
  cardinality of $K=\mathbb{F}_2/\left(X^2+X+1\right)$ is 4,  one
  writes then $K=F_4$. Well, this might be
  strange at the first sight, because we only know that $K$ has four
  elements and if you write $F_4$  you somehow mean that there is only
  one field of four elements. Well, it is true, there is only one
  field of four elements. In fact, all finite fields of the same
  cardinality are isomorphic, and we will see it very shortly
  (see theorem \ref{thm:lec3_1}).
  \label{ex:F2overP}
\end{example}

Arguments for the \autoref{ex:F2overP} can also be found in the
following remark (not part of the lectures)
\begin{remark}[About quotient field]
Consider an arbitrary field $L$ ($L=\mathbb{F}_2$ at the
\autoref{ex:F2overP}) and $P\left(X\right) = X^n + a_{n-1}X^{n-1} +
a_{n-2} X^{n-2} + \dots + a_0 \in L\left[X\right]$ is an
irreducible polynomial over $L$. Let $\alpha$ is a root of the
polynomial then
\[
\alpha^n + a_{n-1} \alpha^{n-1} + \dots + a_0 = 0,
\]
or
\[
\alpha^n = - a_{n-1} \alpha^{n-1} - \dots - a_0.
\]
Therefore $\forall l \ge n, \exists l_i \in L$ such that
\[
\alpha^k = \sum_{i=0}^{n-1}l_i \alpha^{i}
\]
and as result $\forall x \in L/\left(P\right)$ exists $x_i \in L$
such that
\[
x = \sum_{i=0}^{n-1}x_i \alpha^{i}.
\]
We can say that we have the following basis: $\{\{L\}, \alpha, \dots,
\alpha^{n-1}\}$ where $\{L\}$ - L basis. For \autoref{ex:F2overP} we
have
$\{L\}= \{\mathbb{F}_2\}= \{0,1\}$, $\alpha = \bar{X}$ and as result
$K = \mathbb{F}_2/\left(X^2+X+1\right)$ will have the following basis
$\{0,1,\bar{X}\}$.
\end{remark}

\subsection{Algebraic elements}

\begin{definition}[Algebraic element]
  Let $K \subset L$ and $\alpha \in L$. $\alpha$ is an algebraic
  element if $\exists P \in K\left[X\right]$ such that
  $P\left(\alpha\right) = 0$. Otherwise the $\alpha$ is called
  transcendental.
  \label{def:algebraicelement}
\end{definition}

\subsection{Minimal polynomial}

\begin{lemma}[About minimal polynomial existence]
  If $\alpha$ is \mynameref{def:algebraicelement} then
  $\exists!$ unitary polynomial $P$ of minimal degree such that
  $P\left(\alpha\right) = 0$. It is irreducible. $\forall Q$ such that
  $Q\left(\alpha\right) = 0$ is divisible by $P$
  \footnote{
    see also \mynameref{thm:irreduciblediv}
  }
  \begin{proof}
    We know that $K\left[X\right]$ is a \mynameref{def:pid} and a
    polynomial $Q\left(\alpha\right) = 0$ forms an
    \mynameref{def:ideal}: $I \left\{Q \in K\left[X\right] \mid
    Q\left(\alpha\right) = 0 \right\}$, so the ideal is generated by
    one element: $I = \left(P\right)$. This is an unique (up to
    constant) polynomial minimal degree in $I$.

    Lets prove that $P$ is irreducible. If $P$ is not irreducible then
    $\exists Q,R \in I$ such that $P = Q
    R$, $Q(\alpha) = 0$ or $R(\alpha) = 0$ and
    $deg R,Q < deg P$ that is in contradiction with the definition
    that $P$ is a polynomial of minimal degree.
  \end{proof}
  \label{lem:minpolynomial}
\end{lemma}

\begin{definition}[Minimal polynomial]
  If $\alpha$ is \mynameref{def:algebraicelement} then
  the unitary polynomial $P$ of minimal degree such that
  $P\left(\alpha\right) = 0$ is called minimal polynomial and denoted
  by  $P_{min}\left(\alpha, K\right)$.
  \label{def:minpolynomial}
\end{definition}

\begin{gapexample}[Minimal polynomial]
  Consider the following minimal polynomial
  $P_{min}\left(\alpha, \mathbb{Q}\right)$, where $\alpha =
  \sqrt{2}$. In GAP \cite{url:gap} we have
\begin{verbatim}
  gap> x:=Indeterminate(Rationals,"x");;
  gap> alpha:=Sqrt(2);;
  gap> MinimalPolynomial(Rationals, alpha);
  x^2-2
\end{verbatim}
I.e. $P_{min}\left(\alpha, \mathbb{Q}\right) = X^2 -2$.
\label{ex:minpolynomial}
\end{gapexample}

\section{Algebraic elements. Algebraic extensions}

\begin{definition}
  Let $K \subset L$, $\alpha \in L$. The smallest sub-field contained
  $K$ and $\alpha$ denoted by $K\left(\alpha\right)$. The smallest
  sub-ring (or \mynameref{def:kalgebra}) contained $K$ and $\alpha$ denoted by $K\left[\alpha\right]$.
\end{definition}

As soon as $K\left[\alpha\right]$ is a \mynameref{def:kalgebra} it is a
\mynameref{def:vectorspace} over $K$ generated by
\[
1, \alpha, \alpha^2, \dots,
\alpha^n, \dots.
\]

\begin{example}[$\mathbb{C}$]
  \[
  \mathbb{C} = \mathbb{R}\left(i\right) = \mathbb{R}\left[i\right]
  \]
  $\mathbb{C}$ is also a \mynameref{def:vectorspace} generated by $1$
  and $i$: $\forall z \in \mathbb{Z}$ it holds $z = x + i y$ where
  $x,y \in \mathbb{R}$.
\end{example}

\begin{proposition}
  The following assignment are equivalent
  \begin{enumerate}
  \item $\alpha$ is algebraic over $K$
  \item $K\left[\alpha\right]$ is a finite dimensional
    \mynameref{def:vectorspace} over $K$
  \item $K\left[\alpha\right] = K\left(\alpha\right)$
    \footnote{
      Contrary to the example \ref{ex:kalgebranotfield} we see
      that $K$-algebra is a field there.
    }
  \end{enumerate}
  \begin{proof}
    Lets proof that 1 implies 2. If $\alpha$ is algebraic over $K$
    then using lemma \mynameref{def:minpolynomial} $\exists
    P_{min}\left(\alpha, K\right)$:
    \[
    P_{min}\left(\alpha, K\right) = \alpha^d + a_{d-1}\alpha^{d-1} +
    a_1 \alpha + a_0 = 0,
    \]
    where $a_k \in K$. Then
    \[
    \alpha^d  = - a_{d-1}\alpha^{d-1} -
    a_1 \alpha - a_0
    \]
    this means that any $\alpha^n$ can be represented as a linear
    combination of finite number of powers of $\alpha$ i.e.
    $K\left[\alpha\right]$ generated by $1, \alpha, \dots,
    \alpha^{d-1}$ is a finite dimensional \mynameref{def:vectorspace}.

    Lets proof that 2 implies 3. Its enough to prove that
    $K\left[\alpha\right]$ is a field because
    $K\left[\alpha\right] \subset K\left(\alpha\right)$.

    Let $x \ne 0 \in
    K\left[\alpha\right]$ then lets look at an operation
    $x \cdot K\left[\alpha\right] \rightarrow
    K\left[\alpha\right]$. This is \mynameref{def:injection}.
    \footnote{
      If $y, z \in K\left[\alpha\right]$ and
      $\dim K\left[\alpha\right] = d < \infty$ where
      $d = \deg P_{min}\left(\alpha, K\right)$. Then
      $y = \sum_{i=0}^{d-1} y_i \alpha^i$ and
      $z = \sum_{i=0}^{d-1} z_i \alpha^i$ where $y_i, z_i \in K$.
      We have $y - z = \sum_{i=0}^{d-1} \left(y_i - z_i\right)
      \alpha^i \ne 0$ if $y \ne z$ (i.e.
      $\exists i: y_i \ne z_i$)
      because $y -z$ can be considered as a polynomial of degree
      $ \le d - 1 < \deg P_{min}\left(\alpha, K\right)$ and cannot be equal
      to 0 by minimal polynomial definition.
      Continue we have $x \cdot \left(y - z\right) \ne 0$ because it
      also can be considered as a product of 2 polynomial of degree
      $< d$.
      Thus
      \[
      x \cdot y  \ne x \cdot z
      \]
      i.e. \mynameref{def:injection} property is satisfied.
    }
    But the $K\left[\alpha\right]$ is finite dimensional
    \mynameref{def:vectorspace} and a \mynameref{def:homomorphism} between
    2 vector spaces with the same dimension is
    \mynameref{def:surjection}
    \footnote{
      Two vector spaces with same dimension are isomorphic each other
      (see lemma \ref{lem:vsisomorphism})
    }
    thus $\exists y \in K\left[\alpha\right]$
    such that $x \cdot y = 1_{K\left[\alpha\right]}$. Therefore $x$ is
    invertable and $K\left[\alpha\right]$ is a
    \mynameref{def:field}.

    Lets proof that 3 implies 1. Let $K\left[\alpha\right]$ is a
    \mynameref{def:field} but $\alpha$ is not algebraic. Thus $\forall P
    \in K\left[X\right]$ $P(\alpha) \ne 0$. The we have an
    \mynameref{def:injection} \mynameref{def:homomorphism} $i$ :
    $K\left[X\right] \to K\left[\alpha\right] = K\left(\alpha\right)$
    which sends $P\left(X\right)$ to $P\left(\alpha\right)$.
    \footnote{
      And if $P\left(X\right) \ne 0$ then
      $P\left(\alpha\right) \ne 0$
    }
    But $K\left[X\right]$
    is not a field thus $K\left[\alpha\right]$ should not be a field
    too that is in contradiction with the initial conditions.
    \footnote{
      Alternative prove is the following.
      Let $x \ne 0 \in K\left[X\right]$ and $K\left[\alpha\right]$ is a
      field then $i(x)$ is invertable i.e. $\exists y \in
      K\left[X\right]:  i(x) i(y) = 1$ or
      $i(xy) = 1$ or finally $x$ - is invertable and $K\left[X\right]$
      is a field but $K\left[X\right]$ is a ring and therefore we just
      got a contradiction.
    }
  \end{proof}
  \label{prop:lec1_1}
\end{proposition}

\begin{definition}[Algebraic extension]
  $L$ an extension of $K$ is called algebraic over $K$ if $\forall
  \alpha \in L$ - $\alpha$ is algebraic over $K$.
  \label{def:algebraicextension}
\end{definition}

\begin{proposition}
  If $L$ is algebraic over $K$ then any K-subalgebra of $L$ is a
  \mynameref{def:field}.
  \begin{proof}
    Let $L' \subset L$ is a subalgebra and let $\alpha \in L'$. We want
    to show that $\alpha$ is invertable. $\alpha$ is algebraic
    therefore $\alpha \in K\left[\alpha\right] \subset L' \subset L$
    and it's invertable.
    \footnote{
      As soon as $K\left[\alpha\right] = K\left(\alpha\right)$ is a
      field then its any element (especially $\alpha$) is invertable.
    }
  \end{proof}
  \label{prop:lec1_algebraicsubalgebra}
\end{proposition}

\begin{proposition}
  Let $K \subset L \subset M$. $\alpha \in M$ - algebraic over $K$
  then $\alpha$ algebraic over $L$ and
  $P_{min}\left(\alpha, L\right)$ divides $P_{min}\left(\alpha,
  K\right)$.
  \begin{proof}
    It is clear because $P_{min}\left(\alpha,K\right) \in
    L\left[X\right]$.
    \footnote{
      Thus $\exists P_L \in L\left[X\right]$ such that
      $P_L\left(\alpha\right) = 0$ i.e. $\alpha$ is algebraic over $L$.

      As soon as $P_{min}\left(\alpha,K\right) \in L\left[X\right]$ then
      using \mynameref{lem:minpolynomial} one can get that
      $P_{min}\left(\alpha,L\right)$ divides
      $P_{min}\left(\alpha,K\right)$.
    }
  \end{proof}
  \label{prop:lec1_algebraic}
\end{proposition}

We can consider the following example as an illustration for
proposition \ref{prop:lec1_algebraic}:
\begin{myexample}
  $K = \mathbb{R}, L=M=\mathbb{C}$. $\alpha = i \in M$ is algebraic
  over $K = \mathbb{R}$ and therefore using the proposition
  \ref{prop:lec1_algebraic} it is
  algebraic over $L = \mathbb{C}$. Moreover $P_{min}(\alpha, L) = X
  -i$ and it divides $P_{min}(\alpha, K) = X^2 + 1$.
\end{myexample}

\section{Finite extensions. Algebraicity and finiteness}

\begin{definition}[Finite extension]
  $L$ is a finite extension of $K$ if $dim_k L < \infty$. $dim_k L$ is
  called as degree of $L$ over $K$ and is denoted by
  $\left[L:K\right]$
  \label{def:finiteextension}
\end{definition}

\begin{theorem}[The multiplicativity formula for degrees]
  Let $K \subset L \subset M$. Then $M$ is
  \mynameref{def:finiteextension} over $K$ if and only if
  $M$ is \mynameref{def:finiteextension} over $L$ and
  $L$ is \mynameref{def:finiteextension} over $K$. In this case
  \[
  \left[M:K\right] = \left[M:L\right] \left[L:K\right].
  \]
  \begin{proof}
    Let $\left[M:K\right] < \infty$ but any linear independent set of
    vectors  $\left\{m_1, m_2, \dots, m_n\right\}$ over $L$ is also
    linear independent over $K$ thus
    \[
    \left[M:K\right] < \infty \Rightarrow \left[M:L\right] < \infty
    \]
    also $L$ is a vector sub space of $M$ thus if
    $\left[M:K\right] < \infty$ then $\left[L:K\right] < \infty$.

    Let $\left[M:L\right] < \infty$ and $\left[L:K\right] < \infty$
    then we have the following basises
    \begin{itemize}
    \item $L$-basis over $M$: $\left(e_1, e_2, \dots, e_n\right)$
    \item $K$-basis over $L$:
      $\left(\varepsilon_1, \varepsilon_2, \dots, \varepsilon_d\right)$
    \end{itemize}
    Lets proof that $e_i\varepsilon_j$ forms a $K$-basis over $M$.
    $\forall x \in M$:
    \[
    x = \sum_{i=1}^n a_i e_i,
    \]
    where $a_i \in L$ and can be also written as
    \[
    a_i = \sum_{j=1}^d b_{ij} \varepsilon_j,
    \]
    where $b_{ij} \in K$.
    Thus
    \[
    x = \sum_{i=1}^n \sum_{j=1}^d b_{ij} \varepsilon_j e_i,
    \]
    therefore $\varepsilon_j e_i = e_i \varepsilon_j$ generates $M$
    over $K$. From the other side we should check that $\varepsilon_j
    e_i$ linear independent system of vectors. Lets
    \[
    \sum_{i,j} c_{ij} \varepsilon_j e_i =
    \sum_{i=1}^n \left( \sum_{j=1}^d c_{ij} \varepsilon_j \right) e_i,
    \]
    then $\forall i$:
    \[
    \sum_{j=1}^d c_{ij} \varepsilon_j = 0.
    \]
    Thus $\forall i,j: c_{ik} = 0$ that finishes the proof the linear
    independence.
    The number of linear independent vectors is $n \times d$ i.e.
    \[
    \left[M:K\right] = \left[M:L\right] \left[L:K\right].
    \]
  \end{proof}
  \label{thm:mulformuladegrees}
\end{theorem}

\begin{definition}[$K\left(\alpha_1, \dots, \alpha_n\right)$]
  $K\left(\alpha_1, \dots, \alpha_n\right) \subset L$ generated by
  $\alpha_1, \dots, \alpha_n$ is the smallest sub field of $L$
  contained  $K$ and $\alpha_i \in L$.
\end{definition}

\begin{theorem}[About towers]
  $L$ is finite over $K$ if and only if $L$ is generated by a finite
  number of algebraic elements over $K$.
  \begin{proof}
    If $L$ is finite then $\alpha_1, \dots, \alpha_d$ is a basis. In
    this case
    $L = K\left[\alpha_1, \dots, \alpha_d\right] = K\left(\alpha_1,
    \dots, \alpha_d\right)$. Moreover each
    $K\left[\alpha_i\right]$ is finite dimensional thus by
    proposition \ref{prop:lec1_1} $\alpha_i$ is algebraic.

    From other side if we have a finite set of algebraic elements
    $\alpha_1, \dots, \alpha_d$ then
    $K\left[\alpha_1\right]$ is a finite dimensional
    \mynameref{def:vectorspace} over $K$,
    $K\left[\alpha_1, \alpha_2\right]$ is a finite dimensional
    \mynameref{def:vectorspace} over $K\left[\alpha_1\right]$ and
    so on $K\left[\alpha_1, \dots, \alpha_d\right]$ is a finite dimensional
    \mynameref{def:vectorspace} over
    $K\left[\alpha_1, \dots, \alpha_{d-1}\right]$. All elements
    are algebraic thus
    \[
    K\left[\alpha_1, \dots, \alpha_i\right] =
    K\left(\alpha_1, \dots, \alpha_i\right)
    \]
    Then using theorem \ref{thm:mulformuladegrees} we can conclude
    that $K\left(\alpha_1, \dots, \alpha_d\right)$ has finite
    dimension.
  \end{proof}
  \label{thm:lec1_2}
\end{theorem}

\section{Algebraicity in towers. An example}

\begin{theorem}
  $K \subset L \subset M$ then $M$ \mynameref{def:algebraicextension}
  over $K$ if and only if $M$ algebraic over $L$ and $L$ algebraic
  over $K$.
  \begin{proof}
    If $\alpha \in M$ is an \mynameref{def:algebraicelement} over $K$ then
    $\exists P \in K\left[X\right]$ such that
    $P\left(\alpha\right) = 0$ but the
    polynomial $P \in K\left[X\right] \subset L\left[X\right]$
    thus $\alpha$ is algebraic over $L$.
    If $\alpha \in L \subset M$ then $\alpha$ is algebraic over $K$
    thus $L$ is algebraic over $K$.

    Let $M$ algebraic over $L$ and $L$ algebraic over $K$ and let
    $\alpha \in M$. We want to prove that $\alpha$ is algebraic over
    $K$. Lets consider $P_{min}\left(\alpha, L\right)$ the polynomial
    coefficients are from $L$ and they (as soon as they count is a
    finite)  generate a finite extension $E$ over $K$ thus
    $E\left(\alpha\right)$ is finite over $E$ (exists a relation
    between powers of $\alpha$) is finite over $K$ thus $\alpha$ is
    algebraic over $K$.
    \footnote{
      $P_{min}\left(\alpha, L\right) = \sum_{i = 0}^{d-1} l_i
      \alpha^i$ where $l_i \in L$ and each $l_i$ is algebraic over $K$
      by algebraic extension definition
      \ref{def:algebraicextension}. By theorem
      \ref{thm:lec1_2} there are finite number of $l_i$
      and they forms an algebraic extension
      $E = K\left(l_0, l_1, \dots, l_{d-1}\right)$. The
      $E\left(\alpha\right)$ is finite over $E$ and therefore finite
      over $K$. As soon as $E\left(\alpha\right)$ has a finite
      dimension over $K$ thus there exists a relation for powers of
      $\alpha$ such that $\sum_{i=0}^n k_i \alpha^i = 0$ i.e.
      $\alpha$ is algebraic.
    }
  \end{proof}
\end{theorem}
\begin{example}[$\mathbb{Q}$ extension]
  $\mathbb{Q}\left( \sqrt[3]{2}, \sqrt{3}\right)$ algebraic and finite
  over $\mathbb{Q}$:
  \[
  \mathbb{Q} \subset \mathbb{Q}\left( \sqrt[3]{2}\right)
  \subset \mathbb{Q}\left( \sqrt[3]{2}, \sqrt{3}\right)
  \]

  Minimal polynomial
  \[
  P_{min}\left(\sqrt[3]{2}, \mathbb{Q}\right) = x^3 - 2.
  \]

  $\mathbb{Q}\left( \sqrt[3]{2}\right)$ is generated over $\mathbb{Q}$
  by $1, \sqrt[3]{2}, \sqrt[3]{4}$ thus
  $\left[\mathbb{Q}\left( \sqrt[3]{2}\right): \mathbb{Q}\right] = 3$.

  But $\sqrt{3} \notin \mathbb{Q}\left( \sqrt[3]{2}\right)$ because
  otherwise $\left[\mathbb{Q}\left( \sqrt{3}\right): \mathbb{Q}\right]
  = 2$ must devide
  $\left[\mathbb{Q}\left( \sqrt[3]{2}\right): \mathbb{Q}\right] = 3$
  that is impossible.

  Therefore $x^2 - 3$ is irreducible over
  $\mathbb{Q}\left( \sqrt[3]{2}\right)$ and
  \[
  P_{min}\left(\sqrt{3}, \mathbb{Q}\left( \sqrt[3]{2}\right)\right) =
  x^2 - 3.
  \]

  \[
  \left[\mathbb{Q}\left( \sqrt[3]{2}, \sqrt{3}\right):
    \mathbb{Q}\right] = 3 \cdot 2 = 6.
  \]
\end{example}

\begin{proposition}[On dimension of extension]
  \[
  \left[K\left(\alpha\right) : K\right] =
  \deg\left(P_{min}\left(\alpha, K\right)\right),
  \]
  if $\alpha$ is algebraic.
  \begin{proof}
    If $\deg\left(P_{min}\left(\alpha, K\right)\right) = d$ then $1, \alpha,
    \cdots, \alpha^{d-1}$ - $d$ independent vectors and dimension
    $K\left(\alpha\right)$ is $d$.
  \end{proof}
  \label{prop:dimextension}
\end{proposition}

\begin{proposition}[About algebraic closure]
  If $K \subset L$ ($L$ extension of $K$). Consider
  \[
  L' = \left\{
  \alpha \in L \mid \alpha \mbox{ algebraic over } K
  \right\},
  \]
  then $L'$ sub-field of $L$ and is called as algebraic closure of $K$
  in $L$.
  \begin{proof}
    We have to prove that if $\alpha, \beta$ are algebraic then
    $\alpha + \beta$ and $\alpha \cdot \beta$ are also algebraic. This
    is trivial  because
    \[
    \alpha + \beta, \alpha \cdot \beta \in K\left[\alpha, \beta\right]
    \]
    \footnote{
      We also have that $K\left[\alpha, \beta\right]$ is a field:
      $K\left[\alpha, \beta\right]
      = K\left(\alpha, \beta\right)$.
      Really
      $K\left[\alpha\right] =
      K\left(\alpha\right)$ (see proposition
      \ref{prop:lec1_1}). $\beta$ is algebraic over $K$ and
      therefore over $K\left(\alpha\right)$ thus we can construct
      $K\left(\alpha\right)\left[\beta\right] = K\left(\alpha, \beta\right)$
      by proposition \ref{prop:lec1_1}
    }
  \end{proof}
\end{proposition}

\section{A digression: Gauss lemma, Eisenstein criterion}

What we have seen so far:

\begin{itemize}
\item $K$ is a field, $\alpha$ is an \mynameref{def:algebraicelement}
  over $K$ if it is a root of a polynomial $P \in K\left[X\right]$.
\item $L$ is an \mynameref{def:algebraicextension} over $K$ if
  $\forall \alpha \in L$: $\alpha$ is an algebraic over $K$
\item $L$ is a \mynameref{def:finiteextension} over $K$ if $dim_K L <
  \infty$.
\item If an extension is finite then it is algebraic
\item An extension is finite if and only if it is algebraic and
  generated by a finite number of algebraic elements (see theorem
  \ref{thm:lec1_2})
\item $\left[K\left[\alpha\right]:K\right] =
  deg P_{min}\left(\alpha, K\right)$ (see proposition
  \ref{prop:dimextension}).
\end{itemize}

How to decide that a polynomial $P$ is irreducible over $K$?
About polynomial $x^3 - 2$ it is easy to decide that it's irreducible
over $\mathbb{Q}$, but what's about $x^{100}-2$?

\begin{lemma}[Gauss]
  Let $P \in \mathbb{Z}\left[X\right]$, i.e. a polynomial with integer
  coefficients, then if $P$ decomposes over $\mathbb{Q}$ ($P = Q\cdot
  R, deg Q,R < deg P$) then it also decomposes over $\mathbb{Z}$.
  \begin{proof}
    Let $P = Q R$ over $\mathbb{Q}$. Then
    \begin{eqnarray}
      Q = m Q_1, Q_1 \in \mathbb{Z}\left[X\right],
      \nonumber \\
      R = n R_1, R_1 \in \mathbb{Z}\left[X\right],
      \nonumber
    \end{eqnarray}
    thus
    \[
    n m P = Q_1 R_1.
    \]
    There exists $p$ that divides $mn$: $p \mid mn$ thus in modulo $p$
    we have
    \[
    0 = \overline{Q_1}\overline{R_1}
    \]
    but $p$ is prime and the equation is in the field $\mathbb{F}_p$
    thus either $\overline{Q_1} = 0$ or $\overline{R_1} = 0$. Let
    $\overline{Q_1} = 0$ thus $p$ divides all coefficients in $Q_1$
    and we can take $\frac{Q_1}{p} = Q_2 \in
    \mathbb{Z}\left[X\right]$. Continue for all primes in $mn$ we can
    get that
    \[
    P = Q_s R_t,
    \]
    where $Q_s, R_t \in \mathbb{Z}\left[X\right]$.
  \end{proof}
  \label{lem:gauss}
\end{lemma}

\begin{example}[Eisenstein criterion]
  Lets consider the following polynomial $x^{100} -2$. It's
  irreducible. Lets prove it. If it reducible then
  $\exists Q, R \in \mathbb{Z}\left[X\right]$ such that
  \begin{equation}
    x^{100} -2 = Q R
    \label{eq:ex_eisenstein}
  \end{equation}
  Lets consider (\ref{eq:ex_eisenstein}) modulo 2. In the case we will
  have
  \[
  Q R \equiv x^{100} \mod 2,
  \]
  therefore
  \begin{eqnarray}
    Q \equiv x^k \mod 2,
    \nonumber \\
    R \equiv x^l \mod 2,
    \nonumber
  \end{eqnarray}
  or
  \[
  Q = x^k + \dots + 2 \cdot m
  \]
  and
  \[
  R = x^l + \dots + 2 \cdot n
  \]
  thus
  \[
  QR = x^{100} + 4 \cdot nm
  \]
  that is impossible because $n,m \in \mathbb{Z}$ and $nm \ne
  -\frac{1}{2}$.
  \label{ex:eisenstein}
\end{example}

\begin{lemma}[Eisenstein criterion]
  Lets $P \in \mathbb{Z}\left[X\right]$ and
  $P = a_n X^n + a_{n-1} X^{n-1} + a_1 X + a_0$. If $\exists p$ -
  prime such that $p \nmid a_n$, $p \mid a_i \forall i < n$ and
  $p^2 \nmid a_0$, then $P \in \mathbb{Z}\left[X\right]$ is
  irreducible.
  \begin{proof}
    the same as for example \ref{ex:eisenstein}.
  \end{proof}
  \label{lem:eisenstein}
\end{lemma}

Note: that both: \mynameref{lem:gauss} and \mynameref{lem:eisenstein} are
valid by replacing $\mathbb{Z}$ with an \mynameref{def:ufd} $R$ and
$\mathbb{Q}$ by its factorization field.


\documentclass[twoside]{MATH77}
\usepackage{multicol}
\usepackage[fleqn,reqno,centertags]{amsmath}
\begin{document}
\begmath 17.3  Double Precision Complex Computation

\silentfootnote{$^\copyright$1997 Calif. Inst. of Technology, \thisyear \ Math \`a la Carte, Inc.}

\subsection{Purpose}

These subprograms do the following computations for double precision complex
data: sum, difference, product, quotient, square root, and absolute value.
The Fortran~77 standard does not support a double precision complex data
type. Using the convention of storing the real and imaginary parts of a
complex number as an adjacent pair of double precision numbers, this set of
subprograms provides the above operations while staying within the standard.

\subsection{Usage}

\subsubsection{Program Prototype, Double Precision}

\begin{description}

\item[DOUBLE PRECISION] \ {\bf  A}(2){\bf , B}(2){\bf , RESULT}(2){\bf ,
ABSVAL, DZABS}

\end{description}

Assign values to A(), or to A() and B(), and access the appropriate
subprogram. The results will be stored in RESULT() or ABSVAL.
\begin{center}
\fbox{\begin{tabular}{@{\bf \ }ll@{\ }}
CALL ZSUM(A, B, RESULT) & Result $= a + b$\\
CALL ZDIF(A, B, RESULT) & Result $= a - b$\\
CALL ZPRO(A, B, RESULT) & Result $= a \times b$\\
CALL ZQUO(A, B, RESULT) & Result $= a\ /\ b$\\
CALL ZSQRTX(A, RESULT) & Result $= \sqrt a$\\
ABSVAL = DZABS(A) & Absval $= |a|$\\
\end{tabular}}
\end{center}
\subsubsection{Argument Definitions}

\begin{description}

\item[A()] \ [in] Contains the double precision complex value, $a$, with the real part in A(1) and
the imaginary part in A(2).

\item[B()] \ [in] Contains the double precision complex value, $b$, with the real part in B(1)
and the imaginary part in B(2).

\item[RESULT()] \ [out] On return contains the double precision complex result with the real part
in RESULT(1) and the imaginary part in RESULT(2). It is allowable for the
array RESULT() to occupy the same storage locations as the arrays A()
and/or B(). For example the statement, CALL ZPRO(Z, Z, Z), is
permissible.

In the case of the complex square root, which is double valued, ZSQRTX
returns the root with nonnegative real part. If the real part of the root is
zero it returns the root whose imaginary part is nonnegative. The other root
is always the negative of the returned root.

\item[DZABS] \ [out] Returns the double precision absolute value of the complex
number represented by the pair, (A(1),A(2)).

\end{description}

\subsection{Examples and Remarks}

The program, DRZCOMP, with its output, ODZCOMP, illustrates the use of these
subprograms. The example begins with three complex constants, $a$, $b$, and $u$%
. It computes $v = u+a$, $w = v\times b$, and $z = \sqrt w$. It then inverts this
sequence of computations by computing $w_2 = z\times z$, $v_2 = w_2/b$, and $u_2 =
v_2-a$. Mathematically this should result in $w_2 = w$, $v_2 =
v$, and $u_2 = u$. We test the last of these relations by computing TEST\ $=
u_2-u$.  Additionally TEST2 is a measure of the error in an
application of DZABS.  Both TEST and TEST2 are seen to be acceptably
small given that the computation was done with double precision IEEE
arithmetic.

\subsection{Functional Description}

\subsubsection{Method}

To compute $(u,v)$ as the square root of $(x,y)$ the basic algorithm is
\begin{gather*}
r = \sqrt{x^2 + y^2}\\
u = \sqrt{(r+|x|)/2}\\
v = |y|/(2u)\\
\text{if } x < 0 \text{ swap }u\text{ and }v\\
\text{if } y < 0 \text{ set }v = -v
\end{gather*}
Subroutine ZSQRTX contains special treatment for the cases of $x = 0$ or $y =
0$, and uses scaling to avoid unnecessary overflow that could result from
computing $x^2$ or $y^2.$

Subprograms ZQUO and DZABS use scaling to avoid unnecessary overflow.
In the five subroutines the implementations permit the output array to
occupy the same storage locations as the input arrays.

\subsubsection{Accuracy tests}

These subprograms have been tested using arguments on the four principal
axes and interior to the eight octants. Results were consistent with the
machine precision.

\subsection{Error Procedures and Restrictions}

If B($1) = 0$ and B($2) = 0$ in ZQUO, the subroutine will execute a division
by zero. We assume the host system will produce a runtime error diagnostic
in this case.

If the function DZABS is used its name must be typed as double precision in
the referencing program.

\subsection{Supporting Information}

The source language is ANSI Fortran~77.

Designed by C. L. Lawson, JPL, May~1986.

Programmed by C. L. Lawson and S. Y. Chiu, JPL, May~1986, Feb.~1987,
Nov.~1987.

Each of the subprograms, DZABS, ZDIF, ZPRO, ZQUO, ZSQRTX, and ZSUM is
contained in a program file of the same name.

\begcode

\medskip\

\lstset{language=[77]Fortran,showstringspaces=false}
\lstset{xleftmargin=.8in}

\centerline{\bf \large DRZCOMP}\vspace{10pt}
\lstinputlisting{\codeloc{zcomp}}

\vspace{30pt}\centerline{\bf \large ODZCOMP}\vspace{10pt}
\lstset{language={}}
\lstinputlisting{\outputloc{zcomp}}
\end{document}