\documentclass[11pt]{book}
\usepackage{index}
\usepackage[active]{srcltx}
\usepackage{graphicx}
\usepackage{psfrag}
\usepackage[all]{xy}
\bibliographystyle{amsalpha}
\input{macros}
\hoffset=-0.05\textwidth
\textwidth=1.1\textwidth
\voffset=-0.05\textheight
\textheight=1.1\textheight
\makeindex
%\renewcommand{\edit}[1]{}

\title{\Huge\bf\sc A Brief Introduction to 
Classical and Adelic Algebraic Number Theory}
\author{William Stein\\
(based heavily on works of Swinnerton-Dyer and Cassels)}
\date{May 2004}
\begin{document}
\maketitle
\newpage
\tableofcontents
\newpage

\chapter{Preface}
This book is based on notes I created for a one-semester undergraduate
course on Algebraic Number Theory, which I taught at Harvard during
Spring 2004.  The primary sources for the course were chapter 1 of
Swinnerton-Dyer's book {\em A Brief Guide to Algebraic Number Theory}
\cite{sd:brief} and chapter 2 of Cassels's article {\em Global Fields}
\cite{cassels:global}.  I wrote these notes by following closely the
above two chapters; in some cases I added substantial text and
examples.  For example, chapter 1 of \cite{sd:brief} is 30 pages,
whereas my rewrite of it occupies over 100 pages.  In contrast, I
follow \cite{cassels:global} more closely. 
  {\em I have no intent whatever to plagiarize.  I acknowledge as such
    those chapters in this book which are simply a close rewrite of
    \cite{cassels:global}.}
My goal is to take the useful classical article
(\cite{cassels:global}) and make it more accessible to students by
modernizing the notation, and adding additional explanations and 
examples.

I have no intent to publish this book with a traditional publisher, so
it will remain freely available indefinitely.  If you have comments,
corrections, suggestions for additions, etc., please send them to me!
\vspace{0.3in}
\begin{center}
---------------------------
\end{center}
\vspace{0.3in}
\noindent{}Copyright: William Stein, 2004.

\vspace{0.2in}
\noindent{}License: FREE!  More precisely, 
this book my be freely redistributed, copied, or even sold without
requiring you to obtain written permission from me.  You may even
extend or change this book, but this preface page must remain in any
derived work, and any derived work must also remain free, including
the \LaTeX{} source files.  In particular, I have no interest in
making any money from this book.

\vspace{0.2in}
\noindent{}Please send me any typos or corrections: {\tt
  was@math.harvard.edu}.

\newpage
\noindent{\bf Acknowledgement:}   This book closely builds on
Swinnerton-Dyer's book \cite{sd:brief} and Cassels's article
\cite{cassels:global}. Many of the students of Math 129 at Harvard
during Spring 2004 made helpful comments: Jennifer Balakrishnan, Peter
Behrooz, Jonathan Bloom, David Escott Jayce Getz, Michael Hamburg,
Deniz Kural, Danielle li, Andrew Ostergaard Gregory Price, Grant
Schoenebeck, Jennifer Sinnott, Stephen Walker, Daniel Weissman, and
Inna Zakharevich.  Also the course assistant Matt Bainbridge made many
helpful comments.


\chapter{Introduction}

\section{Mathematical background I assume you have}
In addition to general mathematical maturity, 
this book assumes you have the following background:
\begin{itemize}
\item Basics of finite group theory
\item Commutative rings, ideals, quotient rings
\item Some elementary number theory
\item Basic Galois theory of fields
\item Point set topology
\item Basic of topological rings, groups, and measure theory
\end{itemize}
For example, if you have never worked with finite groups before, you
should read another book first. If you haven't seen much elementary
ring theory, there is still hope, but you will have to do some
additional reading and exercises.  I will briefly review the basics of
the Galois theory of number fields.

Some of the homework problems involve using a computer, but I'll give
you examples which you can build on.  I will not assume that you have
a programming background or know much about algorithms.  If you don't
have PARI \cite{pari} or \magma{} \cite{magma}, and don't want to install
either one on your computer, you might want to try the following
online interface to PARI and \magma{}:
\begin{center}
\verb| http://modular.fas.harvard.edu/calc/ |
\end{center}


\section{What is algebraic number theory?}
A \defn{number field} $K$ is a finite algebraic extension
of the rational numbers $\Q$.  Every such extension can be
represented as all polynomials in an algebraic number $\alpha$:
$$
 K = \Q(\alpha) = \left\{ \sum_{n=0}^{m} a_n \alpha^n : a_n\in\Q \right\}.
$$ 
Here $\alpha$ is a root of a polynomial with coefficients in $\Q$.
\comment{
Note that
$\Q(\alpha)$ is non-canonically isomorphic to $\Q[x]/(f)$, where $f$
is the minimal polynomial of~$\alpha$.  The isomorphism is induced by
the homomorphism $\Q[x]\to\Q(\alpha)$ that sends~$x$ to~$\alpha$,
which has kernel~$(f)$.  It is not canonical, since $\Q(\alpha)$ could
have nontrivial automorphisms.  For example, if $\alpha=\sqrt{2}$, then
$\Q(\sqrt{2})$ is isomorphic as a field to $\Q(-\sqrt{2})$ via
$\sqrt{2}\mapsto -\sqrt{2}$.  There are two isomorphisms
$\Q[x]/(x^2-2)\to \Q(\sqrt{2})$.}

\defn{Algebraic number theory} involves using techniques from (mostly
commutative) algebra and finite group theory to gain a deeper
understanding of number fields.  The main objects that we study in
algebraic number theory are number fields, rings of integers of number
fields, unit groups, ideal class groups,norms, traces, discriminants,
prime ideals, Hilbert and other class fields and associated
reciprocity laws, zeta and $L$-functions, and algorithms for computing
each of the above.

\subsection{Topics in this book}
These are some of the main topics that are discussed in this book:
\begin{itemize}
\item Rings of integers of number fields
\item Unique factorization of ideals in Dedekind domains
\item Structure of the group of units of the ring of integers
\item Finiteness of the group of equivalence classes
of ideals of the ring of integers (the ``class group'')
\item Decomposition and inertia groups, Frobenius elements
\item Ramification
\item Discriminant and different
\item Quadratic and biquadratic fields
\item Cyclotomic fields (and applications)
\item How to use a computer to compute with many of the above 
objects (both algorithms and actual use of PARI and \magma{}).
\item Valuations on fields
\item Completions ($p$-adic fields)
\item Adeles and Ideles
\end{itemize}
Note that we will not do anything nontrivial with zeta functions or
$L$-functions.  This is to keep the prerequisites to algebra, and so
we will have more time to discuss algorithmic questions.  Depending on
time and your inclination, I may also talk about integer
factorization, primality testing, or complex multiplication elliptic
curves (which are closely related to quadratic imaginary fields).



\section{Some applications of algebraic number theory}
The following examples are meant to convince you that learning
algebraic number theory now will be an excellent investment of your
time.  If an example below seems vague to you, it is safe to
ignore it.

\begin{enumerate}
\item {\bf Integer factorization} using the number field sieve.  The
number field sieve is the asymptotically fastest known algorithm for
factoring general large integers (that don't have too special of a
form).  Recently, in December 2003, the number field sieve was used to
factor the RSA-576 \$10000 challenge:
$$
\begin{array}{l}
1881988129206079638386972394616504398071635633794173827007\ldots\\
\ldots6335642298885971523466548531906060650474304531738801130339\ldots\\
\ldots6716199692321205734031879550656996221305168759307650257059\\
=39807508642406493739712550055038649119906436234252670840\ldots\\
\hspace{1em}\ldots6385189575946388957261768583317\\
\hspace{2em}\times
47277214610743530253622307197304822463291469530209711\ldots\\
\hspace{3em}\ldots6459852171130520711256363590397527
\end{array}
$$
(The $\ldots$ indicates that the newline should be removed, not that
there are missing digits.)
For more information on the NFS, see 
the paper by Lenstra et al. on the Math 129
web page.
\item {\bf Primality test:} Agrawal and his students Saxena and Kayal from
India recently (2002) found the first ever deterministic
polynomial-time (in the number of digits) primality test.  There
methods involve arithmetic in quotients of $(\Z/n\Z)[x]$, which are
best understood in the context of algebraic number theory.  For
example, Lenstra, Bernstein, and others have done that and improved
the algorithm significantly.

\item {\bf Deeper point of view} on questions in number theory:
\begin{enumerate}
\item Pell's Equation ($x^2-dy^2=1$) $\Longrightarrow$ Units in real quadratic fields $\Longrightarrow$ Unit groups in number fields
\item Diophantine Equations $\Longrightarrow$ For which $n$ does $x^n+y^n=z^n$ have a 
nontrivial solution in $\Q(\sqrt{2})$?
\item Integer Factorization $\Longrightarrow$ Factorization of ideals
\item Riemann Hypothesis $\Longrightarrow$ Generalized Riemann Hypothesis
\item Deeper proof of Gauss's quadratic reciprocity law in terms of arithmetic
of cyclotomic fields $\Q(e^{2\pi i/n})$, which leads to class field theory.
\end{enumerate}
\item Wiles's proof of {\bf Fermat's Last Theorem}, i.e.,
$x^n+y^n=z^n$ has no nontrivial integer solutions, uses methods from
algebraic number theory extensively (in addition to many other deep
techniques).  Attempts to prove Fermat's Last Theorem long ago were
hugely influential in the development of algebraic number theory
(by Dedekind, Kummer, Kronecker, et al.).
\item {\bf Arithmetic geometry:} This is a huge field that studies
solutions to polynomial equations that lie in arithmetically
interesting rings, such as the integers or number fields.  A famous
major triumph of arithmetic geometry is Faltings's proof of Mordell's
Conjecture.
\begin{theorem}[Faltings] \label{thm:faltings}\ithm{Faltings}
Let $X$ be a plane algebraic curve over a number
field $K$.  Assume that the manifold $X(\C)$ of complex solutions to
$X$ has genus at least $2$ (i.e., $X(\C)$ is topologically a donut
with two holes).  Then the set $X(K)$ of points on $X$ with
coordinates in~$K$ is finite.
\end{theorem}  
For example, Theorem~\ref{thm:faltings} implies that for any $n\geq 4$
and any number field~$K$, there are only finitely many solutions
in~$K$ to $x^n+y^n=1$.  A famous open problem in arithmetic geometry
is the {\bf Birch and Swinnerton-Dyer conjecture}, which gives a deep
conjectural criterion for exactly when $X(K)$ should be infinite when
$X(\C)$ is a torus.

\end{enumerate}


\part{Classical Viewpoint}
\chapter{Finitely generated abelian groups}
\setcounter{section}{0}
We will now prove the structure theorem for finitely generated abelian
groups, since it will be crucial for much of what we will do later.
\i{abelian groups!structure theorem}
\i{structure theorem}

Let $\Z=\{0,\pm 1, \pm 2, \ldots\}$ denote the ring of integers, and
for each positive integer~$n$ let $\Z/n\Z$ denote the ring of integers
modulo~$n$, which is a cyclic abelian group of order~$n$ under
addition.

\begin{definition}[Finitely Generated]
  A group $G$ is \defn{finitely generated} if there exists $g_1,\ldots,
  g_n \in G$ such that every element of $G$ can be obtained from the
  $g_i$.
\end{definition}

\begin{theorem}[Structure Theorem for Abelian Groups]\label{thm:struc}
\ithm{structure of abelian groups}
Let $G$ be a finitely generated abelian group.  Then there is an isomorphism
$$
  G \isom (\Z/n_1\Z) \oplus (\Z/n_2\Z) \oplus \cdots \oplus
    (\Z/n_s\Z) \oplus \Z^{r},
$$
where $n_1>1$ and $n_1\mid{}n_2\mid{}\cdots \mid{}n_s$. 
Furthermore, the $n_i$ and~$r$ are uniquely determined by~$G$.
\end{theorem}

We will prove the theorem as follows.  We first remark that any
subgroup of a finitely generated free abelian group is finitely
generated.  Then we see that finitely generated abelian groups can be
presented as quotients of finite rank free abelian groups, and such a
presentation can be reinterpreted in terms of matrices over the
integers.  Next we describe how to use row and column operations over
the integers to show that every matrix over the integers is equivalent
to one in a canonical diagonal form, called the Smith normal form.  We
obtain a proof of the theorem by reinterpreting \ii{Smith normal form} in
terms of groups.

\begin{proposition}\label{prop:subfin}\iprop{subgroup of free group}
Suppose $G$ is a free abelian group of finite rank $n$, and $H$ is a
subgroup of $G$.  Then $H$ is a free abelian group generated by at
most $n$ elements.
\end{proposition}
The key reason that this is true is that~$G$ is a finitely generated
module over the principal ideal domain $\Z$.  We will give a complete
proof of a beautiful generalization of this result in the context of
Noetherian rings next time, but will not prove this proposition here.

\begin{corollary}\label{cor:presentation}\icor{group as quotient of free
groups}
Suppose $G$ is a finitely generated abelian group.  Then there are
finitely generated free abelian groups $F_1$ and $F_2$ such that
$G \isom F_1/F_2$.
\end{corollary}
\begin{proof}
Let $x_1,\ldots, x_m$ be generators for $G$.   Let $F_1=\Z^m$
and let $\vphi:F_1\to G$ be the map that sends the $i$th generator
$(0,0,\ldots,1,\ldots,0)$ of $\Z^m$ to $x_i$.  Then $\vphi$ is
a surjective homomorphism, and by Proposition~\ref{prop:subfin} the
kernel $F_2$ of $\vphi$ is a finitely generated free abelian group.
This proves the corollary.
\end{proof}

Suppose $G$ is a nonzero finitely generated abelian group.  By the
corollary, there are free abelian groups $F_1$ and $F_2$ such that
$G\isom F_1/F_2$.  Choosing a basis for $F_1$, we obtain an
isomorphism $F_1\isom \Z^n$, for some positive integer~$n$. By
Proposition~\ref{prop:subfin}, $F_2\isom \Z^m$, for some integer $m$
with $0\leq m\leq n$, and the inclusion map $F_2\hookrightarrow F_1$
induces a map $\Z^m\to \Z^n$.  This homomorphism is left
multiplication by the $n\times m$ matrix $A$ whose columns are the
images of the generators of $F_2$ in $\Z^n$.  The \defn{cokernel} of
this homomorphism is the quotient of $\Z^n$ by the image of $A$, and the
cokernel is isomorphic to $G$.  By augmenting $A$ with zero columns on
the right we obtain a square $n\times n$ matrix $A$ with the same
cokernel.  The following proposition implies that we may choose bases
such that the matrix $A$ is diagonal, and then the structure of
the cokernel of $A$ will be easy to understand.

\begin{proposition}[Smith normal form]\label{prop:smith}\iprop{Smith normal form}
Suppose~$A$ is an $n\times n$ integer matrix.  Then there exist
invertible integer matrices $P$ and $Q$ such that $A'=PAQ$ is a
diagonal matrix with entries $n_1, n_2,\ldots, n_s,0,\ldots,0$, where
$n_1>1$ and $n_1\mid n_2 \mid{} \ldots \mid{} n_s$.  This is called
the Smith normal form of $A$.
\end{proposition}
We will see in the proof of Theorem~\ref{thm:struc} that
$A'$ is uniquely determined by $A$.
\begin{proof}
The matrix $P$ will be a product of matrices that define elementary
row operations and $Q$ will be a product corresponding to elementary
column operations.  The elementary operations are:
\begin{enumerate}
\item Add an integer multiple of one row to another (or a multiple
of one column to another).
\item Interchange two rows or two columns.
\item Multiply a row by $-1$.
\end{enumerate}
Each of these operations is given by left or right multiplying by an
invertible matrix~$E$ with integer entries, where~$E$ is the result of
applying the given operation to the identity matrix, and~$E$ is
invertible because each operation can be reversed using another row or
column operation over the integers.

To see that the proposition must be true, assume $A\neq 0$ and perform
the following steps (compare \cite[pg. 459]{artin:algebra}):
\begin{enumerate}
\item By permuting rows and columns, move a nonzero entry of $A$ with
smallest absolute value to the upper left corner of $A$.  Now attempt
to make all other entries in the first row and column $0$ by adding
multiples of row or column 1 to other rows (see step~2 below).  If an
operation produces a nonzero entry in the matrix with absolute value
smaller than $|a_{11}|$, start the process over by permuting rows and
columns to move that entry to the upper left corner of $A$.  Since the
integers $|a_{11}|$ are a decreasing sequence of positive integers, we
will not have to move an entry to the upper left corner infinitely
often.

\item Suppose $a_{i1}$ is a nonzero entry in the first column, with
$i>1$.  Using the division algorithm, write $a_{i1} = a_{11}q + r$,
with $0\leq r < a_{11}$.  Now add $-q$ times the first row to the
$i$th row.  If $r>0$, then go to step~1 (so that an entry with
absolute value at most $r$ is the upper left corner).  Since we will
only perform step 1 finitely many times, we may assume $r=0$.
Repeating this procedure we set all entries in the first column
(except $a_{11}$) to $0$.  A similar process using column operations
sets each entry in the first row (except $a_{11}$) to $0$.

\item We may now assume that $a_{11}$ is the only nonzero entry in the
first row and column.  If some entry $a_{ij}$ of $A$ is not divisible
by $a_{11}$, add the column of $A$ containing $a_{ij}$ to the first
column, thus producing an entry in the first column that is nonzero.
When we perform step~2, the remainder $r$ will be greater than $0$.
Permuting rows and columns results in a smaller $|a_{11}|$.  Since
$|a_{11}|$ can only shrink finitely many times, eventually we will get
to a point where every $a_{ij}$ is divisible by $a_{11}$.  If $a_{11}$
is negative, multiple the first row by $-1$.
\end{enumerate}
After performing the above operations, the first row and column
of $A$ are zero except for $a_{11}$ which is positive and divides
all other entries of $A$.  We repeat the above steps for the 
matrix $B$ obtained from $A$ by deleting the first row and column.
The upper left entry of the resulting matrix will be divisible by
$a_{11}$, since every entry of $B$ is.  Repeating the argument
inductively proves the proposition.
\end{proof}

\begin{example}
The matrix $\mtwo{1}{2}{3}{4}$ is equivalent
to $\mtwo{1}{0}{0}{2}$
and the matrix 
$\mthree{1}{2}{3}{4}{5}{6}{7}{8}{9}$
is equivalent to 
$\mthree{1}{0}{0}{0}{3}{0}{0}{0}{0}.$
Note that the determinants match, up to sign.
\end{example}

\begin{proof}[Theorem~\ref{thm:struc}] 
Suppose $G$ is a finitely generated abelian group, which we may assume
is nonzero.  As in the paragraph before Proposition~\ref{prop:smith},
we use Corollary~\ref{cor:presentation} to write $G$ as a the cokernel
of an $n\times n$ integer matrix $A$.  By Proposition~\ref{prop:smith}
there are isomorphisms $Q:\Z^n\to \Z^n$ and $P:\Z^n\to \Z^n$ such that
$A'=PAQ$ is a diagonal matrix with entries $n_1, n_2,\ldots,
n_s,0,\ldots,0$, where $n_1>1$ and $n_1\mid n_2 \mid{} \ldots \mid{}
n_s$.  Then $G$ is isomorphic to the cokernel of the diagonal matrix
$A'$, so
\begin{equation}
\label{eqn:gprod}
  G \isom (\Z/n_1\Z) \oplus (\Z/n_2\Z)
 \oplus \cdots \oplus (\Z/n_s\Z) \oplus \Z^{r},
\end{equation}
as claimed.  The $n_i$ are determined by $G$, because $n_i$ is the
smallest positive integer~$n$ such that $nG$ requires at most $s+r-i$
generators (we see from the representation (\ref{eqn:gprod}) of $G$ as
a product that $n_i$ has this property and that no smaller positive
integer does).

\end{proof}

\chapter{Commutative Algebra}
We will do some serious commutative algebra in this chapter, which
will provide a powerful algebraic foundation for understanding the
more refined number-theoretic structures associated to number fields.

In the first section we establish the standard properties of
Noetherian rings and modules, including the Hilbert basis theorem.  We
also observe that finitely generated abelian groups are Noetherian
$\Z$-modules, which fills the gap in our proof of the structure
theorem for finitely generated abelian groups.  After establishing
properties of Noetherian rings, we consider the rings of algebraic
integers and discuss some of their properties.


\section{Noetherian Rings and Modules}
Let~$R$ be a commutative ring with unit element.  We will frequently
work with $R$-modules, which are like vector spaces but over a ring.
More precisely, recall that an \defn{$R$-module} is an additive abelian
group $M$ equipped with a map $R\times M \to M$ such that for all~$r,
r'\in R$ and all $m, m'\in M$ we have $(r r')m = r(r' m )$, $(r + r')m
= rm + r' m$, $r(m+m') = rm + rm'$, and $1m=m$.  A \defn{submodule}
is a subgroup of $M$ that is preserved by the action of $R$.

\begin{example}
The set of abelian groups are in natural bijection with
$\Z$-modules.
\end{example}

A \defn{homomorphism} of $R$-modules $\vphi:M\to N$ is a abelian group
homomorphism such that for any $r\in R$ and $m\in M$ we have
$\vphi(rm) = r\vphi(m)$.  A \defn{short exact sequence} of $R$-modules
$$0 \to L \xra{f} M \xra{g} N \to 0$$
is a specific choice of injective homomorphism $f:L\to M$ and 
a surjective homomorphism $g:M\to N$ such that $\im(f) = \ker(g)$.


\begin{definition}[Noetherian] An $R$-module~$M$ is \defn{Noetherian} if every
submodule of $M$ is finitely generated.  A ring~$R$ is \defn{Noetherian} if~$R$ is
Noetherian as a module over itself, i.e., if every ideal of~$R$ is finitely generated.
\end{definition}

Notice that any submodule $M'$ of $M$ is Noetherian, because if every submodule of $M$
is finitely generated then so is every submodule of $M'$, since submodules of $M'$
are also submodules of $M$.  

\begin{definition}[Ascending chain condition]
An $R$-module $M$ satisfies the \defn{ascending chain condition} if
every sequences $M_1\subset M_2 \subset M_3 \subset \cdots$ of
submodules of~$M$ eventually stabilizes, i.e., there is some $n$ such
that $M_n=M_{n+1}=M_{n+2}=\cdots$.
\end{definition}

\begin{proposition}\iprop{characterization of Noetherian}
If $M$ is an $R$-module, then the following are equivalent:
\begin{enumerate}
\item $M$ is Noetherian,
\item $M$ satisfies the ascending chain condition, and
\item Every nonempty set of submodules of $M$ contains at least one
maximal element.
\end{enumerate}
\end{proposition}
\begin{proof}
{\bf $1\implies 2$:} Suppose $M_1\subset M_2\subset \cdots$ is a
sequence of submodules of $M$.  Then $M_\infty=\union_{n=1}^{\infty}
M_n$ is a submodule of $M$.  Since $M$ is Noetherian, there is a
finite set $a_1,\ldots, a_m$ of generators for $M$.  Each $a_i$
must be contained in some $M_j$, so there is an $n$ such that
$a_1,\ldots, a_m\in M_n$.  But then $M_{k}=M_n$ for all $k\geq n$,
which proves that the ascending chain condition holds for~$M$.

\noindent{}{\bf $2\implies 3$:} Suppose 3 were false, so there exists
a nonempty set~$S$ of submodules of~$M$ that does not contain a
maximal element.  We will use~$S$ to construct an infinite ascending
chain of submodules of~$M$ that does not stabilize.  Note that~$S$ is
infinite, otherwise it would contain a maximal element.  Let $M_1$ be
any element of~$S$.  Then there is an $M_2$ in $S$ that contains
$M_1$, otherwise $S$ would contain the maximal element $M_1$.
Continuing inductively in this way we find an $M_3$ in $S$ that
properly contains $M_2$, etc., and we produce an infinite ascending
chain of submodules of $M$, which contradicts the ascending chain
condition.

\noindent{}{\bf $3\implies 1$:} Suppose 1 is false, so there is a
submodule $M'$ of~$M$ that is not finitely generated.  We will show
that the set~$S$ of all finitely generated submodules of $M'$ does not
have a maximal element, which will be a contradiction.  Suppose~$S$
does have a maximal element~$L$.  Since~$L$ is finitely generated and
$L\subset M'$, and $M'$ is not finitely generated, there is an $a\in
M'$ such that $a\not\in L$.  Then $L'=L+Ra$ is an element of~$S$ that
strictly contains the presumed maximal element~$L$, a contradiction.
\end{proof}

\begin{lemma}\label{lem:noetherianexact}\ilem{exactness and Noetherian}
If 
$$
 0 \to L \xra{f} M \xra{g} N \to 0
$$ 
is a short exact sequence of~$R$-modules, then~$M$ is Noetherian if and 
only if both~$L$ and~$N$ are Noetherian.
\end{lemma}
\begin{proof}
First suppose that~$M$ is Noetherian.  Then~$L$ is a submodule of~$M$, so~$L$
is Noetherian.   If $N'$ is a submodule of~$N$, then the inverse image of $N'$
in~$M$ is a submodule of~$M$, so it is finitely generated, hence its image
$N'$ is finitely generated.  Thus~$N$ is Noetherian as well.

Next assume nothing about~$M$, but suppose that both~$L$ and~$N$ are
Noetherian.  If $M'$ is a submodule of $M$, then $M_0=\vphi(L)\cap M'$
is isomorphic to a submodule of the Noetherian module $L$, so $M_0$ is
generated by finitely many elements $a_1,\ldots, a_n$.  The quotient
$M'/M_0$ is isomorphic (via $g$) to a submodule of the Noetherian
module~$N$, so $M'/M_0$ is generated by finitely many elements
$b_1,\ldots, b_m$. For each $i\leq m$, let $c_i$ be a lift of $b_i$ to
$M'$, modulo $M_0$.  Then the elements $a_1,\ldots, a_n, c_1,\ldots,
c_m$ generate $M'$, for if $x\in M'$, then there is some element $y\in
M_0$ such that $x-y$ is an $R$-linear combination of the $c_i$,
and~$y$ is an $R$-linear combination of the $a_i$.
\end{proof}


\begin{proposition}\label{prop:noethfg}\iprop{Noetherian equals finitely generated}
Suppose~$R$ is a Noetherian ring.  Then an $R$-module~$M$ is 
Noetherian if and only if it is finitely generated. 
\end{proposition}
\begin{proof}
If~$M$ is Noetherian then every submodule of~$M$ is finitely generated
so~$M$ is finitely generated.  Conversely, suppose~$M$ is finitely
generated, say by elements $a_1,\ldots, a_n$.  Then there is a
surjective homomorphism from $R^n=R\oplus \cdots \oplus R$ to~$M$ that
sends $(0,\ldots,0,1,0,\ldots,0)$ ($1$ in $i$th factor) to $a_i$.
Using Lemma~\ref{lem:noetherianexact} and exact sequences of
$R$-modules such as $0\to R\to R\oplus R\to R\to 0$, we see
inductively that $R^n$ is Noetherian.  Again by
Lemma~\ref{lem:noetherianexact}, homomorphic images of Noetherian
modules are Noetherian, so~$M$ is Noetherian.
\end{proof}

\begin{lemma}\label{lem:surjnoetherian}\ilem{surjection and Noetherian}
Suppose $\vphi:R\to S$ is a surjective homomorphism of rings 
and $R$ is Noetherian.   Then $S$ is Noetherian.
\end{lemma}
\begin{proof}
The kernel of $\vphi$ is an ideal $I$ in $R$, and
we have an exact sequence 
$$ 
  0 \to I \to R \to S \to 0
$$
with~$R$ Noetherian.  By Lemma~\ref{lem:noetherianexact}, it follows
that~$S$ is a Noetherian $R$-modules.  Suppose~$J$ is an ideal of~$S$.
Since~$J$ is an $R$-submodule of~$S$, if we view~$J$ as an $R$-module,
then~$J$ is finitely generated.  Since~$R$ acts on~$J$ through~$S$,
the $R$-generators of~$J$ are also $S$-generators of~$J$, so~$J$ 
is finitely generated as an ideal.  Thus~$S$ is Noetherian.
\end{proof}

\begin{theorem}[Hilbert Basis Theorem]
\ithm{Hilbert Basis}
If $R$ is a Noetherian ring and $S$ is finitely generated as a ring
over~$R$, then~$S$ is Noetherian.  In particular, for any~$n$ the
polynomial ring $R[x_1,\ldots, x_n]$ and any of its quotients are
Noetherian.
\end{theorem}
\begin{proof}
Assume first that we have already shown that for any $n$ the
polynomial ring $R[x_1,\ldots, x_n]$ is Noetherian.  Suppose $S$ is
finitely generated as a ring over $R$, so there are generators
$s_1,\ldots, s_n$ for $S$.  Then the map $x_i\mapsto s_i$ extends
uniquely to a surjective homomorphism $\pi: R[x_1,\ldots, x_n] \to S$,
and Lemma~\ref{lem:surjnoetherian} implies that $S$ is Noetherian.

The rings $R[x_1,\ldots, x_n]$ and $(R[x_1,\ldots,x_{n-1}])[x_n]$ are
isomorphic, so it suffices to prove that if~$R$ is Noetherian then
$R[x]$ is also Noetherian.  (Our proof follows
\cite[\S12.5]{artin:algebra}.)
Thus suppose $I$ is an ideal of $R[x]$ and that~$R$ is
Noetherian.  We will show that $I$ is finitely generated.

Let $A$ be the set of leading coefficients of polynomials in $I$ along
with $0$.  If $a,b\in A$ are nonzero with $a+b\neq 0$, then there are
polynomials $f$ and $g$ in $I$ with leading coefficients $a$ and $b$.
If $\deg(f)\leq \deg(g)$, then $a+b$ is the leading coefficient of
$x^{\deg(g)-\deg(f)}f + g$, so $a+b\in A$.  If $r\in R$ and $a\in A$
with $ra\neq 0$, then $ra$ is the leading coefficient of $rf$, so
$ra\in A$.  Thus $A$ is an ideal in $R$, so since $R$ is Noetherian
there exists $a_1,\ldots, a_n$ that generate $A$ as an ideal.  Since
$A$ is the set of leading coefficients of elements of $I$, and the
$a_j$ are in $I$, we can choose for each $j\leq n$ an element $f_j\in
I$ with leading coefficient $a_j$.  By multipying the $f_j$ by some power
of~$x$, we may assume that the $f_j$ all have the same degree $d$.

Let $S_{<d}$ be the set of elements of~$I$ that have degree strictly less
than~$d$.  This set is closed under addition and under multiplication by
elements of~$R$, so $S_{<d}$ is a module over~$R$.  The module $S_{<d}$ is submodule of
the $R$-module of polynomials of degree less than~$n$, which is
Noetherian because it is generated by $1,x,\ldots, x^{n-1}$.  Thus
$S_{<d}$ is finitely generated, and we may choose generators $h_1,\ldots,
h_m$ for $S_{<d}$.

Suppose $g\in I$ is an arbitrary element.  We will show by induction
on the degree of~$g$ that~$g$ is an $R[x]$-linear combination of
$f_1,\ldots, f_n, h_1,\ldots h_m$.  Thus suppose this statement is
true for all elements of~$I$ of degree less than the degree of~$g$.
If the degree of~$g$ is less than~$d$, then $g\in S_{<d}$, so~$g$ is
in the $R[x]$-ideal generated by $h_1,\ldots, h_m$.  Next suppose
that~$g$ has degree $e\geq d$.  Then the leading coefficient~$b$
of~$g$ lies in the ideal~$A$ of leading coefficients of~$g$, so there
exist $r_i\in R$ such that $b=r_1 a_1 + \cdots + r_n a_n$.  Since
$f_i$ has leading coefficient $a_i$, the difference $g- x^{e-d} r_i
f_i$ has degree less than the degree~$e$ of~$g$.  By induction $g-
x^{e-d} r_i f_i$ is an $R[x]$ linear combination of $f_1,\ldots, f_n,
h_1,\ldots h_m$, so $g$ is also an $R[x]$ linear combination of
$f_1,\ldots, f_n, h_1,\ldots h_m$.  Since each $f_i$ and $h_j$ lies in
$I$, it follows that $I$ is generated by $f_1,\ldots, f_n, h_1,\ldots
h_m$, so $I$ is finitely generated, as required.
\end{proof}

Properties of Noetherian rings and modules will be crucial in the rest
of this course.  We have proved above that Noetherian rings have many
desirable properties.

\subsection{$\Z$ is Noetherian}
The ring $\Z$ of integers is Noetherian because every ideal of $\Z$ is
generated by one element. 
\begin{proposition}\label{prop:zpid}\iprop{$\Z$ is a PID}
Every ideal of the ring $\Z$ of integers is principal.
\end{proposition}
\begin{proof}
Suppose~$I$ is a nonzero ideal in~$\Z$.  Let~$d$ the least positive
element of~$I$.  Suppose that $a\in I$ is any nonzero element of~$I$.
Using the division algorithm, write  $a=dq + r$, where~$q$ is an integer
and $0\leq r < d$.  We have $r=a-dq\in I$ and $r<d$, so our assumption
that $d$ is minimal implies that $r=0$, so $a=dq$ is in the ideal generated
by~$d$.   Thus~$I$ is the principal ideal generated by~$d$.
\end{proof}

Proposition~\ref{prop:noethfg} and \ref{prop:zpid} together imply that
any finitely generated abelian group is Noetherian.  This means that
subgroups of finitely generated abelian groups are finitely generated,
which provides the missing step in our proof of the structure theorem
for finitely generated abelian groups.

\chapter{Rings of Algebraic Integers}
In this chapter we will learn about rings of algebraic integers and
discuss some of their properties.  We will prove that the ring of
integers $\O_K$ of a number field is Noetherian.
We will also develop some basic properties of norms, traces, and
discriminants, and give more properties of rings of integers in the
general context of Dedekind domains.


\section{Rings of Algebraic Integers}
Fix an algebraic closure $\Qbar$ of $\Q$.  For example, $\Qbar$ could
be the subfield of the complex numbers $\C$ generated by all roots in
$\C$ of all polynomials with coefficients in $\Q$.

Much of this course is about algebraic integers.
\begin{definition}[Algebraic Integer]
An element $\alpha\in\Qbar$ is an \defn{algebraic integer} if it is a
root of some monic polynomial with coefficients in $\Z$.
\end{definition}

\begin{definition}[Minimal Polynomial]
The \defn{minimal polynomial} of $\alpha\in\Q$ is the monic polynomial
$f\in\Q[x]$ of least positive degree such that $f(\alpha)=0$.
\end{definition}
The minimal polynomial of $\alpha$ divides any polynomial~$h$ such
that $h(\alpha)=0$, for the following reason. If $h(\alpha)=0$, use
the division algorithm to write $h=qf + r$, where $0\leq \deg(r) <
\deg(f)$.  We have $r(\alpha) = h(\alpha) - q(\alpha) f(\alpha) = 0$,
so $\alpha$ is a root of~$r$.  However,~$f$ is the polynomial of least
positive degree with root~$\alpha$, so $r=0$.

\begin{lemma}\label{lem:minpolint}\ilem{minimal polynomial of algebraic integer}
If~$\alpha$ is an algebraic integer, then the minimal polynomial
of~$\alpha$ has coefficients in~$\Z$.
\end{lemma}
\begin{proof}
Suppose $f\in\Q[x]$ is the minimal polynomial of $\alpha$ and
$g\in\Z[x]$ is a monic integral polynomial such that $g(\alpha)=0$.
As mentioned after the definition of minimal polynomial, we have
$g=fh$, for some $h\in\Q[x]$.  If $f\not\in\Z[x]$, then some prime~$p$
divides the denominator of some coefficient of $f$.  Let $p^i$ be the
largest power of~$p$ that divides some denominator of some
coefficient~$f$, and likewise let $p^j$ be the largest power of~$p$
that divides some denominator of a coefficient of~$g$.  Then $p^{i+j}g
= (p^if)(p^j g)$, and if we reduce both sides modulo $p$, then the
left hand side is $0$ but the right hand side is a product of two
nonzero polynomials in $\F_p[x]$, hence nonzero, a contradiction.
\end{proof}

\begin{proposition}\label{prop:intfg}\iprop{characterization of integrality}
An element $\alpha\in\Qbar$ is integral if and only if $\Z[\alpha]$ is
finitely generated as a $\Z$-module.
\end{proposition}
\begin{proof}
Suppose~$\alpha$ is integral and let $f\in\Z[x]$ be the monic minimal polynomial
of~$\alpha$ (that $f\in\Z[x]$ is Lemma~\ref{lem:minpolint}).  Then $\Z[\alpha]$
is generated by $1,\alpha,\alpha^2,\ldots,\alpha^{d-1}$, where~$d$ is
the degree of~$f$.   Conversely, suppose $\alpha\in\Qbar$ is such that
$\Z[\alpha]$ is finitely generated, say by elements 
$f_1(\alpha), \ldots, f_n(\alpha)$.  Let~$d$ be any integer bigger
than the degree of any~$f_i$.  Then there exist integers $a_i$ such
that $\alpha^d = \sum a_i f_i(\alpha)$, hence~$\alpha$ satisfies
the monic polynomial $x^d - \sum a_i f_i(x) \in \Z[x]$, so~$\alpha$
is integral.
\end{proof}

The rational number $\alpha=1/2$ is not integral.  Note that
$G=\Z[1/2]$ is not a finitely generated $\Z$-module, since $G$ is infinite
and $G/2G=0$.

\begin{proposition}\iprop{$\Zbar$ is a ring}
The set $\Zbar$ of all algebraic integers is a ring, i.e., the sum and
product of two algebraic integers is again an algebraic integer.
\end{proposition}
\begin{proof}
Suppose $\alpha, \beta\in \Z$, and let $m, n$ be the degrees of the
minimal polynomials of $\alpha, \beta$, respectively.  Then
$1,\alpha,\ldots,\alpha^{m-1}$ span $\Z[\alpha]$ and
$1,\beta,\ldots,\beta^{n-1}$ span $\Z[\beta]$ as $\Z$-module.  Thus
the elements $\alpha^i\beta^j$ for $i \leq m, j\leq n$ span
$\Z[\alpha, \beta]$.  Since $\Z[\alpha + \beta]$ is a submodule of the
finitely-generated module $\Z[\alpha, \beta]$, it is finitely
generated, so $\alpha+\beta$ is integral.  Likewise, $\Z[\alpha\beta]$
is a submodule of $\Z[\alpha, \beta]$, so it is also finitely
generated and $\alpha\beta$ is integral.
\end{proof}

Recall that a \defn{number field} is a subfield~$K$ of $\Qbar$ such
that the degree $[K:\Q] := \dim_\Q(K)$ is finite.
\begin{definition}[Ring of Integers]
The \defn{ring of integers} of a number field~$K$ is the ring 
$$
  \O_K = K \cap \Zbar = \{x \in K : \text{ $x$ is an algebraic integer}\}.
$$
\end{definition}


The field $\Q$ of rational numbers is a number field of degree $1$,
and the ring of integers of $\Q$ is $\Z$.  The field $K=\Q(i)$ of
Gaussian integers has degree $2$ and $\O_K = \Z[i]$.  The field
$K=\Q(\sqrt{5})$ has ring of integers $\O_K = \Z[(1+\sqrt{5})/2]$.
Note that the Golden ratio $(1+\sqrt{5})/2$ satisfies $x^2-x-1$.
According to \magma{}, the ring of integers of $K=\Q(\sqrt[3]{9})$ is
$\Z[\sqrt[3]{3}]$, where $\sqrt[3]{3}=\frac{1}{3}(\sqrt[3]{9})^2$.

\begin{definition}[Order]
An \defn{order} in $\O_K$ is any subring $R$ of $\O_K$ such that the
quotient $\O_K/R$ of abelian groups is finite.  
(Note that $R$ must contain $1$ because it is a ring, and for us
every ring has a $1$.)
\end{definition}
As noted above, $\Z[i]$ is the ring of integers of $\Q(i)$.  For every
nonzero integer $n$, the subring $\Z+ni\Z$ of $\Z[i]$ is an order.
The subring $\Z$ of $\Z[i]$ is not an order, because $\Z$ does not
have finite index in $\Z[i]$.  Also the subgroup $2\Z + i\Z$ of
$\Z[i]$ is not an order because it is not a ring.  

We will frequently consider orders in practice because they are often
much easier to write down explicitly than $\O_K$.  For example, if
$K=\Q(\alpha)$ and $\alpha$ is an algebraic integer, then $\Z[\alpha]$
is an order in $\O_K$, but frequently $\Z[\alpha]\neq \O_K$.  

\begin{lemma}\label{lem:intq}\ilem{$\O_K$ span and $\O_K\cap \Q=\Z$}
Let $\O_K$ be the ring of integers of a number field.  Then 
$\O_K\cap \Q = \Z$ and $\Q\O_K = K$.
\end{lemma}
\begin{proof}
Suppose $\alpha\in \O_K\cap\Q$ with $\alpha=a/b$ in lowest terms and
$b>0$.  The monic minimal polynomial of $\alpha$ is $bx-a\in\Z[x]$, so
if $b\neq 1$ then Lemma~\ref{lem:minpolint} implies that $\alpha$ is
not an algebraic integer, a contradiction.

To prove that $\Q\O_K=K$, suppose $\alpha\in K$, and let
$f(x)\in\Q[x]$ be the minimal monic polynomial of~$\alpha$.  For any
positive integer~$d$, the minimal monic polynomial of $d\alpha$ is
$d^{\deg(f)}f(x/d)$, i.e., the polynomial obtained from $f(x)$ by
multiplying the coefficient of $x^{\deg(f)}$ by~$1$, multiplying the
coefficient of $x^{\deg(f)-1}$ by~$d$, multiplying the coefficient of
$x^{\deg(f)-2}$ by $d^2$, etc.  If~$d$ is the least common multiple of
the denominators of the coefficients of~$f$, then the minimal monic
polynomial of $d\alpha$ has integer coefficients, so $d\alpha$ is
integral and $d\alpha\in \O_K$.  This proves that $\Q\O_K = K$.
\end{proof}

In the next two sections we will develop some basic properties of
norms and traces, and deduce further properties of rings of integers.

\section{Norms and Traces}
Before discussing norms and traces we introduce some notation for
field extensions.  If $K\subset L$ are number fields, we let $[L:K]$
denote the dimension of~$L$ viewed as a $K$-vector space.  If~$K$ is a
number field and $a\in \Qbar$, let $K(a)$ be the number field
generated by~$a$, which is the smallest number field that
contains~$a$.  If $a\in\Qbar$ then~$a$ has a minimal polynomial
$f(x)\in\Q[x]$, and the \defn{Galois conjugates} of~$a$ are the roots
of~$f$.  For example the element $\sqrt{2}$ has minimal polynomial
$x^2-2$ and the Galois conjugates of $\sqrt{2}$ are $\pm \sqrt{2}$.

Suppose $K\subset L$ is an inclusion of number fields and let $a\in
L$.  Then left multiplication by~$a$ defines a $K$-linear
transformation $\ell_a:L\to L$.  (The transformation $\ell_a$ is
$K$-linear because $L$ is commutative.)

\begin{definition}[Norm and Trace]
The \defn{norm} and \defn{trace} of~$a$ from~$L$ to~$K$ are
$$\Norm_{L/K}(a)=\det(\ell_a) \quad\text{ and }\quad
 \tr_{L/K}(a)=\tr(\ell_a).$$
\end{definition}
It is standard from linear algebra that 
determinants are multiplicative
and traces are additive, so for $a,b\in L$ we have
$$\Norm_{L/K}(ab) = \Norm_{L/K}(a)\cdot \Norm_{L/K}(b)$$
and
$$\tr_{L/K}(a+b) = \tr_{L/K}(a) + \tr_{L/K}(b).$$

Note that if $f\in\Q[x]$ is the characteristic polynomial of~$\ell_a$,
then the constant term of $f$ is $(-1)^{\deg(f)}\det(\ell_a)$, and the
coefficient of $x^{\deg(f)-1}$ is $-\tr(\ell_a)$.

\begin{proposition}\label{prop:normtracesigma}\iprop{norm and trace}
Let $a\in L$ and let $\sigma_1,\ldots, \sigma_d$, where $d=[L:K]$, be
the distinct field embeddings $L\hra \Qbar$ that fix every element
of~$K$.  Then
$$
\Norm_{L/K}(a) = \prod_{i=1}^d \sigma_i(a)
\quad\text{ and }\quad
\tr_{L/K}(a) = \sum_{i=1}^d \sigma_i(a).
$$
\end{proposition}
\begin{proof}
We prove the proposition by computing the characteristic
polynomial~$F$ of~$a$.  Let $f\in K[x]$ be the minimal polynomial
of~$a$ over~$K$, and note that~$f$ has distinct roots (since it is the
polynomial in $K[x]$ of least degree that is satisfied by~$a$).
Since~$f$ is irreducible, $[K(a):K]=\deg(f)$, and~$a$ satisfies a
polynomial if and only if~$\ell_a$ does, the characteristic polynomial
of $\ell_a$ acting on $K(a)$ is~$f$.  Let $b_1,\ldots,b_n$ be a basis
for $L$ over $K(a)$ and note that $1,\ldots, a^m$ is a basis for
$K(a)/K$, where $m=\deg(f)-1$.  Then $a^i b_j$ is a basis for $L$ over
$K$, and left multiplication by $a$ acts the same way on the span of
$b_j, a b_j, \ldots, a^m b_j$ as on the span of $b_k, a b_k, \ldots,
a^m b_k$, for any pair $j, k\leq n$.  Thus the matrix of $\ell_a$ on
$L$ is a block direct sum of copies of the matrix of $\ell_a$ acting
on $K(a)$, so the characteristic polynomial of $\ell_a$ on~$L$ is
$f^{[L:K(a)]}$.  The proposition follows because the roots of
$f^{[L:K(a)]}$ are exactly the images $\sigma_i(a)$, with multiplicity
$[L:K(a)]$ (since each embedding of $K(a)$ into $\Qbar$ extends in
exactly $[L:K(a)]$ ways to $L$ by Exercise~\ref{ex:extends}).
\end{proof}

The following corollary asserts that the norm and trace behave well in
towers.
\begin{corollary}\icor{norm, trace compatible with towers}
Suppose $K\subset L \subset M$ is a tower of number fields, and
let $a\in M$.  Then 
$$
\Norm_{M/K}(a) = \Norm_{L/K}(\Norm_{M/L}(a))
\quad\text{ and }\quad
\tr_{M/K}(a) = \tr_{L/K}(\tr_{M/L}(a)).
$$
\end{corollary}
\begin{proof}
For the first equation, both sides are the product of $\sigma_i(a)$,
where $\sigma_i$ runs through the embeddings of~$M$ into $K$.  To see
this, suppose $\sigma:L\to \Qbar$ fixes $K$. If $\sigma'$ is an
extension of $\sigma$ to $M$, and $\tau_1,\ldots, \tau_d$ are the
embeddings of $M$ into $\Qbar$ that fix $L$, then
$\tau_1\sigma',\ldots,\tau_d\sigma'$ are exactly the extensions of
$\sigma$ to~$M$.  For the second statement, both sides are the sum of
the $\sigma_i(a)$.
\end{proof}

The norm and trace down to~$\Q$ of an algebraic integer~$a$ is an
element of~$\Z$, because the minimal polynomial of~$a$ has integer
coefficients, and the characteristic polynomial of~$a$ is a power of the
minimal polynomial, as we saw in the proof of
Proposition~\ref{prop:normtracesigma}.

\begin{proposition}\label{prop:ok_lattice}\iprop{$\O_K$ is a lattice}
Let~$K$ be a number field.  The ring of integers $\O_K$ is a lattice
in~$K$, i.e., $\Q\O_K=K$ and $\O_K$ is an abelian group of rank $[K:\Q]$.
\end{proposition}
\begin{proof}
We saw in Lemma~\ref{lem:intq} that $\Q\O_K=K$.  Thus there exists a
basis $a_1,\ldots, a_n$ for~$K$, where each~$a_i$ is in $\O_K$.
Suppose that as $x=\sum c_i a_i\in \O_K$ varies over all elements of
$\O_K$ the denominators of the coefficients $c_i$ are arbitrarily
large.  Then subtracting off integer multiples of the $a_i$, we see
that as $x=\sum c_i a_i\in \O_K$ varies over elements of $\O_K$ with
$c_i$ between $0$ and $1$, the denominators of the $c_i$ are also
arbitrarily large.  This implies that there are infinitely many elements
of $\O_K$ in the bounded subset
$$S = \left\{c_1 a_1 +\cdots + c_n a_n : c_i \in \Q,\, 0\leq c_i \leq 1\right\}\subset K.$$
Thus for any $\eps>0$, there are elements $a,b\in \O_K$ such that the
coefficients of $a-b$ are all less than $\eps$ (otherwise the elements
of $\O_K$ would all be a ``distance'' of least $\eps$ from each other, so only finitely
many of them would fit in $S$).

As mentioned above, the norms of elements of $\O_K$ are integers.
Since the norm of an element is the determinant of left multiplication
by that element, the norm is a homogenous polynomial of degree $n$ in
the indeterminate coefficients $c_i$.  If the $c_i$ get arbitrarily
small for elements of $\O_K$, then the values of the norm polynomial
get arbitrarily small, which would imply that there are elements of
$\O_K$ with positive norm too small to be in $\Z$, a contradiction.
So the set $S$ contains only finitely many elements of $\O_K$.  Thus
the denominators of the $c_i$ are bounded, so for some $d$, we have
that $\O_K$ has finite index in $A=\frac{1}{d}\Z a_1 + \cdots +
\frac{1}{d}\Z a_n$.  Since $A$ is isomorphic to $\Z^n$, it follows
from the structure theorem for finitely generated abelian groups that
$\O_K$ is isomorphic as a $\Z$-module to $\Z^n$, as claimed.
\end{proof}

\begin{corollary}\label{prop:intnoetherian}\icor{$\O_K$
is Noetherian}
The ring of integers $\O_K$ of a number field is Noetherian.
\end{corollary}
\begin{proof}
By Proposition~\ref{prop:ok_lattice}, the ring $\O_K$ is
finitely generated as a module over $\Z$, so it is certainly
finitely generated as a ring over $\Z$.  By the Hilbert
Basis Theorem, $\O_K$ is Noetherian.
\end{proof}




\chapter{Unique Factorization of Ideals}
In this chapter we will deduce, with complete proofs, the most
important basic property of the ring of integers $\O_K$ of an
algebraic number, namely that every nonzero ideals can be written
uniquely as products of prime ideals.  After proving this fundamental
theorem, we will compute some examples using \magma{}. The next chapter
will consist mostly of examples illustrating the substantial theory we
will have already developed, so hang in there!

\section{Dedekind Domains}
Recall (Corollary~\ref{prop:intnoetherian}) that we proved that the
ring of integers $\O_K$ of a number field is Noetherian.  As we saw
before using norms, the ring $\O_K$ is finitely generated as a module
over~$\Z$, so it is certainly finitely generated as a ring over~$\Z$.
By the Hilbert Basis Theorem, $\O_K$ is Noetherian.


If $R$ is an integral domain, the \defn{field of fractions} of $R$ is
the field of all elements $a/b$, where $a,b \in R$.  The field of
fractions of $R$ is the smallest field that contains~$R$.  For
example, the field of fractions of $\Z$ is $\Q$ and of
$\Z[(1+\sqrt{5})/2]$ is $\Q(\sqrt{5})$.

\begin{definition}[Integrally Closed]
An integral domain $R$ is \defn{integrally closed in its field of
fractions} if whenever $\alpha$ is in the field of fractions of $R$
and $\alpha$ satisfies a monic polynomial $f\in R[x]$, then $\alpha
\in R$.
\end{definition}

\begin{proposition}\label{prop:integrallyclosed}\iprop{$\O_K$ is integrally closed}
If $K$ is any number field, then $\O_K$ is integrally closed.  Also,
the ring $\Zbar$ of all algebraic integers is integrally closed.
\end{proposition}
\begin{proof}
We first prove that~$\Zbar$ is integrally closed.  Suppose $c\in\Qbar$
is integral over~$\Zbar$, so there is a monic polynomial $f(x)=x^n +
a_{n-1}x^{n-1} + \cdots + a_1 x + a_0$ with $a_i\in\Zbar$ and
$f(c)=0$.  The $a_i$ all lie in the ring of integers $\O_K$ of the
number field $K=\Q(a_0,a_1,\ldots a_{n-1})$, and $\O_K$ is finitely
generated as a $\Z$-module, so $\Z[a_0,\ldots, a_{n-1}]$ is finitely
generated as a $\Z$-module.  Since $f(c)=0$, we can write $c^n$ as a
$\Z[a_0,\ldots, a_{n-1}]$-linear combination of $c^i$ for $i<n$, so
the ring $\Z[a_0,\ldots, a_{n-1},c]$ is also finitely generated as a
$\Z$-module.  Thus $\Z[c]$ is finitely generated as $\Z$-module
because it is a submodule of a finitely generated $\Z$-module, which
implies that~$c$ is integral over~$\Z$.

Suppose $c\in K$ is integral over $\O_K$.  Then since $\Zbar$ is
integrally closed,~$c$ is an element of $\Zbar$, so $c\in K \cap
\Zbar=\O_K$, as required.
\end{proof}

\begin{definition}[Dedekind Domain]
An integral domain~$R$ is a \defn{Dedekind domain} if it is Noetherian,
integrally closed in its field of fractions, and every nonzero prime
ideal of $R$ is maximal.
\end{definition}
The ring $\Q\oplus \Q$ is Noetherian, integrally closed in its field
of fractions, and the two prime ideals are maximal.  However, it is
not a Dedekind domain because it is not an integral domain.  The ring
$\Z[\sqrt{5}]$ is not a Dedekind domain because it is not integrally
closed in its field of fractions, as $(1+\sqrt{5})/2$ is integrally
over $\Z$ and lies in $\Q(\sqrt{5})$, but not in $\Z[\sqrt{5}]$.  The
ring $\Z$ is a Dedekind domain, as is any ring of integers $\O_K$ of a
number field, as we will see below.  Also, any field $K$ is a Dedekind
domain, since it is a domain, it is trivially integrally closed in
itself, and there are no nonzero prime ideals so that condition that
they be maximal is empty.

\begin{proposition}\iprop{$\O_K$ is Dedekind}
The ring of integers $\O_K$ of a number field is a Dedekind domain.
\end{proposition}
\begin{proof}
By Proposition~\ref{prop:integrallyclosed}, the ring $\O_K$ is
integrally closed, and by Proposition~\ref{prop:intnoetherian} it is
Noetherian.  Suppose that~$\p$ is a nonzero prime ideal of $\O_K$.
Let $\alpha\in \p$ be a nonzero element, and let $f(x)\in\Z[x]$ be the
minimal polynomial of~$\alpha$.  Then
$$f(\alpha)=\alpha^n+a_{n-1}\alpha^{n-1}+\cdots+a_1\alpha+a_0=0,$$ so
$a_0 = -(\alpha^n+a_{n-1}\alpha^{n-1}+\cdots+a_1\alpha)\in \p$.  Since
$f$ is irreducible, $a_0$ is a nonzero element of $\Z$ that lies
in~$\p$.  Every element of the finitely generated abelian group
$\O_K/\p$ is killed by~$a_0$, so $\O_K/\p$ is a finite set.
Since~$\p$ is prime, $\O_K/\p$ is an integral domain.  Every finite
integral domain is a field, so $\p$ is maximal, which
completes the proof.
\end{proof}

If $I$ and $J$ are ideals in a ring $R$, the product $IJ$ is the ideal
generated by all products of elements in $I$ with elements in $J$:
$$
  IJ = (ab : a\in I, b\in J) \subset R.
$$
Note that the set of all products $ab$, with $a\in I$ and $b\in J$,
need not be an ideal, so it is important to take the ideal generated
by that set.  (See the homework problems for examples.)

\begin{definition}[Fractional Ideal]\label{def:fracideal}
A \defn{fractional ideal} is an $\O_K$-submodule of $I\subset K$ that
is finitely generated as an $\O_K$-module. 
\end{definition}
To avoid confusion, we will sometimes call a genuine ideal $I\subset
\O_K$ an \defn{integral ideal}.  Also, since fractional ideals are
finitely generated, we can clear denominators of a generating set to
see that every fractional ideal is of the form $a I = \{a b : b \in
I\}$ for some $a\in K$ and ideal $I\subset \O_K$.

For example, the collection $\frac{1}{2}\Z$ of rational numbers with
denominator $1$ or $2$ is a fractional ideal of $\Z$.

\begin{theorem}\label{thm:ddabgrp}
\ithm{fractional ideals}
The set of nonzero fractional ideals of a Dedekind domain~$R$ is an
abelian group under ideal multiplication.
\end{theorem}
Before proving Theorem~\ref{thm:ddabgrp} we prove a lemma.  For the
rest of this section $\O_K$ is the ring of integers of a number
field~$K$.


\begin{definition}[Divides for Ideals]
Suppose that $I,J$ are ideals of $\O_K$. 
Then~$I$ \defn{divides}~$J$ if $I\supset J$.
\end{definition}
To see that this notion of divides is sensible, suppose $K=\Q$, so
$\O_K=\Z$.  Then $I=(n)$ and $J=(m)$ for some integer $n$ and $m$, and
$I$ divides $J$ means that $(n)\supset (m)$, i.e., that there exists
an integer~$c$ such that $m=cn$, which exactly means that $n$ divides
$m$, as expected.

\begin{lemma}\label{lem:divprod}\ilem{$I$ divides product of primes}
Suppose~$I$ is an ideal of $\O_K$.  Then there exist prime ideals
$\p_1,\ldots, \p_n$ such that $\p_1\cdot \p_2\cdots \p_n \subset{}I$.
In other words,~$I$ divides a product of prime ideals.  (By convention
the empty product is the unit ideal.  Also, if $I=0$, then we take
$\p_1=(0)$, which is a prime ideal.)
\end{lemma}
\begin{proof}
The key idea is to use that $\O_K$ is Noetherian to deduce that the
set~$S$ of ideals that do not satisfy the lemma is empty.  If~$S$ is
nonempty, then because $\O_K$ is Noetherian, there is an ideal $I\in
S$ that is maximal as an element of~$S$.  If~$I$ were prime, then~$I$
would trivially contain a product of primes, so~$I$ is not prime.  By
definition of prime ideal, there exists $a,b\in \O_K$ such that $ab\in
I$ but $a\not\in I$ and $b\not\in I$.  Let $J_1 = I+(a)$ and
$J_2=I+(b)$.  Then neither $J_1$ nor $J_2$ is in $S$, since $I$ is
maximal, so both $J_1$ and $J_2$ contain a product of prime ideals.
Thus so does $I$, since
$$J_1 J_2 = I^2 + I(b)+  (a)I+ (ab) \subset I,$$
which is a contradiction.  Thus~$S$ is empty, which completes the proof.
\end{proof}

We are now ready to prove the theorem.

\begin{proof}[Proof of Theorem~\ref{thm:ddabgrp}]
The product of two fractional ideals is again finitely generated, so
it is a fractional ideal, and $I\O_K=\O_K$ for any nonzero ideal~$I$,
so to prove that the set of fractional ideals under multiplication is
a group it suffices to show the existence of inverses.  We will first
prove that if $\p$ is a prime ideal, then $\p$ has an inverse, then we
will prove that nonzero integral ideals have inverses, and finally
observe that every fractional ideal has an inverse.

Suppose $\p$ is a nonzero prime ideal of $\O_K$.   We will show that
the $\O_K$-module
$$
  I = \{a \in K : a\p \subset \O_K \}
$$ 
is a fractional ideal of $\O_K$ such that $I\p = \O_K$, so that
$I$ is an inverse of $\p$.

For the rest of the proof, fix a nonzero element $b\in \p$.  Since~$I$
is an $\O_K$-module, $bI\subset \O_K$ is an $\O_K$ ideal, hence~$I$ is
a fractional ideal.  Since $\O_K \subset I$ we have $\p \subset I \p
\subset \O_K$, hence either $\p = I\p$ or $I\p = \O_K$.  If
$I\p=\O_K$, we are done since then~$I$ is an inverse of~$\p$.  Thus
suppose that $I\p=\p$.  Our strategy is to show that there is some
$d\in I$ not in $\O_K$; such a~$d$ would leave~$\p$ invariant (i.e.,
$d \p \subset \p$), so since $\p$ is an $\O_K$-module it will follow
that $d\in \O_K$, a contradiction.

By Lemma~\ref{lem:divprod}, we can choose a product $\p_1,\ldots, \p_m$,
with~$m$ minimal, such that 
$$
\p_1\p_2\cdots \p_m \subset (b) \subset \p.
$$ If no $\p_i$ is contained in $\p$, then we can choose for each $i$
an $a_i \in \p_i$ with $a_i\not\in \p$; but then $\prod a_i\in \p$,
which contradicts that $\p$ is a prime ideal.  Thus some $\p_i$, say
$\p_1$, is contained in $\p$, which implies that $\p_1 = \p$ since
every nonzero prime ideal is maximal.  Because~$m$ is minimal,
$\p_2\cdots \p_m$ is not a subset of $(b)$, so there exists $c\in
\p_2\cdots \p_m$ that does not lie in $(b)$. Then $\p(c) \subset (b)$,
so by definition of $I$ we have $d=c/b\in I$.  However, $d\not\in
\O_K$, since if it were then $c$ would be in $(b)$.  We have thus
found our element $d\in I$ that does not lie in $\O_K$.  To finish the
proof that $\p$ has an inverse, we observe that $d$ preserves the
$\O_K$-module $\p$, and is hence in $\O_K$, a contradiction.  More
precisely, if $b_1,\ldots, b_n$ is a basis for $\p$ as a $\Z$-module,
then the action of~$d$ on~$\p$ is given by a matrix with entries in
$\Z$, so the minimal polynomial of $d$ has coefficients in $\Z$.  This
implies that $d$ is integral over $\Z$, so $d\in \O_K$, since $\O_K$
is integrally closed by Proposition~\ref{prop:integrallyclosed}.
(Note how this argument depends strongly on the fact that $\O_K$ is
integrally closed!)

So far we have proved that if $\p$ is a prime ideal of $\O_K$, then
$\p^{-1} = \{a \in \K : a\p \subset \O_K\}$ is the inverse of $\p$ in
the monoid of nonzero fractional ideals of $\O_K$.  As mentioned after
Definition~\ref{def:fracideal} [on Tuesday], every nonzero fractional
ideal is of the form $aI$ for $a\in K$ and $I$ an integral ideal, so
since $(a)$ has inverse $(1/a)$, it suffices to show that every
integral ideal~$I$ has an inverse.  If not, then there is a nonzero
integral ideal~$I$ that is maximal among all nonzero integral ideals
that do not have an inverse.  Every ideal is contained in a maximal
ideal, so there is a nonzero prime ideal $\p$ such that $I\subset \p$.
Multiplying both sides of this inclusion by $\p^{-1}$ and using that
$\O_K\subset \p^{-1}$, we see that $I \subset \p^{-1} I \subset \O_K$.
If $I = \p^{-1} I$, then arguing as in the proof that $\p^{-1}$ is the
inverse of $\p$, we see that each element of $\p^{-1}$ preserves the
finitely generated $\Z$-module~$I$ and is hence integral.  But then
$\p^{-1}\subset \O_K$, which implies that $\O_K = \p \p^{-1} \subset
\p$, a contradiction.  Thus $I \neq \p^{-1} I$.  Because $I$ is
maximal among ideals that do not have an inverse, the ideal $\p^{-1}
I$ does have an inverse, call it~$J$.  Then $\p{}J$ is the inverse of
$I$, since $\O_K = (\p{}J)(\p^{-1}I) = JI$.
\end{proof}

We can finally deduce the crucial Theorem~\ref{thm:intuniqfac}, which
will allow us to show that any nonzero ideal of a Dedekind domain can
be expressed uniquely as a product of primes (up to order).  Thus
unique factorization holds for ideals in a Dedekind domain, and it is
this unique factorization that initially motivated the introduction of
rings of integers of number fields over a century ago.

\begin{theorem}\label{thm:uniqfac}\ithm{unique ideal factorization}
Suppose $I$ is an integral ideal of $\O_K$.  Then $I$ can
be written as a product 
$$
  I = \p_1\cdots \p_n
$$ of prime ideals of $\O_K$, and this representation is unique up to
order.  (Exception: If $I=0$, then the representation is not unique.)
\end{theorem}
\begin{proof}
Suppose $I$ is an ideal that is maximal among the set of all ideals in
$\O_K$ that can not be written as a product of primes.  Every ideal is
contained in a maximal ideal, so $I$ is contained in a nonzero prime
ideal $\p$.  If $I\p^{-1} = I$, then by Theorem~\ref{thm:ddabgrp} we
can cancel $I$ from both sides of this equation to see that
$\p^{-1}=\O_K$, a contradiction.  Thus $I$ is strictly contained in
$I\p^{-1}$, so by our maximality assumption on $I$ there are maximal
ideals $\p_1,\ldots, \p_n$ such that $I\p^{-1} = \p_1\cdots \p_n$.
Then $I=\p\cdot \p_1\cdots \p_n$, a contradiction.  Thus every ideal
can be written as a product of primes.

Suppose $\p_1\cdots \p_n=\q_1\cdots \q_m$. If no $\q_i$ is contained in
$\p_1$, then for each $i$ there is an $a_i\in \q_i$ such that
$a_i\not\in\p_1$.  But the product of the $a_i$ is in the $\p_1\cdots
\p_n$, which is a subset of $\p_1$, which contradicts the fact that
$\p_1$ is a prime ideal.  Thus $\q_i=\p_1$ for some~$i$.  We can thus
cancel $\q_i$ and $\p_1$ from both sides of the equation.  Repeating
this argument finishes the proof of uniqueness.
\end{proof}

\begin{corollary}\label{thm:intuniqfac}\icor{factorization
of fractoinal ideals}
If $I$ is a fractional ideal of $\O_K$ then there exists 
prime ideals $\p_1,\ldots, \p_n$ and $\q_1,\ldots, \q_m$,
unique up to order, such that 
$$
  I = (\p_1\cdots \p_n)(\q_1\cdots \q_m)^{-1}.
$$
\end{corollary}
\begin{proof}
We have $I=(a/b)J$ for some $a,b\in\O_K$ and integral ideal $J$.
Applying Theorem~\ref{thm:intuniqfac} to $(a)$, $(b)$, and $J$ gives
an expression as claimed.  For uniqueness, if one has two such product
expressions, multiply through by the denominators and use the
uniqueness part of Theorem~\ref{thm:intuniqfac}
\end{proof}

\begin{example}
The ring of integers of $K=\Q(\sqrt{-6})$ is $\O_K=\Z[\sqrt{-6}]$.
In $\O_K$, we have
$$
  6 = -\sqrt{-6}\sqrt{-6} = 2 \cdot 3.
$$ If $ab=\sqrt{-6}$, with $a,b\in \O_K$ and neither a unit, then
$\Norm(a)\Norm(b) = 6$, so without loss $\Norm(a)=2$ and
$\Norm(b)=3$. If $a=c + d\sqrt{-6}$, then $\Norm(a) = c^2 + 6d^2$;
since the equation $c^2 + 6d^2 = 2$ has no solution with $c,d\in\Z$,
there is no element in $\O_K$ with norm~$2$, so $\sqrt{-6}$ is
irreducible.  Also, $\sqrt{-6}$ is not a unit times~$2$ or times $3$,
since again the norms would not match up.  Thus $6$ can not be written
uniquely as a product of irreducibles in $\O_K$.
Theorem~\ref{thm:uniqfac}, however, implies that the principal
ideal $(6)$ can, however, be
written uniquely as a product of prime ideals.  Using \magma{}
we find such a decomposition:
\begin{verbatim}
> R<x> := PolynomialRing(RationalField());
> K := NumberField(x^2+6);
> OK := MaximalOrder(K);
> [K!b : b in Basis(OK)];
[
    1,
    K.1    // this is sqrt(-6)
]   
> Factorization(6*OK);
[
    <Prime Ideal of OK
    Two element generators:
        [2, 0]
        [2, 1], 2>,
    <Prime Ideal of OK
    Two element generators:
        [3, 0]
        [3, 1], 2>
]
\end{verbatim}
The output means that
$$
(6) = (2, 2+\sqrt{-6})^2 \cdot (3,3+\sqrt{-6})^2,
$$ where each of the ideals $(2, 2+\sqrt{-6})$ and $(3, 3+\sqrt{-6})$
is prime.  I will discuss algorithms for computing such a
decomposition in detail, probably next week.  The first idea is to
write $(6)=(2)(3)$, and hence reduce to the case of writing the $(p)$,
for $p\in\Z$ prime, as a product of primes. Next one decomposes the
Artinian ring $\O_K\tensor \F_p$ as a product of local Artinian rings.
\end{example}

\chapter{Computing}
\section{Algorithms for Algebraic Number Theory}
I think the best overall reference for algorithms for doing basic algebraic
number theory computations is \cite{cohen:course_ant}.

Our main long-term algorithmic goals for this book (which we won't
succeed at reaching) are to understand good algorithms for solving the
following problems in particular cases:
\begin{itemize}
\item {\bf Ring of integers:} Given a number field $K$ (by giving a
polynomial), compute the full ring $\O_K$ of integers.
\item  {\bf Decomposition of primes:} Given a prime number 
$p\in\Z$, find the decomposition of the ideal $p\O_K$ as a product 
of prime ideals of $\O_K$.
\item {\bf  Class group:} Compute the group of equivalence classes
of nonzero ideals of $\O_K$, where $I$ and $J$
are equivalent if there exists $\alpha \in \O_K$
such that $IJ^{-1}=(\alpha)$.
\item  {\bf Units:} Compute generators for the group of 
units of $\O_K$.
\end{itemize}

As we will see, somewhat surprisingly it turns out that
algorithmically by far the most time-consuming step in computing the
ring of integers $\O_K$ seems to be to factor the discriminant of a
polynomial whose root generates the field~$K$.  The algorithm(s) for
computing $\O_K$ are quite complicated to describe, but the first step
is to factor this discriminant, and it takes much longer in practice
than all the other complicated steps.

\section{Using \magma{}}
This section is a first introduction to \magma{} for algebraic number
theory.  \magma{} is a good general purpose package for doing
algebraic number theory computations.  You can use it via the web page
\verb|http://modular.fas.harvard.edu/calc|.  \magma{} is not free, but student
discounts are available.

The following examples illustrate what we've done so far in the course
using \magma{}, and a little of where we are going.  Feel free to ask
questions as we go. 

\subsection{Smith Normal Form}
On the first day of class we learned about Smith normal forms
of matrices.  
\begin{verbatim}
> A := Matrix(2,2,[1,2,3,4]);
> A;
[1 2]
[3 4]
> SmithForm(A);
[1 0]
[0 2]

[ 1  0]
[-1  1]

[-1  2]
[ 1 -1]
\end{verbatim}
As you can see, \magma{} computed the Smith form, which is 
$\mtwo{1}{0}{0}{2}$.  What are the other two matrices
it output?  To see what any \magma{} command does, type
the command by itself with no arguments followed by a
semicolon.
\begin{verbatim}
> SmithForm;
Intrinsic 'SmithForm'

Signatures:

    (<Mtrx> X) -> Mtrx, AlgMatElt, AlgMatElt
    [
        k: RngIntElt, 
        NormType: MonStgElt, 
        Partial: BoolElt, 
        RightInverse: BoolElt
    ]

        The smith form S of X, together with unimodular matrices 
        P and Q such that P * X * Q = S.
\end{verbatim}
As you can see, {\tt SmithForm} returns three arguments, a matrix and
matrices $P$ and $Q$ that transform the input matrix to Smith normal
form.  The syntax to ``receive'' three return arguments is natural,
but uncommon in other programming languages:
\begin{verbatim}
> S, P, Q := SmithForm(A);
> S;
[1 0]
[0 2]
> P;
[ 1  0]
[-1  1]
> Q;
[-1  2]
[ 1 -1]
> P*A*Q;
[1 0]
[0 2]
\end{verbatim}
Next, let's test the limits.  We make a $10\times 10$ 
integer matrix with entries between $0$ and $99$,
and compute its Smith normal form.
\begin{verbatim}
> A := Matrix(10,10,[Random(100) : i in [1..100]]);
> time B := SmithForm(A);  
Time: 0.000
\end{verbatim}
Let's print the first row of $A$, the first and last
row of $B$, and the diagonal of $B$:
\begin{verbatim}
> A[1];
( 4 48 84  3 58 61 53 26  9  5)
> B[1];
(1 0 0 0 0 0 0 0 0 0)
> B[10];
(0 0 0 0 0 0 0 0 0 51805501538039733)
> [B[i,i] : i in [1..10]];
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 51805501538039733 ]
\end{verbatim}
Let's see how big we have to make~$A$ in order
to slow down \magma{}.  These timings below are on
a 1.6Ghz Pentium 4-M laptop running Magma V2.11 under 
VMware Linux.  I tried exactly the same computation
running Magma V2.17 natively under Windows XP on
the same machine, and it takes {\em twice} as long
to do each computation, which is strange.
\begin{verbatim}
> n := 50; A := Matrix(n,n,[Random(100) : i in [1..n^2]]);
> time B := SmithForm(A);  
Time: 0.050
> n := 100; A := Matrix(n,n,[Random(100) : i in [1..n^2]]);
> time B := SmithForm(A);  
Time: 0.800
> n := 150; A := Matrix(n,n,[Random(100) : i in [1..n^2]]);
> time B := SmithForm(A);  
Time: 4.900
> n := 200; A := Matrix(n,n,[Random(100) : i in [1..n^2]]);
> time B := SmithForm(A);  
Time: 19.160
\end{verbatim}

\magma{} can also work with finitely generated abelian groups.
\begin{verbatim}
> G := AbelianGroup([3,5,18]);
> G;
Abelian Group isomorphic to Z/3 + Z/90
Defined on 3 generators
Relations:
    3*G.1 = 0
    5*G.2 = 0
    18*G.3 = 0
> #G;
270
> H := sub<G | [G.1+G.2]>;
> #H;
15
> G/H;
Abelian Group isomorphic to Z/18
\end{verbatim}

\subsection{$\Qbar$ and Number Fields}
\magma{} has many commands for doing basic arithmetic with
$\Qbar$.
\begin{verbatim}
> Qbar := AlgebraicClosure(RationalField());
> Qbar;
> S<x> := PolynomialRing(Qbar);
> r := Roots(x^3-2);
> r;
[
    <r1, 1>,
    <r2, 1>,
    <r3, 1>
]
> a := r[1][1];
> MinimalPolynomial(a);
x^3 - 2
> s := Roots(x^2-7);
> b := s[1][1];
> MinimalPolynomial(b);
x^2 - 7
> a+b;
r4 + r1
> MinimalPolynomial(a+b);
x^6 - 21*x^4 - 4*x^3 + 147*x^2 - 84*x - 339
> Trace(a+b);
0
> Norm(a+b);
-339
\end{verbatim}
There are few commands for general algebraic number fields,
so usually we work in specific finitely generated subfields:
\begin{verbatim}
> MinimalPolynomial(a+b);
x^6 - 21*x^4 - 4*x^3 + 147*x^2 - 84*x - 339
> K := NumberField($1) ;  // $1 = result of previous computation.
> K;
Number Field with defining polynomial x^6 - 21*x^4 - 4*x^3 + 
    147*x^2 - 84*x - 339 over the Rational Field
\end{verbatim}
We can also define relative extensions of number fields
and pass to the corresponding absolute extension. 
\begin{verbatim}
> R<x> := PolynomialRing(RationalField());
> K<a> := NumberField(x^3-2);   // a is the image of x in Q[x]/(x^3-2)
> a;
a
> a^3;
2
> S<y> := PolynomialRing(K);
> L<b> := NumberField(y^2-a);
> L;
Number Field with defining polynomial y^2 - a over K
> b^2;
a
> b^6;
2
> AbsoluteField(L);
Number Field with defining polynomial x^6 - 2 over the Rational 
Field
\end{verbatim}

\subsection{Rings of integers}
\magma{} computes rings of integers of number fields.
\begin{verbatim}
> RingOfIntegers(K);
Maximal Equation Order with defining polynomial x^3 - 2 over ZZ
> RingOfIntegers(L);
Maximal Equation Order with defining polynomial x^2 + [0, -1, 0] 
over its ground order
\end{verbatim}
Sometimes the ring of integers of $\Q(a)$ isn't just $\Z[a]$.
First a simple example, then a more complicated one:
\begin{verbatim}
> K<a> := NumberField(2*x^2-3);   // doesn't have to be monic
> 2*a^2 - 3;
0
> K;
Number Field with defining polynomial x^2 - 3/2 over the Rational
Field
> O := RingOfIntegers(K);
> O;
Maximal Order of Equation Order with defining polynomial 2*x^2 - 
    3 over ZZ
> Basis(O);
[
    O.1,
    O.2
]
> [K!x : x in Basis(O)];
[
    1,
    2*a       // this is Sqrt(3)
]
\end{verbatim}
Here's are some more examples:
\begin{verbatim}
> procedure ints(f)   // (procedures don't return anything; functions do)
      K<a> := NumberField(f);
      O := MaximalOrder(K);
      print [K!z : z in Basis(O)];
  end procedure;
> ints(x^2-5);
[
    1,
    1/2*(a + 1)
]
> ints(x^2+5);
[
    1,
    a
]
> ints(x^3-17);
[
    1,
    a,
    1/3*(a^2 + 2*a + 1)
]
> ints(CyclotomicPolynomial(7));  
[
    1,
    a,
    a^2,
    a^3,
    a^4,
    a^5
]
> ints(x^5+&+[Random(10)*x^i : i in [0..4]]);  // RANDOM
[
    1,
    a,
    a^2,
    a^3,
    a^4
]
> ints(x^5+&+[Random(10)*x^i : i in [0..4]]);  // RANDOM
[
    1,
    a,
    a^2,
    1/2*(a^3 + a),
    1/16*(a^4 + 7*a^3 + 11*a^2 + 7*a + 14)
]
\end{verbatim}
Lets find out how high of a degree \magma{} can easily deal with.
\begin{verbatim}
> d := 10; time ints(x^10+&+[Random(10)*x^i : i in [0..d-1]]); 
[
    1, a, a^2, a^3, a^4, a^5, a^6, a^7, a^8, a^9
]
Time: 0.030
> d := 15; time ints(x^10+&+[Random(10)*x^i : i in [0..d-1]]); 
[
    1,
    7*a,
    7*a^2 + 4*a,
    7*a^3 + 4*a^2 + 4*a,
    7*a^4 + 4*a^3 + 4*a^2 + a,
    7*a^5 + 4*a^4 + 4*a^3 + a^2 + a,
    7*a^6 + 4*a^5 + 4*a^4 + a^3 + a^2 + 4*a,
    7*a^7 + 4*a^6 + 4*a^5 + a^4 + a^3 + 4*a^2,
    7*a^8 + 4*a^7 + 4*a^6 + a^5 + a^4 + 4*a^3 + 4*a,
    7*a^9 + 4*a^8 + 4*a^7 + a^6 + a^5 + 4*a^4 + 4*a^2 + 5*a,
    7*a^10 + 4*a^9 + 4*a^8 + a^7 + a^6 + 4*a^5 + 4*a^3 + 5*a^2 +  4*a,
  ...
]
Time: 0.480
> d := 20; time ints(x^10+&+[Random(10)*x^i : i in [0..d-1]]); 
[
    1,
    2*a,
    4*a^2,
    8*a^3,
    8*a^4 + 2*a^2 + a,
    8*a^5 + 2*a^3 + 3*a^2,
 ...]
Time: 3.940
> d := 25; time ints(x^10+&+[Random(10)*x^i : i in [0..d-1]]); 
... I stopped it after a few minutes...
\end{verbatim}

We can also define orders in rings of integers.
\begin{verbatim}
> R<x> := PolynomialRing(RationalField());
> K<a> := NumberField(x^3-2);
> O := Order([2*a]);
> O;
Transformation of Order over 
Equation Order with defining polynomial x^3 - 2 over ZZ
Transformation Matrix:
[1 0 0]
[0 2 0]
[0 0 4]
> OK := MaximalOrder(K);
> Index(OK,O);
8
> Discriminant(O);
-6912
> Discriminant(OK);
-108
> 6912/108;
64    // perfect square...
\end{verbatim}

\subsection{Ideals}
\begin{verbatim}
> R<x> := PolynomialRing(RationalField());
> K<a> := NumberField(x^3-2);
> O := Order([2*a]);
> O;
Transformation of Order over 
Equation Order with defining polynomial x^3 - 2 over ZZ
Transformation Matrix:
[1 0 0]
[0 2 0]
[0 0 4]
> OK := MaximalOrder(K);
> Index(OK,O);
8
> Discriminant(O);
-6912
> Discriminant(OK);
-108
> 6912/108;
64    // perfect square...
> R<x> := PolynomialRing(RationalField());
> K<a> := NumberField(x^2-7);
> K<a> := NumberField(x^2-5);
> Discriminant(K);
20   // ????????? Yuck!
> OK := MaximalOrder(K);
> Discriminant(OK);
5    // better
> Discriminant(NumberField(x^2-20));
80
> I := 7*OK;
> I;
Principal Ideal of OK
Generator:
    [7, 0]
> J := (OK!a)*OK;    // the ! computes the natural image of a in OK
> J;
Principal Ideal of OK
Generator:
    [-1, 2]
> I*J;
Principal Ideal of OK
Generator:
    [-7, 14]
> J*I;
Principal Ideal of OK
Generator:
    [-7, 14]
> I+J;
Principal Ideal of OK
Generator:
    [1, 0]
> 
> Factorization(I);
[
    <Principal Prime Ideal of OK
    Generator:
        [7, 0], 1>
]
> Factorization(3*OK);
[
    <Principal Prime Ideal of OK
    Generator:
        [3, 0], 1>
]
> Factorization(5*OK);
[
    <Prime Ideal of OK
    Two element generators:
        [5, 0]
        [4, 2], 2>
]
> Factorization(11*OK);
[
    <Prime Ideal of OK
    Two element generators:
        [11, 0]
        [14, 2], 1>,
    <Prime Ideal of OK
    Two element generators:
        [11, 0]
        [17, 2], 1>
]
\end{verbatim}
We can even work with fractional ideals in \magma{}.
\begin{verbatim}
> K<a> := NumberField(x^2-5);
> OK := MaximalOrder(K);
> I := 7*OK;
> J := (OK!a)*OK;
> M := I/J;
> M;
Fractional Principal Ideal of OK
Generator:
    -7/5*OK.1 + 14/5*OK.2
> Factorization(M);
[
    <Prime Ideal of OK
    Two element generators:
        [5, 0]
        [4, 2], -1>,
    <Principal Prime Ideal of OK
    Generator:
        [7, 0], 1>
]
\end{verbatim}

In the next chapter, we will learn about discriminants and an
algorithm for ``factoring primes'', that is writing an ideal $p\O_K$
as a product of prime ideals of~$\O_K$.


\chapter{Factoring Primes}

First we will learn how, if $p\in \Z$ is a prime and $\O_K$ is the
ring of integers of a number field, to write $p\O_K$ as a product of
primes of $\O_K$.  Then I will sketch the main results and definitions
that we will study in detail during the next few chapters.  We will
cover discriminants and norms of ideals, define the class group of
$\O_K$ and prove that it is finite and computable, and define the
group of units of $\O_K$, determine its structure, and prove that it
is also computable.

\section{Factoring Primes}
\begin{center}
\includegraphics[width=20em]{spec.eps}\\
A diagram from \cite{lenstras:nfs}.
\end{center}

\begin{tabular}{lr}
{\begin{minipage}{4in}
``The obvious mathematical breakthrough would be development of an easy
way to factor large prime numbers.''
\mbox{ }\hfill --{Bill Gates, {\em The Road Ahead}, pg. 265}
\end{minipage}}
&
\begin{minipage}{2in}
\mbox{}\vspace{3ex}
\includegraphics[width=1in]{gates.eps}
\end{minipage}
\\
\end{tabular}

Let $K=\Q(\alpha)$ be a number field, and let $\O_K$ be the ring of
integers of $K$.  To employ our geometric intuition, as the Lenstras
did on the cover of \cite{lenstras:nfs}, it is helpful to
view $\O_K$ as a one-dimensional scheme
$$
  X = \Spec(\O_K) = \{\text{ all prime ideals of $\O_K$ }\}
$$
over
$$
  Y=\Spec(\Z) = \{ (0) \} \union \{ p\Z : p \in\Z \text{ is prime }\}.
$$ 
There is a natural map $\pi :X\ra Y$ that sends a prime ideal $\p\in X$ to
$\p\intersect \Z\in Y$.   For much more on this point of view,
see \cite[Ch.~2]{eisenbud_harris:geometry}.

Ideals were originally introduced by Kummer because, as we proved last
Tuesday, in rings of integers of number fields ideals factor uniquely
as products of primes ideals, which is something that is not true for
general algebraic integers.  (The failure of unique factorization for
algebraic integers was used by Liouville to destroy Lam\'{e}'s
purported 1847 ``proof'' of Fermat's Last Theorem.)

If $p\in\Z$ is a prime number, then the ideal $p\O_K$ of $\O_K$
factors uniquely as a product $\prod \p_i^{e_i}$, where the $\p_i$ are
maximal ideals of $\O_K$.  We may imagine the
decomposition of $p\O_K$ into prime ideals geometrically as 
the fiber $\pi^{-1}(p\Z)$ (with multiplicities).

How can we compute $\pi^{-1}(p\Z)$ in practice?

\begin{example}
The following \magma{} session shows the commands needed to compute 
the factorization of $p\O_K$ in \magma{} for~$K$ the number field
defined by a root of $x^5+7x^4+3x^2-x+1$.
\begin{verbatim}
   > R<x> := PolynomialRing(RationalField());
   > K<a> := NumberField(x^5 + 7*x^4 + 3*x^2 - x + 1);
   > OK := MaximalOrder(K);
   > I := 2*OK;
   > Factorization(I);
   [
   <Principal Prime Ideal of OK
   Generator:
   [2, 0, 0, 0, 0], 1>
   ]
   > J := 5*OK;
   > Factorization(J);
   [
   <Prime Ideal of OK
   Two element generators:
   [5, 0, 0, 0, 0]
   [2, 1, 0, 0, 0], 1>,
   <Prime Ideal of OK
   Two element generators:
   [5, 0, 0, 0, 0]
   [3, 1, 0, 0, 0], 2>,
   <Prime Ideal of OK
   Two element generators:
   [5, 0, 0, 0, 0]
   [2, 4, 1, 0, 0], 1>
   ]
   > [K!OK.i : i in [1..5]];
   [ 1, a, a^2, a^3, a^4 ]
\end{verbatim}
Thus $2\O_K$ is already a prime ideal, and 
$$ 
  5\O_K = (5,2+a)\cdot(5,3+a)^2\cdot(5,2+4a+a^2).
$$ 
Notice that in this example $\O_K=\Z[a]$.  (Warning: There are
examples of $\O_K$ such that $\O_K\neq \Z[a]$ for any $a\in\O_K$, as
Example~\ref{ex:dedekind} below illustrates.)  When $\O_K=\Z[a]$ it is
very easy to factor $p\O_K$, as we will see below.  The following
factorization gives a hint as to why:
$$
  x^5+7x^4+3x^2-x+1 \con (x+2)\cdot (x+3)^2 \cdot (x^2+4x+2)\pmod{5}.
$$

The exponent~$2$ of $(5,3+a)^2$ in the factorization of $5\O_K$ above
suggests ``ramification'',
in the sense that the cover $X\ra Y$ has less points (counting their ``size'', i.e.,
their residue class degree) in its fiber over~$5$ than
it has generically.  Here's a suggestive picture:
\begin{center}
\psfrag{p1}{$(5,2+4a+a^2)$}
\psfrag{p2}{$(5,3+a)^2$}
\psfrag{p3}{$(5,2+a)$}
\psfrag{p}{$5\Z$}
\psfrag{q1}{$2\O_K$}
\psfrag{q}{$2\Z$}
\psfrag{zero}{$(0)$}
\psfrag{r}{$3\Z$}
\psfrag{s}{$7\Z$}
\psfrag{t}{$11\Z$}
\includegraphics[width=21em]{cover1.eps}

Diagram of $\Spec(\O_K) \ra \Spec(\Z)$
\end{center}

\end{example}

\subsection{A Method for Factoring that Often Works}
Suppose $a\in\O_K$ is such that $K=\Q(a)$, and let
$g(x)$ be the minimal polynomial of~$a$.  Then
$\Z[a]\subset \O_K$, and we have a diagram of schemes
$$\xymatrix{
  {(??)\, }\ar@{^(->}[r]\ar[d]               &{\Spec(\O_K)}\ar[d]  \\
{\bigcup\Spec(\F_p[x]/(\overline{g}_i^{e_i}))\,}\ar@{^(->}[r] \ar[d]
         &{\Spec(\Z[a])}\ar[d] \\%\ar@{=}[r] & \Spec(\Z[x]/g(x))\\
{\Spec(\F_p)\,}\ar@{^(->}[r]&{\Spec(\Z)}
}$$
where $\overline{g} = \prod_i \overline{g}_i^{e_i}$
is the factorization of the image of $g$ in $\F_p[x]$.

The cover $\pi:\Spec(\Z[a])\ra \Spec(\Z)$ is easy to understand
because it is defined by the single equation $g(x)$.  To give a
maximal ideal $\p$ of $\Z[a]$ such that $\pi(\p) = p\Z$ is the
same as giving a homomorphism $\vphi:\Z[x]/(g) \ra \Fbar_p$ (up to
automorphisms of the image), which is in turn the same as giving a
root of~$g$ in $\Fbar_p$ (up to automorphism), which is the same
as giving an irreducible factor of the reduction of~$g$ modulo~$p$.

\begin{lemma}\ilem{factorization of $p\O_K$}
Suppose the index of $\Z[a]$ in $\O_K$ is coprime to~$p$.  Then
the primes~$\p_i$ in the factorization of $p\Z[a]$ do not
decompose further going from $\Z[a]$ to $\O_K$, so finding the
prime ideals of $\Z[a]$ that contain~$p$ yields the factorization
of $p\O_K$.
\end{lemma}
\begin{proof}
{\em Hi-brow argument:} By hypothesis we have an exact sequence
of abelian groups
$$ 0 \to \Z[a]\to \O_K \to H \to 0,$$
where $H$ is a finite abelian group of order coprime 
to~$p$.  Tensor product is right exact, and there is
an exact sequence
$$
  \Tor_1(H,\F_p) \to \Z[a]\tensor\F_p \to \O_K\tensor\F_p \to H\tensor\F_p \to 0,
$$
and $\Tor_1(H,\F_p)= H\tensor\F_p = 0$,
so $\Z[a]\tensor\F_p\isom \O_K\tensor\F_p$.\\
{\em Low-brow argument:}
The inclusion map $\Z[a]\hra \O_K$
is defined by a matrix over $\Z$ that has determinant
$\pm [\O_K:\Z[a]]$, which is coprime to~$p$.  The reduction of
this matrix modulo~$p$ is invertible, so it defines an isomorphism
$\Z[a]\tensor\F_p \to \O_K\tensor\F_p$.
Any homomorphism $\O_K\to \Fpbar$ is the composition of a homomorphism
$\O_K \to \O_K\tensor\F_p$ with a homomorphism $\O_K\tensor\F_p \to
\Fpbar$.  Since $\O_K\tensor\F_p\isom \Z[a]\tensor\F_p$, the
homomorphisms $\O_K\to \Fpbar$ are in bijection with the homomorphisms
$\Z[a]\to \Fpbar$, which proves the lemma.
\end{proof}

As suggested in the proof of the lemma, we find all homomorphisms
$\O_K\to \Fpbar$ by finding all homomorphism $\Z[a]\to \Fpbar$.  In
terms of ideals, if $\p=(g(a),p)\Z[a]$ is a maximal ideal of $\Z[a]$,
then the ideal $\p'=(g(a),p)\O_K$ of $\O_K$ is also maximal, since
$$\O_K/\p'\isom (\O_K\tensor\F_p)/(g(\tilde{a}))
\isom (\Z[a]\tensor\F_p) / (g(\tilde{a})) \subset \Fpbar.$$

We formalize the above discussion in the following theorem:
\begin{theorem}\label{thm:fac1}\ithm{prime ideal factorization}
Let $f(x)$ denote the minimal polynomial of~$a$ over~$\Q$.
Suppose that~$p\nmid [\O_K:\Z[a]]$ is a prime.
Let
$$
 \overline{f} = \prod_{i=1}^t \overline{f}_i^{e_i} \in \F_p[x]
$$
where the $\overline{f}_i$ are distinct monic irreducible
polynomials.  
Let 
$
  \p_i = (p,f_i(a))
$
where $f_i\in\Z[x]$ is a lift of $\overline{f}_i$ in $\F_p[X]$.
Then
$$
  p\O_K = \prod_{i=1}^t \p_i^{e_i}.
$$
%Geometrically, the fiber of $\Spec(\O_K) \to p\Z$ 
%contains the points $\{\p_1,\p_2,\ldots, \p_t\}$
%with multiplicites $e_i$.
\end{theorem}

We return to the example from above, in which $K=\Q(a)$, where~$a$ is
a root of $x^5+7x^4+3x^2-x+1$.  According to \magma{}, the maximal
order $\O_K$ has discriminant $2945785$:
\begin{verbatim}
   > Discriminant(MaximalOrder(K));
   2945785
\end{verbatim}
The order $\Z[a]$ has the same discriminant as $\O_K$, so
$\Z[a]=\O_K$ and we can apply the above theorem.
\begin{verbatim}
   > Discriminant(x^5 + 7*x^4 + 3*x^2 - x + 1);
   2945785
\end{verbatim}
We have
$$
  x^5+7x^4+3x^2-x+1 \con (x+2)\cdot (x+3)^2 \cdot (x^2+4x+2)\pmod{5},
$$
which yields the factorization of $5\O_K$ given before the theorem.

If we replace $a$ by $b=7a$, then the index of $\Z[b]$
in $\O_K$ will be a power of $7$, which is coprime to $5$,
so the above method will still work.
\begin{verbatim}
   > f:=MinimalPolynomial(7*a);
   > f;
   x^5 + 49*x^4 + 1029*x^2 - 2401*x + 16807
   > Discriminant(f);
   235050861175510968365785
   > Discriminant(f)/Discriminant(MaximalOrder(K));
   79792266297612001    // coprime to 5
   > S<t> := PolynomialRing(GF(5));
   > Factorization(S!f);
   [
       <t + 1, 2>,
       <t + 4, 1>,
       <t^2 + 3*t + 3, 1>
   ]
\end{verbatim}
Thus $5$ factors in $\O_K$ 
as 
$$
  5\O_K = (5, 7a+1)^2 \cdot (5, 7a+4) \cdot (5, (7a)^2 + 3(7a) + 3).
$$
If we replace $a$ by $b=5a$ and try the above algorithm with $\Z[b]$,
then the method fails because the index of $\Z[b]$ in $\O_K$ is divisible
by~$5$.
\begin{verbatim}
   > f:=MinimalPolynomial(5*a);
   > f;
   x^5 + 35*x^4 + 375*x^2 - 625*x + 3125
   > Discriminant(f) / Discriminant(MaximalOrder(K));
   95367431640625    // divisible by 5
   > Factorization(S!f);
   [
       <t, 5>
   ]
\end{verbatim}

\subsection{A Method for Factoring that Always Works}
There are numbers fields $K$ such that $\O_K$ is not of the form
$\Z[a]$ for any $a\in K$.  Even worse, Dedekind found a
field~$K$ such that $2\mid [\O_K : \Z[a]]$ for {\em all}
$a\in \O_K$, so there is no choice of $a$ such that
Theorem~\ref{thm:fac1} can be used to factor~$2$ for $K$ (see
Example~\ref{ex:dedekind} below).

Most algebraic number theory books do not describe an algorithm for
decomposing primes in the general case.  Fortunately, Cohen's book
\cite[\S6.2]{cohen:course_ant}) describes how to solve the general
problem.  The solutions are somewhat surprising, since the algorithms
are much more sophisticated than the one suggested by
Theorem~\ref{thm:fac1}.  However, these complicated algorithms all run
very quickly in practice, even without assuming the maximal order is
already known.

For simplicity we consider the following slightly easier problem whose
solution contains the key ideas:  {\em Let $\O$ be any order in $\O_K$
and let~$p$ be a prime of $\Z$.  Find the prime ideals of $\O$ that
contain~$p$.}

To go from this special case to the general case, given a prime~$p$
that we wish to factor in $\O_K$, we find a $p$-maximal order $\O$,
i.e., an order~$\O$ such that $[\O_K:\O]$ is coprime to~$p$.  A
$p$-maximal order can be found very quickly in practice using the
``round 2'' or ``round 4'' algorithms.  (Remark: Later we will see
that to compute $\O_K$, we take the sum of $p$-maximal orders, one for
every~$p$ such that $p^2$ divides $\Disc(\O_K)$.  The time-consuming
part of this computation of $\O_K$ is finding the primes~$p$ such that
$p^2\mid \Disc(\O_K)$, not finding the $p$-maximal orders.  Thus a
fast algorithm for factoring integers would not only break
many cryptosystems, but would massively speed up computation of the ring of
integers of a number field.)


\begin{algorithm}
Suppose $\O$ is an order in the ring $\O_K$ of integers of a number
field~$K$.  For any prime $p\in\Z$, the following (sketch of an)
algorithm computes the set of maximal ideals of~$\O$ that contain~$p$.

\hd{Sketch of algorithm.}
{\sf 
Let $K=\Q(a)$ be a number field given
by an algebraic integer~$a$ as a root of its
minimal monic polynomial~$f$ of degree~$n$.
We assume that an order $\O$ has been 
given by a basis $w_1,\ldots,w_n$
and that~$\O$ that contains $\Z[a]$.
%We do {\em not} assume that $p\nmid [\O:\Z[a]]$.
Each of the following steps can be carried out 
efficiently using little more
than linear algebra over $\F_p$.  
The details are in \cite[\S6.2.5]{cohen:course_ant}.
\begin{enumerate}
\item{} [Check if easy] If $p\nmid \disc(\Z[a]) / \disc(\O)$ (so 
$p\nmid [\O:\Z[a]]$), then by a 
slight modification of Theorem~\ref{thm:fac1}, we
easily factor~$p\O$.
\item{} [Compute radical] 
Let $I$ be the \defn{radical} of $p\O$, which is the ideal of 
elements $x\in\O$ such that $x^m\in p\O$ 
for some positive integer~$m$.
Using linear algebra over the finite field 
$\F_p$, we can quickly compute a basis for $I/p\O$.
(We never compute $I\subset \O$.)
\item{} [Compute quotient by radical] 
Compute an $\F_p$ basis for
$$
  A = \O/I = (\O/p\O)/(I/p\O).
$$
The second equality comes from the fact that $p\O\subset I$,
which is clear by definition.  Note that $\O/p\O\isom \O\tensor\F_p$
is obtained by simply reducing the basis $w_1,\ldots, w_n$ modulo~$p$.
\item{} [Decompose quotient] The ring $A$ is a finite Artin ring with
no nilpotents, so it decomposes as a product 
$A \isom \prod \F_p[x]/g_i(x)$ of fields.  We can quickly find such
a decomposition explicitly, as described in 
\cite[\S6.2.5]{cohen:course_ant}.
\item{} [Compute the maximal ideals over $p$] Each maximal ideal $\p_i$ lying over~$p$ 
is the kernel of $\O \ra A \ra \F_p[x]/g_i(x)$.
\end{enumerate}
}
\end{algorithm}
The algorithm finds all primes of $\O$ that contain the radical $I$ of
$p\O$.  Every such prime clearly contains $p$, so to see that the
algorithm is correct, we must prove that the primes $\p$ of $\O$ that
contain~$p$ also contain~$I$.  If $\p$ is a prime of $\O$ that
contains~$p$, then $p\O \subset \p$.  If $x\in I$ then $x^m\in p\O$
for some $m$, so $x^m\in \p$ which implies that $x\in \p$ by primality
of $\p$.  Thus $\p$ contains $I$, as required.



\subsection{Essential Discriminant Divisors}
\begin{definition}
A prime $p$ is an \defn{essential discriminant
divisor} if $p\mid [\O_K : \Z[a]]$ for 
{\em every} $a\in\O_K$.  
\end{definition}
Since $[\O_K : \Z[a]]$ is the absolute value of
$\Disc(f(x))/\Disc(\O_K)$, where $f(x)$ is the characteristic
polynomial of $f(x)$, an essential discriminant divisor divides the
discriminant of the characteristic polynomial of any element of
$\O_K$.

\begin{example}[Dedekind]\label{ex:dedekind}
Let $K=\Q(a)$ be the cubic field defined by a root $a$ of the polynomial
$f = x^3 + x^2 - 2x+8$.  We will use \magma{}, which implements the algorithm
described in the previous section, to show that~$2$ is an essential
discriminant divisor for~$K$.
\begin{verbatim}
   > K<a> := NumberField(x^3 + x^2 - 2*x + 8);
   > OK := MaximalOrder(K);
   > Factorization(2*OK);
   [
   <Prime Ideal of OK
   Basis:
   [2 0 0]
   [0 1 0]
   [0 0 1], 1>,
   <Prime Ideal of OK
   Basis:
   [1 0 1]
   [0 1 0]
   [0 0 2], 1>,
   <Prime Ideal of OK
   Basis:
   [1 0 1]
   [0 1 1]
   [0 0 2], 1>
   ]
\end{verbatim}
Thus $2\O_K=\p_1\p_2\p_3$, with the $\p_i$ distinct.
Moreover, one can check that
$\O_K/\p_i\isom \F_2$.  If $\O_K=\Z[a]$
for some $a\in\O_K$ with minimal polynomial~$g$, then 
$\overline{g}(x)\in\F_2[x]$ must be a product of three {\em distinct} 
linear factors, which is impossible.
\end{example}



\chapter{Chinese Remainder Theorem}
In this section we will prove the Chinese Remainder Theorem for rings
of integers, deduce several surprising and useful consequences, then
learn about discriminants, and finally norms of ideals.  We will also
define the class group of $\O_K$ and state the main theorem about it.
The tools we develop here illustrate the power of what we have
already proved about rings of integers, and will be used over and over
again to prove other deeper results in algebraic number theory.  It is
essentially to understand everything we discuss in this chapter very well.

\section{The Chinese Remainder Theorem}
Recall that the Chinese Remainder Theorem from elementary number
theory asserts that if $n_1,\ldots, n_r$ are integers that are coprime
in pairs, and $a_1,\ldots, a_r$ are integers, then there exists an
integer~$a$ such that $a\con a_i\pmod{n_i}$ for each $i=1,\ldots,r$.
In terms of rings, the Chinese Remainder Theorem asserts that the
natural map
\[
\Z/(n_1\cdots n_r)\Z \to (\Z/n_1\Z)\oplus \cdots \oplus (\Z/n_r\Z)
\]
is an isomorphism.  This result generalizes to rings of integers of
number fields.

\begin{lemma}\label{lem:prodint}\ilem{$I\cap{}J = IJ$}
If $I$ and $J$ are coprime ideals in $\O_K$, then
$I\cap{}J = IJ$.
\end{lemma}
\begin{proof}
The ideal $I\cap{}J$ is the largest ideal of $\O_K$ that is divisible
by (contained in) both~$I$ and~$J$.  Since $I$ and $J$ are coprime,
$I\cap{}J$ is divisible by $IJ$, i.e., $I\cap{}J\subset IJ$.  By
definition of ideal $IJ\subset I\cap{}J$, which
completes the proof.
\end{proof}

\begin{remark} This lemma is true for any ring $R$ and ideals $I,J\subset R$
such that $I+J=R$.   For the general proof, choose $x\in I$ and $y\in J$
such that $x+y=1$.  If $c\in{} I\cap{} J$ then 
$$c=c\cdot 1=c\cdot (x+y) = cx + cy \in IJ + IJ = IJ,$$
so $I\cap{} J\subset IJ$, and the other inclusion is obvious by definition.
\end{remark}

\begin{theorem}[Chinese Remainder Theorem]\label{thm:crt}
\ithm{chinese remainder}
Suppose $I_1,\ldots, I_r$ are ideals of $\O_K$ such 
that $I_m+I_n=\O_K$ for any $m\neq n$.  Then the natural
homomorphism $\O_K \to \bigoplus_{n=1}^r (\O_K/I_n)$ induces an isomorphism
$$
\O_K/\left(\prod_{n=1}^r I_n\right) \to \bigoplus_{n=1}^r (\O_K/I_n).
$$
Thus given any $a_n \in I_n$ then there exists $a\in \O_K$
such that $a\con a_n\pmod{I_n}$ for $n=1,\ldots, r$.
\end{theorem}
\begin{proof}
First assume that we know the theorem in the case when the $I_n$ are
powers of prime ideals.  Then we can deduce the general case by noting
that each $\O_K/I_n$ is isomorphic to a product $\prod
\O_K/\p_{m}^{e_{m}}$, where $I_n=\prod \p_{m}^{e_{m}}$, and
$\O_K/(\prod_n I_n)$ is isomorphic to the product of the $\O_K/\p^e$,
where the $\p$ and $e$ run through the same prime powers as appear
on the right hand side.  

It thus suffices to prove that if $\p_1,\ldots, \p_r$ are distinct
prime ideals of $\O_K$ and $e_1,\ldots, e_r$ are positive integers,
then
$$
 \psi: \O_K/\left(\prod_{n=1}^r \p_n^{e_n} \right) 
   \to \bigoplus_{n=1}^r (\O_K/\p_n^{e_n})
$$ is an isomorphism.  Let $\vphi:\O_K \to \oplus_{n=1}^r
(\O_K/\p_n^{e_n})$ be the natural map induced by reduction mod
$\p_n^{e_n}$.  Then kernel of~$\vphi$ is $\cap_{n=1}^r \p_n^{e_n}$,
which by Lemma~\ref{lem:prodint} is equal to $\prod_{n=1}^r
\p_n^{e_n}$, so $\psi$ is injective.  Note that the projection
$\O_K\to \O_K/\p_n^{e_n}$ of $\vphi$ onto each factor is obviously
surjective, so it suffices to show that the element $(1,0,\ldots,0)$
is in the image of $\vphi$ (and the similar elements for the other
factors).   Since $J=\prod_{n=2}^r\p_n^{e_n}$ is not divisible
by $\p_1$, hence not contained in $\p_1$, there is
an element $a\in{}J$ with $a\not\in\p_1$.   Since $\p_1$
is maximal, $\O_K/\p_1$ is a field, so there exists $b\in \O_K$
such that $ab=1-c$, for some $c\in\p_1$.  Then 
$$1-c^{n_1} = (1-c)(1+c+c^2 + \cdots +c^{n_1-1})
=ab(1+c+c^2 + \cdots +c^{n_1-1})$$
is congruent to~$0$ mod $\p_n^{e_n}$ for each $n\geq 2$
since it is in $\prod_{n=2}^r \p_n^{e_n}$, and it 
is congruent to~$1$ modulo $\p_1^{n_1}$.
\end{proof}

\begin{remark}
  In fact, the surjectivity part of the above proof is easy to prove
  for any commutative ring; indeed, the above proof illustrates how
  trying to prove something in a special case can result in a more
  complicated proof!!  Suppose $R$ is a ring and $I, J$ are ideals in
  $R$ such that $I+J=R$.  Choose $x\in I$ and $y\in J$ such that
  $x+y=1$.  Then $x=1-y$ maps to $(0,1)$ in $R/I \oplus R/J$ and
  $y=1-x$ maps to $(1,0)$ in $R/I\oplus R/J$.  Thus the map $R/(I\cap
  J) \to R/I\oplus R/J$ is surjective.  Also, as mentioned above,
  $R/(I\cap{}J)=R/(IJ)$.
\end{remark}

\begin{example}
The \magma{} command {\tt ChineseRemainderTheorem} implements the
algorithm suggested by the above theorem.  In the following example,
we compute a prime over $(3)$ and a prime over $(5)$ of the ring of
integers of $\Q(\sqrt[3]{2})$, and find an element of $\O_K$ that is
congruent to $\sqrt[3]{2}$ modulo one prime and $1$ modulo the other.
\begin{verbatim}
   > R<x> := PolynomialRing(RationalField());
   > K<a> := NumberField(x^3-2);
   > OK := MaximalOrder(K);
   > I := Factorization(3*OK)[1][1];
   > J := Factorization(5*OK)[1][1];
   > I;
   Prime Ideal of OK
   Two element generators:
       [3, 0, 0]
       [4, 1, 0]
   > J;
   Prime Ideal of OK
   Two element generators:
       [5, 0, 0]
       [7, 1, 0]
   > b := ChineseRemainderTheorem(I, J, OK!a, OK!1);
   > b - a in I;
   true
   > b - 1 in J;
   true
   > K!b;
   -4
\end{verbatim}
The element found by the Chinese Remainder Theorem algorithm in 
this case is $-4$.
\end{example}

The following lemma is a nice application of the Chinese Remainder
Theorem.  We will use it to prove that every ideal of $\O_K$ can be
generated by two elements. Suppose $I$ is a nonzero integral ideals of
$\O_K$.  If $a\in I$, then $(a)\subset I$, so $I$ divides $(a)$ and
the quotient $(a)/I$ is an integral ideal.  The following lemma
asserts that~$(a)$ can be chosen so the quotient $(a)/I$ is coprime to
any given ideal.
\begin{lemma}\label{lem:magica}
If $I, J$ are nonzero integral ideals in $\O_K$, then there exists
an $a\in I$ such that $(a)/I$ is coprime to~$J$.
\end{lemma}
\begin{proof}
Let $\p_1,\ldots, \p_r$ be the prime divisors of~$J$.
For each $n$, let $v_n$ be the largest power of $\p_n$
that divides~$I$.  Choose an element $a_n\in \p_n^{v_n}$
that is not in $\p_n^{v_n+1}$ (there is such an element
since $\p_n^{v_n}\neq \p_n^{v_n+1}$, by unique factorization). 
By Theorem~\ref{thm:crt}, there exists $a\in \O_K$
such that
$$
   a \con a_n \pmod{\p_n^{v_n+1}}
$$
for all $n=1,\ldots, r$ and
also 
$$
   a \con 0 \pmod{I/\prod \p_n^{v_n}}.
$$
(We are applying the theorem with the coprime integral ideals
$\p_n^{v_n+1}$, for $n=1,\ldots, r$ and the integral
ideal $I/\prod \p_n^{v_n}$.)

To complete the proof we must show that $(a)/I$ is not
divisible by any $\p_n$, or equivalently, that the 
$\p_n^{v_n}$ exactly divides $(a)$.  Because
$a\con a_n \pmod{\p_n^{v_n+1}}$, there is 
$b \in \p_n^{v_n+1}$ such that $a = a_n + b$.  Since
$a_n\in \p_n^{v_n}$, it follows that $a\in \p_n^{v_n}$,
so $\p_n^{v_n}$ divides~$(a)$.  If $a\in \p_n^{v_n+1}$,
then $a_n=a-b\in \p_n^{v_n+1}$, a contradiction, so 
$\p_n^{v_n+1}$ does not divide $(a)$, which completes
the proof.
\end{proof}

Suppose~$I$ is a nonzero ideal of $\O_K$.  As an abelian group $\O_K$
is free of rank equal to the degree $[K:\Q]$ of $K$, and~$I$ is of
finite index in $\O_K$, so~$I$ can be generated as an abelian group,
hence as an ideal, by $[K:\Q]$ generators.  The following proposition
asserts something much better, namely that~$I$ can be generated {\em
as an ideal} in $\O_K$ by at most two elements.
\begin{proposition}\iprop{ideals generated by two elements}
Suppose $I$ is a fractional ideal in the ring $\O_K$ of integers of a
number field.  Then there exist $a,b\in{}K$ such that $I=(a,b)$.
\end{proposition}
\begin{proof}
If $I=(0)$, then $I$ is generated by $1$ element and we are done.  If
$I$ is not an integral ideal, then there is $x\in K$ such that $xI$ is
an integral ideal, and the number of generators of $xI$ is the same as
the number of generators of $I$, so we may assume that $I$ is an
integral ideal.  

Let $a$ be any nonzero element of the integral ideal~$I$.  We will
show that there is some $b\in I$ such that $I=(a,b)$.  Let $J=(b)$.
By Lemma~\ref{lem:magica}, there exists $a\in I$ such that $(a)/I$ is
coprime to $(b)$.  The ideal $(a,b)=(a)+(b)$ is the greatest common
divisor of $(a)$ and $(b)$, so~$I$ divides $(a,b)$, since $I$ divides
both $(a)$ and $(b)$.  Suppose $\p^n$ is a prime power that divides
$(a,b)$, so $\p^n$ divides both $(a)$ and $(b)$.  Because $(a)/I$
and $(b)$ are coprime and $\p^n$ divides $(b)$, we see that $\p^n$
does not divide $(a)/I$, so $\p^n$ must divide~$I$.  Thus $(a,b)$
divides $I$, so $(a,b)=I$ as claimed.
\end{proof}

We can also use Theorem~\ref{thm:crt} to determine the
$\O_K$-module structure of the successive quotients $\p^n/\p^{n+1}$.
\begin{proposition}\label{prop:quopow}\iprop{structure of $\p^n/\p^{n+1}$}
Let $\p$ be a nonzero prime ideal of $\O_K$, and let $n\geq 0$ be an
integer.  Then $\p^n/\p^{n+1} \isom \O_K/\p$ as $\O_K$-modules.
\end{proposition}
\begin{proof}
(Compare page 13 of Swinnerton-Dyer.)  
Since $\p^n\neq \p^{n+1}$ (by unique factorization), we
can fix an element $b\in
\p^n$ such that $b\not\in \p^{n+1}$.  Let
$\vphi:\O_K\to\p^n/\p^{n+1}$ be the $\O_K$-module morphism defined by
$\vphi(a)=ab$.  The kernel of $\vphi$ is $\p$ since clearly
$\vphi(\p)=0$ and if $\vphi(a)=0$ then $ab\in\p^{n+1}$, so
$\p^{n+1}\mid (a)(b)$, so $\p\mid (a)$, since $\p^{n+1}$ does not
divide~$(b)$.  Thus~$\vphi$ induces an injective $\O_K$-module
homomorphism $\O_K/\p\hra \p^{n}/\p^{n+1}$.

It remains to show that $\vphi$ is surjective, and this is where we
will use Theorem~\ref{thm:crt}.   Suppose $c\in \p^{n}$.
By Theorem~\ref{thm:crt} there exists $d\in \O_K$
such that
$$
  d \con c\pmod{\p^{n+1}}
\qquad\text{and}\qquad
  d \con 0\pmod{(b)/\p^{n}}.
$$
We have $\p^n\mid (c)$ since $c\in\p^n$ and $(b)/\p^n\mid (d)$
by the second displayed condition, so $(b)=\p^n\cdot(b)/\p^n\mid (d)$, hence 
$d/b\in \O_K$.   Finally
\[
  \vphi\left(\frac{d}{b}\right) \quad =\quad \frac{d}{b}\cdot b \pmod{\p^{n+1}} 
 \quad=\quad b\pmod{p^{n+1}} \quad=\quad c\pmod{p^{n+1}},
\]
so $\vphi$ is surjective.
\end{proof}




\chapter{Discrimannts, Norms, and Finiteness of the Class Group}
\section{Preliminary Remarks}
Let~$K$ be a number field of degree $n$.  Then there are~$n$
embeddings
$$\sigma_1,\ldots, \sigma_n:K\hra \C.$$
Let $\sigma:K\to \C^n$ be the product map $a\mapsto 
(\sigma_1(a),\ldots,\sigma_n(a))$.  
Let $V=\R\sigma(K)$ be the $\R$-span of $\sigma(K)$
inside $\C^n$.

\begin{proposition}\iprop{dimension of embedding of field}
The $\R$-vector space~$V=\R\sigma(K)$ spanned by the image
$\sigma(K)$ has dimension~$n$.
\end{proposition}
\begin{proof}
We prove this by showing that the image $\sigma(\O_K)$ is discrete. If
$\sigma(\O_K)$ were not discrete it would contain elements all of
whose coordinates are simultaneously arbitrarily small.  The norm of
an element $a\in \O_K$ is the product of the entries of $\sigma(a)$,
so the norms of nonzero elements of $\O_K$ would go to~$0$.  This is a
contradiction, since the norms of elements of $\O_K$ are integers.

The fact that $\sigma(\O_K)$ is discrete in $\C^n$ implies that
$\R\sigma(\O_K)$ has dimension equal to the rank~$n$ of
$\sigma(\O_K)$, as claimed.  This last assertion is not obvious, and
requires observing that if~$L$ if a free abelian group that is
discrete in a real vector space~$W$ and $\R{}L=W$, then the rank of
$L$ equals the dimension of~$W$.  Here's why this is true.  If
$x_1,\ldots, x_m \in L$ are a basis for $\R{}L$, then $\Z x_1 + \cdots
+ \Z x_m$ has finite index in~$L$, since otherwise there would be
infinitely many elements of $L$ in a fundamental domain for $\Z x_1 +
\cdots + \Z x_m$, which would contradict discreteness of $L$.  Thus
the rank of~$L$ is $m=\dim(\R{}L)$, as claimed.
\end{proof}

Since $\sigma(\O_K)$ is a lattice in~$V$, the volume of
$V/\sigma(\O_K)$ is finite.  Suppose $w_1,\ldots, w_n$ is a basis for
$\O_K$.  Then if~$A$ is the matrix whose $i$th row is $\sigma(w_i)$,
then $|\det(A)|$ is the volume of $V/\sigma(\O_K)$.  (Take this
determinant as the definition of the volume---we won't be using
``volume'' here except in a formal motivating way.)
\begin{example}
Let $\O_K=\Z[i]$ be the ring of integers of $K=\Q(i)$.
Then $w_1=1$, $w_2=i$ is a basis for $\O_K$.
The map $\sigma:K\to \C^2$ is given by 
$$
   \sigma(a+bi) = (a+bi,a-bi)\in\C^2.
$$
The image $\sigma(\O_K)$ is spanned by
$(1,1)$ and $(i,-i)$.  
The volume determinant is
\[
  \left|\mtwo{1}{1}{i}{-i}\right| = |-2i| = 2.
\]

Let $\O_K=\Z[\sqrt{2}]$ be the ring of integers of $K=\Q(\sqrt{2})$.
The map $\sigma$ is
\[
  \sigma(a+b\sqrt{2}) = (a+b\sqrt{2},a-b\sqrt{2})\in\R^2,
\]
and 
\[
A = \mtwo{1}{1}{\sqrt{2}}{-\sqrt{2}},
\]
which has determinant
$ -2\sqrt{2}$, so the volume of the ring
of integers is $2\sqrt{2}$.
\end{example}
As the above example illustrates, the volume of the ring of integers
is not a great invariant of $\O_K$.  
For example, it need not
be an integer.  If we consider $\det(A)^2$ instead, we
obtain a number that is a well-defined integer which can
be either positive or negative.  In the next section we
will do just this. 

\section{Discriminants}\label{sec:disc}
Suppose $w_1,\ldots, w_n$ are a basis for a number field $K$, which we
view as a $\Q$-vector space.  Let $ \sigma : K\hra \C^n $ be the
embedding $\sigma(a)=(\sigma_1(a),\ldots,\sigma_n(a))$, where
$\sigma_1,\ldots, \sigma_n$ are the distinct embeddings of $K$
into~$\C$.  Let $A$ be the matrix whose rows are $\sigma(w_1), \ldots,
\sigma(w_n)$.  The quantity $\det(A)$ depends on the ordering of the
$w_i$, and need not be an integer.

If we consider $\det(A)^2$ instead, we
obtain a number that is a well-defined integer which can
be either positive or negative.  Note that
\begin{align*}
\det(A)^2 &= \det(AA) = \det(A A^t) \\
 &= \det\left(\sum_{k=1,\ldots,n} \sigma_k(w_i)\sigma_k(w_j)\right)\\
 &= \det(\Tr(w_i w_j)_{1\leq i,j\leq n}),
\end{align*}
so $\det(A)^2$ can be defined purely in terms of the trace without
mentioning the embeddings $\sigma_i$.  Also, changing the basis for
$\O_K$ is the same as left multiplying~$A$ by an integer matrix $U$ of
determinant $\pm 1$, which does not change the squared determinant,
since $\det(UA)^2 = \det(U)^2\det(A)^2 = \det(A)^2$.  Thus $\det(A)^2$
is well defined, and does not depend on the choice of basis.

If we view~$K$ as a $\Q$-vector space, then $(x,y)\mapsto \Tr(xy)$
defines a bilinear pairing $K\times K \to \Q$ on~$K$, which we call
the \defn{trace pairing}.  The following lemma asserts that this
pairing is nondegenerate, so $\det(\Tr(w_i w_j))\neq 0$ hence
$\det(A)\neq 0$.
\begin{lemma}\label{lem:tracenondegen}\ilem{trace pairing nondegenerate}
The trace pairing is nondegenerate.
\end{lemma}
\begin{proof}
If the trace pairing is degenerate, then there exists $a\in K$ such
that for every $b\in K$ we have $\Tr(ab)=0$.  In particularly, taking
$b=a^{-1}$ we see that $0=\Tr(a a^{-1})=\Tr(1)=[K:\Q]>0$, which is
absurd.
\end{proof}

\begin{definition}[Discriminant]
Suppose $a_1,\ldots, a_n$ is any $\Q$-basis of $K$.  The \defn{discriminant}
of $a_1,\ldots, a_n$ is 
$$
  \Disc(a_1,\ldots,a_n) = \det(\Tr(a_i a_j)_{1\leq i,j\leq n})\in\Q.
$$
The \defn{discriminant} $\Disc(\O)$ of an order $\O$ in $\O_K$ is
the discriminant of any basis for~$\O$.
The \defn{discriminant} $d_K=\Disc(K)$ of the number field~$K$ 
is the discrimimant of $\O_K$. 
\end{definition}
Note that the discriminants defined above are all nonzero
by Lemma~\ref{lem:tracenondegen}.

Warning: In \magma{} $\Disc(K)$ is defined to be the discriminant of the
polynomial you happened to use to define $K$, which is (in my opinion)
a poor choice and goes against most of the literature.

The following proposition asserts that the discriminant of an order
$\O$ in $\O_K$ is bigger than $\disc(\O_K)$ by a factor of the square
of the index.
\begin{proposition}\iprop{discriminant of order}
Suppose $\O$ is an order in $\O_K$. Then
$$
  \Disc(\O) =  \Disc(\O_K)\cdot [\O_K:\O]^2.
$$
\end{proposition}
\begin{proof}
Let $A$ be a matrix whose rows are the images via $\sigma$ of a basis
for $\O_K$, and let $B$ be a matrix whose rows are the images via
$\sigma$ of a basis for $\O$.  Since $\O\subset \O_K$ has finite
index, there is an integer matrix $C$ such that $CA=B$,
and $|\det(C)|= [\O_K:\O]$.  Then
\[\Disc(\O) = \det(B)^2 = \det(CA)^2 = \det(C)^2\det(A)^2
  = [\O_K:\O]^2 \cdot \Disc(\O_K).
\]
\end{proof}

This result is enough to give an algorithm for computing $\O_K$,
albeit a potentially slow one.  Given~$K$, find some order $\O\subset
K$, and compute $d=\Disc(\O)$.  Factor $d$, and use the factorization
to write $d=s\cdot f^2$, where $f^2$ is the largest square that
divides~$d$.  Then the index of $\O$ in $\O_K$ is a divisor of~$f$,
and we (tediously) can enumerate all rings~$R$ with $\O\subset
R\subset K$ and $[R:\O] \mid f$, until we find the largest one all of
whose elements are integral.

\begin{example}
Consider the ring $\O_K = \Z[(1+\sqrt{5})/2]$ of integers of 
$K=\Q(\sqrt{5})$.  The discriminant of the basis $1,a=(1+\sqrt{5})/2$
is
\[
  \Disc(\O_K) = \left| \mtwo{2}{1}{1}{3} \right| = 5.
\]
Let $\O=\Z[\sqrt{5}]$ be the order generated by $\sqrt{5}$.
Then $\O$ has basis $1,\sqrt{5}$, so 
\[
  \Disc(\O) = \left| \mtwo{2}{0}{0}{10} \right| = 20 = [\O_K:\O]^2\cdot 5.
\]
\end{example}

\section{Norms of Ideals}
In this section we extend the notion of norm to ideals.  This will be
helpful in proving of class groups in the next section.  For example,
we will prove that the group of fractional ideals modulo principal
fractional ideals of a number field is finite by showing that every
ideal is equivalent to an ideal with norm at most some a priori bound.
\begin{definition}[Lattice Index]
If $L$ and $M$ are two lattices in vector space $V$, then the 
\defn{lattice index} $[L:M]$ is by definition the absolute value of the
determinant of any linear automorphism $A$ of $V$ such that $A(L)=M$.
\end{definition}

The lattice index has the
following properties: 
\begin{itemize}
\item If $M\subset L$, then $[L:M]=\#(L/M)$.
\item If $M, L, N$ are lattices then $[L:N] = [L:M]\cdot [M:N]$.
\end{itemize}


\begin{definition}[Norm of Fractional Ideal]
Suppose $I$ is a fractional ideal of $\O_K$.  The \defn{norm} of~$I$ is
the lattice index
$$ 
  \Norm(I) = [\O_K : I] \in \Q_{\geq 0},
$$ 
or $0$ if $I=0$.
\end{definition}
Note that if $I$ is an integral ideal, then $\Norm(I)=\#(\O_K/I)$.

\begin{lemma}\label{lem:aIfrac}\ilem{$\Norm(a I)$}
Suppose $a\in K$ and $I$ is an integral ideal.
Then 
\[
  \Norm(a I) = |\Norm_{K/\Q}(a)| \Norm(I).
\]
\end{lemma}
\begin{proof}
By properties of the lattice index mentioned above we have
\[
 [\O_K : aI] = [\O_K : I] \cdot [I:aI]
             = \Norm(I) \cdot |\Norm_{K/\Q}(a)|.
\] 
Here we have used that $[I:aI]=|\Norm_{K/\Q}(a)|$, which is because left
multiplication $\ell_a$ is an automorphism of $K$ that sends $I$ onto
$aI$, so $[I:aI]=|\det(\ell_a)|=|\Norm_{K/\Q}(a)|$.
\end{proof}

\begin{proposition}\iprop{multiplicativity of ideal norm}
If $I$ and $J$ are fractional ideals, then 
$$\Norm(IJ) = \Norm(I)\cdot \Norm(J).$$
\end{proposition}
\begin{proof}
By Lemma~\ref{lem:aIfrac}, it suffices to prove this when $I$ and $J$ are
integral ideals.  If $I$ and $J$ are coprime, then
Theorem~\ref{thm:crt} (Chinese Remainder Theorem) implies that
$\Norm(IJ) = \Norm(I)\cdot \Norm(J)$.  Thus we reduce to the case when
$I=\p^m$ and $J=\p^k$ for some prime ideal $\p$ and integers $m,k$.
By Proposition~\ref{prop:quopow} (consequence of CRT that
$\O_K/\p\isom \p^n/\p^{n+1}$), the filtration of $\O_K/\p^{n}$ given
by powers of~$\p$ has successive quotients isomorphic to $\O_K/\p$, so
we see that $\#(\O_K/\p^{n}) = \#(\O_K/\p)^{n}$, which proves that
$\Norm(\p^n)=\Norm(\p)^n$.
\end{proof}

\begin{lemma}\label{lem:finitewithnorm}\ilem{integral ideals of bounded norm}
Fix a number field $K$.
Let $B$ be a positive integer.  There
are only finitely many integral ideals
$I$ of $\O_K$ with norm at most $B$.
\end{lemma}
\begin{proof}
An integral ideal $I$ is a subgroup of $\O_K$ of index equal to the
norm of $I$.  If $G$ is any finitely generated abelian group, then
there are only finitely many subgroups of $G$ of index at most $B$,
since the subgroups of index dividing an integer $n$ are all subgroups
of $G$ that contain $nG$, and the group $G/nG$ is finite.  This
proves the lemma.
\end{proof}

\section{Finiteness of the Class Group via Geometry of Numbers}
We have seen examples in which $\O_K$ is not a unique factorization
domain.  If $\O_K$ is a principal ideal domain, then it is a unique
factorization domain, so it is of interest to understand how badly
$\O_K$ fails to be a principal ideal domain.  The class group of
$\O_K$ measures this failure.  As one sees in a course on Class Field
Theory, the class group and its generalizations also yield deep
insight into the possible abelian Galois extensions of~$K$.

\begin{definition}[Class Group]
Let $\O_K$ be the ring of integers of a number field~$K$.  The 
\defn{class group} $C_K$ of~$K$ is the group of nonzero fractional ideals
modulo the sugroup of principal fractional ideals $(a)$, for $a\in K$.
\end{definition}

Note that if we let $\Div(K)$ denote the group of nonzero fractional
ideals, then there is an exact sequence
$$
  0 \to \O_K^* \to K^* \to \Div(K) \to C_K \to 0.
$$

A basic theorem in algebraic number theory is that the class group
$C_K$ is finite, which follows from the first part of the following
theorem and the fact that there are only finitely many ideals of norm
less than a given integer.
\begin{theorem}[Finiteness of the Class Group]\label{thm:finiteclassgrp}
\ithm{finiteness of class group}
Let $K$ be a number field.  There is a constant $C_{r,s}$ that
depends only on the number $r$, $s$ of real and pairs
of complex conjugate embeddings of~$K$ such that
every ideal class of $\O_K$ contains an integral ideal
of norm at most $C_{r,s}\sqrt{|d_K|}$, where
$d_K=\Disc(\O_K)$.
Thus by Lemma~\ref{lem:finitewithnorm} the class group $C_K$ of~$K$ is
finite.
One can choose $C_{r,s}$ such that every ideal class
in $C_K$  contains an integral ideal of norm at most 
\[
  \sqrt{|d_K|}\cdot \left(\frac{4}{\pi}\right)^s\frac{n!}{n^n}.
\]
\end{theorem}
The explicit bound in the theorem is called the Minkowski bound, and I think it
is the best known unconditional general bound (though there are better
bounds in certain special cases).  

Before proving Theorem~\ref{thm:finiteclassgrp}, we prove a few
lemmas.  The strategy of the proof will be to start with any nonzero
ideal~$I$, and prove that there is some nonzero $a\in K$, with very
small norm, such that $aI$ is an integral ideal. Then
$\Norm(aI)=\Norm_{K/\Q}(a)\Norm(I)$ will be small, since
$\Norm_{K/\Q}(a)$ is small.  The trick is to determine precisely
how small an $a$ we can choose subject to the condition that
$aI$ be an integral ideal, i.e., that $a\in I^{-1}$.

Let $S$ be a subset of $V=\R^n$.  Then $S$ is \defn{convex}
if whenever $x,y\in S$ then the line connecting $x$ and $y$
lies entirely in $S$.  We say that $S$ is \defn{symmetric about
the origin} if whenever $x\in S$ then $-x\in S$ also. 
If $L$ is a lattice in $V$, then the \defn{volume} of $V/L$ is
the volume of the compact real manifold $V/L$, which is the
same thing as the absolute value of the determinant of any
matrix whose rows form a basis for $L$.
\begin{lemma}[Blichfeld]\label{lem:gettwo}\ilem{Blichfeld}
Let $L$ be a lattice in $V=\R^n$, and let $S$ be a
bounded closed convex subset of $V$ that is symmetric about the
origin.  Assume that $\Vol(S)\geq 2^n \Vol(V/L)$.  
Then~$S$ contains a nonzero element of $L$.
\end{lemma}
\begin{proof}
First assume that $\Vol(S)>2^n\cdot \Vol(V/L)$.
If the map $\pi: \frac{1}{2}S \to V/L$ is injective, then 
$$\frac{1}{2^n}\Vol(S) = \Vol\left(\frac{1}{2} S\right)\leq \Vol(V/L),$$ 
a contradiction.  Thus $\pi$ is not injective, so there
exist $P_1\neq P_2\in \frac{1}{2}S$ such that $P_1-P_2\in L$.
By symmetry $-P_2\in \frac{1}{2}S$.  By convexity,
the average $\frac{1}{2}(P_1-P_2)$ of $P_1$ and $-P_2$
is also in $\frac{1}{2}S$.  Thus $0\neq P_1-P_2 \in S\meet L$,
as claimed.

Next assume that $\Vol(S) = 2^n\cdot \Vol(V/L)$.  Then for all
$\eps>0$ there is $0\neq Q_\eps \in L\meet (1+\eps) S$,
since $\Vol((1+\eps)S)>\Vol(S)=2^n\cdot \Vol(V/L)$.
If $\eps<1$ then the $Q_\eps$ are all in $L\meet{} 2 S$,
which is finite since $2S$ is bounded and $L$ is discrete.
Hence there exists $Q=Q_\eps\in L\meet{} (1+\eps) S$ for arbitrarily
small $\eps$.  Since $S$ is closed, $Q\in L\cap S$.
\end{proof}

\begin{lemma}\label{lem:latticevolchange}\ilem{lattices and volumes}
If $L_1$ and $L_2$ are lattices in $V$, then 
\[
   \Vol(V/L_2) = \Vol(V/L_1) \cdot [L_1:L_2].
\]
\end{lemma}
\begin{proof}
Let $A$ be an automorphism of~$V$ such that $A(L_1)=L_2$.  Then $A$
defines an isomorphism of real manifolds $V/L_1\to V/L_2$ that changes
volume by a factor of $|\det(A)|=[L_1:L_2]$.  The claimed
formula then follows.
\end{proof}

Fix a number field $K$ with ring of integers $\O_K$. 
Let $\sigma:K \to V=\R^n$ be the embedding 
\begin{align*}
  \sigma(x) = \big(&\sigma_1(x), \sigma_2(x),\ldots, \sigma_r(x),\\
     &\quad \Re(\sigma_{r+1}(x)), \ldots, \Re(\sigma_{r+s}(x)), 
      \Im(\sigma_{r+1}(x)), \ldots, \Im(\sigma_{r+s}(x))\big),
\end{align*}
where $\sigma_1,\ldots, \sigma_r$ are the real embeddings
of $K$ and $\sigma_{r+1},\ldots, \sigma_{r+s}$ are half
the complex embeddings of $K$, with one representative of
each pair of complex conjugate embeddings.
Note that this $\sigma$ is {\em not} exactly the same as the one
at the beginning of Section~\ref{sec:disc}.

\begin{lemma}\label{lem:volok}\ilem{volume of rings of integers}
\[
  \Vol(V/\sigma(\O_K)) = 2^{-s} \sqrt{|d_K|}.
\]
\end{lemma}
\begin{proof}
Let $L=\sigma(\O_K)$.
From a basis $w_1,\ldots, w_n$ for $\O_K$ we obtain a matrix $A$
whose $i$th row is
\[
(\sigma_1(w_i), \cdots, \sigma_r(w_i), 
\Re(\sigma_{r+1}(w_i)),\ldots, \Re(\sigma_{r+s}(w_1)), 
\Im(\sigma_{r+1}(w_i)),\ldots, \Im(\sigma_{r+s}(w_1)))
\]
and whose determinant has absolute value equal to the volume
of $V/L$.  By doing the following three column operations,
we obtain a matrix whose rows are exactly the images of
the $w_i$ under {\em all} embeddings of $K$ into $\C$, which
is the matrix that came up when we defined $d_K$.
\begin{enumerate}
\item Add $i=\sqrt{-1}$ times each column with entries $\Im(\sigma_{r+j}(w_i))$
to the column with entries $\Re(\sigma_{r+j}(w_i))$.
\item Multiply all columns $\Im(\sigma_{r+j}(w_i))$
  by $-2i$, thus changing the determinant by $(-2i)^s$.
\item Add each columns with entries $\Re(\sigma_{r+j}(w_i))$
to the the column with entries $-2i\Im(\sigma_{r+j}(w_i))$.
\end{enumerate}
Recalling the definition of discriminant, we see that if~$B$ 
is the matrix constructed by the above three
operations, then $\Det(B)^2 = d_K$. 
Thus
\[
  \Vol(V/L) = |\Det(A)| = |(-2i)^{-s}\cdot \Det(B)| = 2^{-s}\sqrt{|d_K|}.
\]
\end{proof}

\begin{lemma}\label{lem:volfracideal}\ilem{fractional ideal is lattice}
If $I$ is a nonzero fractional ideal for $\O_K$, then $\sigma(I)$ is
a lattice in $V$, and 
\[
\Vol(V/\sigma(I)) = 2^{-s}\sqrt{|d_K|}\cdot \Norm(I).
\]
\end{lemma}
\begin{proof}
We know that $[\O_K:I]=\Norm(I)$ is a nonzero rational number.
Lemma~\ref{lem:volok} implies that $\sigma(\O_K)$ is a lattice in $V$,
since $\sigma(\O_K)$ has rank $n$ as abelian group and spans $V$,
so $\sigma(I)$ is also a lattice in~$V$.  For the volume
formula, combine Lemmas~\ref{lem:latticevolchange}--\ref{lem:volok} to get
\[
\Vol(V/\sigma(I)) = \Vol(V/\sigma(\O_K))\cdot[\O_K:I]
         =2^{-s}\sqrt{|d_K|}\Norm(I).
\]
\end{proof}


\begin{proof}[Proof of Theorem~\ref{thm:finiteclassgrp}]
Let $K$ be a number field with ring of integers $\O_K$,
let $\sigma:K\hra V\isom \R^n$ be as above,
and let $f:V\to \R$ be the function defined by
\[
  f(x_1,\ldots, x_n) = |x_1\cdots x_r\cdot (x_{r+1}^2 + x_{(r+1)+s}^2)\cdots (x_{r+s}^2 + x_n^2).
\]
Notice that if $x\in K$ then $f(\sigma(x)) = |\Norm_{K/\Q}(x)|$.

Let $S\subset V$ be any closed, bounded, convex, subset that is
symmetric with respect to the origin and has positive volume.  Since~$S$ is closed
and bounded, 
\[
  M = \max\{f(x) : x \in S\}
\]
exists. 

Suppose~$I$ is any nonzero fractional ideal of $\O_K$.  Our goal
is to prove there is an integral ideal $aI$ with small norm. We
will do this by finding an appropriate $a\in I^{-1}$.
By Lemma~\ref{lem:volfracideal}, 
\[
 c=\Vol(V/I^{-1}) = \frac{2^{-s}\sqrt{|d_K|}}{\Norm(I)}.
\]
Let $\lambda = 2\cdot\left(\frac{c}{v}\right)^{1/n}$, where $v=\Vol(S)$.
Then 
\[
   \Vol(\lambda{} S) = \lambda^n \Vol(S) = 2^n \frac{c}{v} \cdot v = 2^n\cdot c=
  2^n \Vol(V/I^{-1}),
\]
so by Lemma~\ref{lem:gettwo} there exists $0\neq a\in I^{-1}\meet \lambda S$.
Since $M$ is the largest norm of an element of $S$, the largest norm
of an element of $I^{-1}\cap  \lambda{}S$ is at most $\lambda^n M$,
so 
\[
  |\Norm_{K/\Q}(a)| \leq \lambda^n M.
\]
Since $a\in I^{-1}$, we have $aI \subset \O_K$, so 
$aI$ is an integral ideal of $\O_K$ that is equivalent to $I$, and
\begin{align*}
  \Norm(aI) &= |\Norm_{K/\Q}(a)|\cdot \Norm(I)\\
    &\leq \lambda^n M\cdot \Norm(I)\\
    &\leq 2^n \frac{c}{v} M \cdot \Norm(I)\\
    &\leq 2^n\cdot 2^{-s} \sqrt{|d_K|} \cdot M \cdot v^{-1}\\
    &= 2^{r+s} \sqrt{|d_K|} \cdot M \cdot v^{-1}.
\end{align*}
Notice that the right hand side is independent of $I$.  It
depends only on $r$, $s$, $|d_K|$, and our choice of~$S$.
This completes the proof of the theorem, except for
the assertion that $S$ can be chosen to give the claim
at the end of the theorem, which we leave as an exercise.
\end{proof}

\begin{corollary}\icor{discrimant of number field $>1$}
Suppose that $K\neq \Q$ is a number field.  Then $|d_K|>1$.
\end{corollary}
\begin{proof}
Applying Theorem~\ref{thm:finiteclassgrp} to the unit ideal,
we get the bound
\[
 1\leq \sqrt{|d_K|}\cdot \left(\frac{4}{\pi}\right)^s\frac{n!}{n^n}.
\]
Thus 
\[
 \sqrt{|d_K|} 
  \geq 
\left(\frac{\pi}{4}\right)^s\frac{n^n}{n!},
\]
and the right hand quantity is strictly bigger than $1$ for
any $s\leq n/2$ and any $n>1$ (exercise).
\end{proof}

\subsection{An Open Problem}
\begin{conjecture}
There are infinitely many number fields~$K$ such that the class group 
of $K$ has order $1$.  
\end{conjecture}
For example, if we consider real quadratic fields $K=\Q(\sqrt{d})$,
with $d$ positive and square free, many class numbers are probably $1$,
as suggested by the \magma{} output below.
It looks like 1's will keep appearing infinitely often, and indeed
Cohen and Lenstra conjecture that they do.  Nobody has found a way
to prove this yet.
\begin{verbatim}
   > for d in [2..1000] do 
        if d eq SquareFree(d) then 
           h := ClassNumber(NumberField(x^2-d));
           if h eq 1 then
              printf "%o, ", d;
           end if;
        end if;
      end for;
   
   2, 3, 5, 6, 7, 11, 13, 14, 17, 19, 21, 22, 23, 29, 31, 33, 37, 
   38, 41, 43, 46, 47, 53, 57, 59, 61, 62, 67, 69, 71, 73, 77, 83, 
   86, 89, 93, 94, 97, 101, 103, 107, 109, 113, 118, 127, 129, 131, 
   133, 134, 137, 139, 141, 149, 151, 157, 158, 161, 163, 166, 167, 
   173, 177, 179, 181, 191, 193, 197, 199, 201, 206, 209, 211, 213, 
   214, 217, 227, 233, 237, 239, 241, 249, 251, 253, 262, 263, 269, 
   271, 277, 278, 281, 283, 293, 301, 302, 307, 309, 311, 313, 317, 
   329, 331, 334, 337, 341, 347, 349, 353, 358, 367, 373, 379, 381, 
   382, 383, 389, 393, 397, 398, 409, 413, 417, 419, 421, 422, 431, 
   433, 437, 446, 449, 453, 454, 457, 461, 463, 467, 478, 479, 487, 
   489, 491, 497, 501, 502, 503, 509, 517, 521, 523, 526, 537, 541, 
   542, 547, 553, 557, 563, 566, 569, 571, 573, 581, 587, 589, 593, 
   597, 599, 601, 607, 613, 614, 617, 619, 622, 631, 633, 641, 643, 
   647, 649, 653, 661, 662, 669, 673, 677, 681, 683, 691, 694, 701, 
   709, 713, 717, 718, 719, 721, 734, 737, 739, 743, 749, 751, 753, 
   757, 758, 766, 769, 773, 781, 787, 789, 797, 809, 811, 813, 821, 
   823, 827, 829, 838, 849, 853, 857, 859, 862, 863, 869, 877, 878, 
   881, 883, 886, 887, 889, 893, 907, 911, 913, 917, 919, 921, 926, 
   929, 933, 937, 941, 947, 953, 958, 967, 971, 973, 974, 977, 983, 
   989, 991, 997, 998, 
\end{verbatim}
   
In contrast, if we look at class numbers of quadratic imaginary fields,
only a few at the beginning have class number~$1$.  
\begin{verbatim}
   > for d in [1..1000] do 
        if d eq SquareFree(d) then 
           h := ClassNumber(NumberField(x^2+d));
           if h eq 1 then
              printf "%o, ", d;
           end if;
        end if;
     end for;
  1, 2, 3, 7, 11, 19, 43, 67, 163
\end{verbatim}
It is a theorem that the above list of $9$ fields is the complete list
with class number~$1$.  More generally, it is possible (in theory),
using deep work of Gross, Zagier, and Goldfeld involving zeta
functions and elliptic curves, to enumerate all quadratic number
fields with a given class number.


\chapter{Computing Class Groups}
In this chapter we discuss how to compute class groups in some
examples, then introduce the group of units.  We will prove the main
structure theorem for the group of units in the next chapter.

\section{Remarks on Computing the Class Group}
If $\p$ is a prime of $\O_K$, then the intersection $\p\cap \Z=p\Z$ is
a prime ideal of $\Z$.  We say that $\p$ \defn{lies over} $p\in\Z$.
Note $\p$ lies over $p\in\Z$ if and only if $\p$ is one of the prime
factors in the factorization of the ideal $p\O_K$.  Geometrically,
$\p$ is a point of $\Spec(\O_K)$ that lies over the point $p\Z$ of
$\Spec(\Z)$ under the map induced by the inclusion $\Z\hra \O_K$.


\begin{lemma}\ilem{class group generated by bounded primes}
Let $K$ be a number field with ring of integers $\O_K$.  Then the
class group $\Cl(K)$ is generated by the prime ideals $\p$ of $\O_K$
lying over primes $p\in\Z$ with $p\leq B_K = \sqrt{|d_K|}\cdot
\left(\frac{4}{\pi}\right)^s\cdot \frac{n!}{n^n}$,
where $s$ is the number of complex conjugate pairs of embeddings
$K\hra\C$.
\end{lemma}
\begin{proof}
We proved before that every ideal class in $\Cl(K)$ is represented by
an ideal $I$ with $\Norm(I)\leq B_K$.  Write $I=\prod_{i=1}^m
\p_i^{e_i}$, with each $e_i\geq 1$.  Then by multiplicativity of the
norm, each $\p_i$ also satisfies $\Norm(\p_i)\leq B_K$.  If $\p_i \cap
\Z=p\Z$, then $p\mid \Norm(\p_i)$, since $p$ is the residue
characteristic of $\O_K/\p$, so $p\leq B_K$. Thus $I$ is a product of
primes $\p$ that satisfies the norm bound of the lemma, whcih proves
the lemma.
\end{proof}

This is a sketch of how to compute $\Cl(K)$:
\begin{enumerate}
\item Use the ``factoring primes'' algorithm to list all
prime ideals $\p$ of $\O_K$ that appear in the factorization
of a prime $p\in \Z$ with $p\leq B_K$.
\item Find the group generated  by the ideal
classes $[\p]$, where the $\p$ are the prime ideals
found in step 1.  (In general, one must think more carefully
about how to do this step.)
\end{enumerate}
The following three examples illustrate computation of $\Cl(K)$
for $K=\Q(i), \Q(\sqrt{5})$ and $\Q(\sqrt{-6})$.
\begin{example}
We compute the class group of $K=\Q(i)$.  We have
$$
  n = 2, \quad r=0, \quad s=1, \quad d_K = -4,
$$
so 
$$ 
  B_K = \sqrt{4}\cdot \left(\frac{4}{\pi}\right)^1
   \cdot\left(\frac{2!}{2^2}\right) = \frac{8}{\pi} <3.
$$
Thus $\Cl(K)$ is generated by the prime divisors
of $2$.  We have
$$
 2\O_K = (1+i)^2,
$$
so $\Cl(K)$ is generated by the principal prime
ideal $\p=(1+i)$. Thus $\Cl(K)=0$ is trivial.
\end{example}

\begin{example}
We compute the class group of $K=\Q(\sqrt{5})$.
We have
$$
  n = 2, \quad r = 2, \quad s=0, \quad d_K = 5,
$$
so $$B = \sqrt{5}\cdot \left(\frac{4}{\pi}\right)^0\cdot 
\left(\frac{2!}{2^2}\right)  < 3.$$
Thus $\Cl(K)$ is generated by the primes that divide $2$.
We have $\O_K=\Z[\gamma]$, where $\gamma=\frac{1+\sqrt{5}}{2}$
satisfies $x^2-x-1$.   The polynomial $x^2-x-1$ is irreducible
mod $2$, so $2\O_K$ is prime.  Since it is principal, we see
that $\Cl(K)=1$ is trivial.
\end{example}

\begin{example}
In this example, we compute the class group of $K=\Q(\sqrt{-6})$.
We have
$$
  n = 2, \quad r=0, \quad s=1, \quad d_K = -24,
$$
so 
$$
  B = \sqrt{24} \cdot \frac{4}{\pi} \cdot 
       \left(\frac{2!}{2^2}\right)\sim 3.1.
$$ 
Thus $\Cl(K)$ is generated by the prime ideals lying over $2$ and $3$.
We have $\O_K=\Z[\sqrt{-6}]$, and $\sqrt{-6}$ satisfies $x^2+6=0$.
Factoring $x^2+6$ modulo $2$ and $3$ we see that the class group
is generated by the prime ideals
$$
  \p_2 = (2,\sqrt{-6})\qquad\text{and}\qquad
  \p_3 = (3,\sqrt{-6}).
$$
Also, $\p_2^2 = 2\O_K$ and $\p_3^2=3\O_K$, so 
$\p_2$ and $\p_3$ define elements of order
dividing $2$ in $\Cl(K)$.  

Is either $\p_2$ or $\p_3$ principal?  Fortunately,
there is an easier norm trick that allows us to decide.
Suppose $\p_2 = (\alpha)$, where $\alpha=a+b\sqrt{-6}$.
Then $$2=\Norm(\p_2) = |\Norm(\alpha)| = (a+b\sqrt{-6})(a-b\sqrt{-6})
   = a^2 + 6b^2.$$
Trying the first few values of $a, b\in \Z$, we see that this
equation has no solutions, so $\p_2$ can not
be principal.  By a similar argument, we see that $\p_3$
is not principal either.  Thus $\p_2$ and $\p_3$ define
elements of order $2$ in $\Cl(K)$.

Does the class of $\p_2$ equal the class of $\p_3$?
Since $\p_2$ and $\p_3$ define classes of order~$2$,
we can decide this by finding the class of $\p_2\cdot \p_3$.
We have
$$
 \p_2\cdot \p_3 =  (2,\sqrt{-6})\cdot (3,\sqrt{-6})
   = (6,2\sqrt{-6}, 3\sqrt{-6}) \subset (\sqrt{-6}).$$
The ideals on both sides of the inclusion have norm $6$,
so by multiplicativity of the norm, they must be the
same ideal.  Thus $\p_2\cdot \p_3=(\sqrt{-6})$ is principal,
so $\p_2$ and $\p_3$ represent the same element of $\Cl(K)$.
We conclude that $$\Cl(K) = \langle \p_2 \rangle = \Z/2\Z.$$
\end{example}



\chapter{Dirichlet's Unit Theorem}
In this chapter we will prove the main structure theorem for the group
of units of the ring of integers of a number field.  The answer is
remarkably simple: if $K$ has $r$ real and $s$ complex embeddings,
then 
$$
\O_K^*\ncisom \Z^{r+s-1} \oplus W,
$$
where $W$ is the finite cyclic group of roots 
of unity in $K$.  Examples will follow on Thursday (application:
the solutions to Pell's equation $x^2-dy^2=1$, for $d>1$ squarefree, 
form a free abelian group of rank $1$).

\section{The Group of Units}
\begin{definition}[Unit Group]
The \defn{group of units} $U_K$ associated to a number field~$K$ is the
group of elements of $\O_K$ that have an inverse in $\O_K$.
\end{definition}

\begin{theorem}[Dirichlet]\label{thm:units}\ithm{Dirichlet unit}
The group $U_K$ is the product of a finite cyclic group of roots of
unity with a free abelian group of rank $r+s-1$, where~$r$ is the
number of real embeddings of~$K$ and~$s$ is the number of complex
conjugate pairs of embeddings.
\end{theorem}

We prove the theorem by defining a map $\vphi:U_K\to \R^{r+s}$, and
showing that the kernel of $\vphi$ is finite and the image of $\vphi$
is a lattice in a hyperplane in $\R^{r+s}$.  The trickiest part of the
proof is showing that the image of $\vphi$ spans a hyperplane, and we
do this by a clever application of Blichfeldt's lemma (that if $S$ is
closed, bounded, symmetric, etc., and has volume at least $2^n\cdot
\Vol(V/L)$, then $S\cap L$ contains a nonzero element).

\begin{remark}
Theorem~\ref{thm:units} is due to Dirichlet  who lived 1805--1859.
Thomas Hirst described Dirichlet as follows:
\begin{quote}He is a rather tall, lanky-looking man, with moustache and beard about
to turn grey with a somewhat harsh voice and rather deaf. He was
unwashed, with his cup of coffee and cigar. One of his failings is
forgetting time, he pulls his watch out, finds it past three, and runs
out without even finishing the sentence.
\end{quote}
Koch wrote that:
\begin{quote}
... important parts of mathematics were influenced by Dirichlet. His
proofs characteristically started with surprisingly simple
observations, followed by extremely sharp analysis of the remaining
problem. 
\end{quote}
I think Koch's observation nicely describes the proof we will give of
Theorem~\ref{thm:units}.
\end{remark}


The following proposition explains how to think about units in terms
of the norm.
\begin{proposition}\label{prop:unitnorm}\iprop{unit norm characterization}
An element $a\in \O_K$ is a unit if and only if $\Norm_{K/\Q}(a)=\pm 1$.
\end{proposition}
\begin{proof}
Write $\Norm=\Norm_{K/\Q}$.  If $a$ is a unit, then $a^{-1}$ is also a
unit, and $1=\Norm(a)\Norm(a^{-1})$.  Since both $\Norm(a)$ and
$\Norm(a^{-1})$ are integers, it follows that $\Norm(a)=\pm 1$.
Conversely, if $a\in \O_K$ and $\Norm(a)=\pm 1$, then the equation
$aa^{-1}=1=\pm \Norm(a)$ implies that $a^{-1} = \pm \Norm(a)/a$.  But
$\Norm(a)$ is the product of the images of $a$ in $\C$ by all
embeddings of $K$ into $\C$, so $\Norm(a)/a$ is also a product of
images of~$a$ in $\C$, hence a product of algebraic integers,
hence an algebraic integer.  Thus $a^{-1}\in\O_K$, which proves
that~$a$ is a unit.
\end{proof}

Let $r$ be the number of real and $s$ the number of complex conjugate
embeddings of $K$ into $\C$, so $n=[K:\Q]=r+2s$.
Define a map 
$$
\vphi:U_K \to \R^{r+s}
$$
by 
$$
 \vphi(a) = (\log|\sigma_1(a)|,\ldots, \log|\sigma_{r+s}(a)|).
$$

\begin{lemma}\ilem{hyperplane embedding}
The image of $\vphi$ lies in the hyperplane 
\begin{equation}\label{eqn:hyperplane}
H = \{(x_1,\ldots, x_{r+s})\in\R^{r+s} : 
  x_1+ \cdots + x_r + 2x_{r+1} + \cdots + 2x_{r+s} = 0\}.
\end{equation}
\end{lemma}
\begin{proof}
If $a\in U_K$, then 
by Proposition~\ref{prop:unitnorm}, 
$$\left(\prod_{i=1}^{r} |\sigma_i(a)|\right) 
  \cdot \left( \prod_{i=r+1}^s |\sigma_i(a)|^2 \right) = 1.$$
Taking logs of both sides proves the lemma.
\end{proof}

\begin{lemma}\label{lem:vphifinitekernel}
The kernel of $\vphi$ is finite.
\end{lemma}
\begin{proof}
We have
\begin{align*}
  \Ker(\vphi) &\subset \{a\in\O_K : |\sigma_i(a)| = 1 \text{ for all }i=1,\ldots,r+2s\}\\
              &\subset \sigma(\O_K) \cap X,
\end{align*}
where $X$ is the bounded subset of $\R^{r+2s}$ of elements all of whose coordinates
have absolute value at most $1$.  Since $\sigma(\O_K)$ is a lattice 
(see Proposition~\ref{prop:ok_lattice}), 
the intersection $\sigma(\O_K)\cap X$ is finite, so $\Ker(\vphi)$ is finite.
\end{proof}

\begin{lemma}
The kernel of $\vphi$ is a finite cyclic group.
\end{lemma}
\begin{proof}
It is a general fact that any finite subgroup of the multiplicative
group of a field is cyclic.  [Homework.]
\end{proof}

To prove Theorem~\ref{thm:units}, it suffices to proove that
$\Im(\vphi)$ is a lattice in the hyperplane~$H$ from
(\ref{eqn:hyperplane}), which we view as a vector space of dimension
$r+s-1$.

Define an embedding
\begin{equation}\label{eqn:sigma3}
 \sigma : K\hra \R^n
\end{equation}
given by $\sigma(x) = (\sigma_1(x),\ldots,\sigma_{r+s}(x))$,
where we view $\C\isom \R\times \R$ via $a+b i\mapsto (a,b)$.
Note that this is exactly the same as the embedding
\begin{align*}
 x\mapsto \big(&\sigma_1(x), \sigma_2(x),\ldots, \sigma_r(x),\\
     &\quad \Re(\sigma_{r+1}(x)), \ldots, \Re(\sigma_{r+s}(x)), 
      \Im(\sigma_{r+1}(x)), \ldots, \Im(\sigma_{r+s}(x))\big),
\end{align*}
from before, except that we have re-ordered the last~$s$ imaginary
components to be next to their corresponding real parts.


\begin{lemma}
The image of $\vphi$ is discrete in $\R^{r+s}$.
\end{lemma}
\begin{proof}
Suppose $X$ is any bounded subset of $\R^{r+s}$.  Then for any $u\in
Y=\vphi^{-1}(X)$ the coordinates of $\sigma(u)$ are bounded in terms
of $X$ (since $\log$ is an increasing function).  Thus $\sigma(Y)$ is
a bounded subset of $\R^n$.  Since $\sigma(Y)\subset \sigma(\O_K)$,
and $\sigma(\O_K)$ is a lattice in $\R^n$, it follows that $\sigma(Y)$
is finite.  Since $\sigma$ is injective, $Y$ is finite, and $\vphi$
has finite kernel, so $\vphi(U_K)\cap X$ is finite, which implies that
$\vphi(U_K)$ is discrete.
\end{proof}

To finish the proof of Theorem~\ref{thm:units}, we will show that the
image of~$\vphi$ spans~$H$.  Let~$W$ be the $\R$-span of the image
$\vphi(U_K)$, and note that~$W$ is a subspace of~$H$.  We will show
that $W=H$ indirectly by showing that if $v\not \in H^{\perp}$,
where~$\perp$ is with respect to the dot product on $\R^{r+s}$, then
$v\not \in W^{\perp}$.  This will show that $W^{\perp}\subset
H^{\perp}$, hence that $H\subset W$, as required.

Thus suppose $z=(z_1,\ldots,z_{r+s})\not\in H^{\perp}$.  
Define a function $f:K^*\to \R$ by 
\begin{equation}\label{eqn:f}
  f(x) = z_1\log|\sigma_1(x)| + \cdots z_{r+s}\log|\sigma_{r+s}(x)|.
\end{equation}
To show that $z\not\in W^{\perp}$ we show that there exists some $u\in
U_K$ with $f(u)\neq 0$.

Let 
$$
  A=\sqrt{|d_K|} \cdot \left( \frac{2}{\pi}\right)^s \in \R_{>0}.
$$
Choose any positive real numbers $c_1,\ldots, c_{r+s} \in \R_{>0}$
such that
$$
  c_1\cdots c_r\cdot (c_{r+1}\cdots c_{r+s})^2 = A.
$$
Let 
\begin{align*}
  S &= \{(x_1,\ldots,x_n) \in \R^n : \\
    &\qquad\qquad |x_i|\leq c_i\text{ for } 1\leq i \leq r,\\
    &\qquad\qquad |x_i^2 + x_{i+s}^2| \leq c_i^2 \text{ for } r<i\leq r+s\} \subset \R^n.
\end{align*}
Then~$S$ is closed, bounded, convex, symmetric with respect to the
origin, and of dimension $r+2s$, since $S$ is a product of~$r$ intervals
and~$s$ discs, each of which has these properties.
Viewing $S$ as a product of intervals and discs, we see that the volume of $S$ is
$$
  \Vol(S) = \prod_{i=1}^r (2c_i) \cdot \prod_{i=1}^s (\pi c_i^2) 
          = 2^r\cdot \pi^s \cdot A.
$$

Recall \defn{Blichfeldt's lemma} that if~$L$ is a lattice and~$S$ is closed,
bounded, etc., and has volume at least $2^n\cdot \Vol(V/L)$, then
$S\cap L$ contains a nonzero element.   To apply this lemma, we
take $L=\sigma(\O_K)\subset \R^n$, where $\sigma$ is as in (\ref{eqn:sigma3}).
We showed, when proving finiteness of the class group, that 
$\Vol(\R^n/L) = 2^{-s}\sqrt{|d_K|}$.  To check the hypothesis
to Blichfeld's lemma, note that 
$$
 \Vol(S) = 2^{r+s} \sqrt{|d_K|} = 2^n 2^{-s} \sqrt{|d_K|} = 2^n \Vol(\R^n/L).
$$
Thus there exists a nonzero element $a\in S\cap \sigma(\O_K)$, i.e., a nonzero
$a\in \O_K$ such that $|\sigma_i(a)|\leq c_i$ for $1\leq i\leq r+s$.
We then have
\begin{align*}
  |\Norm_{K/\Q}(a)| &=
   \left|\prod_{i=1}^{r+2s} \sigma_i(a)\right|\\
   &=  \prod_{i=1}^r |\sigma_i(a)|\cdot \prod_{i=r+1}^s|\sigma_i(a)|^2\\
   &\leq c_1\cdots c_r\cdot (c_{r+1}\cdots c_{r+s})^2 = A.
\end{align*}
Since $a\in \O_K$ is nonzero, we also have
$$
 |\Norm_{K/\Q}(a)|\geq 1.
$$
Moreover, if for any $i\leq r$, we have $|\sigma_i(a)|< \frac{c_i}{A}$, then 
$$
 1\leq |\Norm_{K/\Q}(a)| < c_1\cdots \frac{c_i}{A}\cdots c_r \cdot (c_{r+1}\cdots c_{r+s})^2 = \frac{A}{A} = 1,
$$
a contradiction, so $|\sigma_i(a)|\geq \frac{c_i}{A}$ for $i=1,\ldots, r$. Likewise,
$|\sigma_i(a)|^2 \geq \frac{c_i^2}{A}$, for $i=r+1,\ldots, r+s$. 
Rewriting this 
we have 
$$
  \frac{c_i}{|\sigma_i(a)|}\leq A\quad\text{ for }i\leq r\quad\text{ and }\quad
\left(\frac{c_i}{|\sigma_i(a)|}\right)^2\leq A\quad\text{ for } i=r+1,\ldots, r+s.
$$

Our strategy is to use an appropriately chosen~$a$ to construct a unit
$u\in U_K$ such $f(u)\neq 0$.  First, let $b_1,\ldots, b_m$ be
representative generators for the finitely many nonzero principal
ideals of $\O_K$ of norm at most $A$.  Since $|\Norm_{K/\Q}(a)|\leq A$,
we have $(a)=(b_j)$, for some $j$, so there is a unit~$u\in \O_K$ such
that $a=u b_j$.

Let $$s=s(c_1,\ldots, c_{r+s}) = z_1\log(c_1)+\cdots
+z_{r+s}\log(c_{r+s}),$$ and recall $f:K^*\to \R$ defined in
(\ref{eqn:f}) above.  We first show that
\begin{equation}\label{eqn:diff}
  |f(u) - s| \leq B = |f(b_j)| + \log(A)\cdot\left(\sum_{i=1}^{r}|z_i| + \frac{1}{2}\cdot \sum_{i=r+1}^s|z_i|\right).
\end{equation}
We have
\begin{align*}
  |f(u) - s| &= |f(a) - f(b_j) - s|\\
   &\leq |f(b_j)| + |s - f(a)|\\
   &=|f(b_j)| + |z_1(\log(c_1) - \log(|\sigma_1(a)|)) + \cdots + z_{r+s}(\log(c_{r+s}) - \log(|\sigma_{r+s}(a)|))|\\
   &=|f(b_j)| + |z_1\cdot \log(c_1/|\sigma_1(a)|) + \cdots + \frac{z_{r+s}}{2}\cdot \log((c_{r+s}/|\sigma_{r+s}(a)|)^2)|\\
   &\leq |f(b_j)| + \log(A)\cdot\left(\sum_{i=1}^{r}|z_i| + \frac{1}{2}\cdot \sum_{i=r+1}^s|z_i|\right).
\end{align*}

The amazing thing about (\ref{eqn:diff}) is that the bound $B$ on the right
hand side does not depend on the $c_i$.  
Suppose we can choose positive real numbers $c_i$ such that 
$$c_1\cdots c_r\cdot (c_{r+1}\cdots c_{r+s})^2 = A$$ and
$s=s(c_1,\ldots, c_{r+s})$ is such that $|s|>B$.  Then $|f(u)-s|\leq
B$ would imply that $|f(u)|>0$, which is exactly what we aimed to
prove.  It is possible to choose such~$c_i$, by proceeding as follows.
If $r+s=1$, then we are trying to prove that $\vphi(U_K)$ is a lattice
in $\R^0=\R^{r+s-1}$, which is automatically true, so assume $r+s>1$.
Then there are at least two distinct $c_i$.  Let $j$ be such that
$z_j\neq 0$ (which exists since $z\neq 0$).  Then $|z_j\log(c_j)|\to
\infty$ as $c_j\to\infty$, so we choose $c_j$ very large and the other
$c_i$, for $i\neq j$, in any way we want subject to the condition
$$
  \prod_{i=1, i\neq j}^r c_i\cdot \prod_{i=r+1}^s c_i^2 = \frac{A}{c_j}.
$$ Since it is possible to choose the $c_i$ as needed, it is possible
to find a unit~$u$ such that $f(u)>0$.  We conclude that $z\not\in
W^{\perp}$, so $W^{\perp}\subset Z^{\perp}$, whence $Z\subset W$,
which finishes the proof Theorem~\ref{thm:units}.

\section{Finishing the proof of Dirichlet's Unit Theorem}
We begin by finishing Dirichlet's proof that the group of units $U_K$ of
$\O_K$ is isomorphic to $\Z^{r+s-1}\oplus \Z/m\Z$, where~$r$ is the
number of real embeddings,~$s$ is half the number of complex
embeddings, and~$m$ is the number of roots of unity in $K$.
Recall that we defined a map $\vphi:U_K\to \R^{r+s}$ by
\[
 \vphi(x) =  (\log|\sigma_1(x)|,\ldots, \log|\sigma_{r+s}(x)|).
\]
Without much trouble, we proved that the kernel of $\vphi$ if finite
and the image $\vphi$ is discrete, and in the last section we
were finishing the proof that the image of $\vphi$ spans the subspace
$H$ of elements of $\R^{r+s}$ that are orthogonal to $v=(1,\ldots, 1,
2, \ldots, 2)$, where $r$ of the entries are $1$'s and $s$ of them
are $2$'s.  The somewhat
indirect route we followed was to suppose
\[
  z\not\in H^{\perp} = \Span(v),
\]
i.e., that $z$ is not a multiple of $v$, and prove that $z$ is not
orthogonal to some element of $\vphi(U_K)$.  Writing
$W=\Span(\vphi(U_K))$, this would show that $W^{\perp} \subset
H^{\perp}$, so $H\subset W$.  We ran into two problems: (1) we ran out
of time, and (2) the notes contained an incomplete argument that a
quantity $s=s(c_1,\ldots, c_{r+s})$ can be chosen to be arbitrarily
large.   We will finish going through a complete proof, then
compute many examples of unit groups using \magma{}.

Recall that $f: K^* \to \R$
was defined by 
\[
 f(x) = z_1\log|\sigma_1(x)| + \cdots + z_{r+s}\log|\sigma_{r+s}(x)|
      = z\bullet \vphi(x)\qquad\text{(dot product)},
\]
and our goal is to show that there is a $u\in U_K$ such that $f(u)\neq
0$.

Our strategy is to use an appropriately chosen~$a$ to construct a unit
$u\in U_K$ such $f(u)\neq 0$.  
Recall that we used Blichfeld's lemma to find an $a\in \O_K$
such that 
$1\leq |\Norm_{K/\Q}(a)|\leq A$, 
and
\begin{equation}\label{eqn:bounds}
  \frac{c_i}{|\sigma_i(a)|}\leq A\quad\text{ for }i\leq r\quad\text{ and }\quad
\left(\frac{c_i}{|\sigma_i(a)|}\right)^2\leq A\quad\text{ for } i=r+1,\ldots, r+s.
\end{equation}


Let $b_1,\ldots, b_m$ be
representative generators for the finitely many nonzero principal
ideals of $\O_K$ of norm at most $A=A_K=\sqrt{|d_K|} \cdot \left(
\frac{2}{\pi}\right)^s$.  Modify the $b_i$ to have the property
that $|f(b_i)|$ is minimal among generators of $(b_i)$ (this is possible
because ideals are discrete).  Note that the set
$\{|f(b_i)| : i = 1,\ldots, m\}$ depends only on $A$.  
Since $|\Norm_{K/\Q}(a)|\leq A$, we have $(a)=(b_j)$, for some $j$, so there
is a unit~$u\in \O_K$ such that $a=u b_j$.




Let $$s=s(c_1,\ldots, c_{r+s}) = z_1\log(c_1)+\cdots
+z_{r+s}\log(c_{r+s})\in \R.$$  
\begin{lemma}\label{lem:diff}
We have
\[
  |f(u) - s| \leq B = \max_i(|f(b_i)|) + \log(A)\cdot\left(\sum_{i=1}^{r}|z_i| + \frac{1}{2}\cdot \sum_{i=r+1}^s|z_i|\right),
\]
and $B$ depends only on $K$ and our fixed choice of $z\in H^{\perp}$.
\end{lemma}
\begin{proof}
By properties of logarithms, $f(u)=f(a/b_j)=f(a)-f(b_j)$.  We next
use the triangle inequality $|a+b|\leq |a|+|b|$ in various ways,
properties of logarithms, and the bounds (\ref{eqn:bounds})
in the following computation:
\begin{align*}
  |f(u) - s| &= |f(a) - f(b_j) - s|\\
   &\leq |f(b_j)| + |s - f(a)|\\
   &=|f(b_j)| + |z_1(\log(c_1) - \log(|\sigma_1(a)|)) + \cdots + z_{r+s}(\log(c_{r+s}) - \log(|\sigma_{r+s}(a)|))|\\
   &=|f(b_j)| + |z_1\cdot \log(c_1/|\sigma_1(a)|) + \cdots + \frac{1}{2}\cdot z_{r+s} \log((c_{r+s}/|\sigma_{r+s}(a)|)^2)|\\
   &\leq |f(b_j)| + \log(A)\cdot\left(\sum_{i=1}^{r}|z_i| + \frac{1}{2}\cdot \sum_{i=r+1}^s|z_i|\right).
\end{align*}
The inequality of the lemma now follows.
That $B$ only depends on $K$ and our choice of $z$ follows from the
formula for $A$ and how we chose the $b_i$.
\end{proof}

The amazing thing about Lemma~\ref{lem:diff} is that the bound $B$ on
the right hand side does not depend on the $c_i$.  Suppose we could
somehow cleverly choose the positive real numbers $c_i$ in such a way
that
\[
c_1\cdots c_r\cdot (c_{r+1}\cdots c_{r+s})^2 = A\qquad\text{and}\qquad
|s(c_1,\ldots, c_{r+s})|>B.
\]
Then the facts that $|f(u)-s|\leq B$ and $|s|>B$ would together imply
that $|f(u)|>0$ (since $f(u)$ is closer to $s$ than $s$ is to $0$),
which is exactly what we aimed to prove.  We finish the proof by
showing that it is possible to choose such $c_i$.  Note that if we
change the $c_i$, then~$a$ could change, hence the $j$ such that
$a/b_j$ is a unit could change, but the $b_j$ don't change, just the
subscript $j$.  Also note that if $r+s=1$, then we are trying to prove
that $\vphi(U_K)$ is a lattice in $\R^0=\R^{r+s-1}$, which is
automatically true, so we may assume that $r+s>1$.

\begin{lemma}
Assume $r+s>1$.  Then
there is a choice of $c_1,\ldots, c_{r+s}\in\R_{>0}$ such that 
$$|z_1\log(c_1)+\cdots +z_{r+s}\log(c_{r+s})| > B.$$  
\end{lemma}
\begin{proof}
It is easier if we write 
\begin{align*}
z_1\log(c_1)&+\cdots +z_{r+s}\log(c_{r+s})
 =\\ 
&z_1\log(c_1)+\cdots +  z_r\log(c_r)+
\frac{1}{2}\cdot z_{r+1}\log(c_{r+1}^2) + 
\cdots + \frac{1}{2}\cdot z_{r+s}\log(c_{r+s}^2)\\
&=w_1\log(d_1)+\cdots +  w_r\log(d_r)+
w_{r+1}\log(d_{r+1}) + 
\cdots +\cdot w_{r+s}\log(d_{r+s}),
\end{align*}
where $w_i=z_i$ and $d_i=c_i$ for $i\leq r$, and
$w_i=\frac{1}{2}z_i$ and $d_i=c_i^2$ for $r<i\leq s$,

The condition that $z\not\in H^{\perp}$ is that the $w_i$ are not all
the same, and in our new coordinates the lemma is equivalent to
showing that $|\sum_{i=1}^{r+s} w_i \log(d_i)|>B$, subject to the
condition that $\prod_{i=1}^{r+s} d_i = A$.  Order the $w_i$ so
that $w_1\neq 0$.  By hypothesis there exists a $w_j$ such that
$w_j\neq w_1$, and again re-ordering we may assume that $j=2$.  Set
$d_3=\cdots=d_{r+s}=1$.  Then $d_1 d_2 = A$ and $\log(1)=0$, so
\begin{align*}
  \left|\sum_{i=1}^{r+s} w_i \log(d_i)\right|
  &= |w_1\log(d_1) + w_2\log(d_2)|\\
  &= |w_1 \log(d_1) + w_2\log(A/d_1)| \\
  &= |(w_1-w_2)\log(d_1) + w_2\log(A)|
\end{align*}
Since $w_1\neq w_2$,  we have $|(w_1-w_2)\log(d_1) + w_2\log(A)|\to\infty$
as $d_1\to \infty$.
\end{proof}



\section{Some Examples of Units in Number Fields}
The classical Pell's equation is, given square-free $d>0$, to find all
positive integer solutions $(x,y)$ to the equation $x^2-dy^2 = 1$.
Note that if $x+y\sqrt{d}\in\Q(\sqrt{d})$, then
$$\Norm(x+y\sqrt{d}) = (x+y\sqrt{d})(x-y\sqrt{d}) = x^2 -dy^2.$$ The
solutions to Pell's equation thus form a finite-index subgroup of the
group of units in the ring of integers of $\Q(\sqrt{d})$.  Dirichlet's
unit theorem implies that for any~$d$ the solutions to Pell's equation
form an infinite cyclic group, a fact that takes substantial work to
prove using only elementary number theory (for example, using
continued fractions).

We first solve the Pell equation 
$x^2 - 5y^2 = 1$ by finding the units of a field using \magma{}
(we will likely discuss algorithms for computing unit groups
later in the course...).  
\begin{verbatim}
> R<x> := PolynomialRing(RationalField());
> K<a> := NumberField(x^2-5);
> G, phi := UnitGroup(K);
> G;
Abelian Group isomorphic to Z/2 + Z
Defined on 2 generators
Relations:
    2*G.1 = 0
> K!phi(G.1);
-1
> u := K!phi(G.2); u;
1/2*(a + 1)
> u^2;
1/2*(a + 3)
> u^3;
a + 2
> Norm(u);
-1
> Norm(u^3);
-1
> Norm(u^6);
1
> fund := u^6;
> fund;
4*a + 9
> 9^2 - 5*4^2;
1
> fund^2;
72*a + 161
> fund^3;
1292*a + 2889
> fund^4;
23184*a + 51841
> fund^5;
416020*a + 930249
\end{verbatim}

I think in practice for solving Pell's equation it's best to use the
ideas in the paper \cite{lenstra:pell}.  A review of this paper says:
``This wonderful article begins with history and some elementary facts
and proceeds to greater and greater depth about the existence of
solutions to Pell equations and then later the algorithmic issues of
finding those solutions. The cattle problem is discussed, as are
modern smooth number methods for solving Pell equations and the
algorithmic issues of representing very large solutions in a
reasonable way.''  You can get the paper freely online from the
Notices web page.

The simplest solutions to Pell's equation can be huge, even when~$d$
is quite small.  Read Lenstra's paper for some awesome examples from
antiquity.
\begin{verbatim}
K<a> := NumberField(x^2-NextPrime(10^7));
> G, phi := UnitGroup(K);
> K!phi(G.2);
    1635802598803463282255922381210946254991426776931429155067472530\
    003400641003657678728904388162492712664239981750303094365756\
    106316392723776016806037958837914778176119741840754457028237\
    899759459100428895693238165048098039*a + 
    517286692885814967470170672368346798303629034373575202975075\
    605058714958080893991274427903448098643836512878351227856269\
    086856679078304979321047765031073345259902622712059164969008\
    6336036036403311756634562204182936222240930
\end{verbatim}


The \magma{} {\tt Signature} command returns the
number of real and complex conjugate embeddings
of $K$ into $\C$.  The command {\tt UnitGroup},
which we used above, returns the unit group $U_K$
as an abstract abelian group and a homomorphism $U_K\to \O_K$.
Note that we have to bang (!) into $K$ to get the units as elements
of $K$.

First we consider $K=\Q(i)$.
\begin{verbatim}
> R<x> := PolynomialRing(RationalField());
> K<a> := NumberField(x^2+1);
> Signature(K);
0 1    // r=0, s=1
> G,phi := UnitGroup(K);
> G;
Abelian Group isomorphic to Z/4
Defined on 1 generator
Relations:
    4*G.1 = 0
> K!phi(G.1);
-a
\end{verbatim}

Next we consider $K=\Q(\sqrt[3]{2})$.
\begin{verbatim}
> K<a> := NumberField(x^3-2);
> Signature(K);
1 1
> G,phi := UnitGroup(K);
> G;
Abelian Group isomorphic to Z/2 + Z
Defined on 2 generators
Relations:
    2*G.1 = 0
> K!phi(G.2);
-a + 1
\end{verbatim}
The {\tt Conjugates} command returns the sequence $(\sigma_1(x),\ldots,\sigma_{r+2s}(x))$ of all embeddings of $x\in K$ into $\C$.  The
{\tt Logs} command returns the sequence
$$(\log(|\sigma_1(x)|),\ldots, \log(|\sigma_{r+s}(x)|)).$$
Continuing the above example, we have
\begin{verbatim}
> Conjugates(K!phi(G.2));
[ -0.25992104989487316476721060727822835057025146470099999999995,
1.6299605249474365823836053036391141752851257323513843923104 - 
1.09112363597172140356007261418980888132587333874018547370560*i, 
1.6299605249474365823836053036391141752851257323513843923104 + 
1.09112363597172140356007261418980888132587333874018547370560*i ]
> Logs(K!phi(G.2));   // image of infinite order unit -- generates a lattice
[ -1.34737734832938410091818789144565304628306227332099999999989\
, 0.6736886741646920504590939457228265231415311366603288999999 ]
> Logs(K!phi(G.1));   // image of -1
[ 0.E-57, 0.E-57 ]
\end{verbatim}

Let's try a field such that $r+s-1=2$.  First, one with $r=0$ and $s=3$:
\begin{verbatim}
> K<a> := NumberField(x^6+x+1);
> Signature(K);
0 3
> G, phi := UnitGroup(K);
> G;
Abelian Group isomorphic to Z/2 + Z + Z
Defined on 3 generators
Relations:
    2*G.1 = 0
> u1 := K!phi(G.2); u1;
a
> u2 := K!phi(G.3); u2;
-2*a^5 - a^3 + a^2 + a
> Logs(u1);
[ 0.11877157353322375762475480482285510811783185904379239999998, 
0.048643909752673399635150940533329986148342128393119899999997, 
-0.16741548328589715725990574535618509426617398743691229999999 ]
> Logs(u2);
[ 1.6502294567845884711894772749682228152154948421589999999997, 
-2.09638539134527779532491660083370951943382108902299999999997, 
0.44615593456068932413543932586548670421832624686433469999994 ]
\end{verbatim}
Notice that the log image of $u_1$ is clearly not a real multiple of
the log image of $u_2$ (e.g., the scalar would have to be positive
because of the first coefficient, but negative because of the second).
This illustrates the fact that the log images of $u_1$ and $u_2$ span
a two-dimensional space.

Next we compute a field with $r=3$ and $s=0$.  (A field with $s=0$
is called ``totally real''.)
\begin{verbatim}
> K<a> := NumberField(x^3 + x^2 - 5*x - 1);
> Signature(K);
3 0
> G, phi := UnitGroup(K);
> G;
Abelian Group isomorphic to Z/2 + Z + Z
Defined on 3 generators
Relations:
    2*G.1 = 0
> u1 := K!phi(G.2); u1;
1/2*(a^2 + 2*a - 1)
> u2 := K!phi(G.3); u2;
a
> Logs(u1);
[ 1.16761574692758757159598251863681302946987760474899999999995, 
-0.39284872458139826129179862583435951875841422643044369999996, 
-0.7747670223461893103041838928024535107114633783181766999998 ]
> Logs(u2);
[ 0.6435429462288618773851817227686467257757954024463081999999, 
-1.6402241503223171469101505551700850575583464226669999999999, 
0.9966812040934552695249688324014383317825510202205498999998 ]
\end{verbatim}

A family of fields with $r=0$ (totally complex) is the \defn{cyclotomic
fields} $\Q(\zeta_n)$.  The degree of $\Q(\zeta_n)$ over $\Q$ is
$\vphi(n)$ and $r=0$, so $s=\vphi(n)/2$ (assuming $n>2$).

\begin{verbatim}
> K := CyclotomicField(11); K;
Cyclotomic Field of order 11 and degree 10
> G, phi := UnitGroup(K);
> G;
Abelian Group isomorphic to Z/22 + Z + Z + Z + Z
Defined on 5 generators
Relations:
    22*G.1 = 0
> u := K!phi(G.2); u;
zeta_11^9 + zeta_11^8 + zeta_11^7 + zeta_11^6 + zeta_11^5 + 
    zeta_11^3 + zeta_11^2 + zeta_11 + 1
> Logs(u);
[ -1.25656632417872848745322215929976803991663080388899999999969,
0.6517968940331400079717923884685099182823284402303273999999, 
-0.18533004655986214094922163920197221556431542171819269999999, 
0.5202849820300749393306985734118507551388955065272236999998, 
0.26981449467537568109995283662137958205972227885009159999993 ]
> K!phi(G.3);
zeta_11^9 + zeta_11^7 + zeta_11^6 + zeta_11^5 + zeta_11^4 + 
    zeta_11^3 + zeta_11^2 + zeta_11 + 1
> K!phi(G.4);
zeta_11^9 + zeta_11^8 + zeta_11^7 + zeta_11^6 + zeta_11^5 + 
    zeta_11^4 + zeta_11^3 + zeta_11^2 + zeta_11
> K!phi(G.5);
zeta_11^9 + zeta_11^8 + zeta_11^7 + zeta_11^6 + zeta_11^5 + 
    zeta_11^4 + zeta_11^2 + zeta_11 + 1
\end{verbatim}

How far can we go computing unit groups of cyclotomic fields
directly with \magma{}?
\begin{verbatim}
> time G,phi := UnitGroup(CyclotomicField(13));
Time: 2.210
> time G,phi := UnitGroup(CyclotomicField(17));
Time: 8.600
> time G,phi := UnitGroup(CyclotomicField(23));
.... I waited over 10 minutes (usage of 300MB RAM) and gave up.
\end{verbatim}

\section{Preview}
In the next chapter we will study extra structure in the case when~$K$
is Galois over~$\Q$; the results are nicely algebraic, beautiful, and
have interesting ramifications.  We'll learn about Frobenius elements,
the Artin symbol, decomposition groups, and how the Galois group of
$K$ is related to Galois groups of residue class fields.  These are
the basic structures needed to make any sense of representations of
Galois groups, which is at the heart of much of number theory.

\chapter{Decomposition and Inertia Groups}
\section{Galois Extensions}
Suppose $K\subset \C$ is a number field.  Then $K$ is \defn{Galois} if
every field homomorphism $K\to \C$ has image $K$, or equivalently,
$\#\Aut(K) = [K:\Q]$.  More generally, we have the following
definition.
\begin{definition}[Galois]
  An extension $K/L$ of number fields is \defn{Galois} if $\#\Aut(K/L)
  = [K:L]$, where $\Aut(K/L)$ is the group of automorphisms of $K$
  that fix $L$.  We write $\Gal(K/L) = \Aut(K/L)$.
\end{definition}
For example, $\Q$ is Galois (over itself), any quadratic extension
$K/L$ is Galois, since it is of the form $L(\sqrt{a})$, for some $a\in
L$, and the nontrivial embedding is induced by $\sqrt{a}\mapsto
-\sqrt{a}$, so there is always one nontrivial automorphism.  If $f\in
L[x]$ is an irreducible cubic polynomial, and $a$ is a root of $f$,
then one proves in a course in Galois theory that $L(a)$ is Galois
over $L$ if and only if the discriminant of~$f$ is a perfect square
in~$L$.  Random number fields of degree bigger than $2$ are rarely
Galois (I will not justify this claim further in this course). 

If $K/\Q$ is a number field, then the Galois closure $K^{\gc}$ of $K$
is the field generated by all images of $K$ under all embeddings in
$\C$ (more generally, if $K/L$ is an extension, the Galois closure of
$K$ over $L$ is the field generated by images of embeddings $K\to \C$
that are the identity map on $L$).  If $K=\Q(a)$, then $K^{\gc}$ is
generated by each of the conjugates of $a$, and is hence Galois
over~$\Q$, since the image under an embedding of any polynomial in the
conjugates of~$a$ is again a polynomial in conjugates of $a$.


How much bigger can the degree of $K^{\gc}$ be as compared to the
degree of $K=\Q(a)$? There is a natural embedding of
$\Gal(K^{\gc}/\Q)$ into the group of permutations of the conjugates of
$a$.  If there are $n$ conjugates of $a$, then this is an embedding
$\Gal(K^{\gc}/\Q)\hra S_n$, where $S_n$ is the symmetric group on $n$
symbols, which has order $n!$.  Thus the degree of the $K^{\gc}$ over
$\Q$ is a divisor of $n!$. Also the Galois group is a transitive
subgroup of $S_n$, which constrains the possibilities further.  When
$n=2$, we recover the fact that quadratic extensions are Galois.  When
$n=3$, we see that the Galois closure of a cubic extension is either
the cubic extension or a quadratic extension of the cubic extension.
It turns out that that Galois closure of a cubic extension is obtained
by adjoining the square root of the discriminant.  For an extension
$K$ of degree $5$, it is ``frequently'' the case that the Galois
closure has degree $120$, and in fact it is a difficult and
interesting problem to find examples of degree $5$ extension in which
the Galois closure has degree smaller than $120$ (according to \magma{}:
the only possibilities for the order of a transitive proper subgroup
of $S_5$ are $5$, $10$, $20$, and $60$; there are five transitive subgroups
of $S_5$ out of the total of $19$ subgroups of $S_5$).

Let $n$ be a positive integer.  Consider the field $K=\Q(\zeta_n)$,
where $\zeta_n=e^{2\pi i/n}$ is a primitive $n$th root of unity.  If
$\sigma:K\to \C$ is an embedding, then $\sigma(\zeta_n)$ is also an
$n$th root of unity, and the group of $n$th roots of unity is cyclic,
so $\sigma(\zeta_n) = \zeta_n^m$ for some $m$ which is invertible
modulo $n$.  Thus $K$ is Galois and $\Gal(K/\Q)\hra (\Z/n\Z)^*$.
However, $[K:\Q]=n$, so this map is an isomorphism.  (Side note:
Taking a $p$-adic limit and using the maps $\Gal(\Qbar/\Q)\to
\Gal(\Q(\zeta_{p^r})/\Q)$, we obtain a homomorphism $\Gal(\Qbar/\Q)\to
\Z_p^*$, which is called the $p$-adic cyclotomic character.)

Compositums of Galois extensions are Galois.  For example, the
biquadratic field $K=\Q(\sqrt{5},\sqrt{-1})$ is a Galois
extension of $\Q$ of degree~$4$.

Fix a number field $K$ that is Galois over a subfield
$L$. Then the Galois group $G=\Gal(K/L)$ acts on many
of the object that we have associated to $K$, including:
\begin{itemize}
\item the integers $\O_K$,
\item the units $U_K$,
\item the group of nonzero fractional ideals of $\O_K$,
\item the class group $\Cl(K)$, and
\item the set $S_\p$ of prime ideals $\P$ lying over a given prime
$\p$ of $\O_L$.
\end{itemize}
In the next section we will be concerned with the action of $\Gal(K/L)$
on $S_\p$, though actions on each of the other objects, especially
$\Cl(K)$, will be of further interest.  

\section{Decomposition of Primes}
Fix a prime $\p\subset \O_K$ and write $\p\O_K = \P_1^{e_1}\cdots 
\P_g^{e_g}$, so $S_\p=\{\P_1,\ldots, \P_g\}$.
\begin{definition}[Residue class degree]
Suppose $\P$ is a prime of $\O_K$ lying over $\p$. 
Then the \defn{residue class degree} of $\P$ is 
$$
   f_{\P/\p} = [\O_K/\P : \O_L/\p],$$
i.e., the degree of the extension of residue class fields.
\end{definition}
If $M/K/L$ is a tower of field extensions and
$\q$ is a prime of $M$ over $\P$, then 
$$f_{\q/\p} = [\O_M/\q : \O_L/\p]
=[\O_M/\q : \O_K/\P]\cdot [\O_K/\P : \O_L/\p] = 
f_{\q/\P}\cdot f_{\P/\p},$$
so the residue class degree is multiplicative in
towers. 

Note that if $\sigma\in\Gal(K/L)$ and $\P\in S_p$, then $\sigma$
induces an isomorphism of finite fields $\O_K/\P\to \O_K/\sigma(\P)$
that fixes the common subfield $\O_L/\p$.  Thus the residue class
degrees of $\P$ and $\sigma(\P)$ are the same.  In fact, much more is
true.
\begin{theorem}\label{thm:transitive}\ithm{transitive Galois action}
Suppose $K/L$ is a Galois extension of number fields,
and let $\p$ be a prime of $\O_L$.  Write 
$\p\O_K=\prod_{i=1}^g \P_i^{e_i}$, and let $f_i = f_{\P_i/\p}$.
Then 
$G=\Gal(K/L)$ acts transitively on the set
$S_\p$ of primes $\P_i$, 
$$ 
  e_1=\cdots =e_g, \qquad f_1 =\cdots = f_g,
$$
and $efg=[K:L]$, where $e$ is the common value of the $e_i$
and $f$ is the common value of the $f_i$.
\end{theorem}
\begin{proof}
For simplicity, we will give the proof only in the case $L=\Q$, but
the proof works in general.  Suppose $p\in\Z$ and
$p\O_K=\p_1^{e_1}\cdots \p_g^{e_g}$, and $S=\{\p_1,\ldots, \p_g\}$.  We
will first prove that $G$ acts transitively on $S$.  Let $\p=\p_i$ for
some~$i$.   Recall that we proved long ago, using the Chinese
Remainder Theorem (Theorem~\ref{thm:crt}) that there exists
$a\in\p$ such that $(a)/\p$ is an integral ideal that is
coprime to $p\O_K$.   The product
\begin{equation}\label{eqn:prodquo}
 I= \prod_{\sigma\in G} \sigma((a)/\p) 
   = \prod_{\sigma\in G} \frac{(\sigma(a))\O_K}{\sigma(\p)}
    = \frac{(\Norm_{K/\Q}(a))\O_K}{\displaystyle \prod_{\sigma\in G} \sigma(\p)}
\end{equation}
is a nonzero integral $\O_K$ ideal since it is a product of nonzero
integral $\O_K$ ideals.   
Since $a\in \p$ we have that
$\Norm_{K/\Q}(a) \in \p\cap\Z=p\Z$.  Thus the numerator of 
the rightmost expression in (\ref{eqn:prodquo}) is
divisible by $p\O_K$.   Also, because $(a)/\p$ is coprime
to $p\O_K$, each $\sigma((a)/\p)$ is coprime to $p\O_K$
as well.   Thus $I$ is coprime to $p\O_K$.   Thus the
denominator of the rightmost expression in (\ref{eqn:prodquo})
must also be divisibly by $p\O_K$ in order to cancel the $p\O_K$
in the numerator.  Thus for any $i$ we have
$$
  \prod_{j=1}^g \p_j^{e_j} = p\O_K \,\,\Big|\,\, \prod_{\sigma\in G} \sigma(\p_i),
$$
which in particular implies that $G$ acts transitively on the $\p_i$.

Choose some $j$ and suppose that $k\neq j$ is another index.  Because
$G$ acts transitively, there exists $\sigma\in G$ such that
$\sigma(\p_k)=\p_j$.  Applying $\sigma$ to the factorization $p\O_K =
\prod_{i=1}^g \p_i^{e_i}$, we see that
$$\prod_{i=1}^g \p_i^{e_i} = \prod_{i=1}^g \sigma(\p_i)^{e_i}.$$
Taking $\ord_{\p_j}$ on both sides we get $e_j = e_k$.  Thus $e_1=e_2=\cdots = e_g$.

As was mentioned right before the statement of the theorem,  for any $\sigma\in G$
we have $\O_K/\p_i\isom \O_K/\sigma(\p_i)$, so by transitivity $f_1=f_2=\cdots = f_g$.
Since $\O_K$ is a lattice in $K$, we have
\begin{align*}
[K:\Q]&= \dim_{\Z} \O_K = \dim_{\F_p} \O_K/p\O_K\\
    &= \dim_{\F_p} \left(\bigoplus_{i=1}^g \O_K/\p_i^{e_i}\right) 
    = \sum_{i=1}^g e_i f_i
    = efg,
\end{align*}
which completes the proof.
\end{proof}

The rest of this section illustrates the theorem for quadratic fields
and a cubic field and its Galois closure.

\subsection{Quadratic Extensions}
Suppose $K/\Q$ is a quadratic field.  Then $K$ is Galois, so for each prime $p\in\Z$ we have
$2=efg$. There are exactly three possibilties:
\begin{itemize}
\item {\bf Ramified:} $e=2$, $f=g=1$: The prime $p$ ramifies in $\O_K$, so $p\O_K = \p^2$. 
There are only finitely many such primes, since if $f(x)$ is the minimal polynomial
of a generator for $\O_K$, then $p$ ramifies if and only if $f(x)$ has a multiple root
modulo~$p$.  However, $f(x)$ has a multiple root modulo $p$ if and only if $p$ divides
the discriminant of $f(x)$, which is nonzero because $f(x)$ is irreducible over $\Z$.
(This argument shows there are only finitely many ramified primes in any number field.
In fact, we will later show that the ramified primes are exactly the ones that
divide the discriminant.)
\item {\bf Inert:} $e=1$, $f=2$, $g=1$: The prime $p$ is inert in $\O_K$, so 
$p\O_K = \p$ is prime.  This happens 50\% of the time, which is 
suggested by quadratic reciprocity (but not proved this way),
as we will see illustrated below for a particular example.
\item {\bf Split:} $e=f=1$, $g=2$: The prime $p$ splits in $\O_K$, in the
sense that $p\O_K = \p_1\p_2$ with $\p_1\neq \p_2$.  This happens the other
50\% of the time. 
\end{itemize}
Suppose, in particular, that $K=\Q(\sqrt{5})$, so $\O_K=\Z[\gamma]$,
where $\gamma=(1+\sqrt{5})/2$.   Then $p=5$ is ramified, since $p\O_K = (\sqrt{5})^2$.
More generally, the order $\Z[\sqrt{5}]$ has index $2$ in $\O_K$, so for any prime $p\neq 2$ we can
determine the factorization of $p$ in $\O_K$ by finding the factorization of the
polynomial $x^2-5\in \F_p[x]$.  The polynomial $x^2-5$ splits as a product of two
distinct factors in $\F_p[x]$ if and only if $e=f=1$ and $g=2$.  For $p\neq 2,5$ this is the
case if and only if $5$ is a square in $\F_p$, i.e., if 
$\kr{5}{p} = 1$, where $\kr{5}{p}$ is $+1$ if $5$ is a square mod $p$ and $-1$ if $5$ is not.
By quadratic reciprocity,
$$
 \kr{5}{p} = (-1)^{\frac{5-1}{2}\cdot \frac{p-1}{2}} \cdot \kr{p}{5} = 
   \kr{p}{5} = \begin{cases} +1 & \text{ if } p\con \pm 1\pmod{5}\\ -1&\text{ if } p \con \pm 2\pmod{5}.\end{cases}
$$
Thus whether $p$ splits or is inert in $\O_K$ is determined by the residue class of~$p$ 
modulo $5$.

\subsection{The Cube Roots of Two}
Suppose $K/\Q$ is not Galois.  Then $e_i$, $f_i$, and~$g$ are defined for each prime $p\in\Z$,
but we need not have $e_1=\cdots=e_g$ or $f_1=\cdots =f_g$.  We do still have that
$\sum_{i=1}^g e_i f_i = n$, by the Chinese Remainder Theorem.

For example, let $K=\Q(\sqrt[3]{2})$. We know that $\O_K = \Z[\sqrt[3]{2}]$.  Thus
$2\O_K = (\sqrt[3]{2})^3$, so for $2$ we have $e=3$ and $f=g=1$.  
To factor $3\O_K$, we note that working modulo $3$ we have 
$$
  x^3 - 2 = (x-2)(x^2+2x+1) = (x-2)(x+1)^2 \in \F_3[x],
$$
so 
$$
  3\O_K = (3, \crtwo - 2)\cdot (3, \crtwo + 1)^2.
$$
Thus $e_1=1$, $e_2=2$, $f_1=f_2=1$, and $g=2$.
Next, working modulo $5$ we have
$$
 x^3 - 2 = (x+2)(x^2+3x+4) \in \F_5[x],
$$
and the quadratic factor is irreducible.  Thus
$$
 5\O_K = (5, \crtwo+2)\cdot (5, \crtwo^2 + 3\crtwo + 4).
$$
Thus here $e_1=e_2=1$, $f_1=1$, $f_2=2$, and $g=2$.

Next we consider what happens in the Galois closure of $K$.  
Since the three embeddings of $\crtwo$ in $\C$ are
$\crtwo$, $\zeta_3\crtwo$, and $\zeta_3^2\crtwo$, 
we have
$$M=K^{\gc} = \Q(\crtwo, \zeta_3) = K.L,$$ where
$L=\Q(\zeta_3)=\Q(\sqrt{-3})$, since $\zeta_3=(-1+\sqrt{-3})/2$ is a
primitive cube root of unity.  The notation $K.L$ means the
``compositum of $K$ and $L$'', which is the smallest field generated
by $K$ and $L$.    

Let's figure out $e$, $f$, and $g$ for the prime $p=3$ relative
to the degree
six Galois field $M/\Q$ by using Theorem~\ref{thm:transitive} and
what we can easily determine about $K$ and $L$.  First,
we know that $efg=6$.  We have $3\O_K=\p_1\p_2^2$,
so $3\O_M=\p_1\O_M\cdot (\p_2 \O_M)^2$, and the prime
factors of $\p_1\O_M$ are disjoint from the prime factors
of $\p_2\O_M$.  Thus $e>1$ is even and also $g>1$.
The only possibility for $e,f,g$ satisfying these
two conditions is $e=2$, $f=1$, $g=3$, so we conclude
that $3\O_M = \q_1^2 \q_2^2 \q_3^2$ without doing
any further work, and without actually knowing the
$\q_i$ explicitly.  

Here's another interesting deduction that we can make ``by hand''.
Suppose for the moment that $\O_M = \Z[\crtwo,\zeta_3]$ (this will turn
out to be false).  Then the factorization of
$(\sqrt{-3})\subset \O_L$ in $\O_M$ would be exactly reflected by the
factorization of $x^3-2$ in $\F_3=\O_L/(\sqrt{-3})$.  Modulo $3$ we
have $x^3-2=x^3+1 = (x+1)^3$, which would imply that $(\sqrt{-3}) =
\q^3$ for some prime $\q$ of $\O_M$, i.e., that $e=6$ and $f=g=1$,
which is incorrect.  Thus $\O_M \neq\Z[\crtwo,\zeta_3]$.  Indeed, this
conclusion agrees with the following \magma{} computation, which
asserts that $[\O_M : \Z[\crtwo,\zeta_3]] = 24$:
\begin{verbatim}
   > R<x> := PolynomialRing(RationalField());
   > K := NumberField(x^3-2);
   > L := NumberField(x^2+3);
   > M := CompositeFields(K,L)[1];
   > O_M := MaximalOrder(M);
   > a := M!K.1;
   > b := M!L.1;
   > O := Order([a,b]);
   > Index(O_M,O);
   24
\end{verbatim}

\chapter{Decomposition Groups and Galois
Representations}
\section{The Decomposition Group}
Suppose $K$ is a number field that is Galois over $\Q$ with
group $G=\Gal(K/\Q)$.
Fix a prime $\p\subset \O_K$ lying over $p\in\Z$.  
\begin{definition}[Decomposition group]\label{def:decomp}
The \defn{decomposition group} of $\p$ is the subgroup
$$
  D_\p = \{\sigma \in G : \sigma(\p)=\p\} \leq G.
$$
\end{definition}
(Note: The decomposition group is called the ``splitting group''
in Swinnerton-Dyer.  Everybody I know calls it the decomposition
group, so we will too.)

Let $\F_{\p} = \O_K/\p$ denote the residue class field of $\p$.
In this section we will prove that there is a natural exact sequence
$$
  1\to I_\p \to D_\p \to \Gal(\F_{\p}/\F_p)\to 1,
$$
where $I_\p$ is the \defn{inertia subgroup} of $D_\p$, and
$\#I_\p=e$.  The most interesting part of the proof is
showing that the natural map $D_\p\to  \Gal(\F_{\p}/\F_p)$
is surjective.

We will also discuss the structure of $D_\p$ and introduce
Frobenius elements, which play a crucial roll in understanding Galois
representations.


Recall that $G$ acts on the set of primes $\p$ lying
over $p$.  Thus the decomposition group is the stabilizer in $G$
of $\p$.  The orbit-stabilizer theorem implies that $[G:D_\p]$
equals the orbit of $\p$, which by Theorem~\ref{thm:transitive}
equals the number $g$ of primes lying over $p$, so $[G:D_\p]=g$.

\begin{lemma}\ilem{decomposition groups are conjugate}
The decomposition subgroups $D_\p$ corresponding to primes $\p$
lying over a given $p$ are all conjugate in $G$.
\end{lemma}
\begin{proof}
We have $\tau(\sigma(\tau^{-1}(\p))) = \p$ if and only if
$\sigma(\tau^{-1}(\p)) = \tau^{-1}\p$.  Thus $\tau\sigma\tau^{-1}\in D_p$
if and only if $\sigma\in D_{\tau^{-1}\p}$, so 
$\tau^{-1}D_p\tau = D_{\tau^{-1}\p}$.   The lemma now follows
because, by Theorem~\ref{thm:transitive}, $G$ 
acts transitively on the set of $\p$ lying over~$p$.
\end{proof}

The decomposition group is extremely useful because it allows us
to see the extension $K/\Q$ as a tower of extensions, such that at
each step in the tower we understand well the splitting behavior
of the primes lying over~$p$.  Now might be a good time to glance
ahead at Figure~\ref{fig} on page~\pageref{fig}.

We characterize the fixed field of $D=D_\p$ as follows.
\begin{proposition}\label{prop:nosplit}\iprop{fixed field characterization}
The fixed field $K^D$ of $D$
$$K^D=\{a \in K : \sigma(a) = a\text{ for all }
\sigma \in D\}$$
is the smallest subfield $L\subset K$ such that $\p\cap L$
does not split in~$K$ (i.e., $g(K/L)=1$).
\end{proposition}
\begin{proof}
First suppose $L=K^D$, and note that by Galois theory $\Gal(K/L)\isom
D$, and by Theorem~\ref{thm:transitive}, the group $D$
acts transitively on the primes of $K$ lying over $\p\cap L$.  One of
these primes is $\p$, and $D$ fixes $\p$ by definition, so there is
only one prime of $K$ lying over $\p\cap L$, i.e., $\p\cap L$ does not
split in~$K$.  Conversely, if $L\subset K$ is such that $\p\cap L$
does not split in~$K$, then $\Gal(K/L)$ fixes $\p$ (since it is the only
prime over $\p\cap L$), so $\Gal(K/L)\subset D$, hence $K^D\subset L$.
\end{proof}
Thus $p$ does not split in going from $K^D$ to $K$---it does some
combination of ramifying and staying inert.  To fill in more of
the picture, the following proposition asserts that $p$ splits
completely and does not ramify in $K^D/\Q$.
\begin{proposition}\label{prop:noresidue}\iprop{$e$, $f$, $g$}
Let $L=K^D$ for our fixed prime $p$ and Galois extension $K/\Q$.
Let $e=e(L/\Q),f=f(L/\Q),g=g(L/\Q)$ be for $L/\Q$ and $p$. 
Then $e=f=1$ and $g=[L:\Q]$, i.e., $p$ does not ramify and splits 
completely in~$L$.  Also $f(K/\Q)=f(K/L)$ and $e(K/\Q)=e(K/L)$.
\end{proposition}
\begin{proof}
As mentioned right after Definition~\ref{def:decomp}, the
orbit-stabilizer theorem implies that $g(K/\Q)=[G:D]$, and 
by Galois theory $[G:D]=[L:\Q]$.
Thus
\begin{align*}
 e(K/L)\cdot f(K/L) &= [K:L]
   =[K:\Q]/[L:\Q] \\
&= \frac{e(K/\Q)\cdot f(K/\Q) \cdot g(K/\Q)}{[L:\Q]}
   = e(K/\Q)\cdot f(K/\Q).
\end{align*}
Now $e(K/L)\leq e(K/\Q)$ and $f(K/L)\leq f(K/\Q)$, so 
we must have $e(K/L)=e(K/\Q)$ and $f(K/L)=f(K/\Q)$.  
Since $e(K/\Q)=e(K/L)\cdot e(L/\Q)$ and $f(K/\Q)=f(K/L)\cdot f(L/\Q)$,
the proposition follows.
\end{proof}

\subsection{Galois groups of finite fields}\label{sec:galoisfinite}
Each $\sigma\in D=D_\p$ acts in a well-defined
way on the finite field $\F_\p = \O_K/\p$, so we obtain
a homomorphism 
$$
  \vphi:D_\p \to \galff.
$$
We pause for a moment and derive a few basic properties of $\galff$,
which are in fact general properties of Galois groups for finite fields. 
Let $f=[\F_\p:\F_p]$.

The group $\autff$ contains the element $\Frob_p$ defined by
$$\Frob_p(x) = x^p,$$ 
because $(xy)^p = x^p y^p$  and
$$(x+y)^p = x^p + px^{p-1}y + \cdots + y^p \con
 x^p+y^p\pmod{p}.$$ 
By Exercise~\ref{hmwk:cyclic} (see Chapter~\ref{ch:hmwk}), the group
$\F_\p^*$ is cyclic, so there is an element $a\in\F_\p^*$ of order
$p^f-1$, and $\F_\p=\F_p(a)$.  Then $\Frob_p^n(a) = a^{p^n} = a$ if
and only if $(p^f-1)\mid p^n-1$ which is the case preciselywhen
$f\mid n$, so the order of $\Frob_p$ is~$f$.  Since the order of the
automorphism group of a field extension is at most the degree of the
extension, we conclude that $\autff$ is generated by $\Frob_p$.  Also,
since $\autff$ has order equal to the degree, we conclude that
$\F_\p/\F_p$ is Galois, with group $\galff$ cyclic of order $f$
generated by $\Frob_p$.  (Anther general fact: Up to isomorphism
there is exactly one finite field of each degree.  Indeed, if there
were two of degree $f$, then both could be characterized as the set of
roots in the compositum of $x^{p^f}-1$, hence they would be equal.)

\subsection{The Exact Sequence}\label{sec:exactseq}
There is a natural reduction homomorphism
$$
  \vphi:D_\p \to \galff.
$$
\begin{theorem}\label{thm:redsurj}\ithm{reduction of Galois group}
The homomorphism $\vphi$ is surjective.
\end{theorem}
\begin{proof}
Let $\tilde{a} \in \F_\p$ be an element such that $\F_\p = \F_p(a)$. 
Lift $\tilde{a}$ to an algebraic integer $a\in \O_K$, and let
$f=\prod_{\sigma\in D_p}(x-\sigma(a))\in K^D[x]$ be the characteristic polynomial of~$a$ over $K^D$.
Using Proposition~\ref{prop:noresidue} we see that~$f$ 
reduces to the minimal polynomial $\tilde{f}=\prod (x-\tilde{\sigma(a)})\in \F_p[x]$
of $\tilde{a}$ (by the Proposition the coefficients of $\tilde{f}$
are in $\F_p$, and $\tilde{a}$ satisfies $\tilde{f}$, and the
degree of $\tilde{f}$ equals the degree of the minimal polynomial
of $\tilde{a}$).   The roots of $\tilde{f}$ are of the form 
$\tilde{\sigma}(a)$, and
the element $\Frob_p(a)$ is also a root of
$\tilde{f}$, so it is of the form $\tilde{\sigma(a)}$.
We conclude that the generator $\Frob_p$ of $\galff$ is
in the image of $\vphi$, which proves the theorem. 
\end{proof}

\begin{definition}[Inertia Group]
The \defn{inertia group} is the kernel $I_\p$ of $D_\p\to\galff$.
\end{definition}
Combining everything so far,  we find an exact sequence of groups
\begin{equation}\label{eqn:exact}
   1 \to I_\p \to D_\p \to \galff\to 1.
\end{equation}
The inertia group is a measure of how $p$ ramifies in $K$.
\begin{corollary}\icor{order of inertia group}
We have $\# I_\p= e(\p/p)$, where $\p$ is a prime of $K$ over $p$.
\end{corollary}
\begin{proof}
The sequence (\ref{eqn:exact}) implies that 
$\#I_\p = \#D_\p/f(K/\Q)$.  Applying Propositions~\ref{prop:nosplit}--\ref{prop:noresidue}, we have
$$\#D_\p = [K:L] = \frac{[K:\Q]}{g} = \frac{efg}{g} = ef.$$
Dividing both sides by $f=f(K/\Q)$ proves the corollary.
\end{proof}

We have the following characterization of $I_\p$.
\begin{proposition}\label{prop:charip}\iprop{inertia group characterization}
Let $K/\Q$ be a Galois extension with group $G$, let $\p$ be a prime lying
over a prime $p$.  Then 
$$
I_\p = \{\sigma\in G : \sigma(a) = a\pmod{\p}\text{ for all } a\in\O_K\}.
$$
\end{proposition}
\begin{proof}
By definition $I_\p = 
\{\sigma\in D_\p : \sigma(a) = a\pmod{\p}\text{ for all } a\in\O_K\}$,
so it suffices to show that if $\sigma\not\in D_\p$, then there
exists $a\in\O_K$ such that $\sigma(a)=a\pmod{\p}$.  
If $\sigma\not\in D_\p$, we have $\sigma^{-1}(\p)\neq \p$, so
since both are maximal ideals, there exists $a\in\p$ with $a\not\in\sigma^{-1}(\p)$,
i.e., $\sigma(a)\not\in\p$.  Thus $\sigma(a)\not\con a\pmod{\p}$.
\end{proof}

Figure~\ref{fig} is a picture of the
splitting behavior of a prime $p\in\Z$.
\begin{figure}\label{fig}
\includegraphics[width=\textwidth]{splitting.eps}
\caption{The Splitting of Behavior of a Prime in a Galois Extension}
\end{figure}


\section{Frobenius Elements}
Suppose that $K/\Q$ is a finite Galois extension with group $G$ and
$p$ is a prime such that $e=1$ (i.e., an unramified prime).  Then 
$I=I_\p=1$ for any $\p\mid p$, so the map $\vphi$ of 
Theorem~\ref{thm:redsurj}
is a canonical isomorphism $D_\p \isom \Gal(\F_\p/\F_p)$.  
By Section~\ref{sec:galoisfinite},
the group $\Gal(\F_\p/\F_p)$ is
cyclic with canonical generator $\Frob_p$.  
The \defn{Frobenius element} corresponding to $\p$ is
$\Frob_\p\in D_\p$. It is the unique element of $G$ such that for all
$a\in\O_K$ we have 
$$
  \Frob_\p(a)\con a^p\pmod{\p}.
$$
(To see this argue as in the proof of Proposition~\ref{prop:charip}.)
Just as the primes $\p$ and decomposition groups $D$ are all
conjugate, the Frobenius elements over a given prime are conjugate.
\begin{proposition}\iprop{conjugation of Frobenius}
For each $\sigma \in G$, we have 
$$
 \Frob_{\sigma\p} = \sigma\Frob_\p\sigma^{-1}.
$$
In particular, the Frobenius elements lying over a given
prime are all conjugate.
\end{proposition}
\begin{proof}
Fix $\sigma\in G$. For any $a\in\O_K$ we have
$\Frob_\p(\sigma^{-1}(a)) - \sigma^{-1}(a) \in \p$. 
Multiply by $\sigma$ we see that 
$\sigma\Frob_\p(\sigma^{-1}(a)) - a \in \sigma\p$,
which proves the proposition.
\end{proof}

Thus the conjugacy class of $\Frob_\p$ in $G$ is a well defined
function of~$p$.  For example, if $G$ is abelian, then $\Frob_\p$ does
not depend on the choice of $\p$ lying over $p$ and we obtain a well
defined symbol $\kr{K/\Q}{p} =\Frob_\p\in G$ called the \defn{Artin
symbol}.  It extends to a map from the free abelian
group on unramified primes to the group $G$ (the fractional ideals of
$\Z$).  Class field theory (for~$\Q$) sets up a natural bijection
between abelian Galois extensions of $\Q$ and certain maps from
certain subgroups of the group of fractional ideals for~$\Z$.  We have
just described one direction of this bijection, which associates to an
abelian extension the Artin symbol (which induces a homomorphism).
The Kronecker-Weber theorem asserts that the abelian extensions of
$\Q$ are exactly the subfields of the fields $\Q(\zeta_n)$, as $n$
varies over all positive integers.  By Galois theory there is a
correspondence between the subfields of $\Q(\zeta_n)$ (which has
Galois group $(\Z/n\Z)^*$) and the subgroups of $(\Z/n\Z)^*$.  Giving
an abelian extension of $\Q$ is {\em exactly the same} as giving an
integer~$n$ and a subgroup of $(\Z/n\Z)^*$. Even more importantly, the
reciprocity map $p\mapsto \kr{Q(\zeta_n)/\Q}{p}$ is simply $p\mapsto
p\in (\Z/n\Z)^*$.  This is a nice generalization of quadratic
reciprocity: for $\Q(\zeta_n)$, the $efg$ for a prime $p$ depends in a
simple way on nothing but $p\mod n$.

\section{Galois Representations and a Conjecture of Artin}
The Galois group $\Gal(\Qbar/\Q)$ is an object of central importance
in number theory, and I've often heard that in some sense number
theory is the study of this group.  A good way to study a group is to
study how it acts on various objects, that is, to study its
representations.

Endow $\galq$ with the topology which has as a basis of open neighborhoods
of the origin the subgroups $\Gal(\Qbar/K)$, where $K$ varies
over finite Galois extensions of $\Q$. (Note: This is {\bf not} the
topology got by taking as a basis of open neighborhoods the collection
of finite-index normal subgroups of $\galq$.)
Fix a positive integer $n$ and let $\GL_n(\C)$ be the group of
$n\times n$ invertible matrices over $\C$ with the discrete topology.

\begin{definition}
A \defn{complex  $n$-dimensional representation} of $\galq$
is a continuous homomorphism
$$
  \rho:\galq\to \GL_n(\C).
$$
\end{definition}
For $\rho$ to be continuous means that there is a finite Galois
extension $K/\Q$ such that $\rho$ factors through $\Gal(K/\Q)$:
$$\xymatrix{ {\galq}\ar[rr]^{\rho}\ar[dr]& &{\GL_n(\C)}\\
&{\Gal(K/\Q)}\ar[ur]_{\rho'}}
$$ 
For example, one could take $K$ to be
the fixed field of $\ker(\rho)$.  (Note that continous implies that
the image of $\rho$ is finite, but using Zorn's lemma one can show
that there are homomorphisms $\galq\to\{\pm 1\}$ with finite image
that are not continuous, since they do not factor through the Galois
group of any finite Galois extension.)

Fix a Galois representation $\rho$ and a finite Galois extension
$K$ such that $\rho$ factors through $\Gal(K/\Q)$.
For each prime $p\in\Z$ that is not ramified in $K$, there is an
element $\Frob_\p\in\Gal(K/\Q)$ that is well-defined up to conjugation
by elements of $\Gal(K/\Q)$.  This means that $\rho'(\Frob_p)\in \GL_n(\C)$
is well-defined up to conjugation.  Thus the characteristic polynomial
$F_p\in\C[x]$ is a well-defined invariant of $p$ and $\rho$.  Let
$$R_p(x) = x^{\deg(F_p)}\cdot F_p(1/x) = 1 + \cdots +
\det(\Frob_p)\cdot x^{\deg(F_p)}$$ 
be the polynomial obtain
by reversing the order of the coefficients of $F_p$.  
Following E.~Artin, set
\begin{equation}\label{eqn:artin}
L(\rho,s) = \prod_{p\text{ unramified}}
\frac{1}{R_p(p^{-s})}.
\end{equation}
We view. $L(\rho,s)$ as a function of a single complex variable $s$.
One can prove that $L(\rho,s)$ is holomorphic on some right
half plane, and extends to a meromorphic function on all $\C$.
\begin{conjecture}[Artin]
The $L$-series of any continuous representation $$\Gal(\Qbar/\Q)\to\GL_n(\C)$$
is an entire function on all $\C$, except possibly at $1$.
\end{conjecture}
This conjecture asserts that there is some way to analytically continue
$L(\rho,s)$ to the whole complex plane, except possibly at $1$.  
(A standard fact from complex analysis is that this analytic
continuation must be unique.)
The simple pole at $s=1$ corresponds to the trivial representation (the
Riemann zeta function), and if $n\geq 2$ and $\rho$ is irreducible,
then the conjecture is that $\rho$ extends to a holomorphic function
on all $\C$.

The conjecture follows from class field theory for $\Q$ when
$n=1$. When $n=2$ and the image of $\rho$ in $\PGL_2(\C)$ is a
solvable group, the conjecture is known, and is a deep theorem of
Langlands and others (see \cite{langlands:basechange}), which played
a crucial roll in Wiles's proof of Fermat's Last Theorem.  When $n=2$
and the projective image is not solvable, the only possibility is that
the projective image is isomorphic to the alternating group~$A_5$.
Because~$A_5$ is the symmetric group of the icosahedron, these
representations are called \defn{icosahedral}.  In this case, Joe
Buhler's Harvard Ph.D. thesis gave the first example, there is a whole
book  \cite{mr95i:11001},
which proves Artin's conjecture for 7 icosahedral representation (none
of which are twists of each other).  Kevin Buzzard and I (Stein)
proved the conjecture for 8 more examples.  Subsequently, Richard
Taylor, Kevin Buzzard, and Mark Dickinson proved the conjecture for an
infinite class of icosahedral Galois representations (disjoint from
the examples).  The general problem for $n=2$ is still open, but
perhaps Taylor and others are still making progress toward it.


\part{Adelic Viewpoint}
\chapter{Valuations}
The rest of this book is a partial rewrite of \cite{cassels:global}
meant to make it more accessible.  I have attempted to add examples
and details of the implicit exercises and remarks that are left to the
reader.

\section{Valuations}

\begin{definition}[Valuation]
A \defn{valuation} $\absspc{}$ on a field $K$ is a function
defined on $K$ with values in $\R_{\geq 0}$ satisfying
the following axioms:
\begin{enumerate}
\item[(1)] $\abs{a} = 0$ if and only if $a = 0$,
\item[(2)] $\abs{ab}=\abs{a}\abs{b}$, and
\item[(3)] there is a constant $C\geq 1$ such that 
$\abs{1+a}\leq C$ whenever $\abs{a}\leq 1$.
\end{enumerate}
\end{definition}

The \defn{trivial valuation} is the valuation for which
$\abs{a}=1$ for all $a\neq 0$.  We will often tacitly
exclude the trivial valuation from consideration.

From (2) we have 
$$
  \abs{1} = \abs{1}\cdot \abs{1},
$$
so $\abs{1} = 1$ by (1).
If $w\in K$ and $w^n=1$, then $|w|=1$ by (2).
In particular, the only valuation of a finite field
is the trivial one.    The same argument shows that $|-1|=|1|$,
so 
$$
  |-a| = |a|\qquad \text{all }a \in K.
$$

\begin{definition}[Equivalent]
Two valuations $\absspc{}_1$ and $\absspc{}_2$ on the
same field are \defn{equivalent}\i{valuation!equivalence of} 
if there exists $c>0$ such
that $$\abs{a}_2 = \abs{a}_1^c$$
for all $a\in K$.
\end{definition}
Note that if $\absspc{}_1$ is a valuation, then 
$\absspc{}_2=\absspc{}_1^c$ is also a valuation.
Also, equivalence of valuations is an equivalence relation.

If $\absspc{}$ is a valuation and $C$ is the constant from Axiom
(3), then there is a $c>0$ such that $C^c=2$ (i.e.,
$c=\log(C)/\log(2)$).  Then we can take $2$ as constant for the
equivalent valuation $\absspc{}^c$.  Thus every valuation is
equivalent to a valuation with $C=2$. Note that if $C=1$, e.g.,
if $\absspc{}$ is the trivial valuation, then we could
simply take $C=2$ in Axiom (3).
\begin{proposition}\iprop{triangle inequality}
Suppose $\absspc{}$ is a valuation with $C=2$.
Then for all $a, b\in K$ we have 
\begin{equation}\label{val3p}
  |a + b| \leq |a| + |b|\qquad \text{(triangle inequality)}.
\end{equation}
\end{proposition}
\begin{proof}
Suppose $a_1, a_2\in K$ with $|a_1|\geq|a_2|$.  Then $a=a_2/a_1$
satisfies $|a|\leq 1$.  By Axiom (3) we have $|1+a|\leq 2$, so
multiplying by $a_1$ we see that
$$|a_1+ a_2|\leq 2|a_1| = 2\cdot\max\{|a_1|,|a_2|\}.$$
Also we have 
$$|a_1+ a_2 + a_3 + a_4|\leq 2\cdot\max\{|a_1+a_2|,|a_3+a_4|\}
   \leq 4\cdot \max\{|a_1|,|a_2|,|a_3|,|a_4|\},
$$
and inductively we have for any $r>0$ that
$$|a_1 + a_2 + \cdots  + a_{2^r}| \leq 2^r\cdot\max{|a_j|}.$$
If $n$ is any positive integer, let $r$ be such
that $2^{r-1}\leq n\leq 2^r$. Thenn
$$|a_1 + a_2 + \cdots + a_{n}| \leq 2^r\cdot \max\{|a_j|\} 
 \leq 2n\cdot \max\{|a_j|\},$$
since $2^r\leq 2n$.  In particular,
\begin{equation}\label{eqn:absn}
  |n| \leq 2n\cdot |1| = 2n \qquad\text{(for $n>0$)}.
\end{equation}
Applying (\ref{eqn:absn}) to $\ds\abs{\binom{n}{j}}$ and using
the binomial expansion, we have for any $a,b\in K$ that
\begin{align*}
|a+b|^n &= \abs{\sum_{j=0}^n \binom{n}{j} a^j b^{n-j}}\\
   &\leq  2(n+1)\max_j\left\{ \abs{\binom{n}{j}} \abs{a}^j\abs{b}^{n-j}\right\}\\
   &\leq  2(n+1)\max_j\left\{ 2 \binom{n}{j} \abs{a}^j\abs{b}^{n-j}\right\}\\
   &\leq  4(n+1)\max_j\left\{ \binom{n}{j} \abs{a}^j\abs{b}^{n-j}\right\}\\
   &\leq  4(n+1)(\abs{a}+\abs{b})^n.
\end{align*}
Now take $n$th roots of both sides to obtain
$$
|a+b| \leq \sqrt[n]{4(n+1)}\cdot (|a| + |b|).
$$
We have by elementary calculus that
$$
  \lim_{n\to \infty} \sqrt[n]{4(n+1)} = 1,
$$ so $|a+b| \leq |a|+|b|$.  
(The ``elementary calculus'': We instead prove that $\sqrt[n]{n}\to 1$, since
the argument is the same and the notation is simpler.  First, for any
$n\geq 1$ we have $\sqrt[n]{n}\geq 1$, since upon taking $n$th powers
this is equivalent to $n\geq 1^n$, which is true by hypothesis.
Second, suppose there is an $\eps>0$ such that $\sqrt[n]{n}\geq
1+\eps$ for all $n\geq 1$.  Then taking logs of boths sides we see
that $\frac{1}{n}\log(n)\geq \log(1+\eps) > 0$.  But 
 $\log(n)/n\to 0$, so there is no such $\eps$.  Thus
$\sqrt[n]{n}\to 1$ as $n\to \infty$.)
\end{proof}
Note that Axioms (1), (2) and Equation (\ref{val3p}) imply Axiom (3)
with $C=2$.  We take Axiom (3) instead of Equation (\ref{val3p}) for
the technical reason that we will want to call the square of the
absolute value of the complex numbers a valuation.

\begin{lemma}\ilem{$\Bigl||a| - |b|\Bigr| \leq \abs{a-b}$}
Suppose $a, b \in K$, and $\absspc{}$ is a valuation on $K$
with $C\leq 2$.
Then 
$$
  \Bigl||a| - |b|\Bigr| \leq \abs{a-b}.
$$
(Here the big absolute value on the outside of the left-hand
side of the inequality is the usual absolute value on 
real numbers, but the other absolute values are a valuation
on an arbitrary field~$K$.)
\end{lemma}
\begin{proof}
We have 
$$|a| = |b + (a-b)| \leq |b| + |a-b|,$$
so $|a|-|b|\leq \abs{a-b}$.  The same argument
with $a$ and $b$ swapped implies that
$|b|-|a|\leq \abs{a-b}$, which proves the lemma.
\end{proof}


\section{Types of Valuations}
We define two important properties of valuations, both of which
apply to  equivalence classes of valuations (i.e., the property
holds for $\absspc{}$ if and only if it holds for a valuation
equivalent to $\absspc{}$).
\begin{definition}[Discrete]
A valuation $\absspc{}$ is \defn{discrete}\i{valuation!discrete} 
if there is a $\delta>0$
such that for any $a\in K$ 
$$
   1-\delta < \abs{a} < 1+\delta \implies |a|=1.
$$
Thus the absolute values are bounded away from $1$.
%then $|a|=1$.
\end{definition}
To say that $\absspc{}$ is discrete is the same as saying
that the set
$$G=\bigl\{
  \log\abs{a} : a \in K, a\neq 0
\bigr\} \subset \R
$$
forms a discrete subgroup of the reals under addition (because
the elements of the group $G$ are bounded away from $0$).
\begin{proposition}\label{prop:discrete}\iprop{discrete subgroup of $\R$}
A nonzero discrete subgroup $G$ of $\R$ is free on one generator.
\end{proposition}
\begin{proof}
Since $G$ is discrete there is a positive  $m\in G$
such that for any positive $x\in G$ we have $m\leq x$.
Suppose $x\in G$ is an arbitrary positive element.
By subtracting off integer multiples of~$m$, we
find that there is a unique $n$ such that
$$
   0\leq x-nm <m.
$$
Since $x-nm\in G$ and $0<x-nm<m$, it follows
that $x-nm=0$, so $x$ is a multiple of $m$.
\end{proof}
By Proposition~\ref{prop:discrete}, the set 
of $\log\abs{a}$ for nonzero $a\in K$
is free on one generator, so there
is a $c<1$ such that $\abs{a}$, for $a\neq 0$,
runs precisely through the set $$c^\Z = \{c^m : m\in \Z\}$$
(Note: we can replace $c$ by $c^{-1}$ to see that we
can assume that $c<1$).

\begin{definition}[Order]
If $\abs{a} = c^m$, we call $m=\ord(a)$ the \defn{order} 
of $a$. 
\end{definition}
Axiom (2) of valuations
translates into
$$
  \ord(ab) = \ord(a) + \ord(b).
$$

\begin{definition}[Non-archimedean]
A valuation $\absspc{}$ is \defn{non-archimedean} 
if we can take $C=1$ in Axiom (3), i.e., if
\begin{equation}\label{eqn:na}
   |a + b| \leq \max\bigl\{|a|,|b|\bigr\}.
\end{equation}
If $\absspc{}$ is not non-archimedean then
it is \defn{archimedean}.
\end{definition}
Note that if we can take $C=1$ for $\absspc{}$
then we can take $C=1$ for any valuation equivalent to
$\absspc{}$.
To see that (\ref{eqn:na}) is equivalent to Axiom (3) with
$C=1$, suppose $|b|\leq |a|$.  Then $|b/a|\leq 1$, so 
Axiom (3) asserts that $|1+b/a|\leq 1$, which implies
that $|a+b| \leq |a| = \max\{|a|,|b|\}$, and conversely.

We note at once the following consequence:
\begin{lemma}\ilem{$|a+b|=|a|$}
Suppose $\absspc{}$ is a non-archimedean valuation.
If $a,b\in K$ with $|b|<|a|$, then
$
 |a+b|=|a|.
$
\end{lemma}
\begin{proof}
Note that $|a+b|\leq \max\{|a|,|b|\} = |a|$, which
is true even if $|b|=|a|$.  Also,
$$
  |a| = |(a+b) - b| \leq \max\{|a+b|, |b|\} = |a+b|,
$$
where for the last equality we have used that $|b|<|a|$
(if $\max\{|a+b|,|b|\} = |b|$, then $|a|\leq |b|$,
a contradiction).

\end{proof}

\begin{definition}[Ring of Integers]
Suppose $\absspc$ is a non-archimedean absolute
value on a  field $K$.  Then
$$
  \O = \{a\in K : |a|\leq 1\}
$$ is a ring called the \defn{ring of integers} of $K$
with respect to $\absspc{}$.
\end{definition}

\begin{lemma}\ilem{equivalent non-archimedean valuations and $\O$'s}
Two non-archimedean valuations $\absspc{}_1$ and 
$\absspc{}_2$ are equivalent if and only if they
give the same $\O$.
\end{lemma}
We will prove this modulo the claim (to 
be proved later in Section~\ref{sec:topology}) that 
valuations are equivalent if (and only if) they induce the 
same topology.
\begin{proof}
Suppose suppose $\absspc{}_1$ is equivalent to
$\absspc{}_2$, so $\absspc{}_1 = \absspc{}_2^c$,
for some $c>0$.  Then $\abs{c}_1 \leq 1$ if and only if
$\abs{c}_2^c \leq 1$, i.e., if $\abs{c}_2 \leq 1^{1/c}=1$.
Thus $\O_1 = \O_2$.

Conversely, suppose $\O_1 = \O_2$. 
Then $|a|_1<|b|_1$ if and only if $a/b\in \O_1$
and $b/a\not\in \O_1$, so 
\begin{equation}\label{eqn:ineqiff}
  |a|_1<|b|_1 \iff |a|_2 < |b|_2.
\end{equation}
The topology induced by $|\mbox{ }|_1$ has as basis
of open neighborhoods the set of open balls
$$
 B_1(z,r) = \{x \in K : |x-z|_1<r \},
$$
for $r>0$, and likewise for $|\mbox{ }|_2$.  Since 
the absolute values $|b|_1$ get arbitrarily close
to $0$, the set $\mathcal{U}$ of open balls $B_1(z,|b|_1)$ also 
forms a  basis of the topology induced
by $|\mbox{ }|_1$ (and similarly for $|\mbox{ }|_2$).
By (\ref{eqn:ineqiff}) we have
$$
 B_1(z,|b|_1) = B_2(z,|b|_2),
$$
so the two topologies both have $\mathcal{U}$ as
a basis, hence are equal.  That equal topologies
imply equivalence of the corresponding valuations
will be proved in Section~\ref{sec:topology}.
\end{proof}

The set of $a\in \O$ with $|a|<1$ forms an ideal $\p$ in $\O$.  The
ideal $\p$ is maximal, since if $a\in\O$ and $a\not\in\p$ then
$|a|=1$, so $|1/a| = 1/|a| = 1$, hence $1/a\in \O$, so $a$ is a unit.

\begin{lemma}\label{lem:discrete_principal}\ilem{characterization of discrete}
A non-archimedean valuation $\absspc{}$ is
discrete if and only if $\p$ is a principal ideal.
\end{lemma}
\begin{proof}
First suppose that $\absspc{}$ is discrete.
Choose $\pi \in \p$ with $|\pi|$ maximal, which
we can do since 
$$
  S=\{\log|a| : a \in \p\} \subset (-\infty,1],
$$
so the discrete set~$S$ is bounded above.
Suppose $a\in \p$.   Then 
$$
  \abs{\frac{a}{\pi}} = \frac{\abs{a}}{\abs{\pi }} \leq 1,
$$
so $a/\pi\in \O$.
Thus $$a = \pi \cdot \frac{a}{\pi} \in \pi \O.$$

Conversely, suppose $\p=(\pi)$ is principal.  For any $a\in \p$
we have $a=\pi b$ with $b\in\O$.  Thus 
$$
  |a| = |\pi|\cdot |b| \leq |\pi| < 1.
$$
Thus $\{|a| : |a|<1\}$ is bounded away from $1$,
which is exactly the definition of discrete.
\end{proof}

\begin{example}\label{ex:padic_valuation}
For any prime $p$, define the $p$-adic valuation
$\absspc{}_p:\Q\to\R$ as follows.  Write a nonzero $\alpha\in K$
as $p^n\cdot \frac{a}{b}$, where $\gcd(a,p)=\gcd(b,p)=1$.  Then
$$\abs{p^n\cdot \frac{a}{b}}_p := p^{-n} = \left(\frac{1}{p}\right)^{n}.$$
This valuation is both discrete and non-archimedean.
The ring $\O$ is the local ring
$$
  \Z_{(p)} = \left\{\frac{a}{b}\in\Q : p\nmid b\right\},
$$
which has maximal ideal generated by $p$.  Note that
$\ord(p^n\cdot \frac{a}{b}) = p^n.$
\end{example}

We will using the following lemma later (e.g., in
the proof of Corollary~\ref{cor:valna} and Theorem~\ref{thm:ostrowski}).
\begin{lemma}\label{lem:nonarch}\ilem{non-archimedean valuation characterization}
  A valuation $\absspc{}$ is non-archimedean if and only if $|n|\leq
  1$ for all $n$ in the ring generated by $1$ in $K$.
\end{lemma}
Note that we cannot identify the ring generated by $1$ with~$\Z$ 
in general, because~$K$ might have characteristic $p>0$.
\begin{proof}
If $\absspc{}$ is non-archimedean, then $|1|\leq 1$,
so by Axiom (3) with $a=1$, we have  $|1+1|\leq 1$.  By
induction it follows that $|n|\leq 1$.

Conversely, suppose $|n|\leq 1$ for all integer multiples~$n$ of~$1$.
This condition is also true if we replace $\absspc{}$ by
any equivalent valuation, so replace $\absspc{}$ by
one with $C\leq 2$, so that the triangle inequality holds.
Suppose $a\in K$ with $|a|\leq 1$.  Then 
by the triangle inequality,
\begin{align*}
  \abs{1+a}^n &= \abs{(1+a)^n} \\
     \leq& \sum_{j=0}^n \abs{\binom{n}{j}} \abs{a}\\
     \leq& 1 + 1 + \cdots + 1 = n.
\end{align*}
Now take $n$th roots of both sides to get
$$\abs{1+a} \leq \sqrt[n]{n},$$
and take the limit as $n\to \infty$ to see
that $\abs{1+a} \leq 1$.  This proves that one
can take $C=1$ in Axiom (3), hence that $\absspc{}$
is non-archimedean.
\end{proof}

\section{Examples of Valuations}
The archetypal example of an archimedean valuation is the absolute
value on the complex numbers.  It is essentially the only one:
\begin{theorem}[Gelfand-Tornheim]\ithm{Gelfand-Tornheim} Any field~$K$ with
an archimedean valuation is isomorphic to a subfield of~$\C$,
the valuation being equivalent to that induced by the usual
absolute value on~$\C$.
\end{theorem}
We do not prove this here as we do not need it.  For a proof,
see \cite[pg. 45, 67]{artin:ant}.

There are many non-archimedean valuations.  On the rationals $\Q$
there is one for every prime $p>0$, the $p$-adic valuation, as
in Example~\ref{ex:padic_valuation}.

\begin{theorem}[Ostrowski]\label{thm:ostrowski}\ithm{Ostrowski}
\ithm{valuations on $\Q$}
The nontrivial valuations
on $\Q$ are those equivalent to $\absspc_p$, for some
prime $p$, and the usual absolute value $\absspc_\infty$.
\end{theorem}
\begin{remark}
Before giving the proof, we pause with a brief remark about
Ostrowski.  According to
{\small
\begin{verbatim}
   http://www-gap.dcs.st-and.ac.uk/~history/Mathematicians/Ostrowski.html
\end{verbatim}}
\noindent{}Ostrowski was a Ukrainian mathematician who lived
1893--1986.  Gautschi writes about Ostrowski as follows: ``... you are
able, on the one hand, to emphasise the abstract and axiomatic side of
mathematics, as for example in your theory of general norms, or, on
the other hand, to concentrate on the concrete and constructive
aspects of mathematics, as in your study of numerical methods, and to
do both with equal ease. {\em You delight in finding short and
succinct proofs, of which you have given many examples} ...'' [italics mine]
\end{remark}
We will now give an example of one of these short and succinct proofs.
\begin{proof}                                     
Suppose $\absspc$ is a nontrivial valuation on $\Q$.
\par{\em Nonarchimedean case:} 
Suppose $\abs{c}\leq 1$ for all $c\in\Z$, so by
Lemma~\ref{lem:nonarch}, $\absspc$ is nonarchimedean.  
Since $\absspc$ is nontrivial, the set 
$$
  \p=\{a\in\Z : \abs{a}<1\}
$$
is nonzero.  Also $\p$ is an ideal and if $\abs{ab}<1$,
then $\abs{a}\abs{b}=\abs{ab}<1$, so $\abs{a}<1$ or $\abs{b}<1$,
so $\p$ is a prime ideal of~$\Z$.  Thus $\p=p\Z$, for some prime
number~$p$.  Since every element of $\Z$ has valuation at most
$1$, if  $u\in\Z$ with $\gcd(u,p)=1$, then $u\not\in\p$,
so $\abs{u}=1$.  Let $\alpha=\log_{\abs{p}}\frac{1}{p}$, so 
$\abs{p}^\alpha = \frac{1}{p}$.    Then for any $r$ and any $u\in\Z$
with $\gcd(u,p)=1$, we have
$$
\abs{up^r}^{\alpha} = \abs{u}^{\alpha}\abs{p}^{\alpha r}
   = \abs{p}^{\alpha r} = p^{-r} = \abs{up^r}_p.
$$
Thus $\absspc^{\alpha} =  \absspc_p$ on $\Z$, hence on $\Q$
by multiplicativity, so $\absspc$ is equivalent to $\absspc_p$,
as claimed.

{\em Archimedean case:} By replacing $\absspc$ by a power of
$\absspc$, we may assume without loss that $\absspc$ satisfies the
triangle inequality.  We first make some general remarks about any
valuation that satisfies the triangle inequality.  
Suppose $a\in\Z$ is greater than $1$.  Consider, for any $b\in\Z$
the base-$a$ expansion of $b$:
$$
  b = b_m a^m + b_{m-1} a^{m-1} + \cdots + b_0,
$$
where 
$$
  0 \leq b_j < a \qquad (0\leq j \leq m),
$$  
and $b_m\neq 0$.
Since $a^m\leq b$, taking logs we see that
$m\log(a)\leq \log(b)$, so 
$$m \leq \frac{\log(b)}{\log(a)}.$$
Let $\ds M=\max_{1\leq d<a}\abs{d}$.  Then by the triangle
inequality for $\absspc$, we have
\begin{align*}
\abs{b}&\leq \abs{b_m}{a}^m + \cdots + \abs{b_1}\abs{a} + \abs{b_0}\\
    & \leq M\cdot (\abs{a}^m + \cdots + \abs{a} + 1)\\
   & \leq M\cdot (m+1)\cdot \max(1,\abs{a}^m)\\
   & \leq M\cdot\left(\frac{\log(b)}{\log(a)} + 1\right)
        \cdot \max\left(1,\abs{a}^{\log(b)/\log(a)}\right),
\end{align*}
where in the last step we use that $m\leq \frac{\log(b)}{\log(a)}$.
Setting $b=c^n$, for $c\in\Z$, in the above inequality and
taking $n$th roots, we have 
\begin{align*}
\abs{c} &\leq \left( M\cdot 
\left(\frac{\log(c^n)}{\log(a)}+1\right)\cdot
  \max(1,\abs{a}^{log(c^n)/\log(a)})\right)^{1/n}\\
  & = M^{1/n}\cdot\left(
       \frac{\log(c^n)}{\log(a)}+1\right)^{1/n}\cdot
      \max\left(1,\abs{a}^{\log(c^n)/\log(a)}\right)^{1/n}.
\end{align*}
The first factor $M^{1/n}$ converges to~$1$ as $n\to\infty$,
since $M\geq 1$ (because $\abs{1}=1$).  The second factor
is
$$
  \left(\frac{\log(c^n)}{\log(a)}+1\right)^{1/n}
   = 
\left(n \cdot \frac{\log(c)}{\log(a)}+1\right)^{1/n}
$$
which also converges to $1$, for the
same reason that $n^{1/n}\to 1$ 
(because $\log(n^{1/n})=\frac{1}{n}\log(n)\to 0$ as
$n\to\infty$).
The third factor is
$$
\max\left(1,\abs{a}^{\log(c^n)/\log(a)}\right)^{1/n}
  = \begin{cases}
   1 & \text{if }\abs{a}<1,\\
\abs{a}^{\log(c)/\log(a)} & \text{if }\abs{a}\geq 1.
\end{cases}
$$
Putting this all together, we see that
$$
\abs{c} \leq \max\left(1,\abs{a}^{\frac{\log(c)}{\log(a)}}\right).
$$

Our assumption that $\absspc$ is nonarchimedean implies
that there is $c\in\Z$ with $c>1$ and $\abs{c}>1$.
Then for all $a\in\Z$ with $a>1$ we have
\begin{equation}\label{eqn:pow}
  1 < \abs{c} \leq
  \max\left(1,\abs{a}^{\frac{\log(c)}{\log(a)}}\right),
\end{equation}
so $1<\abs{a}^{\log(c)/\log(a)}$, so 
$1<\abs{a}$ as well (i.e., any $a\in\Z$ with
$a>1$ automatically satisfies $\abs{a}>1$).  Also, taking the
$1/\log(c)$ power on both sides of (\ref{eqn:pow})
we see that 
\begin{equation}\label{eqn:ineqac}
  \abs{c}^{\frac{1}{\log(c)}}
    \leq   \abs{a}^{\frac{1}{\log(a)}}.
\end{equation}
Because, as mentioned above, $\abs{a}>1$, we can interchange the roll
of $a$ and $c$ to obtain the reverse inequality of (\ref{eqn:ineqac}).
We thus have 
$$
  \abs{c}
    =   \abs{a}^{\frac{\log(c)}{\log(a)}}.
$$ Letting $\alpha=\log(2)\cdot \log_{\abs{2}}(e)$ and setting $a=2$,
we have
$$
  \abs{c}^{\alpha} = \abs{2}^{\frac{\alpha}{\log(2)}\cdot \log(c)}
      = \left(\abs{2}^{\log_{\abs{2}}(e)}\right)^{\log(c)} =
   e^{\log(c)} = c = \abs{c}_\infty.
$$
Thus for all integers $c\in\Z$ with $c>1$ we have
$\abs{c}^{\alpha} = \abs{c}_{\infty}$, which implies
that $\absspc$ is equivalent to $\absspc_\infty$.
\end{proof}

Let $k$ be any field and let $K=k(t)$, where $t$
is transcendental.  Fix a real number $c>1$.
If $p=p(t)$ is an irreducible
polynomial in the ring $k[t]$, we define a valuation
by 
\begin{equation}\label{eqn:ffabsp}
  \abs{p^a \cdot \frac{u}{v}}_p = c^{-\deg(p)\cdot a},
\end{equation}
where $a\in\Z$ and $u,v\in k[t]$ with
$p\nmid u$ and $p\nmid v$.
\begin{remark}
This definition differs from the one page 46 of [Cassels-Frohlich,
Ch. 2] in two ways.   First, we assume that $c>1$ instead
of $c<1$, since otherwise $\absspc_p$ does not satisfy
Axiom 3 of a valuation.  Also, we write $c^{-\deg(p)\cdot a}$
instead of $c^{-a}$, so that the product formula will
hold.  (For more about the product formula, see
Section~\ref{sec:global_fields}.)
\end{remark}
In addition there is a a non-archimedean valuation
$\absspc_\infty$ defined by 
\begin{equation}\label{eqn:ffabsoo}
  \abs{\frac{u}{v}}_\infty = c^{\deg(u)-\deg(v)}.
\end{equation}


This definition differs from the one in \cite[pg.~46]{cassels:global}
in two ways.  First, we assume that $c>1$ instead of $c<1$, since
otherwise $\absspc_p$ does not satisfy Axiom 3 of a valuation.  Here's
why: Recall that Axiom 3 for a non-archimedean valuation on $K$
asserts that whenever $a\in K$ and $\abs{a}\leq 1$, then
$\abs{a+1}\leq 1$.  Set $a=p-1$, where $p=p(t)\in K[t]$ is an
irreducible polynomial.  Then $\abs{a}=c^0 = 1$, since $\ord_p(p-1) =
0$.  However, $\abs{a+1} = \abs{p-1+1} = \abs{p}=c^1<1$, since
$\ord_p(p) = 1$.  If we take $c>1$ instead of $c<1$, as I propose,
then $\abs{p}=c^1>1$, as required.


Note the (albeit imperfect) analogy between $K=k(t)$ and $\Q$.
If $s=t^{-1}$, so $k(t)=k(s)$, the valuation $\absspc_{\infty}$
is of the type (\ref{eqn:ffabsp}) belonging to the irreducible
polynomial $p(s)=s$.

The reader is urged to prove the following lemma as a homework
problem.
\begin{lemma}\ilem{valuations on $k(t)$}
The only nontrivial valuations on $k(t)$ which are trivial
on $k$ are equivalent to the valuation (\ref{eqn:ffabsp})
or (\ref{eqn:ffabsoo}).
\end{lemma}
For example, if $k$ is a finite field, there are no
nontrivial valuations on $k$, so the only
nontrivial valuations on $k(t)$ are equivalent to 
(\ref{eqn:ffabsp}) or (\ref{eqn:ffabsoo}).


\chapter{Topology and  Completeness}

\section{Topology}\label{sec:topology}
A valuation $\absspc$ on a field $K$ induces a topology in which a
basis for the neighborhoods of $a$ are the \defn{open balls}
$$
  B(a,d) = \{x\in K : \abs{x-a} < d\}
$$
for $d>0$.
\begin{lemma}\ilem{equivalent valuations, same topology}
Equivalent valuations induce the same topology.
\end{lemma}
\begin{proof}
If $\absspc_1=\absspc_2^r$, then 
$\abs{x-a}_1 < d$ if and only if
$\abs{x-a}_2^r<d$ if and only if
$\abs{x-a}_2<d^{1/r}$
so $B_1(a,d) = B_2(a,d^{1/r})$.
Thus the basis of open neighborhoods of $a$
for $\absspc_1$ and $\absspc_2$ are identical.
\end{proof}

A valuation satisfying the triangle inequality gives a metric for the
topology on defining the distance from $a$ to $b$ to be $\abs{a-b}$.
Assume for the rest of this section that we only consider valuations
that satisfy the triangle inequality.
\begin{lemma}\ilem{topological field}
A field with the topology induced by a valuation is
a \defn{topological field}, i.e., the operations sum, product, 
and reciprocal are continuous.
\end{lemma}
\begin{proof}
For example (product) the triangle inequality implies that
$$
  \abs{(a+\eps)(b+\delta) - ab}
   \leq \abs{\eps}\abs{\delta} + \abs{a}\abs{\delta}
     + \abs{b}\abs{\eps}
$$
     is small when $\abs{\eps}$ and $\abs{\delta}$ are
small (for fixed $a, b$).
\end{proof}

\begin{lemma}\label{lem:absvalconv}
Suppose two valuations $\absspc_1$ and $\absspc_2$ on the same
field $K$ induce the same topology. Then
for any sequence $\{x_n\}$ in~$K$ we
have 
$$
  \abs{x_n}_1 \to 0 \iff \abs{x_n}_2 \to 0.
$$
\end{lemma}
\begin{proof}
It suffices to prove that if $\abs{x_n}_1\to 0$
then $\abs{x_n}_2\to 0$, since the proof of the
other implication is the same. 
Let $\eps>0$.  The topologies induced by the two absolute
values are the same, so $B_2(0,\eps)$ can be covered by
open balls $B_1(a_i,r_i)$.  One of these open balls
$B_1(a,r)$ contains~$0$. There is $\eps'>0$ such that
$$
  B_1(0,\eps') \subset B_1(a,r)\subset B_2(0,\eps).
$$
Since $\abs{x_n}_1\to 0$, there exists $N$ such
that for $n\geq N$ we have $\abs{x_n}_1 <\eps'$.
For such~$n$, we have $x_n\in B_1(0,\eps')$, so $x_n\in B_2(0,\eps)$,
so $\abs{x_n}_2<\eps$.  Thus $\abs{x_n}_2\to 0$.
\end{proof}

\begin{proposition}\label{prop:same_topo}\iprop{same topology implies equivalent valuations}
If two valuations $\absspc_1$ and $\absspc_2$ on the same
field induce the same topology, then they are equivalent in
the sense that there is a positive real $\alpha$ such that 
$\absspc_1 = \absspc_2^{\alpha}$.
\end{proposition}
\begin{proof}
If $x\in K$ and $i=1,2$, then $\abs{x^n}_i \to 0$
if and only if $\abs{x}_i^n\to 0$, which is the
case if and only if $\abs{x}_i<1$.   Thus 
Lemma~\ref{lem:absvalconv} implies that 
$\abs{x}_1<1$ if and only if $\abs{x}_2<1$.
On taking reciprocals we see that $\abs{x}_1>1$
if and only if $\abs{x}_2>1$, so finally
$\abs{x}_1 = 1$ if and only if $\abs{x}_2=1$.

Let now $w,z\in K$ be nonzero elements with $\abs{w}_i \neq 1$ and
$\abs{z}_i\neq 1$.  On
applying the foregoing to
$$
  x = w^m z^n \qquad (m,n\in\Z)
$$
we see that
$$
  m\log\abs{w}_1 + n\log\abs{z}_1 \geq 0
$$
if and only if
$$
  m\log\abs{w}_2 + n\log\abs{z}_2 \geq 0.
$$
Dividing through by $\log\abs{z}_i$, and rearranging,
we see that for every rational number $\alpha=-n/m$, 
$$
  \frac{\log\abs{w}_1}{\log \abs{z}_1} \geq \alpha
\iff
  \frac{\log\abs{w}_2}{\log \abs{z}_2} \geq \alpha.
$$
Thus 
$$
  \frac{\log\abs{w}_1}{\log \abs{z}_1} =  
                \frac{\log\abs{w}_2}{\log \abs{z}_2},
$$
so 
$$
  \frac{\log\abs{w}_1}{\log \abs{w}_2} =  
                \frac{\log\abs{z}_1}{\log \abs{z}_2}.
$$
Since this equality does not depend on the choice of~$z$,
we see that there is a constant $c$ ($=\log\abs{z}_1/\log \abs{z}_2$)
such that $\log\abs{w}_1/\log \abs{w}_2 = c$ for all $w$.
Thus $\log\abs{w}_1 = c\cdot \log\abs{w}_2$, so 
$\abs{w}_1 = \abs{w}_2^c$, which implies that $\absspc_1$
is equivalent to $\absspc_2$.
\end{proof}

\section{Completeness}\label{sec:completeness}
We recall the definition of metric on a set $X$.
\begin{definition}[Metric]\label{defn:metric}
A \defn{metric} on a set~$X$ is a map
$$
  d : X \cross X \ra \R
$$
such that for all $x,y,z\in X$,
\begin{enumerate}
\item $d(x,y)\geq 0$ and $d(x,y)=0$ if and only if $x=y$,
\item $d(x,y)=d(y,x)$, and
\item $d(x,z)\leq d(x,y)+d(y,z)$.
\end{enumerate}
\end{definition}
A \defn{Cauchy sequence} is a sequence
$(x_n)$ in $X$ such that for all $\eps>0$ there exists~$M$ such that
for all $n,m>M$ we have $d(x_n,x_m)<\eps$.  The \defn{completion}
of~$X$ is the set of Cauchy sequences $(x_n)$ in~$X$ modulo the
equivalence relation in which two Cauchy sequences $(x_n)$ and $(y_n)$
are equivalent if $\lim_{n\ra\infty} d(x_n,y_n)=0$.  A metric space is
\defn{complete}\index{complete|nn} if every Cauchy sequence converges,
and one can show that the completion of~$X$ with respect to a metric
is complete.

For example, $d(x,y)=|x-y|$ (usual archimedean absolute value) defines
a metric on~$\Q$.  The completion of $\Q$ with respect to this metric
is the field $\R$ of real numbers.  More generally, whenever $\absspc$
is a valuation on a field $K$ that satisfies the triangle inequality,
then $d(x,y)=\abs{x-y}$ defines a metric on $K$.
Consider for the rest of this section only valuations that
satisfy the triangle inequality. 

\begin{definition}[Complete]
A field $K$ is \defn{complete} with respect to a valuation $\absspc$
if given any Cauchy sequence $a_n$, ($n=1,2,\ldots$), i.e.,
one for which
$$
\abs{a_m - a_n} \to 0 \qquad(m,n\to \infty,\infty),
$$
there is an $a^*\in K$ such that
$$
  a_n \to a^* \qquad \text{ w.r.t. }\absspc
$$
(i.e., $\abs{a_n-a^*}\to 0$).
\end{definition}

\begin{theorem}\ithm{complete embedding}
Every field $K$ with valuation $v=\absspc$ can be
embedded in a complete field $K_v$ with a valuation $\absspc{}$
extending the original one in such a way that $K_v$ is the closure of
$K$ with respect to $\absspc{}$.  Further $K_v$ is unique up to
a unique isomorphism fixing $K$.
\end{theorem}
\begin{proof}
Define $K_v$ to be the completion of $K$ with respect to the metric
defined by $\absspc$.  Thus $K_v$ is the set of equivalence classes of
Cauchy sequences, and there is a natural injective map from $K$ to
$K_v$ sending an element $a\in K$ to the constant Cauchy sequence
$(a)$.  Because the field operations on $K$ are continuous, they
induce well-defined field operations on equivalence classes of Cauchy
sequences componentwise.   Also, define a valuation on $K_v$ by
$$\abs{(a_n)_{n=1}^{\infty}} = \lim_{n\to\infty} \abs{a_n},$$ and note
that this is well defined and extends the valuation on $K$.

To see that $K_v$ is unique up to a unique isomorphism fixing~$K$, we
observe that there are no nontrivial continuous automorphisms $K_v\to
K_v$ that fix~$K$.  This is because, by denseness, a continuous
automorphism $\sigma: K_v\to K_v$ is determined by what it does
to~$K$, and by assumption~$\sigma$ is the identity map on~$K$.  More
precisely, suppose $a\in K_v$ and~$n$ is a positive integer.  Then by
continuity there is $\delta>0$ (with $\delta<1/n$) such that if
$a_n\in K_v$ and $\abs{a-a_n}<\delta$ then
$\abs{\sigma(a)-\sigma(a_n)}<1/n$.  Since $K$ is dense in $K_v$, we
can choose the $a_n$ above to be an element of~$K$.  Then by
hypothesis $\sigma(a_n)=a_n$, so $\abs{\sigma(a) - a_n} < 1/n$.  Thus
$\sigma(a) = \lim_{n\to\infty} a_n = a$.
\end{proof}

\begin{corollary}\label{cor:valna}\icor{valuation stays non-archimedean}
\icor{value set stays same}
The valuation $\absspc$ is non-archimedean
on $K_v$ if and only if it is so on $K$.  If $\absspc$ is
non-archimedean, then the set of values taken by $\absspc{}$ on $K$
and $K_v$ are the same.
\end{corollary}
\begin{proof}
  The first part follows from Lemma~\ref{lem:nonarch} which asserts
  that a valuation is non-archimedean if and only if $\abs{n}<1$ for
  all integers $n$.  Since the valuation on $K_v$ extends the
  valuation on~$K$, and all $n$ are in $K$, the first statement
  follows.

For the second, suppose that $\absspc{}$ is non-archimedean (but
not necessarily discrete).
Suppose $b\in K_v$ with $b\neq 0$. 
First I claim that there is $c\in K$ such that $\abs{b-c} < \abs{b}$.
To see this, let $c'=b-\frac{b}{a}$, where~$a$ is some 
element of $K_v$ with $\abs{a}>1$, note that
$\abs{b-c'}=\abs{\frac{b}{a}}<\abs{b}$, and choose $c\in K$ such
that $\abs{c-c'} < \abs{b-c'}$, so 
$$\abs{b-c} = \abs{b-c' - (c-c')}
 \leq \max\left(\abs{b-c'},\abs{c-c'}\right) = \abs{b-c'}<\abs{b}.
$$
Since $\absspc{}$ is non-archimedean,
we have
$$
  \abs{b} = \abs{(b-c)+c} \leq \max\left(\abs{b-c},\abs{c}\right) = \abs{c},
$$
where in the last equality we use that $\abs{b-c}<\abs{b}$.
Also,
$$
  \abs{c} = \abs{b + (c-b)} \leq \max\left(\abs{b},\abs{c-b}\right) = \abs{b},
$$
so $\abs{b} = \abs{c}$, which is in the set of values of $\absspc{}$
on $K$.
\end{proof}

\subsection{$p$-adic Numbers}
This section is about the $p$-adic numbers $\Q_p$, which are the
completion of $\Q$ with respect to the $p$-adic valuation.
Alternatively, to give a $p$-adic {\em integer} in $\Z_p$ is the same
as giving for every prime power $p^r$ an element $a_r\in \Z/p^r\Z$
such that if $s\leq r$ then $a_s$ is the reduction of $a_r$ modulo
$p^s$.  The field $\Q_p$ is then the field of fractions of $\Z_p$.

We begin with the definition of the $N$-adic numbers for any positive
integer~$N$.  Section~\ref{sec:tenadic} is about the $N$-adics in the
special case $N=10$; these are fun because they can be represented as
decimal expansions that go off infinitely far to the left.
Section~\ref{sec:qnweird} is about how the topology of $\Q_N$ is
nothing like the topology of $\R$.  Finally, in
Section~\ref{sec:hasse} we state the Hasse-Minkowski theorem, which
shows how to use $p$-adic numbers to decide whether or not a quadratic
equation in~$n$ variables has a rational zero.

\subsubsection{The $N$-adic Numbers}\index{N@$N$-adic!numbers}
\label{sec:nadic}

\begin{lemma}\label{lem:ord_lemma}
Let $N$ be a positive integer.  Then for any 
nonzero rational number~$\alpha$ there exists a
unique $e\in\Z$ and  integers~$a$,~$b$, with $b$ positive, such that 
$\alpha = N^e \cdot \frac{a}{b}$ with
$N\nmid a$, $\gcd(a,b)=1$, and $\gcd(N,b)=1$.
\end{lemma}
\begin{proof}
Write $\alpha = c/d$ with $c,d\in\Z$ and $d>0$.  
First suppose~$d$ is exactly divisible by a power of~$N$, 
so for some~$r$ we have $N^r\mid d$ but $\gcd(N,d/N^r)=1$.  
Then 
$$
  \frac{c}{d} = N^{-r} \frac{c}{d/N^r}.
$$
If $N^s$ is the largest power of $N$ that divides~$c$, then $e=s-r$,
$a=c/N^s$, $b=d/N^r$ satisfy the conclusion of the lemma.

By unique factorization of integers, there is a smallest multiple~$f$
of~$d$ such that $fd$ is exactly divisible by~$N$.  Now apply the
above argument with~$c$ and~$d$ replaced by $cf$ and $df$.
\end{proof}


\begin{definition}[$N$-adic valuation]
\label{def:nadicvaluation}
Let~$N$ be a positive integer.  For any positive $\alpha\in\Q$, the 
\defn{$N$-adic valuation} of~$\alpha$ is~$e$, where~$e$ is as in
Lemma~\ref{lem:ord_lemma}.  The $N$-adic  valuation of~$0$ is~$\infty$.  
\end{definition}
We denote the $N$-adic valuation of $\alpha$ by $\ord_N(\alpha)$.
(Note: Here we are using ``valuation'' in a different way than in the
rest of the text.  This valuation is not an absolute value, but the
logarithm of one.)

\begin{definition}[$N$-adic metric]
\label{def:nadicmetric}
For $x,y\in\Q$ the \defn{$N$-adic distance} 
between~$x$ and~$y$ is
$$
  d_N(x,y) = N^{-\ord_N(x-y)}.
$$
We let $d_N(x,x) = 0$, since $\ord_N(x-x)=\ord_N(0)=\infty$.
\end{definition}
For example, $x,y\in\Z$ are close  in the $N$-adic metric if their
difference is divisible by a large power of~$N$.   E.g., if $N=10$ then
$93427$ and $13427$ are close because their difference is $80000$, which 
is divisible by a large power of~$10$.

\begin{proposition}\label{prop:ismetric}\iprop{$N$-distance is metric}
The distance $d_N$ on~$\Q$ defined above is a metric.  Moreover, 
for all $x,y,z\in\Q$ we have
$$
 d(x,z) \leq \max(d(x,y),d(y,z)).
$$
(This is the ``nonarchimedean'' triangle inequality.)
\end{proposition}
\begin{proof}
The first two properties of Definition~\ref{defn:metric} are
immediate.  For the third, we first prove that if $\alpha,\beta\in\Q$
then 
$$
 \ord_N(\alpha+\beta)\geq \min(\ord_N(\alpha),\ord_N(\beta)).
$$
Assume, without loss, that $\ord_N(\alpha) \leq \ord_N(\beta)$ and
that both $\alpha$ and $\beta$ are nonzero.
Using Lemma~\ref{lem:ord_lemma} write $\alpha=N^e(a/b)$ and 
$\beta=N^f(c/d)$ with~$a$ or~$c$ possibly negative.  Then
$$
 \alpha + \beta = N^e \left(\frac{a}{b} + N^{f-e}\frac{c}{d}\right)
                = N^e \left(\frac{ad+bcN^{f-e}}{bd}\right).
$$
Since $\gcd(N,bd)=1$ it follows that $\ord_N(\alpha+\beta)\geq e$.
Now suppose $x,y, z\in \Q$.  Then
$$
 x-z = (x-y) + (y-z),
$$
so 
$$
 \ord_N(x-z) \geq \min (\ord_N(x-y), \ord_N(y-z)),
$$
hence $d_N(x,z) \leq \max(d_N(x,y), d_N(y,z))$.
\end{proof}

We can finally define the $N$-adic numbers.
\begin{definition}[The $N$-adic Numbers]
  The set of \defn{$N$-adic numbers}, denoted $\Q_N$, is the
  completion of~$\Q$ with respect to the metric $d_N$.
\end{definition}
The set $\Q_N$ is a ring\index{ring!of $N$-adic numbers|nn}, 
but it need not be a field as you will show in Exercises~\ref{ex:padic4} and 
\ref{ex:padic3}. It is a field if and only if $N$ is prime.
Also, $\Q_N$ has a ``bizarre'' topology,
as we will see in Section~\ref{sec:qnweird}.  

\subsubsection{The $10$-adic Numbers}
\label{sec:tenadic}
It's a familiar fact that every real number can be written in the
form 
$$
d_n\ldots d_1 d_0.d_{-1}d_{-2}\ldots
 = d_n 10^{n} + \cdots + d_1 10 + d_0 
   + d_{-1} 10^{-1} + d_{-2} 10^{-2} + \cdots
$$
where each digit $d_i$ is between~$0$ and~$9$, and the sequence can
continue indefinitely to the right.  

The $10$-adic numbers also have decimal expansions, but everything is backward!
To get a feeling for why this might be the case, we consider Euler's\index{Euler}
nonsensical series
$$
  \sum_{n=1}^{\infty} (-1)^{n+1}n! = 1! - 2! + 3! - 4! + 5! - 6! + \cdots.
$$
One can prove (see Exercise~\ref{ex:padic1}) that this series
converges in $\Q_{10}$ to some element $\alpha\in\Q_{10}$.

What is $\alpha$?  How can we write it down?  First note that for all
$M\geq 5$, the terms of the sum are divisible by~$10$, so the difference
between~$\alpha$ and $1! - 2! + 3! - 4!$ is divisible by~$10$.  Thus
we can compute $\alpha$ modulo~$10$ by computing $1! - 2! + 3! - 4!$
modulo~$10$.  Likewise, we can compute~$\alpha$ modulo~$100$
by compute $1! - 2! + \cdots + 9! - 10!$, etc.  
We obtain the following table:
\begin{center}
\begin{tabular}{|rl|}\hline
$\alpha$ & $\mod 10^r$\\\hline
$1$ & $\mod 10$\\
$81$ & $\mod 10^2$\\
$981$ & $\mod 10^3$\\
$2981$ & $\mod 10^4$\\
$22981$ & $\mod 10^5$\\
$422981$ & $\mod 10^6$\\\hline
\end{tabular}
\end{center}
Continuing we see that
$$
 1! - 2! + 3! - 4! + \cdots = 
  \ldots 637838364422981\qquad\text{in $\Q_{10}$ !}
$$

Here's another example.  Reducing $1/7$ modulo larger and larger powers of~$10$ we
see that 
$$
 \frac{1}{7} = \ldots857142857143\qquad\text{in $\Q_{10}$}.
$$

Here's another example, but with a decimal point.
$$
\frac{1}{70} = \frac{1}{10}\cdot \frac{1}{7} = \ldots85714285714.3
$$
We have 
$$\frac{1}{3} + \frac{1}{7} = 
   \ldots66667 + \ldots57143 = \frac{10}{21} = \ldots 23810,
$$
which illustrates that addition with carrying works as usual.

\subsubsection{Fermat's Last Theorem in $\Z_{10}$}
An amusing observation, which people often argued about 
on USENET news back 
in the 1990s, is that Fermat's last theorem\index{Fermat's last theorem} 
is false in $\Z_{10}$. For example, $x^3 + y^3 = z^3$ has a nontrivial solution, namely 
$x = 1$, $y=2$, and $z=\ldots60569$.   Here~$z$ is a cube
root of $9$ in $\Z_{10}$.  Note that it takes some work to prove that there
is a cube root of $9$ in $\Z_{10}$ (see Exercise~\ref{ex:padic2}).

\subsection{The Field of $p$-adic Numbers}\index{$p$-adic field}
The ring $\Q_{10}$ of $10$-adic numbers is isomorphic to
$\Q_{\hspace{.2ex}2}\cross\Q_{\hspace{.2ex}5}$ (see Exercise~\ref{ex:padic3}), so it is not a
field.  For example, the element $\ldots8212890625$ corresponding to
$(1,0)$ under this isomorphism has no inverse.  (To compute~$n$ digits
of $(1,0)$ use the Chinese remainder theorem to find a number that
is~$1$ modulo~$2^{n}$ and~$0$ modulo $5^n$.)  

If~$p$ is prime then $\Q_p$ is a field (see Exercise~\ref{ex:padic4}). 
Since $p\neq 10$ it is a little more
complicated to write $p$-adic numbers down.  People typically write
$p$-adic numbers in the form
$$
  \frac{a_{-\!d}}{p^{d}} + \cdots + \frac{a_{-1}}{p} + a_0 + a_1 p + a_2 p^2 + a_3 p^3 + \cdots
$$
where $0\leq a_i < p$ for each~$i$.     

\subsection{The Topology of $\Q_N$ (is Weird)}\label{sec:qnweird}
\begin{definition}[Connected]\label{def:connected}\index{connected|nn}
Let $X$ be a topological space.  A subset~$S$ of~$X$ is 
\defn{disconnected}
if there exist open subsets $U_1, U_2\subset X$ with $U_1\intersect U_2\intersect S=\emptyset$
and $S=(S\intersect U_1)\union (S\intersect U_2)$ with 
$S\intersect U_1$ and $S\intersect U_2$ nonempty.
If~$S$ is not disconnected it is \defn{connected}.
\end{definition}

The topology on $\Q_N$ is induced by $d_N$, so every open set is a union 
of open balls 
$$
  B(x,r) = \{y \in \Q_N : d_N(x,y) < r\}.
$$
Recall Proposition~\ref{prop:ismetric}, which asserts that for
all $x,y,z$, 
$$
 d(x,z) \leq \max(d(x,y), d(y,z)).
$$
This translates into the following shocking and bizarre lemma:
\begin{lemma}\label{lem:balls}
Suppose $x\in \Q_N$ and $r>0$.  If $y\in\Q_N$ and $d_N(x,y)\geq r$, then
$B(x,r)\intersect B(y,r) = \emptyset$.
\end{lemma}
\begin{proof}
Suppose $z\in B(x,r)$ and $z\in B(y,r)$.  Then 
$$
 r\leq d_N(x,y) \leq \max(d_N(x,z), d_N(z,y)) < r,
$$
a contradiction.
\end{proof}
You should draw a picture to illustrates Lemma~\ref{lem:balls}.
\begin{lemma}\label{lem:opencomplement}\ilem{open ball is closed}
The open ball $B(x,r)$ is also closed.
\end{lemma}
\begin{proof} 
Suppose $y\not\in B(x,r)$.  Then $r\leq d(x,y)$ so
$$ 
 B(y,d(x,y)) \intersect B(x,r)
\subset 
 B(y,d(x,y)) \intersect B(x,d(x,y))
 = \emptyset.
$$
Thus the complement of $B(x,r)$ is a union of open balls.
\end{proof}

The lemmas imply that $\Q_N$ is \defn{totally disconnected},\index{totally disconnected} 
\index{N@$N$-adic!totally disconnected}
in the following sense.
\begin{proposition}\label{prop:disconnected}\iprop{$\Q_N$ totally disconnected}
The only connected subsets of $\Q_N$ are the singleton sets
$\{x\}$ for $x\in\Q_N$ and the empty set.
\end{proposition}
\begin{proof}
Suppose $S\subset \Q_N$ is a nonempty connected set and $x, y$ are distinct
elements of~$S$.  Let $r=d_N(x,y)>0$.  Let $U_1=B(x,r)$ and $U_2$ be
the complement of $U_1$, which is open by Lemma~\ref{lem:opencomplement}.
Then $U_1$ and $U_2$ satisfies the conditions of Definition~\ref{def:connected},
so~$S$ is not connected, a contradiction.
\end{proof}


\subsection{The Local-to-Global Principle of Hasse and Minkowski}\label{sec:hasse}
\index{Hasse}\index{Minkowski}\index{local-to-global principal}
Section~\ref{sec:qnweird} might have convinced you that $\Q_N$ is a
bizarre pathology.  In fact, $\Q_N$ is omnipresent in number theory,
as the following two fundamental examples illustrate.

In the statement of the following theorem, a \defn{nontrivial solution}
to a homogeneous polynomial equation is a solution where not all
indeterminates are~$0$.
\begin{theorem}[Hasse-Minkowski]
\label{thm:hasse_minkowski}\ithm{Hasse-Minkowski}
The quadratic equation 
\begin{equation}\label{eqn:quad}
a_1x_1^2 + a_2 x_2^2 + \cdots + a_n x_n^2 = 0,
\end{equation}
with $a_i\in\Q^{\star}$,
has a nontrivial solution with $x_1,\ldots, x_n$ in $\Q$ if and only 
if  (\ref{eqn:quad}) has a solution in $\R$ and in $\Q_p$ for
all primes~$p$.
\end{theorem}
This theorem is very useful in practice because the 
$p$-adic condition turns out to be easy to check.  For more details,
including a complete proof, see 
\cite[IV.3.2]{serre:arithmetic}.

The analogue of Theorem~\ref{thm:hasse_minkowski}
for cubic equations is false.
For example, Selmer\index{Selmer}\index{Selmer curve} proved that the cubic 
$$
 3x^3 + 4y^3 + 5z^3 = 0
$$
has a solution other than $(0,0,0)$ in $\R$ and in $\Q_p$ for all primes~$p$
but has no solution other than $(0,0,0)$ in~$\Q$ (for a proof 
see \cite[\S 18]{cassels:lectures}).

\vspace{1ex}
\noindent{\bf Open Problem. }\index{open problem!solvability of plane cubics}
Give an algorithm that decides whether or not a cubic $$ax^3 + by^3 + cz^3=0$$
has a nontrivial solution in~$\Q$.
\vspace{1ex}

This open problem is closely related to the Birch and Swinnerton-Dyer
Conjecture\index{Birch and Swinnerton-Dyer conjecture} 
for elliptic curves\index{elliptic curve}. 
The truth of the conjecture would
follow if we knew that ``Shafarevich-Tate Groups''\index{Shafarevich-Tate group} 
of elliptic  curves were finite.


\section{Weak Approximation}

The following theorem asserts that inequivalent valuations are in fact
almost totally indepedent.  For our purposes it will be superseded by
the strong approximation theorem (Theorem~\ref{thm:strong}).

\begin{theorem}[Weak Approximation]\label{thm:weakapprox}\ithm{weak approximation}
  Let $\absspc_n$, for $1\leq n \leq N$, be inequivalent nontrivial
  valuations of a field $K$.  For each $n$, let $K_n$ be the
  topological space consisting of the set of elements of $K$ with the
  topology induced by $\absspc_n$.  Let $\Delta$ be the image of $K$
  in the topological product $$A=\prod_{1\leq n\leq N} K_n$$ equipped
  with the product topology.  Then $\Delta$ is dense in $A$.
\end{theorem}
The conclusion of the theorem may be expressed in a less topological
manner as follows: given any $a_n\in K$, for $1\leq n \leq N$, and
real $\eps>0$, there is an $b\in K$ such that simultaneously
$$
  \abs{a_n - b}_n  < \eps \qquad (1\leq n\leq N).
$$

If $K=\Q$ and the $\absspc{}$ are $p$-adic valuations,
Theorem~\ref{thm:weakapprox} is related to the Chinese Remainder
Theorem (Theorem~\ref{thm:crt}), but the strong approximation theorem 
(Theorem~\ref{thm:strong}) is the
real generalization.  

\begin{proof}
  We note first that it will be enough to find, for each $n$, an
  element $c_n\in K$ such that 
$$
  \abs{c_n}_n > 1 \quad \text{ and } \quad \abs{c_n}_m < 1
  \quad\text{ for }n\neq m,
  $$
  where $1\leq n,m\leq N$.  For then as $r\to+\infty$, we have
$$
\frac{c_n^r}{1+c_n^r} = \frac{1}{1+\left(\frac{1}{c_n}\right)^{r}}
 \to \begin{cases} 1 & \text{with respect to } \absspc_n \text{ and }\\
                   0 & \text{with respect to } \absspc_m, \text{ for }
                   m\neq n.
     \end{cases}
     $$
  It is then enough to take
$$
   b = \sum_{n=1}^N \frac{c_n^r}{1+c_n^r} \cdot a_n
$$

By symmetry it is enough to show the existence of $c=c_1$ with
$$
  \abs{c}_1 > 1 \qquad \text{and} \qquad \abs{c}_n<1 \quad
\text{for} \quad 2\leq n\leq N.
$$
We will do this by induction on $N$.

First suppose $N=2$.  Since $\absspc_1$ and $\absspc_2$ are
inequivalent (and all absolute values are assumed nontrivial)
there is an $a\in K$ such that 
\begin{equation}\label{eqn:nonobvious}
  \abs{a}_1 < 1\qquad \text{and}\qquad \abs{a}_2 \geq 1
\end{equation}
and similarly a $b$ such that 
$$
  \abs{b}_1 \geq 1\qquad \text{and}\qquad \abs{b}_2 < 1.
$$
Then $\ds c=\frac{b}{a}$ will do.

\begin{remark}  
  It is not completely clear that
  one can choose an~$a$ such that (\ref{eqn:nonobvious}) is satisfied.
  Suppose it were impossible.  Then because the valuations are
  nontrivial, we would have that for any $a\in K$ if $\abs{a}_1<1$
  then $\abs{a}_2<1$.  This implies the converse statement: if $a\in
  K$ and $\abs{a}_2<1$ then $\abs{a}_1<1$.  To see this, suppose there
  is an $a\in K$ such that $\abs{a}_2<1$ and $\abs{a}_1\geq 1$.
  Choose $y\in K$ such that $\abs{y}_1<1$.  Then for any integer $n>0$
  we have $\abs{y/a^n}_1<1$, so by hypothesis $\abs{y/a^n}_2<1$.  Thus
  $\abs{y}_2 < \abs{a}_2^n < 1$ for all $n$.  Since $\abs{a}_2<1$ we
  have $\abs{a}_2^n\to 0$ as $n\to\infty$, so $\abs{y}_2=0$, a
  contradiction since $y\neq 0$.  Thus $\abs{a}_1<1$ if and only if
  $\abs{a}_2<1$, and we have proved before that this implies that
  $\absspc_1$ is equivalent to $\absspc_2$.
\end{remark}


Next suppose $N\geq 3$.  By the case $N-1$, there is an $a\in K$ such
that 
$$
  \abs{a}_1 > 1 \qquad \text{and} \qquad \abs{a}_n<1 \quad
\text{for} \quad 2\leq n\leq N-1.
$$
By the case for $N=2$ there is a $b\in K$ such that 
$$
   \abs{b}_1>1 \qquad\text{and}\qquad\abs{b}_N<1.
$$
Then put
$$
c = \begin{cases}
  a & \text{if } \abs{a}_N<1\\
  a^r\cdot b & \text{if } \abs{a}_N=1\\
  {\ds\frac{a^r}{1+a^r}}\cdot b & \text{if }\abs{a}_N>1
\end{cases}
$$
where $r\in\Z$ is sufficiently large so that
$\abs{c}_1>1$ and $\abs{c}_n<1$ for $2\leq n\leq N$.
\end{proof}

\begin{example}\label{ex:weakapprox}
  Suppose $K=\Q$, let $\absspc_1$ be the archimedean absolute value
  and let $\absspc_2$ be the $2$-adic absolute value.  Let $a_1=-1$,
  $a_2=8$, and $\eps=1/10$, as in the remark right after
  Theorem~\ref{thm:weakapprox}.  Then the theorem implies that there
  is an element $b\in \Q$ such that 
$$
 \abs{-1-b}_1 < \frac{1}{10} \qquad\text{and}\qquad \abs{8-b}_2 < \frac{1}{10}.
 $$
 As in the proof of the theorem, we can find such a $b$ by finding
 a $c_1, c_2\in\Q$ such that $\abs{c_1}_1>1$ and $\abs{c_1}_2<1$, and
a $\abs{c_2}_1<1$ and $\abs{c_2}_2>1$.  For example,
 $c_1=2$ and $c_2=1/2$ works, since $\abs{2}_1 = 2$ and $\abs{2}_2 =
 1/2$ and 
$\abs{1/2}_1=1/2$ and $\abs{1/2}_2=2$.  Again
 following the proof, we see that for sufficiently large $r$
we can take 
\begin{align*}
   b_r &= \frac{c_1^r}{1+c_1^r} \cdot a_1 + 
     \frac{c_2^r}{1+c_2^r} \cdot a_2\\
     &=\frac{2^r}{1+2^r} \cdot (-1) + 
     \frac{(1/2)^r}{1+(1/2)^r} \cdot 8.
   \end{align*}
We have $b_1 = 2$, $b_2 = 4/5$, $b_3 = 0$, $b_4 = -8/17$, 
$b_5 = -8/11$, $b_6 = -56/55$.  None of the $b_i$ work for $i<6$,
but $b_6$ works.
\end{example} 

\chapter{Adic Numbers: The Finite Residue Field Case}

\section{Finite Residue Field Case}
Let $K$ be a field with a non-archimedean valuation $v=\absspc$.
Recall that the set of $a\in K$ with $\abs{a}\leq 1$ forms a ring
$\O$, the ring of integers for $v$.  The set of $u\in K$ with
$\abs{u}=1$ are a group $U$ under multiplication, the group of units
for $v$.  Finally, the set of $a\in K$ with $\abs{a}<1$ is a maximal
ideal $\p$, so the quotient ring $\O/\p$ is a field.  In this section
we consider the case when $\O/\p$ is a finite field of order a prime
power~$q$.  For example, $K$ could be $\Q$ and $\absspc{}$ could be a
$p$-adic valuation, or $K$ could be a number field and $\absspc{}$
could be the valuation corresponding to a maximal ideal of the ring of
integers.  Among other things, we will discuss in more depth the
topological and measure-theoretic nature of the completion of $K$ at
$v$.

Suppose further for the rest of this section that $\absspc{}$ is
discrete.  Then by Lemma~\ref{lem:discrete_principal}, the ideal $\p$
is a principal ideal $(\pi)$, say, and every $a\in K$ is of the form
$a=\pi^n\eps$, where $n\in\Z$ and $\eps\in U$ is a unit. We call
$$
n = \ord(a) = \ord_\pi(a) = \ord_\p(a) = \ord_v(a)
$$
the ord of~$a$ at~$v$.  (Some authors, including me (!) also call
this integer the \defn{valuation} of~$a$ with respect to~$v$.)  If
$\p=(\pi')$, then $\pi/\pi'$ is a unit, and conversely, so $\ord(a)$
is independent of the choice of~$\pi$.

Let $\O_v$ and $\p_v$ be defined with respect to the completion $K_v$
of $K$ at $v$.  
\begin{lemma}\ilem{reduction homomorphism}
There is a natural isomorphism 
$$
\vphi:\O_v/\p_v \to \O/\p,
$$
and $\p_v = (\pi)$ as an $\O_v$-ideal.
\end{lemma}
\begin{proof}
  We may view $\O_v$ as the set of equivalence classes of Cauchy
  sequences $(a_n)$ in $K$ such that $a_n\in \O$ for $n$ sufficiently
  large.  For any $\eps$, given such a sequence $(a_n)$, there is $N$
  such that for $n,m\geq N$, we have $\abs{a_n-a_m}<\eps$.  In
  particular, we can choose $N$ such that $n,m\geq N$ implies that
  $a_n\con a_m\pmod{\p}$.  Let $\vphi((a_n)) = a_N\pmod{\p}$, which is
  well-defined.  The map $\vphi$ is surjective because the constant
  sequences are in $\O_v$.  Its kernel is the set of Cauchy sequences
  whose elements are eventually all in $\p$, which is exactly $\p_v$.
  This proves the first part of the lemma.  The second part is true
  because any element of $\p_v$ is a sequence all of whose terms are
  eventually in $\p$, hence all a multiple of $\pi$ (we can set to $0$
  a finite number of terms of the sequence without changing the
  equivalence class of the sequence).
\end{proof}

{\em Assume for the rest of this section that $K$ is complete with
  respect to $\absspc$.}
\begin{lemma}\ilem{adic-expansion}
Then ring $\O$ is precisely the set of infinite sums 
\begin{equation}\label{eq:infsum}
  a = \sum_{j=0}^{\infty} a_j \cdot \pi^j
\end{equation}
where the $a_j$ run independently through some set $\cR$ of
representatives of $\O$ in $\O/\p$.
\end{lemma}
By (\ref{eq:infsum}) is meant the limit of the Cauchy sequence
$\sum_{j=0}^n a_j\cdot \pi^j$ as $j\to\infty$.
\begin{proof}
There is a uniquely defined $a_0\in \cR$ such that $\abs{a-a_0}<1$.
Then $a' = \pi^{-1}\cdot (a-a_0) \in \O$.  Now define
$a_1\in \cR$ by $\abs{a'-a_1}<1$.  And so on.
\end{proof}
\begin{example}
  Suppose $K=\Q$ and $\absspc=\absspc_p$ is the $p$-adic valuation,
  for some prime~$p$.  We can take $\cR=\{0,1,\ldots, p-1\}$.
  The lemma asserts that 
  $$\O=\Z_p = \left\{ \sum_{j=0}^{\infty} a_n p^n : 0\leq a_n\leq
    p-1\right\}.$$
  Notice that $\O$ is uncountable since there are $p$
  choices for each $p$-adic ``digit''.  We can do arithmetic with
  elements of $\Z_p$, which can be thought of ``backwards'' as numbers
  in base $p$.  For example, with $p=3$ we have
  \begin{align*}
&   (1+2\cdot 3 + 3^2 + \cdots ) + (2 + 2\cdot 3 + 3^2 + \cdots ) \\
& = 3+4\cdot 3 + 2\cdot 3^2 + \cdots   \qquad \text{not in canonical form}\\
& = 0 + 2\cdot 3 + 3\cdot 3 + 2\cdot 3^2 + \cdots \qquad\text{still not canonical}\\
& = 0 + 2\cdot 3 + 0\cdot 3^2 + \cdots 
\end{align*}

Basic arithmetic with the $p$-adics in \magma{} is really weird (even
weirder than it was a year ago...  There are presumably efficiency
advantages to using the \magma{} formalization, and it's supposed to be
better for working with extension fields.  But I can't get it to do
even the calculation below in a way that is clear.)  In PARI (gp) the
$p$-adics work as expected:
\begin{verbatim}
   ? a = 1 + 2*3 + 3^2 + O(3^3);
   ? b = 2 + 2*3 + 3^2 + O(3^3); 
   ? a+b
   %3 = 2*3 + O(3^3)
   ? sqrt(1+2*3+O(3^20))  
   %5 = 1 + 3 + 3^2 + 2*3^4 + 2*3^7 + 3^8 + 3^9 + 2*3^10 + 2*3^12 
          + 2*3^13 + 2*3^14 + 3^15 + 2*3^17 + 3^18 + 2*3^19 + O(3^20)
   ? 1/sqrt(1+2*3+O(3^20))   
   %6 = 1 + 2*3 + 2*3^2 + 2*3^7 + 2*3^10 + 2*3^11 + 2*3^12 + 2*3^13 
          + 2*3^14 + 3^15 + 2*3^16 + 2*3^17 + 3^18 + 3^19 + O(3^20)
\end{verbatim}
\end{example}

\begin{theorem}\label{thm:compact}\ithm{compactness of ring of integers}
Under the conditions of the preceding lemma, $\O$ is compact with
respect to the $\absspc{}$-topology. 
\end{theorem}
\begin{proof}
  Let $V_\lambda$, for $\lambda$ running through some index set
  $\Lambda$, be some family of open sets that cover $\O$.  We must
  show that there is a finite subcover.  We suppose not.
  
  Let $\cR$ be a set of representatives for $\O/\p$.  Then $\O$ is the
  union of the finite number of cosets $a+\pi\O$, for $a\in \cR$.
    Hence for at lest one $a_0\in \cR$ the set $a_0+\pi \O$
    is not covered by finitely many of the $V_\lambda$.  Then similarly
  there is an $a_1\in \cR$ such that $a_0 + a_1\pi + \pi^2\O$ is not
  finitely covered. And so on.  Let 
  $$
  a = a_0 + a_1\pi + a_2 \pi^2 + \cdots \in \O.
  $$
  Then $a\in V_{\lambda_0}$ for some $\lambda_0\in\Lambda$.  Since
  $V_{\lambda_0}$ is an open set, $a+\pi^J\cdot \O\subset
  V_{\lambda_0}$ for some~$J$ (since those are exactly the open balls
  that form a basis for the topology). This is a contradiction because
  we constructed $a$ so that none of the sets $a+\pi^n\cdot \O$, for
  each $n$, are not covered by any finite subset of the $V_{\lambda}$.
\end{proof}

\begin{definition}[Locally compact]
  A topological space $X$ is \defn{locally compact} at a point $x$ if
  there is some compact subset $C$ of $X$ that contains a neighborhood
  of~$x$.  The space $X$ is locally compact if it is locally compact
  at each point in $X$.
\end{definition}
\begin{corollary}\label{cor:locally_compact}\icor{complete local field locally compact}
The complete local field $K$ is locally compact.
\end{corollary}
\begin{proof}
  If $x\in K$, then $x \in C=x+\O$, and $C$ is a compact subset of $K$
  by Theorem~\ref{thm:compact}.  Also $C$ contains the neighborhood
  $x+\pi\O = B(x,1)$ of $x$.  Thus $K$ is locally compact at $x$.
\end{proof}

\begin{remark}\label{rem:locally_compact}
The converse is also true.  If $K$ is locally compact with respect to
a non-archimedean valuation $\absspc{}$, then
\begin{enumerate}
\item $K$ is complete,
\item the residue field is finite, and
\item the valuation is discrete.
\end{enumerate}
For there is a compact neighbourhood $C$ of $0$.  
Let $\pi$ be any nonzero with $\abs{\pi}<1$.
Then $\pi^n\cdot
\O\subset C$ for sufficiently large $n$, so $\pi^n\cdot \O$ is
compact, being closed.  Hence $\O$ is compact.  Since $\absspc$ is a
metric, $\O$ is sequentially compact, i.e., every fundamental sequence
in $\O$ has a limit, which implies (1).  Let $a_\lambda$ (for
$\lambda\in\Lambda$) be a set of representatives in $\O$ of $\O/\p$.
Then $\O_{\lambda} = \{z : \abs{z-a_{\lambda}}<1\}$ is an open
covering of $\O$.  Thus (2) holds since $\O$ is compact.  Finally,
$\p$ is compact, being a closed subset of $\O$.  Let $S_n$ be the set
of $a\in K$ with $\abs{a}<1-1/n.$  Then $S_n$ (for $1\leq n < \infty$)
is an open covering of $\p$, so $\p=S_n$ for some $n$, i.e., (3) is
true. 

If we allow $\absspc{}$ to be archimedean the only further
possibilities are $k=\R$ and $k=\C$ with $\absspc{}$ equivalent to the
usual absolute value.
\end{remark}

We denote by $K^+$ the commutative topological group whose points are
the elements of $K$, whose group law is addition and whose topology is
that induced by $\absspc$.  General theory tells us that there is an
invariant Haar measure defined on $K^+$ and that this
measure is unique up to a multiplicative constant.  

\begin{definition}[Haar Measure]\label{defn:haar}
A \defn{Haar measure} on a locally compact topological group 
$G$ is a translation invariant measure such that every open
set can be covered by open sets with finite measure. 
\end{definition}

\begin{lemma}\ilem{Haar measure on compact}
  Haar measure of any compact subset $C$ of $G$ is finite.  
\end{lemma}
\begin{proof}
The whole group $G$ is open, so there is a covering $U_\alpha$
of $G$ by open sets each of which has finite measure. 
Since $C$ is compact, there is a finite subset of the $U_\alpha$
that covers $C$.  The measure of $C$ is at most the sum of
the measures of these finitely many $U_\alpha$, hence finite.
\end{proof}

\begin{remark}
  Usually one defined Haar measure to be a translation invariant
  measure such that the measure of compact sets is finite.  Because of
  local compactness, this definition is equivalent to
  Definition~\ref{defn:haar}.  We take this alternative viewpoint
  because Haar measure is constructed naturally on the topological
  groups we will consider by defining the measure on each member of a
  basis of open sets for the topology.
\end{remark}

We now deduce what any such measure $\mu$ on $G=K^+$ must be.  Since
$\O$ is compact (Theorem~\ref{thm:compact}), the measure of $\O$ is
finite.  Since $\mu$ is translation invariant,
$$
  \mu_n = \mu(a + \pi^n \O)
$$
is independent of $a$.  Further, 
$$
a + \pi^n\O = \bigcup_{1\leq j\leq q} a + \pi^n a_j + \pi^{n+1}\O,
\qquad\text{(disjoint union)}
$$
where $a_j$ (for $1\leq j \leq q$) is a set of representatives of
$\O/\p$. Hence
$$
 \mu_n = q\cdot \mu_{n+1}.
$$
If we normalize $\mu$ by putting 
$$
 \mu(\O) = 1
 $$
 we have $\mu_0 = 1$, hence $\mu_1 = q$, and in general $$\mu_n =
 q^{-n}.$$
 
 Conversely, without the theory of Haar measure, we could {\em define}
 $\mu$ to be the necessarily unique measure on $K^+$ such that
 $\mu(\O)=1$ that is translation invariant.  This would have to be the
 $\mu$ we just found above.
 
 Everything so far in this section has depended not on the valuation
 $\absspc$ but only on its equivalence class.  The above
 considerations now single out one valuation in the equivalence class
 as particularly important.
\begin{definition}[Normalized valuation]\label{defn:normalized}
Let $K$ be a field equipped with a discrete valuation $\absspc$
and residue class field with $q<\infty$ elements.  We say that
$\absspc$ is \defn{normalized} if 
$$
\abs{\pi} = \frac{1}{q},
$$
where $\p=(\pi)$ is the maximal ideal of $\O$.
\end{definition}
\begin{example}
The normalized valuation on the $p$-adic numbers $\Q_p$ is 
$\abs{u\cdot p^n} = p^{-n}$, where $u$ is a rational number
whose numerator and denominator are coprime to $p$.

Next suppose $K=\Q_p(\sqrt{p})$.  Then the $p$-adic valuation on 
$\Q_p$ extends uniquely to one on $K$ such that 
$\abs{\sqrt{p}}^2 = \abs{p} = 1/p$.  Since $\pi=\sqrt{p}$
for $K$, this valuation is not normalized.  (Note that
the ord of $\pi=\sqrt{p}$ is $1/2$.)
The normalized valuation is $v=\absspc' = \absspc^2$.  Note that 
$\absspc'{p} = 1/p^2$, or $\ord_v(p)=2$ instead of $1$.

Finally suppose that $K=\Q_p(\sqrt{q})$ where $x^2-q$
has not root mod $p$.  Then the residue class field 
degree is $2$, and the normalized valuation must
satisfy $\abs{\sqrt{q}} = 1/p^2$.
\end{example}

The following proposition makes clear why this is the best choice of
normalization.
\begin{theorem}\ithm{properties of Haar measure}
Suppose further that $K$ is complete with respect to the normalized
valuation $\absspc{}$.  Then 
$$
\mu(a + b\O) = \abs{b},
$$
where $\mu$ is the Haar measure on $K^+$ normalized so
that $\mu(\O)=1$.
\end{theorem}
\begin{proof}
Since $\mu$ is translation invariant, $\mu(a+b\O) = \mu(b\O)$.
Write $b=u\cdot \pi^n$, where $u$ is a unit. Then since $u\cdot
\O=\O$, we have
$$\mu(b\O) 
  = \mu(u\cdot \pi^n\cdot \O) = \mu(\pi^n \cdot u\cdot\O)
    = \mu(\pi^n\cdot \O) = q^{-n} = \abs{\pi^n} = \abs{b}.
$$
Here we have $\mu(\pi^n\cdot \O) = q^{-n}$ by the discussion
before Definition~\ref{defn:normalized}.
\end{proof}

We can express the result of the theorem in a more suggestive way.
Let $b\in K$ with $b\neq 0$, and let $\mu$ be a Haar measure on $K^+$
(not necessarily normalized as in the theorem).  Then we can define a
new Haar measure $\mu_b$ on $K^+$ by putting $\mu_b(E) = \mu(bE)$ for
$E\subset K^+$.  But Haar measure is unique up to a multiplicative
constant and so $\mu_b(E) = \mu(bE) = c\cdot \mu(E)$ for all
measurable sets $E$, where the factor~$c$ depends only on~$b$.
Putting $E=\O$, shows that the theorem implies that~$c$ is just
$\abs{b}$, when $\absspc$ is the normalized valuation.

\begin{remark}
  The theory of locally compact topological groups leads to the
  consideration of the dual (character) group of $K^+$.  It turns out
  that it is isomorphic to $K^+$.  We do not need this fact for class
  field theory, so do not prove it here.  For a proof and applications
  see Tate's thesis or Lang's {\em Algebraic Numbers}, and for
  generalizations see Weil's {\em Adeles and Algebraic Groups} and
  Godement's Bourbaki seminars 171 and 176.  The determination of the
  character group of $K^*$ is local class field theory.
\end{remark} 

The set of nonzero elements of~$K$ is a group $K^*$ under
multiplication.  Multiplication and inverses are continuous with
respect to the topology induced on $K^*$ as a subset of $K$, so $K^*$
is a topological group with this topology.  We have 
$$
  U_1 \subset U \subset K^*
  $$
  where $U$ is the group of units of $\O\subset K$ and $U_1$ is
  the group of $1$-units, i.e., those units $\eps\in U$ with
  $\abs{\eps-1}<1$, so
  $$U_1 = 1 + \pi\O.$$
  The set $U$ is the open ball about $0$ of
  radius $1$, so is open, and because the metric is nonarchimedean $U$
  is also closed.  Likewise, $U_1$ is both open and closed.

  The quotient $K^*/U = \{ \pi^n \cdot U : n \in \Z\}$ is isomorphic to the additive group $\Z^+$
of integers with the discrete topology, where the map is 
$$
 \pi^n\cdot U \mapsto n  \qquad \text{ for } n\in\Z.
 $$

The quotient
 $U/U_1$ is isomorphic to the multiplicative group $\F^*$ of the
 nonzero elements of the residue class field, where the finite gorup
 $\F^*$ has the discrete topology.  
Note that $\F^*$ is cyclic
 of order $q-1$, and Hensel's lemma implies that $K^*$ contains a
 primitive $(q-1)$th root of unity $\zeta$.  Thus $K^*$ has
the following structure:
$$
K^* = \{ \pi^n\zeta^m\eps : n\in \Z, m\in\Z/(q-1)\Z, \eps\in U_1\}
\isom \Z\,\, \cross\,\, \Z/(q-1)\Z \,\,\cross\,\, U_1.
$$
(How to apply Hensel's lemma: Let $f(x) = x^{q-1}-1$ and let
$a\in\O$ be such that $a\mod\p$ generates $K^*$.  Then $\abs{f(a)}<1$
and $\abs{f'(a)}=1$.  By Hensel's lemma  there is a
$\zeta\in K$ such that $f(\zeta)=0$ and $\zeta\con a\pmod{\p}$.)

Since $U$ is compact and the cosets of $U$ cover $K$, we see that
$K^*$ is locally compact.  
\begin{lemma}\ilem{Haar measure on $K^*$}
The additive Haar measure $\mu$ on $K^+$,
when restricted to $U_1$ gives a measure on $U_1$ that is also
invariant under multiplication, so gives a Haar measure on $U_1$.
\end{lemma}
\begin{proof}
It suffices to show that
$$\mu(1+\pi^n\O) = \mu(u\cdot(1+\pi^n\O)),$$ 
for any $u\in U_1$ and $n>0$.
Write $u=1+a_1\pi + a_2\pi^2 +\cdots$.
We have
\begin{align*}
 u\cdot (1+\pi^n\O) &= (1+a_1\pi + a_2\pi^2 +\cdots)\cdot (1+\pi^n\O)\\
  &= 1+a_1\pi + a_2\pi^2 + \cdots + \pi^n\O\\
  &= a_1\pi + a_2\pi^2 + \cdots + ( 1+\pi^n\O),
\end{align*}
which is an additive translate of $1+\pi^n\O$, hence has the
same measure. 
\end{proof}
Thus $\mu$ gives a Haar measure on $K^*$ by translating $U_1$ around
to cover $K^*$.

\begin{lemma}\ilem{$K^+$ and $K^*$ are totally disconnected}
The topological spaces $K^+$ and $K^*$ are totally disconnected (the
only connected sets are points).
\end{lemma}
\begin{proof}
  The proof is the same as that of
  Proposition~\ref{prop:disconnected}.  The point is that the
  non-archimedean triangle inequality forces the complement an open
  disc to be open, hence any set with at least two distinct elements
  ``falls apart'' into a disjoint union of two disjoint open subsets.
\end{proof}

\begin{remark}
Note that $K^*$ and $K^+$ are locally isomorphic if $K$ has
characteristic~$0$.   We have the exponential map
$$
a \mapsto \exp(a) = \sum_{n=0}^{\infty} \frac{a^n}{n!}
$$
defined for all sufficiently small $a$ with its inverse
$$
\log(a) = \sum_{n=1}^{\infty} \frac{(-1)^{n-1}(a-1)^n}{n},
$$
which is defined for all $a$ sufficiently close to $1$.
\end{remark}

\chapter{Normed Spaces and Tensor Products}
Much of this chapter is preparation for what we will do later
when we will prove that if~$K$ is complete with respect to a valuation
(and locally compact) and~$L$ is a finite extension of~$K$, then there
is a {\em unique} valuation on~$L$ that extends the valuation on~$K$.
Also, if~$K$ is a number field, $v=\absspc{}$ is a valuation on~$K$,
$K_v$ is the completion of~$K$ with respect to~$v$, and~$L$ is a
finite extension of~$K$, we'll prove that
$$
 K_v \tensor_K L   = \bigoplus_{j=1}^J L_j,
 $$
 where the $L_j$ are the completions of~$L$ with respect to the
 equivalence classes of extensions of~$v$ to~$L$.  In particular,
 if~$L$ is a number field defined by a root of $f(x)\in \Q[x]$, then
$$
  \Q_p  \tensor_\Q  L = \bigoplus_{j=1}^J L_j,
$$
 where the $L_j$ correspond to the irreducible factors of
 the polynomial $f(x) \in \Q_p[x]$ (hence the extensions of 
$\absspc_p$ correspond to irreducible factors of $f(x)$
over $\Q_p[x]$).  

In preparation for this clean view of the local nature of number
fields, we will prove that the norms on a finite-dimensional
vector space over a complete field are all equivalent.  We will also
explicitly construct tensor products of fields and deduce some of
their properties.

\section{Normed Spaces}
\begin{definition}[Norm]\label{defn:norm} 
Let $K$ be a field with valuation $\absspc$ and let $V$ be a vector space 
over $K$.  A real-valued function $\normspc$ on $V$ is called a \defn{norm} if 
\begin{enumerate}
\item $\norm{v}>0$ for all nonzero $v\in V$ (positivity).
\item $\norm{v+w} \leq \norm{v} + \norm{w}$ for all $v,w\in V$ (triangle inequality). 
\item $\norm{av} = \abs{a}\norm{v}$ for all $a\in K$ and $v\in V$ (homogeneity).
\end{enumerate} 
\end{definition}
Note that setting $\norm{v}=1$ for all $v\neq 0$ does {\em not} define
a norm unless the absolute value on $K$ is trivial, as $1=\norm{av} =
\abs{a}\norm{v}=\abs{a}$.  We assume for the rest of this section
that $\absspc{}$ is not trivial.

\begin{definition}[Equivalent]
  Two norms $\normspc_1$ and $\normspc_2$ on the same vector space~$V$
  are \defn{equivalent} if there exists positive real numbers $c_1$ and $c_2$
  such that for all $v\in V$
$$
  \norm{v}_1 \leq c_1 \norm{v}_2
  \qquad\text{and}\qquad
  \norm{v}_2 \leq c_2 \norm{v}_1.
$$
\end{definition}

\begin{lemma}\label{lem:ext_unique}\ilem{any two norms equivalent}
Suppose that $K$ is a field that is complete with respect to a valuation
$\absspc{}$ and that $V$ is a finite dimensional~$K$ vector space.  
Continue to assume, as mentioned above, that $K$ is complete
with respect to $\absspc{}$.
Then any two norms on $V$ are equivalent.
\end{lemma}
\begin{remark}
  As we shall see soon (see Theorem~\ref{thm:extensions}), the lemma
  is usually false if we do not assume that~$K$ is complete.  For
  example, when $K=\Q$ and $\absspc_p$ is the $p$-adic valuation, and
  $V$ is a number field, then there may be several extensions of
  $\absspc_p$ to inequivalent norms on $V$.
\end{remark}
If two norms are equivalent then the corresponding topologies on~$V$
are equal, since very open ball for $\normspc_1$ is contained in an
open ball for $\normspc_2$, and conversely. (The converse is also
true, since, as we will show, all norms on~$V$ are equivalent.)
\begin{proof} 
Let $v_1,\ldots, v_N$ be a basis for~$V$.  Define the max
norm $\normspc_0$ by 
$$
\norm{\sum_{n=1}^N a_n v_n}_0 = \max \left\{\abs{a_n} : n=1,\ldots, N\right\}.
$$
It is enough to show that any norm $\normspc$ is equivalent to
$\normspc_0$.  We have
\begin{align*}
\norm{\sum_{n=1}^N a_n v_n} & \leq
    \sum_{n=1}^N \abs{a_n} \norm{v_n} \\
    &\leq \sum_{n=1}^N \max{\abs{a_n}} \norm{v_n}\\
    & = c_1 \cdot \norm{\sum_{n=1}^N a_n v_n}_0,
\end{align*}
where $c_1 = \sum_{n=1}^N \norm{v_n}$.

To finish the proof, we show that there is a 
$c_2\in \R$ such that for all $v\in V$,
$$
 \norm{v}_0 \leq c_2 \cdot \norm{v}.
$$
We will only prove this in the case when $K$ is not just merely complete
with respect to $\absspc{}$ but also locally compact.  This will 
be the case of primary interest to us.  For a proof in the general case,
see the original article by Cassels (page 53). 

By what we have already shown, the function $\norm{v}$ is continuous
in the $\normspc_0$-topology, so by local compactness it attains its
lower bound $\delta$ on the unit circle $\left\{v\in V :
  \norm{v}_0=1\right\}$.  (Why is the unit circle compact?  With
respect to $\normspc_0$, the topology on $V$ is the same as that of a
product of copies of $K$.  If the valuation is archimedean then
$K\isom \R$ or $\C$ with the standard topology and the unit circle is
compact.  If the valuation is non-archimedean, then we saw (see
Remark~\ref{rem:locally_compact}) that if~$K$ is locally compact, then
the valuation is discrete, in which case we showed that the unit disc
is compact, hence the unit circle is also compact since it is closed.)
Note that $\delta>0$ by part 1 of Definition~\ref{defn:norm}.  Also,
by definition of $\normspc_0$, for any $v\in V$ there exists $a\in K$
such that $\norm{v}_0 = \abs{a}$ (just take the max coefficient in our
basis).  Thus we can write any $v\in V$ as $a\cdot w$ where $a\in K$
and $w\in V$ with $\norm{w}_0=1$.  We then have
$$
\frac{\norm{v}_0}{\norm{v}} = 
\frac{\norm{aw}_0}{\norm{aw}}
= \frac{\abs{a}\norm{w}_0}{\abs{a}\norm{w}}
= \frac{1}{\norm{w}} \leq \frac{1}{\delta}.
$$
Thus for 
all~$v$ we have
$$\norm{v}_0\leq c_2\cdot \norm{v},$$
where $c_2 = 1/\delta$, which proves the theorem. 
\end{proof}


\section{Tensor Products}
We need only a special case of the tensor product construction.
Let~$A$ and~$B$ be commutative rings containing a field~$K$ and suppose that~$B$ is of finite dimension~$N$ over~$K$, say, with basis 
$$
  1=w_1, w_2, \ldots, w_N.
$$
Then~$B$ is determined up to isomorphism as a ring over~$K$
by the multiplication table $(c_{i,j,n})$ defined by
$$
   w_i \cdot w_j = \sum_{n=1}^N c_{i,j,n} \cdot w_n.
$$
We define a new ring~$C$ containing~$K$ whose elements are 
the set of all expressions
$$
\sum_{n=1}^N a_n \ww_n
$$
where the $\ww_n$ have the same multiplication rule
$$
   \ww_i \cdot \ww_j = \sum_{n=1}^N c_{i,j,n} \cdot \ww_n
$$
as the $w_n$. 

There are injective ring homomorphisms
$$  
i:A\hra C, \qquad i(a) = a \ww_1  \qquad \text{(note that $\ww_1=1$)}
$$
and 
$$
j:B\hra C, \qquad j\left(\sum_{n=1}^N c_n w_n\right) = \sum_{n=1}^N c_n \ww_n.
\qquad\quad\,\,\,\,\mbox{}
$$
Moreover~$C$ is defined, up to isomorphism, by~$A$ and~$B$ and is
independent of the particular choice of basis $w_n$ of~$B$ (i.e., a
change of basis of $B$ induces a canonical isomorphism of the $C$
defined by the first basis to the $C$ defined by the second basis).
We write
$$
  C = A\tensor_K B
$$
since~$C$ is, in fact, a special case of the ring tensor product.

Let us now suppose, further, that~$A$ is a topological ring, i.e., has
a topology with respect to which addition and multiplication are
continuous.  Then the map 
$$
C\to A \oplus \cdots \oplus A,\qquad
  \sum_{m=1}^N a_m \ww_m \mapsto (a_1,\ldots, a_N)
$$
defines a bijection between~$C$ and the product of~$N$ copies of~$A$
(considered as sets). We give~$C$ the product topology.  It is readily
verified that this topology is independent of the choice of basis
$w_1, \ldots, w_N$ and that multiplication and addition on~$C$ are
continuous, so~$C$ is a topological ring.  We call this topology
on~$C$ the \defn{tensor product topology}.

Now drop our assumption that~$A$ and~$B$ have a topology, but suppose
that~$A$ and~$B$ are not merely rings but fields.  Recall that a
finite extension $L/K$ of fields is \defn{separable} if the number of
embeddings $L\hra \Kbar$ that fix~$K$ equals the degree of~$L$
over~$K$, where $\Kbar$ is an algebraic closure of~$K$.  The primitive
element theorem from Galois theory asserts that any such extension is
generated by a single element, i.e., $L=K(a)$ for some $a\in L$.
\begin{lemma}\label{lem:tensor_prod}\ilem{structure of tensor product of fields}
  Let~$A$ and~$B$ be fields containing the field~$K$ and suppose
  that~$B$ is a separable extension of finite degree $N=[B:K]$.  Then
  $C=A\tensor_K B$ is the direct sum of a finite number of fields
  $K_j$, each containing an isomorphic image of~$A$ and an isomorphic
  image of~$B$.
\end{lemma}
\begin{proof}
  By the primitive element theorem, we have $B=K(b)$, where~$b$ is a
  root of some separable irreducible polynomial $f(x)\in K[x]$ of
  degree~$N$.  Then $1,b,\ldots, b^{N-1}$ is a basis 
for~$B$ over~$K$, so
$$
  A\tensor_K B = A[\bb] \isom A[x]/(f(x))
$$
where $1,\bb,\bb^2,\ldots,\bb^{N-1}$ are 
linearly independent over~$A$ and $\bb$ satisfies 
$f(\bb)=0$.

Although the polynomial $f(x)$ is irreducible as an element
of $K[x]$, it need not be irreducible in $A[x]$.  Since~$A$
is a field,  we have a factorization 
$$
   f(x) = \prod_{j=1}^J g_j(x)
$$
where $g_j(x)\in A[x]$ is irreducible.  The $g_j(x)$ are
distinct because $f(x)$ is separable (i.e., has distinct
roots in any algebraic closure).   

For each~$j$, let $\bb_j\in \overline{A}$ be a root of $g_j(x)$, where
$\overline{A}$ is a fixed 
algebraic closure of the field~$A$.  Let $K_j = A(\bb_j)$.
Then the map
\begin{equation}\label{eqn:tensor}
  \vphi_j : A\tensor_K B \to K_j
\end{equation}
given by sending any polynomial $h(\bb)$ in $\bb$ (where $h\in A[x]$)
to $h(\bb_j)$ is a ring homomorphism, because the image
of~$\bb$ satisfies the polynomial $f(x)$, and $A\tensor_K B\isom A[x]/(f(x))$.

By the Chinese Remainder Theorem, the maps from (\ref{eqn:tensor})
combine to define a ring isomorphism
$$
 A\tensor_K B \isom A[x]/(f(x)) \isom \bigoplus_{j=1}^J A[x]/(g_j(x))
   \isom \bigoplus_{j=1}^J K_j.
$$

Each $K_j$ is of the form $A[x]/(g_j(x))$, so contains an isomorphic
image of $A$.  It thus remains to show that the ring 
homomorphisms
$$
  \lambda_j : B \xra{b\,\mapsto 1\tensor b} A\tensor_K B \xra{\vphi_j} K_j
$$
are injections.  Since $B$ and $K_j$ are both fields, $\lambda_j$
is either the $0$ map or injective.  However, $\lambda_j$ is
not the $0$ map since $\lambda_j(1)=1\in K_j$.  
\end{proof}
\begin{example}
  If $A$ and $B$ are finite extensions of $\Q$, then $A\tensor_\Q B$
  is an algebra of degree $[A:\Q]\cdot [B:\Q]$. For example, suppose
  $A$ is generated by a root of $x^2+1$ and $B$ is generated by a root
  of $x^3-2$.  We can view $A\tensor_\Q B$ as either $A[x]/(x^3-2)$ or
  $B[x]/(x^2+1)$.  The polynomial $x^2+1$ is irreducible over $\Q$,
  and if it factored over the cubic field $B$, then there would be a
  root of $x^2+1$ in $B$, i.e., the quadratic field $A=\Q(i)$ would be
  a subfield of the cubic field $B=\Q(\sqrt[3]{2})$, which is
  impossible.  Thus $x^2+1$ is irreducible over $B$, so $A\tensor_\Q B
  = A.B = \Q(i,\sqrt[3]{2})$ is a degree $6$ extension of $\Q$.
  Notice that $A.B$ contains a copy~$A$ and a copy of~$B$. By the
  primitive element theorem the composite field $A.B$ can be generated
  by the root of a single polynomial. For example, the minimal
  polynomial of $i+\sqrt[3]{2}$ is $x^6 + 3x^4 - 4x^3 + 3x^2 + 12x +
  5$, hence $\Q(i+\sqrt[3]{2})=A.B$.
\end{example}

\begin{example}
  The case $A\isom B$ is even more exciting.  For example, suppose
  $A=B=\Q(i)$. Using the Chinese Remainder Theorem we have that
$$
  \Q(i)\tensor_\Q \Q(i) \isom \Q(i)[x]/(x^2+1)
\isom \Q(i)[x]/((x-i)(x+i))
\isom \Q(i) \oplus \Q(i),
$$
since $(x-i)$ and $(x+i)$ are coprime.  The last isomorphism
sends $a + b x$, with $a,b\in\Q(i)$, to $(a+bi, a-bi)$.
Since $\Q(i)\oplus \Q(i)$ has zero divisors, the tensor
product $\Q(i)\tensor_\Q \Q(i)$ must also have zero divisors.
For example, $(1,0)$ and $(0,1)$ is a zero divisor pair
on the right hand side, and we can trace back to the elements
of the tensor product that they define.  First, by solving
the system
$$ a+bi=1\qquad \text{ and }\qquad a-bi=0$$
we see that
$(1,0)$ corresponds to $a=1/2$ and $b=-i/2$, i.e., to the element
$$\frac{1}{2}- \frac{i}{2} x\in \Q(i)[x]/(x^2+1).$$ 
This element in turn
corresponds to 
$$
\frac{1}{2}\tensor 1 - \frac{i}{2}\tensor i \in \Q(i)\tensor_\Q\Q(i).
$$
Similarly the other element $(0,1)$ corresponds to 
$$
 \frac{1}{2}\tensor 1 + \frac{i}{2}\tensor i \in \Q(i)\tensor_\Q\Q(i).
$$
As a double check, observe that 
\begin{align*}
\left(\frac{1}{2}\tensor 1 - \frac{i}{2}\tensor i\right)\cdot
 \left(\frac{1}{2}\tensor 1 + \frac{i}{2}\tensor i\right)
&= \frac{1}{4}\tensor 1 + \frac{i}{4}\tensor i - \frac{i}{4}\tensor i
    -\frac{i^2}{4}\tensor i^2\\
 &= \frac{1}{4}\tensor 1 - \frac{1}{4}\tensor 1 = 0 \in \Q(i)\tensor_\Q\Q(i).
\end{align*}
Clearing the denominator of $2$ and writing $1\tensor 1 = 1$, we have
$(1-i\tensor i)(1+i\tensor i) = 0$, so $i\tensor i$ is a root of the
polynomimal $x^2-1$, and $i\tensor i$ is not $\pm 1$, so $x^2-1$ has
more than $2$ roots.

In general, to understand $A\tensor_K B$ explicitly 
is the same as factoring either the defining polynomial of~$B$
over the field~$A$, or factoring the defining polynomial of~$A$ 
over~$B$.
\end{example}

\begin{corollary}\label{cor:fcp}\icor{tensor products and characteristic polynomials}
  Let $a\in B$ be any element and let $f(x)\in K[x]$ be the
  characteristic polynomials of $a$ over $K$ and let $g_j(x)\in A[x]$
  (for $1\leq j \leq J$) be the characteristic polynomials of the
  images of~$a$ under $B\to A\tensor_K B \to K_j$ over $A$,
  respectively.  Then
\begin{equation}\label{eqn:fcp}
  f(x) = \prod_{j=1}^J g_j(X).
\end{equation}
\end{corollary}
\begin{proof}
  We show that both sides of (\ref{eqn:fcp}) are the characteristic
  polynomial $T(x)$ of the image of $a$ in $A\tensor_K B$ over $A$.
  That $f(x)=T(x)$ follows at once by computing the characteristic
  polynomial in terms of a basis $\ww_1,\ldots, \ww_N$ of $A\tensor_K
  B$, where $w_1,\ldots, w_N$ is a basis for $B$ over $K$ (this is
  because the matrix of left multiplication by $b$ on $A \tensor_K B$
  is exactly the same as the matrix of left multiplication on~$B$, so
  the characteristic polynomial doesn't change).  To see that $T(X) =
  \prod g_j(X)$, compute the action of the image of~$a$ in $A\tensor_K
  B$ with respect to a basis of
\begin{equation}\label{eqn:decomp}
  A\tensor_K B \isom \bigoplus_{j=1}^J K_j
\end{equation}
composed of basis of the individual extensions $K_j$ of $A$.  The
  resulting matrix will be a block direct sum of submatrices, each of
  whose characteristic polynomials is one of the $g_j(X)$.  Taking
  the product gives the claimed identity (\ref{eqn:fcp}).
\end{proof}

\begin{corollary}\icor{completion, norms, and traces}
\icor{norms, traces, and completions}
For $a\in B$ we have 
$$
 \Norm_{B/K}(a) = \prod_{j=1}^J \Norm_{K_j/A}(a),
$$
and 
$$
 \Tr_{B/K}(a) = \sum_{j=1}^J \Tr_{K_j/A}(a),
$$
\end{corollary}
\begin{proof}
  This follows from Corollary~\ref{cor:fcp}.  First, the norm is $\pm$
  the constant term of the characteristic polynomial, and the constant
  term of the product of polynomials is the product of the constant
  terms (and one sees that the sign matches up correctly).  Second,
  the trace is minus the second coefficient of the characteristic
  polynomial, and second coefficients add when one multiplies
  polynomials:
  $$
  (x^n + a_{n-1}x^{n-1} + \cdots ) \cdot (x^m + a_{m-1}x^{m-1} +
  \cdots ) = x^{n+m} + x^{n+m-1} (a_{m-1} + a_{n-1}) + \cdots.
  $$
  One could also see both the statements by considering a matrix of
  left multiplication by $a$ first with respect to the basis of
  $\ww_n$ and second with respect to the basis coming from the left
  side of (\ref{eqn:decomp}).

\end{proof}

\chapter{Extensions and Normalizations of Valuations}
\section{Extensions of Valuations}
In this section we continue to tacitly assume that all valuations are
nontrivial.  We do not assume all our valuations satisfy the triangle


Suppose $K\subset L$ is a finite extension of fields, and that $\absspc{}$ and $\normspc{}$
are valuations on~$K$ and~$L$, respectively.  
\begin{definition}[Extends]
We say that $\normspc{}$ \defn{extends}
$\absspc$ if $\abs{a} = \norm{a}$ for all $a\in K$.   
\end{definition}
\begin{theorem}\label{thm:extunique}\ithm{uniqueness of valuation extension}
Suppose that $K$ is a field that is complete with respect to $\absspc$
and that~$L$ is a finite extension of~$K$ of degree $N=[L:K]$.   
Then there is precisely
one extension of $\absspc{}$ to $K$, namely
\begin{equation}
  \norm{a} = \abs{\Norm_{L/K}(a)}^{1/N},
\label{eqn:normdef}\end{equation}
where the $N$th root is the non-negative real $N$th root of the
nonnegative real number $\abs{\Norm_{L/K}(a)}$.
\end{theorem}
\begin{proof}
We may assume that $\absspc$ is normalized so as
to satisfy the triangle inequality.  Otherwise, normalize
$\absspc$ so that it does, prove the theorem for the normalized 
valuation $\absspc^c$, then raise both sides of (\ref{eqn:normdef})
to the power $1/c$.  In the uniqueness proof, by the same
argument we may assume that $\normspc$ also satisfies the triangle
inequality.

\vspace{1ex}\noindent{\em Uniqueness.}  View $L$ as a
finite-dimensional vector space over~$K$. Then $\normspc$ is a norm in
the sense defined earlier (Definition~\ref{defn:norm}).  Hence any two
extensions $\normspc_1$ and $\normspc_2$ of $\absspc$ are equivalent
as norms, so induce the same topology on $K$.  But as we have
seen (Proposition~\ref{prop:same_topo}), two valuations which induce the same topology are
equivalent valuations, i.e., $\normspc_1 = \normspc_2^c$, for some
positive real $c$.  Finally $c=1$ since $\norm{a}_1 = \abs{a} =
\norm{a}_2$ for all $a\in K$.

\vspace{1ex}\noindent{\em Existence.}  We do not give a proof of
existence in the general case.  Instead we give a proof, which was
suggested by Dr. Geyer at the conference out of which
\cite{cassels:global} arose. It is valid when~$K$ is locally
compact, which is the only case we will use later.

We see at once that the function defined in (\ref{eqn:normdef})
satisfies the condition (i) that $\norm{a}\geq 0$ with equality only
for $a=0$, and (ii) $\norm{ab}=\norm{a}\cdot \norm{b}$ for all $a,b\in
L$.  The difficult part of the proof is to show that there is a
constant $C>0$ such that $$\norm{a}\leq 1 \implies \norm{1+a}\leq C.$$
Note that we do not know (and will not show) that $\normspc$ as
defined by (\ref{eqn:normdef}) is a norm as in
Definition~\ref{defn:norm}, since showing that $\normspc$ is a norm
would entail showing that it satisfies the triangle inequality, which
is not obvious.

Choose a basis $b_1,\ldots, b_N$ for~$L$ over~$K$.  Let $\normspc_0$
be the max norm on $L$, so for $a=\sum_{i=1}^N c_i b_i$ with $c_i\in K$ we have
$$
\norm{a}_0 = \norm{\sum_{i=1}^N c_i b_i}_0 = \max \{\abs{c_i} : i=1,\ldots, N\}.
$$
(Note: in Cassels's original article he let $\normspc_0$ be {\em
  any} norm, but we don't because the rest of the proof does not work,
since we can't use homogeneity as he claims to do.  This is because it need not
be possible to find, for any nonzero $a\in L$ some element $c\in K$ such that
$\norm{ac}_0=1$.  This would fail, e.g., if $\norm{a}_0\neq \abs{c}$
for any $c\in K$.)
The rest of the argument is very similar to our proof from
Lemma~\ref{lem:ext_unique} of uniqueness of norms on vector spaces
over complete fields.

With respect to the $\normspc_0$-topology, $L$ has the product topology
as a product of copies of $K$.  The
function $a\mapsto \norm{a}$ is a composition of continuous functions on $L$
with respect to this topology (e.g., $\Norm_{L/K}$ is the determinant, hence
polynomial),
hence $\normspc$ defines nonzero continuous function on the compact set 
$$
 S = \{a \in L : \norm{a}_0 = 1\}.
$$
By compactness, there are  real numbers $\delta,\Delta\in\R_{>0}$ such that 
$$
0 < \delta \leq \norm{a} \leq \Delta \qquad\text{for all $a\in S$}.
$$
For any nonzero $a\in L$ there exists $c\in K$ such that
$\norm{a}_0 = \abs{c}$; to see this take $c$ to be a $c_i$
in the expression $a=\sum_{i=1}^N c_i b_i$ with $\abs{c_i}\geq \abs{c_j}$
for any~$j$.  Hence $\norm{a/c}_0 = 1$, so $a/c\in S$ and
$$
0 \leq \delta \leq \frac{\norm{a/c}}{\norm{a/c}_0} \leq \Delta.
$$
Then by homogeneity
$$
0 \leq \delta \leq \frac{\norm{a}}{\norm{a}_0} \leq \Delta.
$$
Suppose now that $\norm{a}\leq 1$.  Then $\norm{a}_0\leq \delta^{-1}$, so 
\begin{align*}
 \norm{1+a} &\leq \Delta\cdot \norm{1+a}_0 \\
  &\leq \Delta\cdot \left( \norm{1}_0 + \norm{a}_0\right)\\
  &\leq \Delta\cdot \left( \norm{1}_0 + \delta^{-1}\right)\\
  &=C \quad\text{(say)},
\end{align*}
as required.
\end{proof}

\begin{example}
Consider the extension $\C$ of $\R$ equipped with the archimedean valuation.
The unique extension is the ordinary absolute value on $\C$:
$$\norm{x+iy} = \left(x^2 + y^2\right)^{1/2}.$$
\end{example}

\begin{example}
Consider the extension $\Q_2(\sqrt{2})$ of $\Q_2$ 
equipped with the $2$-adic absolute value.  
Since $x^2-2$ is irreducible over $\Q_2$ we can do
some computations by working in the subfield $\Q(\sqrt{2})$
of $\Q_2(\sqrt{2})$.
\begin{verbatim}
> K<a> := NumberField(x^2-2);
> K;
Number Field with defining polynomial x^2 - 2 over the Rational Field
> function norm(x) return Sqrt(2^(-Valuation(Norm(x),2))); end function;
> norm(1+a);
1.0000000000000000000000000000
> norm(1+a+1);
0.70710678118654752440084436209
> z := 3+2*a;
> norm(z);
1.0000000000000000000000000000
> norm(z+1);
0.353553390593273762200422181049
\end{verbatim}
\end{example}

\begin{remark}
  Geyer's existence proof gives (\ref{eqn:normdef}).  But it is
  perhaps worth noting that in any case (\ref{eqn:normdef}) is a
  consequence of unique existence, as follows.  Suppose $L/K$ is as
  above.  Suppose $M$ is a finite Galois extension of $K$ that
  contains~$L$.  Then by assumption there is a unique extension of
  $\absspc{}$ to $M$, which we shall also denote by $\normspc$.  If
  $\sigma\in\Gal(M/K)$, then
$$\norm{a}_\sigma := \norm{\sigma(a)}
$$
is also an extension of $\absspc{}$ to $M$, so $\normspc_\sigma = \normspc$,
i.e.,
$$ 
  \norm{\sigma(a)} = \norm{a}\qquad\text{for all $a\in M$}.
$$
But now 
$$
\Norm_{L/K}(a) = \sigma_1(a) \cdot \sigma_2(a) \cdots \sigma_N(a)
$$
for $a\in K$, where $\sigma_1,\ldots, \sigma_N\in \Gal(M/K)$ extend the embeddings
of $L$ into $M$.
Hence 
\begin{align*}
 \abs{\Norm_{L/K}(a)} &= \norm{\Norm_{L/K}(a)} \\
     &= \prod_{1\leq n \leq N} \norm{\sigma_n(a)}\\
     &= \norm{a}^N,
\end{align*}
as required.
\end{remark}

\begin{corollary} 
Let $w_1,\ldots, w_N$ be a basis for $L$ over $K$.  Then
there are positive constants $c_1$ and $c_2$ such that 
$$
   c_1 \leq \frac{\norm{\ds\sum_{n=1}^{N} b_n w_n}}{\max \{ \abs{b_n} : n = 1,\ldots, N\}} \leq c_2
$$
for any $b_1,\ldots, b_N\in K$ not all $0$.
\end{corollary}
\begin{proof}
  For $\abs{\sum_{n=1}^N b_n w_n}$ and $\max{\abs{b_n}}$ are two norms
  on $L$ considered as a vector space over $K$.  

I don't believe this
  proof, which I copied from Cassels's article.  My problem with it is
  that the proof of Theorem~\ref{thm:extunique} does not give that
  $C\leq 2$, i.e., that the triangle inequality holds for $\normspc$.  By
changing the basis for $L/K$ one can make any nonzero vector $a\in L$
have $\norm{a}_0=1$, so if we choose $a$ such that $\abs{a}$ is very large,
then the $\Delta$ in the proof will also be very large.  One way to fix
the corollary is to only claim that there are positive
constants $c_1, c_2,c_3, c_4$
such that 
$$
   c_1 \leq \frac{\norm{\ds\sum_{n=1}^{N} b_n w_n}^{c_3}}{\max \{ \abs{b_n}^{c_4} : n = 1,\ldots, N\}} \leq c_2.
$$
Then choose $c_3, c_4$ such that $\normspc^{c_3}$ and $\absspc^{c_4}$ satisfies the triangle inequality, and prove the modified corollary
using the proof suggested by Cassels.
\end{proof}

\begin{corollary}\label{cor:iscomp}\icor{extension of complete field is complete}
A finite extension of a completely valued field $K$ is complete
with respect to the extended valuation.
\end{corollary}
\begin{proof}
By the proceeding corollary it has the topology of a finite-dimensional
vector space over $K$. (The problem with the proof of the previous
corollary is not an issue, because we can replace the extended valuation
by an inequivalent one that satisfies the triangle inequality and
induces the same topology.)
\end{proof}

When $K$ is no longer complete under $\absspc$ the position is more complicated:
\begin{theorem}\label{thm:extensions}\ithm{valuation extensions}
Let $L$ be a separable extension of $K$ of finite degree
  $N=[L:K]$.  Then there are at most $N$ extensions of a valuation
  $\absspc$ on $K$ to $L$, say $\normspc_j$, for $1\leq j \leq J$.
  Let $K_v$ be the completion of $K$ with respect to $\absspc$, and for
  each~$j$ let $L_j$ be the completion of $L$ with respect to
  $\normspc_j$.  Then
\begin{equation}\label{eqn:tenslocal}
  K_v \tensor_K L \isom \bigoplus_{1\leq j\leq J} L_j
\end{equation}
algebraically and topologically, where the right hand side is given
the product topology.
\end{theorem}
\begin{proof}
  We already know (Lemma~\ref{lem:tensor_prod}) that $K_v\tensor_K L$
  is of the shape (\ref{eqn:tenslocal}), where the $L_j$ are finite
  extensions of $K_v$.  Hence there is a unique extension
  $\absspc_j^*$ of $\absspc$ to the $L_j$, and by
  Corollary~\ref{cor:iscomp} the $L_j$ are complete with respect to
  the extended valuation.  Further,  the
  ring homomorphisms
  $$
  \lambda_j : L \to K_v\tensor_K L \to L_j
  $$
  are injections.   Hence we get an extension $\normspc_j$ of $\absspc$ to $L$ by putting 
$$
\norm{b}_j = \abs{\lambda_j(b)}_j^*.
$$
Further, $L\isom \lambda_j(L)$ is dense in $L_j$ with respect to $\normspc_j$ because
$L = K\tensor_K L$ is dense in $K_v\tensor_K L$ (since $K$ is dense
in $K_v$).  Hence $L_j$ is exactly the completion of $L$.

It remains to show that the $\normspc_j$ are distinct and that they
are the only extensions of $\absspc{}$ to~$L$.

Suppose $\normspc$ is any valuation of $L$ that extends $\absspc$.  Then
$\normspc$ extends by continuity to a real-valued function on $K_v\tensor_K L$,
which we also denote by $\normspc$. (We are again using that $L$ is dense
in $K_v\tensor_K L$.)  By continuity we have for all $a,b\in K_v\tensor_K L$,
$$
  \norm{ab} = \norm{a}\cdot \norm{b}
$$
and if $C$ is the constant in axiom (iii) for $L$ and $\normspc$, then
$$
 \norm{a}\leq 1 \implies \norm{1+a}\leq C.
$$
(In Cassels, he inexplicable assume that $C=1$ at this point in the proof.)

We consider the restriction of $\normspc$ to one of the $L_j$.  If $\norm{a}\neq 0$
for some $a\in L_j$, then $\norm{a} = \norm{b}\cdot \norm{ab^{-1}}$ for every
$b\neq 0$ in $L_j$ so $\norm{b} \neq 0$.  Hence either $\normspc$ is identically
$0$ on $L_j$ or it induces a valuation on $L_j$.

Further, $\normspc$ cannot induce a valuation on two of the $L_j$.  For
$$
  (a_1,0,\ldots, 0)\cdot (0,a_2,0,\ldots,0) = (0,0,0,\ldots,0),
$$
so for any $a_1\in L_1$, $a_2\in L_2$,
$$
  \norm{a_1}\cdot \norm{a_2} = 0.
$$
Hence $\normspc{}$ induces a valuation in precisely one of the $L_j$,
and it extends the given valuation $\absspc$ of $K_v$.  Hence $\normspc = \normspc_j$
for precisely one $j$.

It remains only to show that (\ref{eqn:tenslocal}) is a topological homomorphism.
For $$(b_1,\ldots, b_J)\in L_1\oplus \cdots \oplus L_J$$ put
$$
\norm{(b_1,\ldots, b_J)}_0 = \max_{1\leq j \leq J} \norm{b_j}_j.
$$
Then $\normspc_0$ is a norm on the right hand side of (\ref{eqn:tenslocal}),
considered as a vector space over $K_v$ and it induces the product topology.
On the other hand, any two norms are equivalent, since $K_v$ is complete,
so $\normspc_0$ induces the tensor product topology on the left hand side of
(\ref{eqn:tenslocal}).
\end{proof}

\begin{corollary}
Suppose $L=K(a)$, and let $f(x)\in K[x]$ be the minimal polynomial of~$a$. 
Suppose that 
$$
f(x) = \prod_{1\leq j\leq J} g_j(x)
$$
in $K_v[x]$, where the $g_j$ are irreducible.  Then $L_j = K_v(b_j)$, where
$b_j$ is a root of $g_j$.
\end{corollary}

\section{Extensions of Normalized Valuations}
Let $K$ be a complete field with valuation $\absspc$.  
We consider the following three cases:
\begin{itemize}
\item[(1)] $\absspc$ is discrete non-archimedean and the 
residue class field is finite.
\item[(2i)] The completion of $K$ with respect to $\absspc$ is $\R$.
\item[(2ii)] The completion of $K$ with respect to $\absspc$ is $\C$.
\end{itemize}
(Alternatively, these cases can be subsumed by the hypothesis that
the completion of $K$ is locally compact.)

In case (1) we defined the normalized valuation to 
be the one such that if Haar measure of the ring of integers $\O$ is $1$,
then $\mu(a\O) = \abs{a}$ (see Definition~\ref{defn:normalized}).
In case (2i) we say that $\absspc$ is normalized if it is the ordinary
absolute value, and in (2ii) if it is the {\em square} of the ordinary
absolute value:
$$\abs{x+iy} = x^2 + y^2 \qquad \text{(normalized)}.$$
In every case, for every $a\in K$,  the map 
$$
   a: x \mapsto a x
$$
on $K^+$ multiplies any choice of Haar measure by $\abs{a}$, and this characterizes
the normalized valuations among equivalent ones. 

We have already verified the above characterization for
non-archimedean valuations, and it is clear for the ordinary absolute
value on $\R$, so it remains to verify it for $\C$.  The additive
group $\C^+$ is topologically isomorphic to $\R^+ \oplus \R^+$, so a
choice of Haar measure of $\C^+$ is the usual area measure on the
Euclidean plane.  Multiplication by $x+iy\in \C$ is the same as
rotation followed by scaling by a factor of $\sqrt{x^2+y^2}$, so if we
rescale a region by a factor of $x+iy$, the area of the region changes
by a factor of the square of $\sqrt{x^2+y^2}$. This explains why the
normalized valuation on $\C$ is the square of the usual absolute
value.  Note that the normalized valuation on $\C$ does not satisfy
the triangle inequality:
$$
\abs{1 + (1+i)} = \abs{2+i} = 2^2 + 1^2 = 5 \not\leq 
 3= 1^2 + (1^2 + 1^2) =  \abs{1} + \abs{1+i}.
$$
The constant $C$ in axiom (3) of a valuation for the ordinary
absolute value on $\C$ is $2$, so the constant for the normalized
valuation $\absspc$ is $C\leq 4$:
$$
 \abs{x+iy} \leq 1 \implies \abs{x+iy+1} \leq 4.
$$
Note that $x^2 +y^2 \leq 1$ implies $$(x+1)^2 + y^2 
 = x^2 + 2x + 1 + y^2 \leq 1 + 2x + 1 \leq 4$$ since
$x\leq 1$.

\begin{lemma}\ilem{extension of normalized valuation}
  Suppose~$K$ is a field that is complete with respect to a normalized
  valuation~$\absspc$ and let~$L$ be a finite extension of~$K$ of
  degree $N=[L:K]$.  Then the normalized valuation $\normspc$ on~$L$
  which is equivalent to the unique extension of $\absspc$ to~$L$ is
  given by the formula
\begin{equation}\label{eqn:normdef2}
 \norm{a} = \abs{\Norm_{L/K}(a)}\qquad \text{all } a\in L.
\end{equation}
\end{lemma}
\begin{proof}
Let $\normspc$ be the normalized valuation on $L$ that extends $\absspc$.
Our goal is to identify $\normspc$, and in particular to show
that it is given by (\ref{eqn:normdef2}).

By the preceding section there is a positive real number~$c$ 
such that for all $a\in L$ we have
$$\norm{a} = \abs{\Norm_{L/K}(a)}^c.$$
Thus all we have to do is prove that $c=1$.
In case 2 the only nontrivial situation is $L=\C$ and $K=\R$,
in which case $\abs{\Norm_{\C/\R}(x+iy)} = \abs{x^2+y^2}$,
which is the normalized valuation on $\C$ defined above.

One can argue in a unified way in all cases as follows.
Let $w_1,\ldots, w_N$ be a basis for $L/K$. Then the map
$$
  \vphi:L^+ \to \bigoplus_{n=1}^N K^+, \qquad 
\sum a_n w_n \mapsto (a_1,\ldots, a_N)
$$
is an isomorphism between the additive group $L^+$
and the direct sum $\oplus_{n=1}^N K^+$, and
this is a homeomorphism if the right hand side
is given the product topology.  In particular, the
Haar measures on $L^+$ and on $\oplus_{n=1}^N K^+$
are the same up to a multiplicative constant in $\Q^*$.  

Let $b\in K$.  Then the left-multiplication-by-$b$ map
$$
   b : \sum a_n w_n \mapsto \sum b a_n w_n
$$
on $L^+$ is the same as the map
$$
  (a_1,\ldots, a_N) \mapsto (ba_1,\ldots, ba_N)
$$
on $\oplus_{n=1}^N K^+$, so it multiplies the Haar
measure by $\abs{b}^N$, since $\absspc$ on~$K$
is assumed normalized (the measure of each factor
is multiplied by $\abs{b}$, so the measure on
the product is multiplied by $\abs{b}^N$).
Since $\normspc$ is assumed normalized, so
multiplication by~$b$ rescales by $\norm{b}$, we
have 
$$
  \norm{b} = \abs{b}^N.
$$
But $b\in K$, so $\Norm_{L/K}(b) = b^N$.
Since $\absspc$ is nontrivial and for $a\in K$ we 
have $$\norm{a} = \abs{a}^N = \abs{a^N} = \abs{\Norm_{L/K}(a)},$$
so we must have $c=1$ in (\ref{eqn:normdef2}), as claimed.
\end{proof}

In the case when~$K$ need not be complete with respect
to the valuation~$\absspc$ on~$K$, we have the following
theorem.
\begin{theorem}\label{thm:normprod}\ithm{product of extensions}
Suppose $\absspc$ is a (nontrivial as always) normalized valuation
of a field~$K$ and let~$L$ be a finite extension of~$K$.
Then for any $a\in L$,
$$  
   \prod_{1\leq j \leq J} \norm{a}_j = \abs{\Norm_{L/K}(a)}
$$
where the $\normspc_j$ are the normalized valuations equivalent
to the extensions of~$\absspc$ to~$K$.
\end{theorem}
\begin{proof}
Let $K_v$ denote the completion of $K$ with respect to 
$\absspc$.  Write
$$
  K_v\tensor_K L = \bigoplus_{1\leq j \leq J} L_j.
$$
Then Theorem~\ref{thm:normprod} asserts that
\begin{equation}\label{eqn:normprod}
 \Norm_{L/K}(a) = \prod_{1\leq j\leq J} \Norm_{L_j/K_v}(a).
\end{equation}
By Theorem~\ref{thm:extensions}, the $\normspc_j$ are exactly the
normalizations of the extensions of $\absspc$ to the $L_j$ (i.e., the
$L_j$ are in bijection with the extensions of valuations, so there are
no other valuations missed).  By Lemma~\ref{eqn:normdef}, the
normalized valuation $\normspc_j$ on $L_j$ is $\abs{a} =
\abs{\Norm_{L_J/K_v}(a)}$.  The theorem now follows by taking absolute
values of both sides of (\ref{eqn:normprod}).
\end{proof}

What next?!  We'll building up to giving a new proof of finiteness of
the class group that uses that the class group naturally has the
discrete topology and is the continuous image of a compact group.

\chapter{Global Fields and Adeles}
\section{Global Fields}\label{sec:global_fields}
\begin{definition}[Global Field]
  A \defn{global field} is a number field or a finite separable
  extension of $\F(t)$, where $\F$ is a finite field, and $t$ is
  transcendental over $\F$.
\end{definition}

Below we will focus attention on number fields leaving the function
field case to the reader.   

The following lemma essentially says that the denominator of an
element of a global field is only ``nontrivial'' at a finite number of
valuations.
\begin{lemma}\label{lem:absbig}\ilem{valuations such that $\abs{a}>1$}
Let $a\in K$ be a nonzero element of a global field $K$.  Then
there are only finitely many inequivalent valuations $\absspc$
of $K$ for which 
$$
  \abs{a} > 1.
$$
\end{lemma}
\begin{proof}
  If $K=\Q$ or $\F(t)$ then the lemma follows by Ostrowski's
  classification of all the valuations on~$K$ (see 
Theorem~\ref{thm:ostrowski}). For example,
  when $a=\frac{n}{d}\in\Q$, with $n,d\in \Z$, then the valuations
  where we could have $\abs{a}>1$ are the archimedean one, or the
  $p$-adic valuations $\absspc_p$ for which $p\mid d$.

Suppose now that $K$ is a finite extension of $\Q$, so
$a$ satisfies a monic polynomial
$$
  a^n + c_{n-1} a^{n-1} + \cdots + c_0 = 0,
$$
for some $n$ and $c_0,\ldots, c_{n-1}\in\Q$.
If $\absspc$ is a non-archimedean valuation on $K$, we have
\begin{align*}
  \abs{a}^n &= \abs{-(c_{n-1} a^{n-1} + \cdots + c_0)} \\
      &\leq \max(1,\abs{a}^{n-1})\cdot \max(\abs{c_0},\ldots,\abs{c_{n-1}}).
\end{align*}
Dividing each side by $\abs{a}^{n-1}$, we have
that
$$
   \abs{a} \leq \max(\abs{c_0},\ldots,\abs{c_{n-1}}),
$$
so in all cases we have
\begin{equation}\label{eqn:maxabs}
   \abs{a} \leq \max(1, \abs{c_0},
   \ldots,\abs{c_{n-1}})^{1/(n-1)}.
\end{equation}
We know the lemma for~$\Q$, so there are only finitely many
valuations~$\absspc$ on~$\Q$ such that the right hand side of
(\ref{eqn:maxabs}) is bigger than~$1$.  Since each valuation of~$\Q$
has finitely many extensions to~$K$, and there are only finitely many
archimedean valuations, it follows that there are only finitely many
valuations on~$K$ such that $\abs{a}>1$.
\end{proof}

Any valuation on a global field is either archimedean, or discrete
non-archimedean with finite residue class field, since this is true of
$\Q$ and $\F(t)$ and is a property preserved by extending a valuation
to a finite extension of the base field.  Hence it makes sense to talk
of normalized valuations.  Recall that the normalized $p$-adic
valuation on $\Q$ is $\abs{x}_p = p^{-\ord_p(x)}$, and if~$v$ is a
valuation on a number field~$K$ equivalent to an extension of
$\absspc_p$, then the normalization of $v$ is the composite of the
sequence of maps
$$
  K\hra K_v \xra{\Norm} \Q_p \xra{\absspc_p} \R,
$$
where $K_v$ is the completion of $K$ at $v$.

\begin{example}
Let $K=\Q(\sqrt{2})$, and let $p=2$.  Because $\sqrt{2}\not\in\Q_2$, there is
exactly one extension of $\absspc_2$ to~$K$, and
it sends $a=1/\sqrt{2}$ to
$$
  \abs{\Norm_{\Q_2(\sqrt{2})/\Q_2}(1/\sqrt{2})}^{1/2}_2 = \sqrt{2}.
$$
Thus the normalized valuation of $a$ is $2$.

There are two extensions of $\absspc_7$ to $\Q(\sqrt{2})$,
since $\Q(\sqrt{2})\tensor_\Q \Q_7 \isom \Q_7 \oplus \Q_7$,
as $x^2-2 = (x-3)(x-4)\pmod{7}$.  The image of $\sqrt{2}$
under each embedding into $\Q_7$ is a unit in $\Z_7$, so
the normalized valuation of $a=1/\sqrt{2}$ is, in both
cases, equal to $1$.  More generally, for any valuation
of $K$ of characteristic an odd prime $p$, the
normalized valuation of $a$ is $1$.

Since $K=\Q(\sqrt{2})\hra \R$ in two ways, there are exactly
two normalized archimedean valuations on $K$, and
both of their values on $a$ equal $1/\sqrt{2}$.
Notice that the product of the absolute values of $a$
with respect to all normalized valuations is
$$
   2 \cdot \frac{1}{\sqrt{2}} \cdot \frac{1}{\sqrt{2}} \cdot 1
   \cdot 1 \cdot 1 \cdots  = 1.
$$
This ``product formula'' holds in much more generality, as
we will now see.
\end{example}

\begin{theorem}[Product Formula]\label{thm:product_formula}\ithm{product formula}
Let $a\in K$ be a nonzero element of a global field~$K$.
Let $\absspc_v$ run through the normalized valuations
of $K$.  Then $\abs{a}_v=1$ for almost all $v$, and 
$$
\prod_{\text{\rm all }v} \abs{a}_v = 1\qquad{\text{\rm (the product
    formula).}}
$$
\end{theorem}
We will later give a more conceptual proof of this
using Haar measure (see Remark~\ref{rem:conceptual_prod}).
\begin{proof}
By Lemma~\ref{lem:absbig}, we have $\abs{a}_v\leq 1$
for almost all~$v$.  Likewise, $1/\abs{a}_v = \abs{1/a}_v\leq 1$
for almost all~$v$, so $\abs{a}_v = 1$ for almost all~$v$.

Let $w$ run through all normalized valuations of $\Q$ (or of $\F(t)$),
and write $v\mid w$ if the restriction of $v$ to $\Q$ is equivalent to $w$.
Then by Theorem~\ref{thm:normprod},
$$
 \prod_{v} \abs{a}_v = \prod_w \left(\prod_{v\mid w} \abs{a}_v\right)
     = \prod_w \abs{\Norm_{K/\Q}(a)}_w,
$$
so it suffices to prove the theorem for $K=\Q$.

By multiplicativity of valuations, if the theorem is true for $b$ and
$c$ then it is true for the product $b c$ and quotient $b/c$ (when
$c\neq 0$). The theorem is clearly true for $-1$, which has valuation
$1$ at all valuations.  Thus to prove the theorem for $\Q$ it suffices
to prove it when $a=p$ is a prime number.  Then we have
$\abs{p}_\infty = p$, $\abs{p}_p = 1/p$, and for primes $q\neq p$ that
$\abs{p}_q = 1$.  Thus
$$\prod_v \abs{p}_v = p \cdot \frac{1}{p} \cdot 1 \cdot 1 \cdot 1 \cdots = 1,$$
as claimed.
\end{proof}


If $v$ is a valuation on a field $K$, recall that 
we let $K_v$ denote the completion of $K$ with respect to $v$. Also when
$v$ is non-archimedean, let
$$
  \O_v = \O_{K,v} = \{x \in K_v : \abs{x} \leq 1\}
$$
be the ring of integers of the completion. 

\begin{definition}[Almost All]
We say a condition holds for \defn{almost all} elements
of a set if it holds for all but finitely many elements.
\end{definition}

We will use the following lemma later (see Lemma~\ref{lem:adelext}) to
prove that formation of the adeles of a global field 
is compatible with base change. 
\begin{lemma} \label{lem:ints_adeles}\ilem{matching integers}
Let $\omega_1,\ldots, \omega_n$ be a basis for $L/K$,
where $L$ is a finite separable extension of the global field
$K$ of degree~$n$. 
Then for almost all normalized non-archimedean valuations $v$ on $K$ we
have
\begin{equation}\label{eqn:sum_int}
   \omega_1 \O_{v} \oplus \cdots \oplus \omega_n \O_{v}
      = \O_{w_1} \oplus \cdots \oplus \O_{w_g}
      \subset K_v\tensor_K L,
\end{equation}
where $w_1,\ldots, w_g$ are the extensions of $v$
to $L$.   Here we have identified $a\in L$ with
its canonical image in $K_v\tensor_K L$, and the direct 
sum on the left is the sum taken inside the tensor
product (so directness means that the intersections are
trivial). 
\end{lemma}
\begin{proof}
  The proof proceeds in two steps.  First we deduce easily from
  Lemma~\ref{lem:absbig} that for almost all $v$ the left hand side 
of (\ref{eqn:sum_int}) is
  contained in the right hand side.  Then we use a trick involving
  discriminants to show the opposite inclusion for all but finitely
  many primes.
  
  Since $\O_v\subset \O_{w_i}$ for all $i$, the left hand side of
  (\ref{eqn:sum_int}) is contained in the right hand side if
  $\abs{\omega_i}_{w_j}\leq 1$ for $1\leq i\leq n$ and $1\leq j\leq
  g$.  Thus by Lemma~\ref{lem:absbig}, for all but finitely many~$v$
  the left hand side of (\ref{eqn:sum_int}) is contained in the right
  hand side.  We have just eliminated the finitely many primes
  corresponding to ``denominators'' of some $\omega_i$, and now only
  consider~$v$ such that $\omega_1,\ldots, \omega_n \in \O_{w}$ for
  all $w\mid v$.
  
  For any elements $a_1,\ldots, a_n \in K_v\tensor_K L$, consider the
  discriminant
  $$
  D(a_1,\ldots, a_n) = \det(\Tr(a_i a_j)) \in K_v,
  $$
  where the trace is induced from the $L/K$ trace.
  Since each $\omega_i$ is in each $\O_w$, for $w\mid v$, the
  traces lie in $\O_v$, so
  $$d = D(\omega_1,\ldots, \omega_n)\in \O_v.$$
  Also note that $d\in
  K$ since each $\omega_i$ is in $L$.  Now suppose that
  $$
  \alpha = \sum_{i=1}^n a_i \omega_i \in \O_{w_1} \oplus \cdots
  \oplus \O_{w_g},
  $$
  with $a_i \in K_v$.  Then by properties of determinants for any
  $m$ with $1\leq m\leq n$, we have
  \begin{equation}\label{eqn:discsquare} 
  D(\omega_1,\ldots, \omega_{m-1}, \alpha, \omega_{m+1}, \ldots, \omega_n)
    = a_m^2 D(\omega_1,\ldots, \omega_n).
  \end{equation}
  The left hand side of (\ref{eqn:discsquare}) is in $\O_v$, so the
  right hand side is well, i.e.,
  $$
  a_m^2 \cdot d \in \O_v, \qquad\text{(for }m=1,\ldots, n\text{)},
  $$
  where $d\in K$. Since $\omega_1,\ldots, \omega_n$ are a basis for
  $L$ over $K$ and the trace pairing is nondegenerate, we have $d\neq
  0$, so by Theorem~\ref{thm:product_formula} we have $\abs{d}_v=1$
  for all but finitely many~$v$.  Then for all but finitely many~$v$
  we have that $a_m^2\in \O_v$.  For these $v$, that $a_m^2\in\O_v$
  implies $a_m\in \O_v$ since $a_m\in K_v$, i.e., $\alpha$ is in the
  left hand side of (\ref{eqn:sum_int}).
\end{proof}
\begin{example}
Let $K=\Q$ and $L=\Q(\sqrt{2})$.  Let $\omega_1 = 1/3$ and $\omega_2 = 2\sqrt{2}$.  In the first stage of the above proof we would eliminate
$\absspc_3$ because $\omega_2$ is not integral at $3$.  The discriminant
is
$$
 d = D\left(\frac{1}{3}, 2\sqrt{2}\right)
   =\det \mtwo{\frac{2}{9}}{0}{0}{16} = \frac{32}{9}.
$$
As explained in the second part of the proof, as long as $v\neq 2, 3$,
we have equality of the left and right hand sides in (\ref{eqn:sum_int}).
\end{example}


\section{Restricted Topological Products}

In this section we describe a topological tool, which we need in order
to define adeles (see Definition~\ref{def:adele}).

\begin{definition}[Restricted Topological Products]
  Let $X_\lambda$, for $\lambda\in\Lambda$, be a family of topological
  spaces, and for almost all~$\lambda$ let $Y_{\lambda}\subset
  X_{\lambda}$ be an open subset of $X_{\lambda}$.  Consider the space
  $X$ whose elements are sequences $\bx = \{x_\lambda\}_{\lambda\in
    \Lambda}$, where $x_\lambda\in X_\lambda$ for every $\lambda$, and
  $x_\lambda\in Y_{\lambda}$ for almost all~$\lambda$.  We give $X$ a
  topology by taking as a basis of open sets the sets $\prod
  U_{\lambda}$, where $U_{\lambda}\subset X_{\lambda}$ is open for all
  $\lambda$, and $U_{\lambda} = Y_{\lambda}$ for almost all $\lambda$.
  We call~$X$ with this topology the \defn{restricted topological
    product} of the $X_{\lambda}$ with respect to the $Y_{\lambda}$.
\end{definition}


\begin{corollary}\label{lem:xs}\icor{topology on adeles}
  Let $S$ be a finite subset of $\Lambda$, and let $X_S$ be the set of
  $\bx\in X$ with $x_\lambda\in Y_\lambda$ for all $\lambda\not\in S$,
  i.e.,
  $$
  X_S = \prod_{\lambda \in S} X_{\lambda} \times
  \prod_{\lambda\not\in S} Y_{\lambda} \subset X.
  $$
  Then $X_S$ is an open subset of $X$, and the topology induced on
  $X_S$ as a subset of $X$ is the same as the product topology.
\end{corollary}

The restricted topological product depends on the totality of the
$Y_{\lambda}$, but not on the individual $Y_{\lambda}$:
\begin{lemma}\ilem{restricted product}
  Let $Y_{\lambda}'\subset X_{\lambda}$ be open subsets, and suppose
  that $Y_{\lambda} = Y_{\lambda}'$ for almost all~$\lambda$.  Then
  the restricted topological product of the $X_\lambda$ with respect
  to the $Y_{\lambda}'$ is canonically isomorphic to the restricted
  topological product with respect to the $Y_{\lambda}$.
\end{lemma}

\begin{lemma}\label{lem:res_compact}\ilem{local compactness of restricted product}
  Suppose that the $X_\lambda$ are locally compact and that the
  $Y_\lambda$ are compact.  Then the restricted topological
product $X$ of the $X_\lambda$ is locally compact.
\end{lemma}
\begin{proof}
  For any finite subset $S$ of $\Lambda$, the open subset $X_S\subset
  X$ is locally compact, because by Lemma~\ref{lem:xs} it is a product
  of finitely many locally compact sets with an infinite product of
  compact sets.  (Here we are using Tychonoff's theorem from topology,
  which asserts that an arbitrary product of compact topological
  spaces is compact (see Munkres's {\em Topology, a first course},
  chapter 5).) Since $X=\cup_{S} X_S$, and the $X_S$ are open in $X$,
  the result follows.
\end{proof}

The following measure will be extremely important in deducing
topological properties of the ideles, which will be used in
proving finiteness of class groups.  See, e.g., the
proof of Lemma~\ref{lem:bignorm}, which is a key input
to the proof of strong approximation (Theorem~\ref{thm:strong}).  
\begin{definition}[Product Measure]\label{defn:prodmeasure}
  For all $\lambda\in\Lambda$, suppose $\mu_\lambda$ is a measure on
  $X_\lambda$ with $\mu_\lambda(Y_\lambda) = 1$ when $Y_\lambda$ is
  defined.  We define the \defn{product measure} $\mu$ on $X$ to be
  that for which a basis of measurable sets is $$\prod_\lambda
  M_\lambda$$
  where each $M_\lambda\subset X_\lambda$ has finite
  $\mu_\lambda$-measure and
  $M_\lambda=Y_\lambda$ for almost all $\lambda$, and where
  $$
  \mu\left(\prod_\lambda M_\lambda\right) = \prod_\lambda
  \mu_\lambda(M_\lambda).
  $$
\end{definition}

\section{The Adele Ring}
Let $K$ be a global field.  For each normalization $\absspc_v$ of $K$,
let $K_v$ denote the completion of $K$.  If $\absspc_v$ is
non-archimedean, let $\O_v$ denote the ring of integers of $K_v$.
\renewcommand{\AA}{\mathbb{A}}

\begin{definition}[Adele Ring]\label{def:adele}
  The \defn{adele ring} $\AA_K$ of $K$ is the topological ring whose
  underlying topological space is the restricted topological product
  of the $K_v$ with respect to the $\O_v$, and where addition and
  multiplication are defined componentwise:
\begin{equation}\label{eqn:adelearith} 
(\bx \by)_v = \bx_v \by_v \qquad
(\bx + \by)_v = \bx_v + \by_v\qquad
\text{for }\bx, \by\in\AA_K.
\end{equation}
\end{definition}
It is readily verified that (i) this definition makes sense, i.e., if
$\bx, \by\in \AA_K$, then $\bx\by$ and $\bx+\by$, whose components are
given by (\ref{eqn:adelearith}), are also in $\AA_K$, and (ii) that
addition and multiplication are continuous in the $\AA_K$-topology, so
$\AA_K$ is a topological ring, as asserted.  
Also,
Lemma~\ref{lem:res_compact} implies that $\AA_K$ is locally compact
because the $K_v$ are locally compact
(Corollary~\ref{cor:locally_compact}), and the $\O_v$ are 
compact (Theorem~\ref{thm:compact}).

There is a natural continuous ring inclusion
\begin{equation}\label{eqn:princ_inc} 
K\hra \AA_K
\end{equation}
that sends $x\in K$ to the adele every one of whose components is $x$.
This is an adele because $x\in \O_v$ for almost all $v$, by
Lemma~\ref{lem:absbig}.  The map is injective because each map $K\to
K_v$ is an inclusion.
 
\begin{definition}[Principal Adeles]
  The image of (\ref{eqn:princ_inc}) is the ring of \defn{principal
    adeles}.
\end{definition}
It will cause no trouble to identify $K$ with the principal adeles, so
we shall speak of~$K$ as a subring of $\AA_K$.

Formation of the adeles is compatibility with base change, in the
following sense.
\begin{lemma}\label{lem:adelext}\ilem{base extension of adeles}
  Suppose $L$ is a finite (separable) extension of the global field
  $K$.  Then
\begin{equation}\label{eqn:baseext}
  \AA_K \tensor_K L \isom \AA_L
\end{equation}
both algebraically and topologically.  Under this isomorphism,
  $$L\isom K\tensor_K L \subset \AA_K \tensor_K L$$ maps isomorphically onto
  $L\subset \AA_L$.
\end{lemma}
\begin{proof}
Let $\omega_1,\ldots, \omega_n$
be a basis for $L/K$ and let $v$ run through the normalized valuations
on~$K$.  The left hand side of (\ref{eqn:baseext}), with
the tensor product topology, is the restricted product of the
tensor products
$$
  K_v \tensor_K L \isom K_v \cdot\omega_1 \oplus \cdots \oplus K_v\cdot \omega_n
$$
with respect to the integers
\begin{equation}\label{eqn:intsum}
   \O_v\cdot \omega_1 \oplus \cdots \oplus \O_v\cdot \omega_n.
 \end{equation}
 (An element of the left hand side is a finite linear combination $\sum
\bx_i \tensor a_i$ of adeles $\bx_i \in \AA_K$ and coefficients $a_i
\in L$, and there is a natural isomorphism from the ring of such formal
sums to the restricted product of the $K_v\tensor_K L$.)

We proved before (Theorem~\ref{thm:extensions}) that
 $$
  K_v \tensor_K L \isom L_{w_1} \oplus \cdots \oplus L_{w_g},
  $$
  where $w_1,\ldots, w_g$ are the normalizations of the extensions
  of $v$ to $L$.  Furthermore, as we proved using discriminants (see
  Lemma~\ref{lem:ints_adeles}), the above identification identifies
  (\ref{eqn:intsum}) with
$$
 \O_{L_{w_1}} \oplus \cdots \oplus \O_{L_{w_g}},
$$
for almost all~$v$.
Thus the left hand side of (\ref{eqn:baseext}) is the restricted
product of the $L_{w_1} \oplus \cdots \oplus L_{w_g}$
with respect to the $\O_{L_{w_1}} \oplus \cdots \oplus \O_{L_{w_g}}$.
But this is canonically isomorphic to the restricted product
of all completions $L_w$ with respect to $\O_w$, which
is the right hand side of (\ref{eqn:baseext}).  This 
establishes an isomorphism between the two sides of (\ref{eqn:baseext})
as topological spaces.  The map is also a ring homomorphism, so 
the two sides are algebraically isomorphic, as claimed.
\end{proof}

\begin{corollary}\label{cor:addstruct}\icor{$\AA_K^+$ and base extension}
Let $\AA_K^+$ denote the topological group obtained from the
additive structure on $\AA_K$.  Suppose $L$ is a finite seperable
extension of $K$.
 Then 
$$ 
  \AA_L^+ = \AA_K^+ \oplus \cdots \oplus \AA_K^+,
\qquad ([L:K] \text{ summands}).
$$
In this isomorphism the additive group $L^+\subset \AA_L^+$ of the
principal adeles is mapped isomorphically onto $K^+\oplus \cdots
\oplus K^+$.
\end{corollary}
\begin{proof}
For any nonzero $\omega \in L$, the subgroup $\omega\cdot \AA_K^+$
of $\AA_L^+$ is isomorphic as a topological group to $\AA_K^+$
(the isomorphism is multiplication by $1/\omega$).  By
Lemma~\ref{lem:adelext}, we have isomorphisms
$$
\AA_L^+ = \AA_K^+ \tensor_K L 
   \isom \omega_1\cdot \AA_K^+ \oplus \cdots \oplus \omega_n \cdot \AA_K^+
   \isom \AA_K^+ \oplus \cdots \oplus \AA_K^+. 
$$
If $a \in L$, write $a=\sum b_i \omega_i$, with $b_i \in K$.
Then $a$ maps via the above map to 
$$x = (\omega_1\cdot \{b_1\},\ldots, \omega_n \cdot \{b_n\}),$$
where $\{b_i\}$ denotes the principal adele defined by $b_i$.
Under the final map, $x$ maps to the tuple
$$(b_1,\ldots, b_n) \in K\oplus \cdots \oplus K \subset 
\AA_K^+ \oplus \cdots \oplus \AA_K^+.$$
The dimensions of $L$ and of $K\oplus \cdots \oplus K$ over
$K$ are the same, so 
this proves the final claim of the corollary. 
\end{proof}

\begin{theorem}\label{thm:adelequo}\ithm{compact quotient of adeles}
  The global field $K$ is discrete in $\AA_K$ and the quotient
  $\AA_K^+/K^+$ of additive groups is compact in the quotient
  topology.
\end{theorem}
At this point Cassels remarks 
\begin{quote}``It is impossible to conceive of any other uniquely
defined topology on $K$.  This metamathematical reason is more
persuasive than the argument that follows!''
\end{quote}
\begin{proof}
Corollary~\ref{cor:addstruct}, with $K$ for $L$ and $\Q$ or 
$\F(t)$ for $K$, shows that it is enough to verify
the theorem for $\Q$ or $\F(t)$, and we shall do it
here for $\Q$.

To show that $\Q^+$ is discrete in $\AA_\Q^+$ it is enough, because of
the group structure, to find an open set $U$ that contains $0 \in
\AA_\Q^+$, but which contains no other elements of $\Q^+$.  (If
$\alpha\in\Q^+$, then $U+\alpha$ is an open subset of $\AA_\Q^+$
whose intersection with $\Q^+$ is $\{\alpha\}$.)
We take for $U$ the set of $\bx=\{x_v\}_v \in \AA_\Q^+$ with
$$
 \abs{x_\infty}_\infty < 1 
\qquad\text{and}\qquad \abs{x_p}_p \leq 1 \quad \text{(all $p$)},
$$
where $\absspc_p$ and $\absspc_\infty$ are respectively the
$p$-adic and the usual archimedean absolute values on~$\Q$.
If $b\in \Q\cap U$, then in the first place $b\in \Z$
because $\abs{b}_p\leq 1$ for all $p$, and then $b=0$
because $\abs{b}_\infty<1$.  This proves that $K^+$
is discrete in $\AA_\Q^+$.  (If we leave out one valuation,
as we will see later (Theorem~\ref{thm:strong}), this theorem is 
false---what goes wrong with the proof just given?)

Next we prove that the quotient $\AA_\Q^+/\Q^+$ is compact.
Let $W\subset \AA_\Q^+$ consist of the $\bx=\{x_v\}_v\in \AA_\Q^+$
with 
$$
  \abs{x_\infty}_\infty \leq \frac{1}{2}\qquad\text{and}\qquad
   \abs{x_p}_p \leq 1\qquad\text{for all primes $p$}.
$$
We show that every adele $\by=\{y_v\}_v$ is of the form
$$
  \by = a + \bx, \qquad a\in \Q, \quad \bx\in W,
$$
which will imply that the compact set $W$ maps surjectively
onto $\AA_\Q^+ / \Q^+$.
Fix an adele $\by=\{y_v\}\in\AA_\Q^+$.  Since $\by$
is an adele, for each prime $p$ we can find
a rational number
$$
  r_p = \frac{z_p}{p^{n_p}}
\qquad \text{with} \quad z_p \in \Z \quad \text{and} \quad n_p \in \Z_{\geq 0}
$$
such that 
$$
  \abs{y_p - r_p}_p \leq 1,
$$
and 
$$
  r_p = 0 \qquad \text{almost all $p$}.
$$
More precisely, for the finitely
many $p$ such that $$y_p = \sum_{n\geq -\abs{s}} a_np^n \not\in\Z_p,$$ choose
$r_p$ to be a rational number that is the value of an appropriate truncation
of the $p$-adic expansion of $y_p$, and 
when $y_p\in \Z_p$ just choose $r_p = 0$.
Hence $r=\sum_{p} r_p\in\Q$ is well defined.
The $r_q$ for $q\neq p$ do not mess up the inequality 
$\abs{y_p - r}_p \leq 1$ since the
valuation $\absspc_p$ is non-archimedean and the $r_q$ do not have any $p$ in
their denominator:
$$\abs{y_p  - r}_p 
   = \abs{y_p - r_p - \sum_{q\neq p} r_q}_p
   \leq \max\left(\abs{y_p - r_p}_p, \abs{\sum_{q\neq p} r_q}_p\right)
   \leq \max(1,1) = 1.
$$
Now choose $s\in\Z$ such that 
$$
  \abs{b_\infty - r-s} \leq \frac{1}{2}.
$$
Then $a=r+s$ and $\bx = \by - a$ do what is required,
since $\by - a = \by - r - s$ has the desired property
(since $s\in\Z$ and the $p$-adic valuations are
non-archimedean).

Hence the continuous map $W\to \AA_\Q^+/\Q^+$ induced by the quotient
map $\AA_\Q^+ \to \AA_\Q^+/\Q^+$ is surjective.  But $W$ is compact
(being the topological product of the compact spaces
$\abs{x_\infty}_\infty\leq 1/2$ and the $\Z_p$ for all $p$), hence
$\AA_\Q^+/\Q^+$ is also compact. 
\end{proof}

\begin{corollary}\label{cor:subsetW}\icor{compact subset of adeles}
There is a subset $W$ of $\AA_K$ defined by inequalities of the
type $\abs{x_v}_v \leq \delta_v$, where $\delta_v=1$
for almost all $v$, such that every $\by\in\AA_K$ can
be put in the form
$$
  \by = a + \bx, \qquad a\in K, \quad \bx \in W,
$$
i.e., $\AA_K = K + W$.
\end{corollary}
\begin{proof}
  We constructed such a set for $K=\Q$ when proving
  Theorem~\ref{thm:adelequo}.  For general~$K$ the $W$ coming from the
  proof determines compenent-wise a subset of $\AA_K^+\isom
  \AA_\Q^+\oplus \cdots \oplus \AA_\Q^+$ that is a subset of a set
  with the properties claimed by the corollary.
\end{proof}

As already remarked, $\AA_K^+$ is a locally compact group, so it has
an invariant Haar measure.  In fact one choice of this Haar measure is
the product of the Haar measures on the $K_v$, in the sense
of Definition~\ref{defn:prodmeasure}.

\begin{corollary}\label{cor:finitemeasure}\icor{$\AA_K^+/K^+$ has finite measure}
The quotient $\AA_K^+/K^+$ has finite measure in the quotient measure
induced by the Haar measure on $\AA_K^+$.
\end{corollary}
\begin{remark}
This statement is independent of the particular choice
of the multiplicative constant in the Haar measure
on $\AA_K^+$.  We do not here go into the question of
finding the measure $\AA_K^+/K^+$ in terms of our 
explicitly given Haar measure.  (See Tate's thesis,
\cite[Chapter XV]{cassels-frohlich}.)
\end{remark}
\begin{proof}
This can be reduced similarly to the case of $\Q$
or $\F(t)$ which is immediate, e.g., the $W$ defined
above has measure $1$ for our Haar measure.

Alternatively, finite measure follows from compactness.  To see
this,  cover
$\AA_K/K^+$ with the translates of $U$, where $U$ is a nonempty open
set with finite measure.  The existence of a finite subcover implies
finite measure.
\end{proof}

\begin{remark}\label{rem:conceptual_prod}
  We give an alternative proof of the product formula
  $\prod\abs{a}_v=1$ for nonzero $a\in K$.  We have seen that if
  $x_v\in K_v$, then multiplication by $x_v$ magnifies the Haar
  measure in $K_v^+$ by a factor of $\abs{x_v}_v$.  Hence if
  $\bx=\{x_v\}\in\AA_K$, then multiplication by $\bx$ magnifies the
  Haar measure in $\AA_K^+$ by $\prod \abs{x_v}_v$.  But now
  multiplication by $a\in K$ takes $K^+\subset \AA_K^+$ into $K^+$, so
  gives a well-defined bijection of $\AA_K^+/K^+$ onto $\AA_K^+/K^+$
  which magnifies the measure by the factor $\prod\abs{a}_v$.  Hence
  $\prod\abs{a}_v=1$ Corollary~\ref{cor:finitemeasure}.  (The point is
  that if $\mu$ is the measure of $\AA_K^+/K^+$, then $\mu =
  \prod\abs{a}_v \cdot \mu$, so because $\mu$ is finite we must have
  $\prod\abs{a}_v = 1$.)
\end{remark}


\section{Strong Approximation}
We first prove a technical lemma and corollary, then use them to
deduce the strong approximation theorem, which is an extreme
generalization of the Chinese Remainder Theorem; it asserts that $K^+$
is dense in the analogue of the adeles with one valuation removed.

The proof of Lemma~\ref{lem:bignorm} below will use in a crucial way
the normalized Haar measure on $\AA_K$ and the induced measure on the
compact quotient $\AA_K^+/K^+$.  Since I am not formally developing
Haar measure on locally compact groups, and since I didn't explain
induced measures on quotients well in the last chapter, hopefully the
following discussion will help clarify what is going on.

The real numbers $\R^+$ under addition is a locally compact
topological group.  Normalized Haar measure $\mu$ has the property
that $\mu([a,b]) = b-a$, where $a\leq b$ are real numbers and 
$[a,b]$ is the closed interval from $a$ to $b$.  The subset
$\Z^+$ of $\R^+$ is discrete, and the quotient $S^1 = \R^+/\Z^+$
is a compact topological group, which thus
has a Haar measure.  Let $\overline{\mu}$ be the Haar measure 
on $S^1$ normalized so that  the natural quotient $\pi:\R^+\to S^1$
preserves the measure, in the sense that if $X\subset \R^+$
is a measurable set that maps injectively into $S^1$, then 
$\mu(X) = \overline{\mu}(\pi(X))$.  This determine
$\overline{\mu}$ and we have $\overline{\mu}(S^1)=1$ since 
$X=[0,1)$ is a measurable set that maps bijectively onto
$S^1$ and has measure~$1$.  The situation for the map
$\AA_K \to \AA_K/K^+$ is pretty much the same.  


\begin{lemma}\label{lem:bignorm}
  There is a constant $C>0$ that depends only on the global field $K$
  with the following property:

Whenever $\bx=\{x_v\}_v \in \AA_K$ is such that 
\begin{equation}\label{eqn:bignorm}
\prod_v \abs{x_v}_v > C,
\end{equation}
then there is a nonzero principal adele $a \in K\subset \AA_K$ such
that
$$
  \abs{a}_v \leq \abs{x_v}_v \qquad\text{\rm for all $v$}.
$$
\end{lemma}
\begin{proof}
This proof is modelled on Blichfeldt's proof of Minkowski's
Theorem in the Geometry of Numbers, and works in quite general
circumstances.

First we show that (\ref{eqn:bignorm}) implies that $\abs{x_v}_v=1$
for almost all $v$.  Because $\bx$ is an adele, we have
$\abs{x_v}_v\leq 1$ for almost all $v$.  If $\abs{x_v}_v<1$ for
infinitely many $v$, then the product in (\ref{eqn:bignorm}) would
have to be $0$.  (We prove this only when $K$ is a finite extension of
$\Q$.)  Excluding archimedean valuations, this is because the
normalized valuation $\abs{x_v}_v = \abs{\Norm(x_v)}_p$, which if less
than $1$ is necessarily $\leq 1/p$. Any infinite product of numbers
$1/p_i$ must be $0$, whenever $p_i$ is a sequence of primes.

Let $c_0$ be the Haar measure of $\AA_K^+/K^+$ induced from normalized
Haar measure on $\AA_K^+$, and let $c_1$ be the Haar measure of the set
of $\by=\{y_v\}_v \in \AA_K^+$ that satisfy
\begin{align*}
  \abs{y_v}_v &\leq \frac{1}{2} \qquad \text{if $v$ is real archimedean},\\
  \abs{y_v}_v &\leq \frac{1}{2} \qquad \text{if $v$ is complex archimedean},\\
  \abs{y_v}_v &\leq 1 \,\qquad \text{if $v$ is non-archimedean}.
\end{align*}
(As we will see, any positive real number $\leq 1/2$ would suffice in
the definition of $c_1$ above.  For example, in Cassels's article he
uses the mysterious $1/10$.  He also doesn't discuss the subtleties
of the complex archimedean case separately.)

Then $0<c_0<\infty$ since $\AA_K/K^+$ is compact, and $0<c_1<\infty$
because the number of archimedean valuations $v$ is finite.  We show
that $$C=\frac{c_0}{c_1}$$ will do.  Thus suppose $\bx$ is as in
(\ref{eqn:bignorm}).

The set $T$ of $\bt=\{t_v\}_v\in \AA_K^+$ such that
\begin{align*}
  \abs{t_v}_v &\leq \frac{1}{2}\abs{x_v}_v \,\qquad\text{if $v$ is real archimedean},\\
  \abs{t_v}_v &\leq \frac{1}{2}\sqrt{\abs{x_v}_v} \,\qquad\text{if $v$ is complex archimedean},\\
  \abs{t_v}_v &\leq \abs{x_v}_v \quad\,\qquad \text{if $v$ is non-archimedean}
\end{align*}
has measure 
\begin{equation}\label{eqn:tbigger}
 c_1 \cdot \prod_{v} \abs{x_v}_v > c_1 \cdot C = c_0.
\end{equation}
(Note:  If there are complex valuations, then the some of
the $\abs{x_v}_v$'s in the product must be squared.)

%% (Note: The reason for the square root for the complex archimedean valuations
%% is that the normalized Haar measure on~$\C$ is the usual 
%% Lebesgue measure on~$\C$, and the disc in $\C$ of radius
%% $(m_v/2)\cdot \sqrt{\abs{x_v}_v}$ 
%% has measure $(m_v\sqrt{\abs{x_v}_v})^2$ times the
%% measure ($=\pi/4$) of the disk of radius $1/2$ in $\C$.)

Because of (\ref{eqn:tbigger}), in 
the quotient map $\AA_K^+ \to \AA_K^+/K^+$
there
must be a pair of distinct points of $T$ that have
the same image in $\AA_K^+/K^+$, say
$$
   \bt' = \{t'_v\}_v \in T\quad\text{and}\quad \bt'' = \{t''_v\}_v\in T
$$
and 
$$
  a = \bt' - \bt'' \in K^+
$$
is nonzero.
Then 
$$  \abs{a}_v = \abs{t'_v - t''_v}_v 
         \leq 
\begin{cases}
\abs{t'_v} + \abs{t''_v} \leq 2\cdot \frac{1}{2}\abs{x_v}_v \leq \abs{x_v}_v &
    \text{if $v$ is real archimedean, or}\\
\max(\abs{t'_v},\abs{t''_v}) \leq \abs{x_v}_v  &
    \text{if $v$ is non-archimedean,}
\end{cases}
$$
for all $v$.  In the case of complex archimedean $v$, we must be
careful because the normalized valuation $\absspc_v$ is the {\em
  square} of the usual archimedean complex valuation $\absspc_\infty$
on $\C$, so e.g., it does not satisfy the triangle inequality.  
In particular, the quantity $\abs{t_v'-t''_v}_v$ is at most
the square of the maximum distance between two points in the disc in
$\C$ of radius $\frac{1}{2}\sqrt{\abs{x_v}_v}$, where by distance we
mean the usual distance.  This maximum distance in such a disc
is at most $\sqrt{\abs{x_v}_v}$, so $\abs{t_v'-t''_v}_v$ is at most
$\abs{x_v}_v$, as required.  Thus $a$ satisfies the requirements of
the lemma.
\end{proof}

\begin{corollary}\label{cor:small_a}
Let $v_0$ be a normalized valuation and let $\delta_v>0$ be given
for all $v\neq v_0$ with $\delta_v = 1$ for almost all $v$.  Then 
there is a nonzero $a\in K$ with
$$
  \abs{a}_v \leq \delta_v\qquad\text{(all $v\neq v_0$)}.
$$
\end{corollary}
\begin{proof}
This is just a degenerate case of Lemma~\ref{lem:bignorm}.
Choose $x_v\in K_v$ with $0< \abs{x_v}_v \leq \delta_v$
and $\abs{x_v}_v=1$ if $\delta_v=1$.  We can then choose
$x_{v_0}\in K_{v_0}$ so that
$$
\prod_{\text{all $v$ including $v_0$}} \abs{x_v}_v > C.
$$
Then Lemma~\ref{lem:bignorm} does what is required.
\end{proof}

\begin{remark}
  The character group of the locally compact group $\AA_K^+$ is
  isomorphic to $\AA_K^+$ and $K^+$ plays a special role.  See Chapter
  XV of \cite{cassels-frohlich}, Lang's \cite{lang:algebraic_numbers},
  Weil's \cite{weil:adeles}, and Godement's Bourbaki seminars 171 and
  176.  This duality lies behind the functional equation of $\zeta$
  and $L$-functions.  Iwasawa has shown \cite{iwasawa:adele} that the
  rings of adeles are characterized by certain general
  topologico-algebraic properties.
\end{remark}

We proved before that $K$ is discrete in $\AA_K$.  If one valuation is
removed, the situation is much different.
\begin{theorem}[Strong Approximation]\label{thm:strong}\ithm{strong approximation}
  Let $v_0$ be any normalized nontrivial valuation of the global field~$K$.
  Let $\AA_{K,v_0}$ be the restricted topological product of the
  $K_v$ with respect to the $\O_v$, where $v$ runs through all
  normalized valuations $v\neq v_0$.  Then~$K$ is dense in
  $\AA_{K,v_0}$.
\end{theorem}
\begin{proof}
This proof was suggested by Prof. Kneser at the Cassels-Frohlich
conference.

Recall that if $\bx =\{x_v\}_v\in \AA_{K,v_0}$ then a basis of open
sets about $\bx$ is the collection of products 
$$\prod_{v\in S} B(x_v,\eps_v) \times \prod_{v\not\in S,\,\, v\neq v_0} \O_v,$$
where $B(x_v,\eps_v)$ is an open ball in $K_v$ about $x_v$, and
$S$ runs through finite sets of normalized valuations (not including
$v_0$).  Thus
denseness of $K$ in $\AA_{K,v_0}$ is equivalent to the following
statement about elements.  Suppose we are given (i) a finite set $S$
of valuations $v\neq v_0$, (ii) elements $x_v\in K_v$ for all $v\in
S$, and (iii) an $\eps>0$.  Then there is an element $b\in K$ such that
$\abs{b-x_v}_v<\eps$ for all $v\in S$ and $\abs{b}_v\leq 1$ for all
$v\not\in S$ with $v\neq v_0$.

By the corollary to our proof that $\AA_K^+/K^+$ is compact
(Corollary~\ref{cor:subsetW}), there is a $W\subset \AA_K$ that is
defined by inequalities of the form $\abs{y_v}_v\leq \delta_v$ (where
$\delta_v=1$ for almost all $v$) such that ever $\mathbf{z}\in \AA_K$
is of the form
\begin{equation}\label{eqn:wsum}
  \mathbf{z} = \by + c, \qquad \by\in W, \quad c\in K.
\end{equation}
By Corollary~\ref{cor:small_a}, there is a nonzero $a\in K$ such
that 
\begin{align*}
  \abs{a}_v &< \frac{1}{\delta_v}\cdot \eps\qquad \text{ for }v\in S,\\
  \abs{a}_v &\leq \frac{1}{\delta_v} \qquad\,\quad \text{ for } v\not\in S,\, v\neq v_0.
\end{align*}
Hence on putting $\mathbf{z} = \frac{1}{a}\cdot \bx$ 
in (\ref{eqn:wsum}) and multiplying by $a$, we see that
every $\bx\in \AA_K$ is of the shape
$$
  \bx = \mathbf{w} + b,\qquad \mathbf{w}\in a\cdot W, \quad b\in K,
$$
where $a\cdot W$ is the set of $a\by$ for $\by\in W$.
If now we let $\bx$ have components the given $x_v$ at $v\in S$,
and (say) $0$ elsewhere, then $b=\bx-\bw$ has the properties required. 
\end{proof}

\begin{remark}
The proof gives a quantitative form of the theorem (i.e.,
with a bound for $\abs{b}_{v_0}$).  For an alternative approach,
see \cite{mahler:inequalities}.
\end{remark}

In the next chapter we'll introduce the ideles $\AA_K^*$.  Finally,
we'll relate ideles to ideals, and use everything so far to give a new
interpretation of class groups and their finiteness.


\chapter{Ideles and Ideals}
In this chapter, we introduce the ideles $\II_K$, and relate ideles to
ideals, and use what we've done so far to give an alternative
interpretation of class groups and their finiteness, thus linking the
adelic point of view with the classical point of view of the first
part of this course.



\section{The Idele Group}
The invertible elements of any commutative
topological ring~$R$ are a group $R^*$ under multiplication.
In general $R^*$ is not a topological group if it is
endowed with the subset topology because inversion need
not be continuous (only multiplication and addition on 
$R$ are required to be continuous).  It is usual therefore
to give $R^*$ the following topology.
There is an injection 
\begin{equation}\label{eqn:prod_embed}
  x\mapsto \left( x, \,\,\,\frac{1}{x} \right)
\end{equation}
of $R^*$ into the topological product $R\times R$.  We give $R^*$ the
corresponding subset topology.  Then $R^*$ with this topology is a
topological group and the inclusion map $R^*\hra R$ is continous.  To
see continuity of inclusion, note that this topology is finer (has at
least as many open sets) than the subset topology induced by
$R^*\subset R$, since the projection maps $R\times R\to R$ are
continuous.

\begin{example}\label{ex:cont}
This is a ``non-example''. The inverse map on $\Z_p^*$ is continuous with
respect to the $p$-adic topology.  If $a,b\in \Z_p^*$,
then $\abs{a}=\abs{b}=1$, so if $\abs{a-b}<\eps$, then
$$
  \abs{\frac{1}{a} - \frac{1}{b}}
   = \abs{\frac{b-a}{ab}} = \frac{\abs{b-a}}{\abs{ab}} < \frac{\eps}{1}=\eps.
$$
\end{example}

\begin{definition}[Idele Group]
  The \defn{idele group} $\II_K$ of $K$ is the group $\AA_K^*$ of invertible
  elements of the adele ring $\AA_K$.
\end{definition}
We shall usually speak of $\II_K$ as a subset of $\AA_K$, and will
have to distinguish between the $\II_K$ and $\AA_K$-topologies.
\begin{example}
For a rational prime $p$, let $\bx_p\in \AA_\Q$ be the adele whose $p$th
component is $p$ and whose $v$th component, for $v\neq p$, is $1$.
Then $\bx_p \to 1$ as $p\to\infty$ in $\AA_\Q$, for the following reason.
We must show that if $U$ is a basic open set that contains the
adele $1=\{1\}_v$, the $\bx_p$ for all sufficiently large $p$
are contained in $U$.  Since $U$ contains $1$ and is a basic
open set, it is of the form 
$$\prod_{v\in S} U_v \times \prod_{v\not\in S} \Z_v,$$
where $S$ if a finite set, and the $U_v$, for $v\in S$, are
arbitrary open subsets of $\Q_v$ that contain $1$.  
If $q$ is a prime larger than any prime in $S$, then 
$\bx_p$ for $p\geq q$, is in $U$.   This proves
convergence.
If the inverse map were continuous on $\II_K$, then 
the sequence of $\bx_p^{-1}$ would converge to $1^{-1}=1$.  
However, if $U$ is an open set as above about $1$, then
for sufficiently large $p$, {\em none} of the adeles $\bx_p$ are
contained in $U$.
\end{example}


\begin{lemma}\label{lem:idelesprod}\ilem{ideles are a restricted product}
The group of ideles $\II_K$ is the restricted topological project
of the $K_v^*$ with respect to the units $U_v=\O_v^*\subset K_v$,
with the restricted product topology.
\end{lemma}
We omit the proof of Lemma~\ref{lem:idelesprod}, which is a
matter of thinking carefully about the definitions.  The main
point is that inversion is continuous on $\O_v^*$ for each~$v$.
(See Example~\ref{ex:cont}.)


We have seen that $K$ is naturally embedded in $\AA_K$, so
$K^*$ is naturally embedded in~$\II_K$.  
\begin{definition}[Principal Ideles]
  We call $K^*$, considered as a subgroup of $\II_K$, the 
\defn{principal ideles}.
\end{definition}

\begin{lemma}\ilem{principal ideles are discrete}
The principal ideles $K^*$ are discrete as a subgroup of $\II_K$.
\end{lemma}
\begin{proof}
  For $K$ is discrete in $\AA_K$, so $K^*$ is embedded in $\AA_K\times
  \AA_K$ by (\ref{eqn:prod_embed}) as a discrete subset.
  (Alternatively, the subgroup topology on $\II_K$ is finer than the
  topology coming from $\II_K$ being a subset of $\AA_K$, and $K$ is
  already discrete in $\AA_K$.)
\end{proof}

\begin{definition}[Content of an Idele]
The \defn{content} of $\bx=\{x_v\}_v \in \II_K$ is
$$
  c(\bx) = \prod_{\text{all }v} \abs{x_v}_v \in \R_{>0}.
$$
\end{definition}

\begin{lemma}\ilem{content map is continuous}
The map $\bx\to c(\bx)$ is a continuous  homomorphism of
the topological group $\II_K$ into $\R_{>0}$, where
we view $\R_{>0}$ as a topological group under multiplication.
If~$K$ is a number field, then $c$ is surjective.
\end{lemma}
\begin{proof}
That the content map~$c$ satisfies the axioms of a homomorphisms
follows from the multiplicative nature of the defining formula
for~$c$.  For continuity, suppose $(a,b)$ is an open interval
in $\R_{>0}$.  Suppose $\bx\in\II_K$ is such that $c(\bx)\in (a,b)$.
By considering small intervals about each non-unit component of 
$\bx$, we find an open neighborhood $U\subset \II_K$ of $\bx$ 
such that $c(U)\subset (a,b)$.  It follows the $c^{-1}((a,b))$
is open.

For surjectivity, use that each archimedean valuation is surjective,
and choose an idele that is~$1$ at all but one archimedean valuation.
\end{proof}
\begin{remark}
Note also that the $\II_K$-topology is that appropriate to a
group of operators on $\AA_K^+$: a basis of open sets
is the $S(C,U)$, where $C,U\subset \AA_K^+$
are, respectively, $\AA_K$-compact and $\AA_K$-open, and
$S$ consists of the $\bx\in \II_J$ such that 
$(1-\bx) C\subset U$ and 
$(1-\bx^{-1}) C\subset U$.
\end{remark}

\begin{definition}[$1$-Ideles]
  The subgroup $\II_K^1$ of \defn{$1$-ideles} is the subgroup of ideles
  $\bx=\{x_v\}$ such that $c(\bx)=1$.  Thus $\II_K^1$
is the kernel of $c$, so we have an exact sequence
$$
1 \to \II_K^1 \to \II_K \xra{c} \R_{>0}\to 1,
$$
where the surjectivity on the right is only if $K$
is a number field.
\end{definition}

\begin{lemma}\ilem{subset topology on $1$-ideles $\II_K^1$}
The subset $\II_K^1$ of $\AA_K$ is closed as a subset,
and the $\AA_K$-subset topology on $\II_K^1$ coincides
with the $\II_K$-subset topology on $\II_K^1$.
\end{lemma}
\begin{proof}
  Let $\bx\in\AA_K$ with $\bx\not\in\II_K^1$. To prove that $\II_K^1$
  is closed in $\AA_K$, we find an $\AA_K$-neighborhood $W$ of $\bx$
  that does not meet $\II_K^1$.

{\em 1st Case.}  Suppose that $\prod_v \abs{x_v}_v<1$ (possibly $=0$).
Then there is a finite set~$S$ of~$v$ such that
\begin{enumerate}
\item $S$ contains all the $v$ with $\abs{x_v}_v>1$, and
\item $\prod_{v\in S}\abs{x_v}_v < 1$.
\end{enumerate}
Then the set $W$ can be
defined by 
\begin{align*}
  \abs{w_v - x_v}_v &< \eps \qquad v\in S\\
  \abs{w_v}_v &\leq 1 \qquad v\not\in S
\end{align*}
for sufficiently small $\eps$.

{\em 2nd Case.} Suppose that $C:=\prod_v \abs{x_v}_v>1$.
Then there is a finite set $S$ of $v$ such that
\begin{enumerate}
\item $S$ contains all the $v$ with $\abs{x_v}_v>1$, and
\item if $v\not\in S$ an inequality 
$\abs{w_v}_v<1$ implies $\abs{w_v}_v < \frac{1}{2C}.$
(This is because for a non-archimedean valuation, the
largest absolute value less than $1$ is $1/p$, where $p$ is
the residue characteristic.  Also, the upper bound in
Cassels's article is $\frac{1}{2}C$ instead of $\frac{1}{2C}$,
but I think he got it wrong.)
\end{enumerate}
We can choose $\eps$ so small that 
$\abs{w_v-x_v}_v<\eps$ (for $v\in S$) implies
$1<\prod_{v\in S} \abs{w_v}_v < 2C.$  Then $W$ may be defined
by 
\begin{align*}
  \abs{w_v - x_v}_v &< \eps \qquad v\in S\\
  \abs{w_v}_v &\leq 1 \qquad v\not\in S.
\end{align*}
This works because if $\bw\in W$, then either
$\abs{w_v}_v=1$ for all $v\not\in S$, in 
which case $1 < c(\bw)  < 2c$, so $\bw\not\in \II_K^1$,
or $\abs{w_{v_0}}_{v_0}<1$ for some $v_0\not\in S$, in
which case $$c(\bw) = \left(\prod_{v\in S} \abs{w_v}_v \right)\cdot 
\abs{w_{v_0}} \cdots < 2C \cdot \frac{1}{2C} \cdots < 1,$$
so again $\bw\not\in\II_K^1$.

We next show that the $\II_K$- and $\AA_K$-topologies on $\II_K^1$
are the same.  If $\bx\in \II_K^1$, we must show that every
$\AA_K$-neighborhood of $\bx$ contains an $\AA_K$-neighborhood
and vice-versa.

Let $W\subset \II_K^1$ be an $\AA_K$-neighborhood of $\bx$.  Then it
contains an $\AA_K$-neighborhood of the type
\begin{align}\label{eqn:adelicnbhd}
  \abs{w_v - x_v}_v &< \eps \qquad v\in S\\
  \abs{w_v}_v &\leq 1 \qquad v\not\in S
\end{align}
where $S$ is a finite set of valuations $v$.  This contains
the $\II_K$-neighborhood in which $\leq$ in (\ref{eqn:adelicnbhd})
is replaced by $=$.

Next let $H\subset \II_K^1$ be an $\II_K$-neighborhood.  Then it contains
an $\II_K$-neighborhood of the form
\begin{align}\label{eqn:adelicnbhd2}
  \abs{w_v - x_v}_v &< \eps \qquad v\in S\\
  \abs{w_v}_v &= 1 \qquad v\not\in S,
\end{align}
where the finite set~$S$ contains at least all archimedean
valuations~$v$ and all valuations~$v$ with 
$\abs{x_v}_v\neq 1$.  Since $\prod\abs{x_v}_v=1$, we may also
suppose that $\eps$ is so small that (\ref{eqn:adelicnbhd2})
implies 
$$
  \prod_v\abs{w_v}_v < 2.
$$
Then the intersection of  (\ref{eqn:adelicnbhd2}) with
$\II_K^1$ is the same as that of  (\ref{eqn:adelicnbhd})
with $\II_K^1$, i.e.,  (\ref{eqn:adelicnbhd2})
defines an $\AA_K$-neighborhood.
\end{proof}

By the product formula we have that $K^*\subset \II_K^1$.
The following result is of vital importance in class
field theory.
\begin{theorem}\label{thm:compquo}\ithm{compact quotient of ideles}
The quotient $\II_K^1/K^*$ with the quotient topology
is compact.
\end{theorem}
\begin{proof}
After the preceeding lemma, it is enough to find
an $\AA_K$-compact set $W\subset \AA_K$ such that the map
$$
  W\meet \II_K^1 \to \II_K^1/K^*
$$
is surjective.  We take for $W$ the set of 
$\bw=\{w_v\}_v$ with
$$
  \abs{w_v}_v\leq \abs{x_v}_v,
$$
where $\bx=\{x_v\}_v$ is any idele of content greater than
the $C$ of Lemma~\ref{lem:bignorm}.

Let $\by=\{y_v\}_v\in \II_K^1$.  Then the content of $\bx/\by$ equals
the content of $\bx$, so by Lemma~\ref{lem:bignorm}
there is an $a\in K^*$ such that 
$$
  \abs{a}_v \leq \abs{\frac{x_v}{y_v}}_v \qquad\text{all $v$}.
$$
Then $a\by\in W$, as required.
\end{proof}

\begin{remark}
  The quotient $\II_K^1/K^*$ is totally disconnected in the function
  field case.  For the structure of its connected component in the
  number field case, see papers of Artin and Weil in the ``Proceedings
  of the Tokyo Symposium on Algebraic Number Theory, 1955'' (Science
  Council of Japan) or \cite{artin-tate:cft}. The determination of the
  character group of $\II_K/K^*$ is global class field theory.
\end{remark}

\section{Ideals and Divisors}
Suppose that $K$ is a finite extension of $\Q$.  Let $F_K$ be the the
free abelian group on a set of symbols in bijection with the
non-archimedean valuation~$v$ of $K$.  Thus an element of $F_K$
is a formal linear combination 
$$
  \sum_{v\text{ non arch.}} n_v \cdot v
$$
where $n_v\in\Z$ and all but finitely many $n_v$ are $0$. 

\begin{lemma}\ilem{fractional ideals and formal sums of valuations}
  There is a natural bijection between $F_K$ and the group of nonzero
  fractional ideals of $\O_K$.  The correspondence is induced by
  $$ v\mapsto \wp_v = \{x \in \O_K : v(x)<1\},$$
where $v$ is a non-archimedean valuation.
\end{lemma}


Endow $F_K$ with the discrete topology.  Then there is a natural
continuous map $\pi:\II_K \to F_K$ given by
$$
\bx = \{x_v\}_v \mapsto \sum_v \ord_v(x_v)\cdot v.
$$
This map is continuous since the inverse image of 
a valuation $v$ (a point) is the product 
$$
\pi^{-1}(v) = \pi \O_v^* \quad \times 
\prod_{w \text{ archimedean}} K_w^*\quad
\times \prod_{w\neq v \text{ non-arch.}} \O_w^*,
$$
which is an open set in the restricted product
topology on $\II_K$.
Moreover, the image of $K^*$ in $F_K$ is the group of nonzero
principal fractional ideals.

Recall that the \defn{class group} $C_K$ of the number field $K$
is by definition the quotient of $F_K$ by the image of $K^*$.

\begin{theorem}\label{thm:classgrpfin}\ithm{finiteness of class group}
The class group $C_K$ of a number field $K$ is finite.
\end{theorem}
\begin{proof}
  We first prove that the map $\II_K^1\to F_K$ is surjective.  Let
  $\infty$ be an archimedean valuation on $K$.  If $v$ is a
  non-archimedean valuation, let $\bx\in \II_K^1$ be a $1$-idele such
  that $x_w=1$ at ever valuation~$w$ except~$v$ and~$\infty$.  At~$v$,
  choose $x_v = \pi$ to be a generator for the maximal ideal of
  $\O_v$, and choose $x_\infty$ to be such that $\abs{x_\infty}_\infty
  = 1/\abs{x_v}_v$.  Then $\bx\in \II_K$ and $\prod_{w}\abs{x_w}_w =
  1$, so $\bx\in\II_K^1$.  Also $\bx$ maps to $v \in F_K$.
  
  Thus the group of ideal classes is the continuous image of the
  compact group $\II_K^1/K^*$ (see Theorem~\ref{thm:compquo}), hence
  compact.  But a compact discrete group is finite.
\end{proof}

\subsection{The Function Field Case}

When $K$ is a finite separable extension of $\F(t)$, we define the
divisor group $D_K$ of $K$ to be the free abelian group on all the
valuations~$v$.  For each $v$ the number of elements of the residue class
field $\F_v = \O_v/\wp_v$ of $v$ is a power, say $q^{n_v}$, of the number~$q$
of elements in $\F_v$.  We call $n_v$ the degree of $v$, and similarly
define $\sum n_v d_v$ to be the degree of the divisor $\sum n_v\cdot v$.
The divisors of degree $0$ form a group $D_K^0$.  
As before, the principal divisor attached to $a\in K^*$  is 
$\sum \ord_v(a) \cdot v \in D_K$.
The following theorem is proved in the same way as Theorem~\ref{thm:classgrpfin}.
\begin{theorem}\label{thm:finclassgrpff}\ithm{finiteness of function field class group}
The quotient of $D_K^0$ modulo the principal divisors is
a finite group.
\end{theorem}

\subsection{Jacobians of Curves}
For those familiar with algebraic geometry and algebraic curves, one
can prove Theorem~\ref{thm:finclassgrpff} from an alternative point of
view.  There is a bijection between nonsingular geometrically
irreducible projective curves over $\F$ and function fields $K$ over
$\F$ (which we assume are finite separable extensions of $\F(t)$ such
that $\Fbar\meet K = \F$).  Let $X$ be the curve corresponding to $K$.
The group $D_K^0$ is in bijection with the divisors of degree $0$ on
$X$, a group typically denoted $\Div^0(X)$.  The quotient of
$\Div^0(X)$ by principal divisors is denoted $\Pic^0(X)$.  The {\em
  Jacobian} of $X$ is an abelian variety $J=\Jac(X)$ over the finite
field $\F$ whose dimension is equal to the genus of $X$.  Moreover,
assuming $X$ has an $\F$-rational point, the elements of $\Pic^0(X)$
are in natural bijection with the $\F$-rational points on~$J$.  In
particular, with these hypothesis, the class group of $K$, which is
isomorphic to $\Pic^0(X)$, is in bijection with the group of
$\F$-rational points on an algebraic variety over a finite field.
This gives an alternative more complicated proof of finiteness of the
degree $0$ class group of a function field.  

Without the degree $0$ condition, the divisor class group won't be finite.  It
is an extension of~$\Z$ by a finite group.
$$
  0 \to \Pic^0(X) \to \Pic(X) \xra{\deg} n\Z \to 0,
$$
where~$n$ is the greatest common divisor of the degrees of 
elements of $\Pic(X)$, which is $1$ when $X$ has a rational 
point.


\chapter{Exercises}
\label{ch:hmwk}
\begin{enumerate}

\item %(Artin, problem 12.4.3) 
Let $A=\left(
        \begin{matrix}4&7&2\\2&4&6\\0&0&0
        \end{matrix}\right)$. 
\begin{enumerate}
\item Find invertible integer matrices $P$ and $Q$ such
that $PAQ$ is in Smith normal form.  
\item What is the group structure of
the cokernel of the map $\Z^3\to \Z^3$ defined by multiplication by
$A$?
\end{enumerate}

\item Let $G$ be the abelian group generated by $x,y,z$ with relatoins
$2x+y=0$ and $x-y+3z=0$.  Find a product of cyclic groups that is
isomorphic to $G$.

\item Prove that each of the following rings have infinitely
many prime ideals:
\begin{enumerate}
\item The integers $\Z$.  [Hint: Euclid gave a famous proof of this long ago.]
\item The ring $\Q[x]$ of polynomials over $\Q$.
\item The ring $\Z[x]$ of polynomials over $\Z$.
\item The ring $\Zbar$ of all algebraic integers. [Hint: Use Zorn's
lemma, which implies that every ideal is contained in a maximal
ideal. See, e.g., Prop 1.12 on page 589 of Artin's {\em Algebra}.]
\end{enumerate}

\item 
(This problem was on the graduate qualifying exam on Tuesday.)  Let
$\Zbar$ denote the subset of all elements of $\Qbar$ that satisfy a
monic polynomial with coefficients in the ring $\Z$ of integers.  We
proved in class that $\Zbar$ is a ring.
\begin{enumerate}
\item Show that the ideals $(2)$ and $(\sqrt{2})$ in $\Zbar$ are
distinct.
\item Prove that $\Zbar$ is not Noetherian.
\end{enumerate}

\item% (1.2 from Swinnerton-Dyer): 
Show that neither $\Z[\sqrt{-6}]$
nor $\Z[\sqrt{5}]$ is a unique factorization domain.  [Hint: Consider
the factorization into irreducible elements of $6$ in the first case
and~$4$ in the second.  A nonzero element $a$ in a ring $R$ is an {\em
irreducible element} if it is not a unit and if whenever $a=qr$, then
one of $q$ or $r$ is a unit.]

\item Find the ring of integers of each of the following number
fields:
\begin{enumerate}
\item $\Q(\sqrt{-3})$,
\item $\Q(\sqrt{3})$, and
\item $\Q(\sqrt[3]{2})$.
\end{enumerate}
Do not use a computer for the first two.

\item Find the discriminants of the rings of integers of the numbers
fields in the previous problem.  (Do not use a computer.)

\item Let $R$ be a finite integral domain.  Prove that $R$ is a field. 
[Hint: Show that if $x$ is a nonzero element, then $x$ has an inverse
by considering powers of $x$.]

\item\label{ex:extends} Suppose $K\subset L\subset M$ is a tower of number fields
and let $\sigma:L\hra \Qbar$ be a field embedding of $L$ into $\Qbar$
that fixes $K$ elementwise.  Show that $\sigma$ extends in exactly
$[M:L]$ ways to a field embedding $M\hra\Qbar$.

\item
\begin{enumerate}
\item  Suppose $I$ and $J$ are principal ideals in a ring $R$.
Show that the set $\{ab : a \in I,\, b\in J\}$ is an ideal.  
\item Give an example of ideals $I$ and $J$ in the polynomial
ring $\Q[x,y]$ in two variables such that 
$\{ab : a \in I,\, b\in J\}$ is not an ideal.
Your example illustrates why it is necessary to define the product
of two ideals to be the ideal generated by
$\{ab : a \in I,\, b\in J\}$.
\item Give an example of a ring of integers $\O_K$ of a number
field, and ideals~$I$ and~$J$ such that $\{ab : a \in I,\, b\in J\}$
is not an ideal.
\end{enumerate}


\item 
\begin{enumerate}
\item Let $k$ be a field. Prove that $k[x]$ is a Dedekind domain.
\item (Problem 1.12 from Swinnerton-Dyer)  Let $x$ be an indeterminate.
Show that the ring $\Z[x]$ is Noetherian and integrally closed in its
field of fractions, but is not a Dedekind domain.
\end{enumerate}

\item Use \magma{} to write each of the following (fractional) ideals as a
product of explicitly given prime ideals:
\begin{enumerate}
\item The ideal $(2004)$ in $\Q(\sqrt{-1})$.
\item The ideals $I=(7)$ and $J=(3)$ in the ring of integers of
$\Q(\zeta_7)$, where $\zeta_7$ is a root of the irreducible polynomial
$x^6 + x^5 + x^4 + x^3 + x^2 + x + 1$.    (The field $\Q(\zeta_7)$
is called the $7$th cyclotomic field.)
\item The principal fractional ideal $(3/8)$ in $\Q(\sqrt{5})$.
\end{enumerate}

\item Suppose~$R$ is an order in the ring $\O_K$ of integers of a
number field.  (Recall that an order is a subring of finite index in
$\O_K$.)  For each of the following questions, either explain why the
answer is yes for any possible order $R$ in any $\O_K$, or find one
specific counterexample:
\begin{enumerate}
\item Is $R$ necessarily Noetherian? 
\item Is $R$ necessarily integrally closed in its field of fractions?
\item Is every nonzero prime ideal of $R$ necessarily maximal?
\item Is it always possible to write every ideal of $R$ uniquely as a
product of prime ideals of $R$?
\end{enumerate}

\item Let $\O_K$ be the ring of integers of a number field~$K$.  Prove
that the group of fractional ideals of $\O_K$, under multiplication is
(non-canonically) isomorphic to the group of positive rational numbers
under multiplication.


\item 
\begin{enumerate}
\item Suppose $K$ is a number field of degree $2$.  Prove that
$\O_K=\Z[a]$ for some $a\in\O_K$.
\item Prove that if $K$ and $K'$ are two number fields
of degree $2$ and $\Disc(\O_K) = \Disc(\O_{K'})$ then
$K=K'$.
\end{enumerate}

\item (*) Does there exist a number field~$K$ of degree~$4$ such that
$\O_K\neq \Z[a]$ for all $a\in\O_K$?  If so, give an explicit example.

\item Let $K$ be the quintic number field generated by a root of
$x^5+7x^4+3x^2-x+1$.  Draw a diagram (be creative) that illustrates
the factorization of every prime $p\in\Z$, with $p<100$, in $\O_K$.

\item (Problem 1.9 in Swinnerton-Dyer) Show that the only solutions
$x,y\in\Z$ to $y^2 = x^3 - 13$
are given by $x=17, y=\pm 70$, as follows. 
Factor the equation $y^2+13=x^3$ 
in the number field $\Q(\sqrt{-13})$, which has
class number~$2$.  Show that if $x,y$ is an integer solution then the
ideal $(y+\sqrt{-13})$ must be the cube of an ideal, and hence
$y+\sqrt{-13} = (a+b\sqrt{-13})^3$; thus $1=b(3a^2-13b^2)$.

%\item Find representative ideals for each element of the class group
%of $\Q(\sqrt{-23})$.

\item Suppose $I$ and $J$ are ideals in the ring $\O_K$ of integers of
a number field $K$.  Does $IJ=I\cap J$?  Prove or give a
counterexample.

\item Let $\O_K$ be the ring of integers $\Q(\sqrt{5})$,
and let 
$$I=(5, 2+\sqrt{5})\qquad\text{and}\qquad J=(209,(389+\sqrt{5})/2)$$
be integral ideals of $\O_K$.
\begin{enumerate}
\item 
Find an element of $\O_K$ that is congruent to $\sqrt{5}$
modulo $I$ and is congruent to $1-\sqrt{5}$ modulo $J$.
\item What is the cardinality of $(\O_K/I) \oplus (\O_K/J)$?
\item Find an element $a\in I$ such that $(a)/I$ is coprime
to $J$.
\end{enumerate}

\item Let $\O_K$ be the ring of integers of a number field
$K$, and suppose $K$ has exactly $2s$ complex embeddings. Prove
that the sign of $\Disc(\O_K)$ is $(-1)^s$.

\item (*) Suppose $\O$ is an order in the ring of integers $\O_K$ of a
number field.  Is every ideal in $\O$ necessarily generated by two
elements? (Answer: No. Challenge: Given an example.)


\item Find representative ideals for each element of the class group
of $\Q(\sqrt{-23})$.  Illustrate how to use the Minkowski bound
to prove that your list of representatives is complete.

\item Suppose $\O$ is an order in the ring of integers $\O_K$ of a
number field.  Is every ideal in $\O$ necessarily generated by two
elements?

\item Let $K$ be a number field of degree $n>1$ with $s$ pairs
of complex conjugate embeddings.  Prove that 
\[
\left(\frac{\pi}{4}\right)^s\cdot \frac{n^n}{n!} > 1.
\]

\item Do the exercise on page 19 of Swinnerton-Dyer, which shows
that the quantity $C_{r,s}$ in the finiteness of class group theorem
can be taken to be $\left(\frac{4}{\pi}\right)^{s} \frac{n!}{n^n}$.

% exercise from page 341 of Frohlich-Taylor
\item Let $\alpha$ denote a root of $x^3-x+2$ and let $K=\Q(\alpha)$.
Show that $\O_K=\Z[\alpha]$ and that $K$ has class number $1$ (don't
just read this off from the output of the \magma{} commands {\tt
MaximalOrder} and {\tt ClassNumber}).  [Hint: consider the square
factors of the discriminant of $x^3-x+2$ and show that
$\frac{1}{2}(a+b\alpha + c\alpha^2)$ is an algebra integer if and only
if $a$, $b$, and $c$ are all even.]

% from page 342 of Frohlich-Taylor
\item If $S$ is a closed, bounded, convex, symmetric set in $\R^n$
with $\Vol(S)\geq m 2^n$, for some positive integer $m$, show that
$S$ contains at least $2m$ nonzero points in $\Z^n$.

\item\label{hmwk:cyclic} Prove that any finite subgroup of the multiplicative
group of a field is cyclic.

\item For a given number field $K$, which seems more difficult for
\magma{} to compute, the class groups or explicit generators for the
group of units?  It is very difficult (but not impossible) to not get
full credit on this problem.  Play around with some examples, see what
seems more difficult, and {\em justify} your response with examples.
(This problem might be annoying to do using the \magma{} web page, since
it kills your \magma{} job after 30 seconds.  Feel free to request a
binary of \magma{} from me, or an account on MECCAH (Mathematics Extreme
Computation Cluster at Harvard).)

\item
\begin{enumerate}
\item Prove that there is no number field $K$ such that $U_K\isom \Z/10\Z$.
\item Is there a number field $K$ such that 
$U_K\isom \Z\times \Z/6\Z$?
\end{enumerate}

\item Prove that the rank of $U_K$ is unbounded as $K$ varies over all
number fields.

\item Let $K=\Q(\zeta_5)$.
\begin{enumerate}
\item Show that $r=0$ and $s=2$.
\item Find explicitly generators for the group of
units of $U_K$ (you can use \magma{} for this).
\item Draw an illustration of the log map
$\vphi:U_K\to \R^2$, including the hyperplane
$x_1+x_2=0$ and the lattice in the hyperplane 
spanned by the image of $U_K$.
\end{enumerate}

\item
Find the group of units of $\Q(\zeta_n)$ as an abstract
group as a function of $n$.  (I.e., find the number of cyclic
factors and the size of the torsion subgroup.  You do not have
to find explicit generators!)

\item Let $K=\Q(a)$, where $a$
is a root $x^3-3x+1$.
\begin{enumerate}
\item Show that $r=3$.
\item Find explicitly the log embedding of $U_K$
into a $2$-dimensional hyperplane in $\R^3$, and
draw a picture.
\end{enumerate}

\item Prove that if $K$ is a quadratic field and the torsion subgroup
of $U_K$ has order bigger than $2$, then $K=\Q(\sqrt{-3})$ or
$K=\Q(\sqrt{-1})$.

\item A \defn{Salem number} is a real algebraic integer, greater than
1, with the property that all of its conjugates lie on or within the
unit circle, and at least one conjugate lies on the unit circle.  By
any method (including ``google''), give two examples of Salem numbers.

\item Let $p\in \Z$ and let $K$ be a number field.  Show that 
$\Norm_{K/\Q}(p\O_K) = p^{[K:\Q]}$.

\item
A totally real number field is a number field in which all embeddings
into $\C$ have image in $\R$.  Prove there are totally real number
fields of degree $p$, for every prime $p$.  [Hint: Let $\zeta_n$
denote a primitive $n$th root of unity.  For $n\geq 3$, show that
$\Q(\zeta_n+1/\zeta_n)$ is totally real of degree $\vphi(n)/2$.  Now
prove that $\vphi(n)/2$ can be made divisible by any prime.]

\item Give an example of a number field $K/\Q$ and a prime $p$ such
that the $e_i$ in the factorization of $p\O_K$ are not all the same.

\item Let $K$ be a number field.  Give the ``simplest''
proof you can think of that there are only finitely many
primes that ramify (i.e., have some $e_i>1$) in $K$.
[The meaning of ``simplest'' is a matter of taste.]

\item Give examples to show that for $K/\Q$ a Galois extension, the
quantity $e$ can be arbirarily large and $f$ can be arbitrarily large.

\item Suppose $K/\Q$ is Galois and $p$ is a prime such that 
$p\O_K$ is also prime (i.e., $p$ is inert in $K$).  Show
that $\Gal(K/\Q)$ is a cyclic group.

\item (Problem 7, page 116, from Marcus {\em Number Fields})  For
each of the following, find
a prime $p$ and quadratic extensions $K$ and $L$ of $\Q$
that illustrates the assertion:
\begin{enumerate}
\item The prime $p$ can be totally ramified in $K$ and $L$ without
being totally ramified in $KL$.
\item The fields $K$ and $L$ can each contain unique primes lying over $p$
while $KL$ does not.
\item The prime $p$ can be inert in $K$ and $L$ without being inert in $KL$.
\item The residue field extensions of $\F_p$ can be trivial
for $K$ and $L$ without being trivial for $KL$.
\end{enumerate}

\item Let $S_3$ by the symmetric group on three symbols, which
has order $6$.
\begin{enumerate}
\item \label{ex:a} Observe that $S_3\isom D_3$, where $D_3$ is the dihedral group
of order $6$, which is the group of symmetries of an equilateral
triangle.
\item Use (\ref{ex:a}) to write down an explicit
embedding $S_3\hra \GL_2(\C)$.
\item Let $K$ be the number field $\Q(\sqrt[3]{2},\omega)$,
where $\omega^3=1$ is a nontrivial cube root of unity.  Show
that $K$ is a Galois extension with Galois group isomorphic to $S_3$.
\item We thus obtain a $2$-dimensional irreducible complex
Galois representation
$$
\rho:\Gal(\Qbar/\Q) \to \Gal(K/\Q)\isom S_3 \subset \GL_2(\C).
$$
Compute a representative matrix of $\Frob_p$ and the characteristic polynomial
of $\Frob_p$ for $p=5,7,11,13$.  
\end{enumerate}

\item Let $K=\Q(\sqrt{2},\sqrt{3},\sqrt{5},\sqrt{7})$. 
Show that $K$ is Galois over $\Q$, compute the Galois
group of $K$, and compute $\Frob_{37}$.

\item Let $k$ be any field. Prove that the only nontrivial valuations
on $k(t)$ which are trivial on $k$ are equivalent to the valuation
(\ref{eqn:ffabsp}) or (\ref{eqn:ffabsoo}) of page~\pageref{eqn:ffabsp}.
\item A field with the topology induced by a valuation is
a topological field, i.e., the operations sum, product, 
and reciprocal are continuous.
\item Give an example of a non-archimedean valuation on a field that
is not discrete.
\item Prove that the field $\Q_p$ of $p$-adic numbers is 
uncountable.
\item Prove that the polynomial $f(x)=x^3 - 3x^2 + 2x + 5$ 
has all its roots in $\Q_5$, and find the $5$-adic valuations
of each of these roots.  (You might need to use
Hensel's lemma, which we don't discuss in detail
in this book. See \cite[App.~C]{cassels:global}.)

\item In this problem you will compute an example of weak
  approximation, like I did in the Example~\ref{ex:weakapprox}.  Let
  $K=\Q$, let $\absspc_7$ be the $7$-adic absolute value, let
  $\absspc_{11}$ be the $11$-adic absolute value, and let
  $\absspc_{\infty}$ be the usual archimedean absolute value.  Find an
  element $b\in \Q$ such that $\abs{b-a_i}_i<\frac{1}{10}$, where $a_7
  = 1$, $a_{11} = 2$, and $a_{\infty} = -2004$.
  
\item Prove that $-9$ has a cube root in $\Q_{10}$ using the following
  strategy (this is a special case of Hensel's Lemma, which you can
  read about in an appendix to Cassel's article).

\begin{enumerate}
\item Show that there is an element $\alpha\in\Z$ such that $\alpha^3\con 9\pmod{10^3}$. 
\item Suppose $n\geq 3$. 
Use induction to show that if $\alpha_1\in\Z$ and 
$\alpha^3\con 9\pmod{10^n}$,  then there exists $\alpha_2\in\Z$ such 
that $\alpha_2^3\con 9\pmod{10^{n+1}}$.
(Hint: Show that there is an integer~$b$ such that
$(\alpha_1 + b\cdot 10^{n})^3 \con 9\pmod{10^{n+1}}$.)
\item Conclude that $9$ has a cube root in $\Q_{10}$.
\end{enumerate}

\item\label{ex:padic0}
Compute the first~$5$ digits of the $10$-adic expansions of the following
rational numbers:
$$ 
 \frac{13}{2}, \quad \frac{1}{389}, \quad \frac{17}{19}, 
 \quad \text{ the 4 square roots of $41$}.
$$

\item\label{ex:padic1}
Let $N>1$ be an integer.  Prove that the series
$$
  \sum_{n=1}^{\infty} (-1)^{n+1}n! = 1! - 2! + 3! - 4! + 5! - 6! + \cdots.
$$
converges in $\Q_N$.

\item\label{ex:padic2}
Prove that $-9$ has a cube root in $\Q_{10}$ using the following strategy (this
is a special case of ``Hensel's Lemma''\index{Hensel's lemma}).

\begin{enumerate}
\item Show that there is $\alpha\in\Z$ such that $\alpha^3\con 9\pmod{10^3}$. 
\item Suppose $n\geq 3$. 
Use induction to show that if $\alpha_1\in\Z$ and 
$\alpha^3\con 9\pmod{10^n}$,  then there exists $\alpha_2\in\Z$ such 
that $\alpha_2^3\con 9\pmod{10^{n+1}}$.
(Hint: Show that there is an integer~$b$ such that
$(\alpha_1 + b10^{n})^3 \con 9\pmod{10^{n+1}}$.)
\item Conclude that $9$ has a cube root in $\Q_{10}$.
\end{enumerate}

\item\label{ex:padic4}
Let $N>1$ be an integer.  
\begin{enumerate}
\item Prove that $\Q_N$ is equipped with a natural ring structure.
\item If $N$ is prime, prove that $\Q_N$ is a field.
\end{enumerate}


\item\label{ex:padic3}
\begin{enumerate}
\item Let $p$ and $q$ be distinct primes.  Prove that 
$\Q_{pq} \isom \Q_p \cross \Q_q$.
\item Is $\Q_{p^2}$ isomorphic to either of $\Q_p\cross \Q_p$ or $\Q_p$?
\end{enumerate}


\item\label{ques:approxfield} Prove that every finite extension of
  $\Q_p$ ``comes from'' an extension of~$\Q$, in the following sense.
  Given an irreducible polynomial $f\in\Q_p[x]$ there exists an
  irreducible polynomial $g\in \Q[x]$ such that the fields
  $\Q_p[x]/(f)$ and $\Q_p[x]/(g)$ are isomorphic.  [Hint: Choose each
  coefficient of $g$ to be sufficiently close to the corresponding
  coefficient of $f$, then use Hensel's lemma to show that $g$ has a
  root in $\Q_p[x]/(f)$.]

\item Find the $3$-adic expansion to precision 4 of each root of the following polynomial over $\Q_3$:
$$
  f = x^3 - 3x^2 + 2x + 3 \in \Q_3[x].
$$
Your solution should conclude with three expressions of the form 
$$a_0 + a_1\cdot 3 + a_2\cdot 3^2 + a_3 \cdot 3^3 + O(3^4).$$

\item
\begin{enumerate}
\item Find the normalized Haar measure of the following subset of 
$\Q_7^+$:
$$
U = B\left(28,\frac{1}{50}\right) = 
\left\lbrace x\in \Q_7 : \abs{x-28} < \frac{1}{50}\right\rbrace.
$$
\item
Find the normalized Haar measure of the subset $\Z_7^*$ of
$\Q_7^*$.
\end{enumerate} 


\item Suppose that $K$ is a finite extension of $\Q_p$ and $L$
is a finite extension of $\Q_q$, with $p\neq q$ and assume
that $K$ and $L$ have the same degree.  Prove that
there is a polynomial $g\in \Q[x]$ such that $\Q_p[x]/(g)\isom K$
and $\Q_q[x]/(g)\isom L$.  [Hint: Combine your solution to \ref{ques:approxfield} with the weak approximation theorem.]
 
\item Prove that the ring $C$ defined in Section 9 really is the tensor
product of $A$ and $B$, i.e., that it satisfies the defining universal
mapping property for tensor products.  Part of this problem is for you
to look up a functorial definition of tensor product.

\item Find a zero divisor pair in $\Q(\sqrt{5})\tensor_\Q\Q(\sqrt{5})$.

\item 
\begin{enumerate}
\item Is $\Q(\sqrt{5})\tensor_\Q\Q(\sqrt{-5})$ a field?
\item Is $\Q(\sqrt[4]{5})\tensor_\Q\Q(\sqrt[4]{-5})\tensor_\Q\Q(\sqrt{-1})$ a field?
\end{enumerate}

\item Suppose $\zeta_5$ denotes a primitive $5$th root of unity.  For
  any prime $p$, consider the tensor product $\Q_p \tensor_\Q
  \Q(\zeta_5) = K_1\oplus \cdots \oplus K_{n(p)}$.  Find a simple
  formula for the number $n(p)$ of fields appearing in the
  decomposition of the tensor product $\Q_p \tensor_\Q \Q(\zeta_5)$.
  To get full credit on this problem your formula must be correct, but
  you do {\em not} have to prove that it is correct.

\item Suppose $\normspc_1$ and $\normspc_2$ are 
equivalent norms on a finite-dimensional vector space
$V$ over a field $K$ (with valuation $\absspc$). 
Carefully prove that the topology induced by $\normspc_1$
is the same as that induced by $\normspc_2$.

\item Suppose $K$ and $L$ are number fields (i.e., finite
extensions of $\Q$).  Is it possible for the tensor
product $K\tensor_\Q L$ to contain a nilpotent element? 
(A nonzero element $a$ in a ring $R$ is \defn{nilpotent} if 
there exists $n>1$ such that $a^n=0$.)

\item  Let $K$ be the number field $\Q(\sqrt[5]{2})$.

\begin{enumerate}
\item In how many ways does the $2$-adic valuation $\absspc_2$ on $\Q$
extend to a valuation on $K$?
\item Let $v=\absspc$ be a valuation on $K$ that extends $\absspc_2$.
Let $K_v$ be the completion of $K$ with respect to $v$.
What is the residue class field $\F$ of $K_v$?
\end{enumerate}

\item Prove that the product formula holds for $\F(t)$ similar to the
  proof we gave in class using Ostrowski's theorem for $\Q$.  You may
  use the analogue of Ostrowski's theorem for $\F(t)$, which you had
  on a previous homework assignment.  (Don't give a measure-theoretic
  proof.)
\item Prove Theorem~\ref{thm:adelequo}, that ``The global field $K$
  is discrete in $\AA_K$ and the quotient $\AA_K^+/K^+$ of additive
  groups is compact in the quotient topology.'' in the case when $K$
  is a finite extension of $\F(t)$, where $\F$ is a finite field.

\end{enumerate}


\bibliography{biblio}

\newcommand{\nn}[1]{{\bf #1}}
\printindex

\end{document}

