\chapter{Rings and ideals}
\section{Some motivational metaphors about rings vs groups}
In this chapter we'll introduce the notion of
a \textbf{commutative ring} $R$.
It is a larger structure than a group:
it will have two operations addition and multiplication,
rather than just one.
We will then immediately define a \textbf{ring homomorphism}
$R \to S$ between pairs of rings.

This time, instead of having normal subgroups $H \normalin G$,
rings will instead have subsets $I \subseteq R$ called \textbf{ideals},
which are not themselves rings but satisfy some niceness conditions.
We will then show how you to define $R/I$,
in analogy to $G/H$ as before.
Finally, like with groups, we will talk a bit about how to generate ideals.

Here is a possibly helpful table of analogies to help you keep track:
\begin{center}
	\begin{tabular}[h]{lcc}
		& Group & Ring \\
		\hline
		Notation & $G$ & $R$ \\
		Operations & $\cdot$ & $+$, $\times$ \\
		Commutativity & only if abelian & for us, always \\
		Sub-structure & subgroup & (not discussed) \\
		Homomorphism & grp hom.\ $G \to H$ & ring hom.\ $R \to S$ \\
		Kernel & normal subgroup & ideal \\
		Quotient & $G/H$ & $R/I$ \\
	\end{tabular}
\end{center}

\section{(Optional) Pedagogical notes on motivation}
I wrote most of these examples with a number theoretic eye in mind;
thus if you liked elementary number theory,
a lot of your intuition will carry over.
Basically, we'll try to generalize properties of the ring $\ZZ$ to
any abelian structure in which we can also multiply.
That's why, for example, you can talk about
``irreducible polynomials in $\QQ[x]$'' in the same
way you can talk about ``primes in $\ZZ$'',
or about ``factoring polynomials modulo $p$''
in the same way we can talk ``unique factorization in $\ZZ$''.
Even if you only care about $\ZZ$
(say, you're a number theorist), this has a lot of value:
I assure you that trying to solve $x^n+y^n = z^n$ (for $n > 2$)
requires going into a ring other than $\ZZ$!

Thus for all the sections that follow, keep $\ZZ$ in mind as your prototype.

I mention this here because
commutative algebra is \emph{also} closely tied to algebraic geometry.
Lots of the ideas in commutative algebra have nice
``geometric'' interpretations that motivate the definitions,
and these connections are explored in the corresponding part later.
So, I want to admit outright that this is not
the only good way (perhaps not even the most natural one)
of motivating what is to follow.

\section{Definition and examples of rings}
\prototype{$\ZZ$ all the way! Also $R[x]$ and various fields (next section).}

Well, I guess I'll define a ring\footnote{Or,
	according to some authors, a ``ring with identity'';
	some authors don't require rings to have multiplicative identity.
	For us, ``ring'' always means ``ring with $1$''.}.

\begin{definition}
	A \vocab{ring} is a triple $(R, +, \times)$,
	the two operations usually called addition and multiplication, such that
	\begin{enumerate}[(i)]
		\ii $(R,+)$ is an abelian group, with identity $0_R$, or just $0$.
		\ii $\times$ is an associative, binary operation on $R$ with some
		identity, written $1_R$ or just $1$.
		\ii Multiplication distributes over addition.
	\end{enumerate}
	The ring $R$ is \vocab{commutative} if $\times$ is commutative.
\end{definition}
\begin{abuse}
	As usual, we will abbreviate $(R, +, \times)$ to $R$.
\end{abuse}
\begin{abuse}
	For simplicity, assume all rings are commutative
	for the rest of this chapter.
	We'll run into some noncommutative rings eventually,
	but for such rings we won't need the full theory of this chapter anyways.
\end{abuse}

These definitions are just here for completeness.
The examples are much more important.
\begin{example}[Typical rings]
	\listhack
	\begin{enumerate}[(a)]
		\ii The sets $\ZZ$, $\QQ$, $\RR$ and $\CC$ are all rings
		with the usual addition and multiplication.
		\ii The integers modulo $n$ are also a ring
		with the usual addition and multiplication.
		We also denote it by $\Zc n$.
	\end{enumerate}
\end{example}

Here is also a trivial example.
\begin{definition}
	The \vocab{zero ring} is the ring $R$ with a single element.
	We denote the zero ring by $0$.
	A ring is \vocab{nontrivial} if it is not the zero ring.
\end{definition}
\begin{exercise}
	[Comedic]
	Show that a ring is nontrivial if and only if $0_R \ne 1_R$.
\end{exercise}

Since I've defined this structure, I may as well state the obligatory facts about it.
\begin{fact}
	For any ring $R$ and $r \in R$, $r \cdot 0_R = 0_R$.
	Moreover, $r \cdot (-1_R) = -r$.
\end{fact}

Here are some more examples of rings.
\begin{example}
	[Product ring]
	\label{ex:product_ring}
	Given two rings $R$ and $S$ the \vocab{product ring},
	denoted $R \times S$, is defined as ordered pairs $(r,s)$
	with both operations done component-wise.
	For example, the Chinese remainder theorem says
	that \[ \Zc{15} \cong \Zc3 \times \Zc5 \]
	with the isomorphism $n \bmod{15} \mapsto (n \bmod 3, n \bmod 5)$.
\end{example}
\begin{remark}
	Equivalently, we can define $R \times S$ as the abelian group $R \oplus S$,
	and endow it with the multiplication where $r \cdot s = 0$
	for $r \in R$, $s \in S$.
\end{remark}
\begin{ques}
	Which $(r,s)$ is the identity element of the product ring $R \times S$?
\end{ques}

\begin{example}[Polynomial ring]
	Given any ring $R$,
	the \vocab{polynomial ring} $R[x]$ is defined as the set of polynomials
	with coefficients in $R$:
	\[ R[x] = \left\{ a_n x^n+a_{n-1}x^{n-1}+\dots+a_0
		\mid a_0, \dots, a_n \in R \right\}. \]
	This is pronounced ``$R$ adjoin $x$''.
	Addition and multiplication are done exactly in the way you would expect.
\end{example}
\begin{remark}
	[Digression on division]
	Happily, polynomial division also does what we expect:
	if $p \in R[x]$ is a polynomial, and $p(a) = 0$,
	then $(x-a)q(x) = p(x)$ for some polynomial $q$.
	Proof: do polynomial long division.

	With that, note the caveat that
	\[ x^2-1 \equiv (x-1)(x+1) \pmod 8 \]
	has \emph{four} roots $1$, $3$, $5$, $7$ in $\Zc8$.

	The problem is that $2 \cdot 4 = 0$ even though $2$ and $4$ are not zero;
	we call $2$ and $4$ \emph{zero divisors} for that reason.
	In an \emph{integral domain} (a ring without zero divisors),
	this pathology goes away,
	and just about everything you know about polynomials carries over.
	(I'll say this all again next section.)
\end{remark}
\begin{example}
	[Multi-variable polynomial ring]
	We can consider polynomials in $n$ variables with coefficients in $R$,
	denoted $R[x_1, \dots, x_n]$.
	(We can even adjoin infinitely many $x$'s if we like!)
\end{example}

\begin{example}
	[Gaussian integers are a ring]
	The \vocab{Gaussian integers} are the set of complex numbers
	with integer real and imaginary parts, that is
	\[ \ZZ[i] = \left\{ a+bi \mid a,b \in \ZZ \right\}. \]
\end{example}
\begin{abuse}
	[Liberal use of adjoinment]
	Careful readers will detect some abuse in notation here.
	$\ZZ[i]$ should officially be
	``integer-coefficient polynomials in a variable $i$''.
	However, it is understood from context that $i^2=-1$;
	and a polynomial in $i = \sqrt{-1}$ ``is'' a Gaussian integer.
\end{abuse}
\begin{example}
	[Cube root of $2$]
	As another example (using the same abuse of notation):
	\[ \ZZ[\sqrt[3]{2}] = \left\{ a + b\sqrt[3]{2} + c\sqrt[3]4
		\mid a,b,c \in \ZZ \right\}. \]
\end{example}

\section{Fields}
\prototype{$\QQ$ is a field, but $\ZZ$ is not.}

Although we won't need to know what a field is until next chapter,
they're so convenient for examples I will go ahead and introduce them now.

As you might already know, if the multiplication is invertible,
then we call the ring a field.
To be explicit, let me write the relevant definitions.

\begin{definition}
	\label{def:unit}
	A \vocab{unit} of a ring $R$
	is an element $u \in R$ which is invertible:
	for some $x \in R$ we have $ux = 1_R$.
\end{definition}

\begin{example}
	[Examples of units]
	\listhack
	\begin{enumerate}[(a)]
	\ii The units of $\ZZ$ are $\pm 1$,
	because these are the only things which ``divide $1$''
	(which is the reason for the name ``unit'').
	\ii On the other hand, in $\QQ$ everything is a unit (except $0$).
	For example, $\frac 35$ is a unit since
	$\frac 35 \cdot \frac 53 = 1$.
	\ii The Gaussian integers $\ZZ[i]$ have four units:
	$\pm 1$ and $\pm i$.
	\end{enumerate}
\end{example}

\begin{definition}
	A nontrivial (commutative) ring is a \vocab{field}
	when all its nonzero elements are units.
\end{definition}

Colloquially, we say that
\begin{moral}
	A field is a structure where you can add, subtract, multiply, and divide.
\end{moral}
Depending on context, they are often denoted
either $k$, $K$, $F$.

\begin{example}
	[First examples of fields]
	\listhack
	\begin{enumerate}[(a)]
		\ii $\QQ$, $\RR$, $\CC$ are fields,
		since the notion $\frac 1c$ makes sense in them.
		\ii If $p$ is a prime, then $\Zc p$ is a field,
		which we denote will usually denote by $\FF_p$.
	\end{enumerate}
	The trivial ring $0$ is \emph{not} considered a field,
	since we require fields to be nontrivial.
\end{example}

%\begin{remark}
%	You might say at this point that ``fields are nicer than rings'',
%	but as you'll see in this chapter, the conditions for
%	being a field are somehow ``too strong''.
%	To give an example of what I mean:
%	if you try to think about the concept of ``divisibility''
%	in $\ZZ$, you've stepped into the vast and bizarre realm of
%	number theory.  Try to do the same thing in $\QQ$ and you get nothing:
%	any nonzero $a$ ``divides'' any nonzero $b$
%	because $b = a \cdot \frac ba$.
%
%	I know at least one person who instead
%	thinks of this as an argument for why people
%	shouldn't care about number theory
%	(studying chaos rather than order).
%\end{remark}

\section{Homomorphisms}
\prototype{$\ZZ \to \Zc5$ by modding out by $5$.}
This section is going to go briskly --
it's the obvious generalization of all the stuff
we did with quotient groups.\footnote{I once found an
	abstract algebra textbook which teaches rings before groups.
	At the time I didn't understand why,
	but now I think I get it -- modding out by things in
	commutative rings is far more natural, and you can start talking
	about all the various flavors of rings and fields.
	You also have (in my opinion) more vivid first examples
	for rings than for groups.
	I actually sympathize a lot with this approach --- maybe I'll convert
	Napkin to follow it one day.}

First, we define a homomorphism and isomorphism.
\begin{definition}
	Let $R = (R, +_R, \times_R)$ and $S = (S, +_S, \times_S)$ be rings.
	A \vocab{ring homomorphism} is a map $\phi : R \to S$
	such that
	\begin{enumerate}[(i)]
		\ii $\phi(x +_R y) = \phi(x) +_S \phi(y)$ for each $x,y \in R$.
		\ii $\phi(x \times_R y) = \phi(x) \times_S \phi(y)$ for each $x,y \in R$.
		\ii $\phi(1_R) = 1_S$.
	\end{enumerate}
	If $\phi$ is a bijection then $\phi$ is an \vocab{isomorphism}
	and we say that rings $R$ and $S$ are \vocab{isomorphic}.
\end{definition}
Just what you would expect.
The only surprise is that we also demand $\phi(1_R)$ to go to $1_S$.
This condition is not extraneous:
consider the map $\ZZ \to \ZZ$ called ``multiply by zero''.
\begin{example}
	[Examples of homomorphisms]
	\listhack
	\begin{enumerate}[(a)]
		\ii The identity map, as always.
		\ii The map $\ZZ \to \Zc5$ modding out by $5$.
		\ii The map $\RR[x] \to \RR$ by $p(x) \mapsto p(0)$
		by taking the constant term.
		\ii For any ring $R$, there is a trivial ring homomorphism $R \to 0$.
	\end{enumerate}
\end{example}
\begin{example}
	[Non-examples of homomorphisms]
	Because we require $1_R$ to $1_S$, some maps that you
	might have thought were homomorphisms will fail.
	\begin{enumerate}[(a)]
		\ii The map $\ZZ \to \ZZ$ by $x \mapsto 2x$
		is not a ring homomorphism.
		Aside from the fact it sends $1$ to $2$,
		it also does not preserve multiplication.

		\ii If $S$ is a nontrivial ring,
		the map $R \to S$ by $x \mapsto 0$ is not
		a ring homomorphism, even though it preserves multiplication.

		\ii There is no ring homomorphism $\Zc{2016} \to \ZZ$ at all.
	\end{enumerate}
	In particular, whereas for groups $G$ and $H$
	there was always a trivial group homomorphism sending
	everything in $G$ to $1_H$, this is not the case for rings.
\end{example}

\section{Ideals}
\prototype{The multiples of $5$ are an ideal of $\ZZ$.}
Now, just like we were able to mod out by groups,
we'd also like to define quotient rings.
So once again,
\begin{definition}
	The \vocab{kernel} of a ring homomorphism $\phi \colon R \to S$,
	denoted $\ker \phi$, is the set of $r \in R$ such that $\phi(r) = 0$.
\end{definition}

In group theory, we were able to characterize the ``normal'' subgroups by a few
obviously necessary conditions (namely, $gHg\inv = H$).
We can do the same thing for rings, and it's in fact easier because our operations are commutative.

First, note two obvious facts:
\begin{itemize}
	\ii If $\phi(x) = \phi(y) = 0$, then $\phi(x+y) = 0$ as well.
	So $\ker \phi$ should be closed under addition.
	\ii If $\phi(x) = 0$, then for any $r \in R$ we have
	$\phi(rx) = \phi(r)\phi(x) = 0$ too.
	So for $x \in \ker \phi$ and \emph{any} $r \in R$,
	we have $rx \in \ker\phi$.
\end{itemize}

A (nonempty) subset $I \subseteq R$ is called
an ideal if it satisfies these properties.
That is,
\begin{definition}
	A nonempty subset $I \subseteq R$ is an \vocab{ideal}
	if it is closed under addition, and for each $x \in I$,
	$rx \in I$ for all $r \in R$.
	It is \vocab{proper} if $I \neq R$.
\end{definition}

Note that in the second condition, $r$ need not be in $I$!
So this is stronger than merely saying $I$ is closed under multiplication.
\begin{remark}
	If $R$ is not commutative, we also need the condition $xr \in I$.
	That is, the ideal is \emph{two-sided}: it absorbs multiplication
	from both the left and the right.
	But since rings in Napkin are commutative
	we needn't worry with this distinction.
\end{remark}

\begin{example}
	[Prototypical example of an ideal]
	Consider the set $I = 5\ZZ = \{\dots,-10,-5,0,5,10,\dots\}$ as an ideal in $\ZZ$.
	We indeed see $I$ is the kernel of the ``take mod $5$'' homomorphism:
	\[ \ZZ \surjto \ZZ/5\ZZ. \]
	It's clearly closed under addition,
	but it absorbs multiplication from \emph{all} elements of $\ZZ$:
	given $15 \in I$, $999 \in \ZZ$, we get $15 \cdot 999 \in I$.
\end{example}

\begin{exercise}
	[Mandatory: fields have two ideals]
	If $K$ is a field, show that $K$ has exactly two ideals.
	What are they?
	\label{exer:field_ideal}
\end{exercise}

Now we claim that these conditions are sufficient.
More explicitly,
\begin{theorem}
	[Ring analog of normal subgroups]
	Let $R$ be a ring and $I \subsetneq R$.
	Then $I$ is the kernel of some homomorphism if and only if it's an ideal.
\end{theorem}
\begin{proof}
	It's quite similar to the proof for the normal subgroup thing,
	and you might try it yourself as an exercise.

	Obviously the conditions are necessary.
	To see they're sufficient, we \emph{define} a ring by ``cosets''
	\[ S = \left\{ r + I \mid r \in R \right\}. \]
	These are the equivalence classes under $r_1 \sim r_2$ if and only if $r_1 - r_2 \in I$
	(think of this as taking ``mod $I$'').
	To see that these form a ring, we have to check that the addition
	and multiplication we put on them is well-defined.
	Specifically, we want to check that if $r_1 \sim s_1$ and $r_2 \sim s_2$,
	then $r_1 + r_2 \sim s_1 + s_2$ and $r_1r_2 \sim s_1s_2$.
	We actually already did the first part
	-- just think of $R$ and $S$ as abelian
	groups, forgetting for the moment that we can multiply.
	The multiplication is more interesting.
	\begin{exercise}
		[Recommended]
		Show that if $r_1 \sim s_1$ and $r_2 \sim s_2$, then $r_1r_2 \sim s_1s_2$.
		You will need to use the fact that $I$ absorbs multiplication
		from \emph{any} elements of $R$, not just those in $I$.
	\end{exercise}
	Anyways, since this addition and multiplication is well-defined there
	is now a surjective homomorphism $R \to S$ with kernel exactly $I$.
\end{proof}

\begin{definition}
	Given an ideal $I$, we define as above the \vocab{quotient ring}
	\[ R/I \defeq \left\{ r+I \mid r \in R \right\}. \]
	It's the ring of these equivalence classes.
	This ring is pronounced ``$R$ mod $I$''.
\end{definition}
\begin{example}[$\ZZ/5\ZZ$]
	The integers modulo $5$ formed by ``modding out additively by $5$''
	are the $\Zc 5$ we have already met.
\end{example}
But here's an important point:
just as we don't actually think of $\ZZ/5\ZZ$ as consisting of
$k + 5\ZZ$ for $k=0,\dots,4$,
we also don't really want to think about $R/I$ as elements $r+I$.
The better way to think about it is
\begin{moral}
	$R/I$ is the result when we declare that elements of $I$ are all zero;
	that is, we ``mod out by elements of $I$''.
\end{moral}
For example, modding out by $5\ZZ$ means that we consider
all elements in $\ZZ$ divisible by $5$ to be zero.
This gives you the usual modular arithmetic!

\begin{exercise}
	Earlier, we wrote $\ZZ[i]$ for the Gaussian integers,
	which was a slight abuse of notation.
	Convince yourself that this ring
	could instead be written as $\ZZ[x] / (x^2+1)$,
	if we wanted to be perfectly formal.
	(We will stick with $\ZZ[i]$ though --- it's more natural.)

	Figure out the analogous formalization of $\ZZ[\sqrt[3]{2}]$.
\end{exercise}

\section{Generating ideals}
\prototype{In $\ZZ$, the ideals are all of the form $(n)$.}

Let's give you some practice with ideals.

An important piece of intuition is that once an ideal
contains a unit, it contains $1$, and
thus must contain the entire ring.
That's why the notion of ``proper ideal''
is useful language.
To expand on that:
\begin{proposition}
	[Proper ideal $\iff$ no units]
	Let $R$ be a ring and $I \subseteq R$ an ideal.
	Then $I$ is proper (i.e.\ $I \ne R$)
	if and only if it contains no units of $R$.
\end{proposition}
\begin{proof}
	Suppose $I$ contains a unit $u$, i.e.\ an element $u$
	with an inverse $u\inv$.
	Then it contains $u \cdot u\inv = 1$, and thus $I = R$.
	Conversely, if $I$ contains no units, it is obviously proper.
\end{proof}
As a consequence, if $K$ is a field,
then its only ideals are $(0)$ and $K$
(this was \Cref{exer:field_ideal}).
So for our practice purposes, we'll be working with rings that aren't fields.

First practice: $\ZZ$.
\begin{exercise}
	Show that the only ideals of $\ZZ$ are precisely those
	sets of the form $n\ZZ$, where $n$ is a nonnegative integer.
\end{exercise}

Thus, while ideals of fields are not terribly interesting,
ideals of $\ZZ$ look eerily like elements of $\ZZ$.
Let's make this more precise.
\begin{definition}
	Let $R$ be a ring.
	The \vocab{ideal generated} by a set of elements $x_1, \dots, x_n \in R$
	is denoted by $I = (x_1, x_2, \dots, x_n)$
	and given by
	\[ I = \left\{ r_1 x_1 + \dots + r_n x_n \mid r_i \in R \right\}.  \]
	One can think of this as ``the smallest ideal containing all the $x_i$''.
\end{definition}

The analogy of putting the $\{x_i\}$ in a sealed box and shaking vigorously
kind of works here too.
\begin{remark}
	[Linear algebra digression]
	If you know linear algebra,
	you can summarize this as: an ideal is an $R$-module.
	The ideal $(x_1, \dots, x_n)$ is the submodule spanned by $x_1, \dots, x_n$.
\end{remark}

In particular, if $I = (x)$ then $I$ consists of exactly the
``multiples of $x$'', i.e.\ numbers of the form $rx$ for $r \in R$.
\begin{remark}
	We can also apply this definition to infinite generating sets,
	as long as only finitely many of the $r_i$ are not zero
	(since infinite sums don't make sense in general).
\end{remark}

\begin{example}[Examples of generated ideals]
	\listhack
	\begin{enumerate}[(a)]
		\ii As $(n) = n\ZZ$ for all $n \in \ZZ$,
		every ideal in $\ZZ$ is of the form $(n)$.
		\ii In $\ZZ[i]$, we have
		$(5) = \left\{ 5a + 5b i \mid a,b \in \ZZ \right\}$.
		\ii In $\ZZ[x]$, the ideal $(x)$ consists of polynomials
		with zero constant terms.
		\ii In $\ZZ[x,y]$, the ideal $(x,y)$ again consists
		of polynomials with zero constant terms.
		\ii In $\ZZ[x]$, the ideal $(x,5)$ consists of polynomials
		whose constant term is divisible by $5$.
	\end{enumerate}
\end{example}
\begin{ques}
	Please check that the set
	$I = \left\{ r_1 x_1 + \dots + r_n x_n \mid r_i \in R \right\}$
	is indeed always an ideal (closed under addition,
	and absorbs multiplication).
\end{ques}
Now suppose $I = (x_1, \dots, x_n)$.
What does $R/I$ look like?
According to what I said at the end of the last section,
it's what happens when we ``mod out'' by each of the elements $x_i$.
For example\dots
\begin{example}
	[Modding out by generated ideals]
	\listhack
	\begin{enumerate}[(a)]
		\ii Let $R = \ZZ$ and $I = (5)$. Then $R/I$ is literally
		$\ZZ/5\ZZ$, or the ``integers modulo $5$'':
		it is the result of declaring $5 = 0$.
		\ii Let $R = \ZZ[x]$ and $I = (x)$.
		Then $R/I$ means we send $x$ to zero; hence $R/I \cong \ZZ$
		as given any polynomial $p(x) \in R$,
		we simply get its constant term.
		\ii Let $R = \ZZ[x]$ again and now let $I = (x-3)$.
		Then $R/I$ should be thought of as the quotient when $x-3 \equiv 0$,
		that is, $x \equiv 3$.
		So given a polynomial $p(x)$ its image after
		we mod out should be thought of as $p(3)$.
		Again $R/I \cong \ZZ$, but in a different way.
		\ii Finally, let $I = (x-3,5)$.
		Then $R/I$ not only sends $x$ to three, but also $5$ to zero.
		So given $p \in R$, we get $p(3) \pmod 5$.
		Then $R/I \cong \ZZ/5\ZZ$.
	\end{enumerate}
\end{example}
\begin{remark}
	[Mod notation]
	By the way, given an ideal $I$ of a ring $R$, it's totally legit to write
	\[ x \equiv y \pmod I \]
	to mean that $x-y \in I$.
	Everything you learned about modular arithmetic carries over.
\end{remark}

\section{Principal ideal domains}
\prototype{$\ZZ$ is a PID, $\ZZ[x]$ is not.
$\CC[x]$ is a PID, $\CC[x,y]$ is not.}

What happens if we put multiple generators in an ideal,
like $(10,15) \subseteq \ZZ$?
Well, we have by definition that $(10,15)$ is given as a set by
\[ (10,15) \defeq \left\{ 10x + 15y \mid x,y \in \ZZ \right\}.  \]
If you're good at number theory you'll instantly
recognize this as $5\ZZ = (5)$.
Surprise! In $\ZZ$, the ideal $(a,b)$ is exactly $\gcd(a,b) \ZZ$.
And that's exactly the reason you often see the GCD of two numbers denoted $(a,b)$.

We call such an ideal (one generated by a single element) a \vocab{principal ideal}.
So, in $\ZZ$, every ideal is principal.
But the same is not true in more general rings.
\begin{example}
	[A non-principal ideal]
	In $\ZZ[x]$, $I = (x,2015)$ is \emph{not} a principal ideal.

	For if $I = (f)$ for some polynomial $f \in I$
	then $f$ divides $x$ and $2015$.
	This can only occur if $f = \pm 1$,
	but then $I$ contains $\pm1$, which it does not.
\end{example}
A ring with the property that all its ideals
are principal is called a \vocab{principal ideal ring}.
We like this property because they effectively
let us take the ``greatest common factor''
in a similar way as the GCD in $\ZZ$.

In practice, we actually usually care about
so-called \textbf{principal ideal domains (PID's)}.
But we haven't defined what a domain is yet.
Nonetheless, all the examples below are actually PID's,
so we will go ahead and use this word for now,
and tell you what the additional condition is in the next chapter.

\begin{example}
	[Examples of PID's]
	To reiterate, for now you should just verify
	that these are principal ideal rings,
	even though we are using the word PID.
	\begin{enumerate}[(a)]
		\ii As we saw, $\ZZ$ is a PID.

		\ii As we also saw, $\ZZ[x]$ is not a PID,
		since $I = (x,2015)$ for example is not principal.

		\ii It turns out that for a field $k$
		the ring $k[x]$ is always a PID.
		For example, $\QQ[x]$, $\RR[x]$, $\CC[x]$ are PID's.

		If you want to try and prove this,
		first prove an analog of B\'{e}zout's lemma,
		which implies the result.

		\ii $\CC[x,y]$ is not a PID, because $(x,y)$
		is not principal.
	\end{enumerate}
\end{example}

\section{Noetherian rings}
\prototype{$\ZZ[x_1, x_2, \dots]$ is not Noetherian,
	but most reasonable rings are.
	In particular polynomial rings are.
	(Equivalently, only weirdos care about non-Noetherian rings).}

If it's too much to ask that an ideal is generated by \emph{one} element,
perhaps we can at least ask that our ideals
are generated by \emph{finitely many} elements.
Unfortunately, in certain weird rings this is also not the case.
\begin{example}
	[Non-Noetherian ring]
	Consider the ring $R = \ZZ[x_1, x_2, x_3, \dots]$
	which has \emph{infinitely} many free variables.
	Then the ideal $I = (x_1, x_2, \dots) \subseteq R$
	cannot be written with a finite generating set.
\end{example}
Nonetheless, most ``sane'' rings we work in
\emph{do} have the property that their ideals are finitely generated.
We now name such rings and give two equivalent definitions:
\begin{proposition}[The equivalent definitions of a Noetherian ring]
	For a ring $R$, the following are equivalent:
	\begin{enumerate}[(a)]
		\ii Every ideal $I$ of $R$ is finitely generated
		(i.e.\ can be written with a finite generating set).
		\ii There does \emph{not} exist an
		infinite ascending chain of ideals
		\[ I_1 \subsetneq I_2 \subsetneq I_3 \subsetneq \dots. \]
		The absence of such chains is often
		called the \vocab{ascending chain condition}.
	\end{enumerate}
	Such rings are called \vocab{Noetherian}.
\end{proposition}

\begin{example}
	[Non-Noetherian ring breaks ACC]
	In the ring $R = \ZZ[x_1, x_2, x_3, \dots]$ we have
	an infinite ascending chain
	\[ (x_1) \subsetneq (x_1, x_2) \subsetneq (x_1,x_2,x_3) \subsetneq \dots. \]
\end{example}
From the example, you can kind of see why the proposition is true:
from an infinitely generated ideal you can extract an ascending chain
by throwing elements in one at a time.
I'll leave the proof to you if you want to
do it.\footnote{On the other hand, every undergraduate
	class in this topic I've seen makes you do it as homework.
	Admittedly I haven't gone to that many such classes.}

\begin{ques}
	Why are fields Noetherian?
	Why are PID's (such as $\ZZ$) Noetherian?
\end{ques}

This leaves the question:
is our prototypical non-example of a PID,
$\ZZ[x]$, a Noetherian ring?
The answer is a glorious yes,
according to the celebrated Hilbert basis theorem.
\begin{theorem}[Hilbert basis theorem]
	Given a Noetherian ring $R$,
	the ring $R[x]$ is also Noetherian.
	Thus by induction, $R[x_1, x_2, \dots, x_n]$ is Noetherian
	for any integer $n$.
	\label{thm:hilbert_basis}
\end{theorem}
The proof of this theorem is really olympiad flavored,
so I couldn't possibly spoil it -- I've
left it as a problem at the end of this chapter.

Noetherian rings really shine in algebraic geometry,
and it's a bit hard for me to motivate them right now,
other than to say
``most rings you'll encounter are Noetherian''.
Please bear with me!

\section{\problemhead}

\begin{problem}
	The ring $R = \RR[x] / (x^2+1)$ is one that you've seen before.
	What is its name?
	\begin{hint}
		$R = \RR[i]$.
	\end{hint}
	\begin{sol}
		This is just $\RR[i] = \CC$.
		The isomorphism is given by $x \mapsto i$,
		which has kernel $(x^2+1)$.
	\end{sol}
\end{problem}

\begin{problem}
	Show that $\CC[x] / (x^2-x) \cong \CC \times \CC$.
	\begin{hint}
		The isomorphism is given by $x \mapsto (1,0)$
		and $1-x \mapsto (0,1)$.
	\end{hint}
\end{problem}

\begin{problem}
	In the ring $\ZZ$, let $I = (2016)$ and $J = (30)$.
	Show that $I \cap J$ is an ideal of $\ZZ$ and compute its elements.
\end{problem}

\begin{sproblem}
	\label{prob:inclusion_preserving}
	Let $R$ be a ring and $I$ an ideal.
	Find an inclusion-preserving bijection between
	\begin{itemize}
		\ii ideals of $R/I$, and
		\ii ideals of $R$ which contain $I$.
	\end{itemize}
\end{sproblem}

\begin{problem}
	Let $R$ be a ring.
	\begin{enumerate}[(a)]
		\ii Prove that there is exactly one ring homomorphism $\ZZ \to R$.
		\ii Prove that the number of ring homomorphisms
		$\ZZ[x] \to R$ is equal to the number of elements of $R$.
	\end{enumerate}
	\begin{hint}
		For (b) homomorphism is uniquely determined by the choice of $\psi(x) \in R$
	\end{hint}
\end{problem}

%\begin{problem}
%	[$\phi(1_R) = 1_S$ is really necessary]
%	Find two rings $R$ and $S$ and a \emph{nonzero} function
%	$f \colon R \to S$ such that
%	\begin{itemize}
%		\ii $f(x+y) = f(x) + f(y)$ for $x,y \in R$,
%		\ii $f(xy) = f(x) f(y)$ for $x,y \in R$,
%		\ii $f(1_R) \ne 1_S$ (i.e.\ $f$ is not a ring homomorphism).
%	\end{itemize}
%	\begin{hint}
%		Take $S = R \times R$ with $R$ nonzero.
%	\end{hint}
%	\begin{sol}
%		The map $R \to R \times R$ by $x \mapsto (x,0)$ will always work,
%		with $R$ nonzero.
%	\end{sol}
%\end{problem}

\begin{problem}
	\gim
	Prove the Hilbert basis theorem, \Cref{thm:hilbert_basis}.
\end{problem}

\begin{problem}
	[USA Team Selection Test 2016]
	Let $\FF_p$ denote the integers modulo a fixed prime number $p$.
	Define $\Psi \colon \FF_p[x] \to \FF_p[x]$ by
	\[ \Psi\left( \sum_{i=0}^n a_i x^i \right) = \sum_{i=0}^n a_i x^{p^i}. \]
	Let $S$ denote the image of $\Psi$.
	\begin{enumerate}[(a)]
		\ii Show that $S$ is a ring with addition
		given by polynomial addition,
		and multiplication given by \emph{function composition}.
		\ii Prove that $\Psi \colon \FF_p[x] \to S$
		is then a ring isomorphism.
	\end{enumerate}
\end{problem}

\begin{problem} % from Brian Chen
	\yod
	Let $A \subseteq B \subseteq C$ be rings.
	Suppose $C$ is a finitely generated $A$-module.
	Does it follow that $B$ is a finitely generated $A$-module?
	% Assume $A$ is Noetherian. Show that $B$ is finitely generated as an $A$-module.
	% Find a counterexample where $A$ is not Noetherian.
	\begin{hint}
		I think the result is true if you add the assumption $A$ is Noetherian,
		so look for trouble by picking $A$ not Noetherian.
	\end{hint}
	\begin{sol}
		Nope! Pick
		\begin{align*}
			A &= \ZZ[x_1, x_2, \dots] \\
			B &= \ZZ[x_1, x_2, \dots, \eps x_1, \eps x_2, \dots] \\
			C &= \ZZ[x_1, x_2, \dots, \eps].
		\end{align*}
		where $\eps \neq 0$ but $\eps^2 = 0$.
		I think the result is true if you add the assumption $A$ is Noetherian.
	\end{sol}
\end{problem}
