\documentclass{article}

\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[UKenglish]{babel}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{mathtools}
\usepackage{tikz-cd}
\usepackage{csquotes}

\newcommand{\F}{\mathbb{F}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\A}{\mathbb{A}}
\renewcommand{\P}{\mathbb{P}}

\newcommand{\val}[1]{\left. #1 \right\rvert}
\newcommand{\rb}[1]{\left( #1 \right)}
\renewcommand{\sb}[1]{\left[ #1 \right]}
\newcommand{\cb}[1]{\left\{ #1 \right\}}
\newcommand{\ab}[1]{\left\langle #1 \right\rangle}
\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}
\newcommand{\two}[2]{\begin{pmatrix} #1 \\ #2 \end{pmatrix}}
\newcommand{\three}[3]{\begin{pmatrix} #1 & #2 & #3 \end{pmatrix}}

\theoremstyle{definition}\newtheorem{definition}{Definition}[section]
\theoremstyle{definition}\newtheorem{remark}[definition]{Remark}
\theoremstyle{definition}\newtheorem*{example}{Example}
\theoremstyle{definition}\newtheorem*{note}{Note}
\newtheorem{proposition}[definition]{Proposition}
\newtheorem{lemma}[definition]{Lemma}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{corollary}[definition]{Corollary}

\pagestyle{fancy}
\lhead{M4P55 Commutative Algebra}
\rhead{Autumn 2018}

\title{M4P55 Commutative Algebra}
\author{Lectured by Prof Alexei Skorobogatov \\ Typeset by David Kurniadi Angdinata}
\date{Autumn 2018}

\setcounter{section}{-1}

\begin{document}

\maketitle

\vfill

\tableofcontents

\pagebreak

\marginpar{Lecture 1 \\ Friday \\ 05/10/18}

\section{Introduction}

\subsection{Outline}

Why study commutative algebra? Number theory and algebraic geometry use this language.

Structure of the course:
\begin{enumerate}
\item Rings, ideals, zero divisors, nilpotents, etc
\item Prime and maximal ideals
\item Radicals of ideals, nilradicals and the Jacobson radicals
\item Localisation
\item Modules, Nakayama's lemma
\item Noetherian and Artinian rings
\item Primary decomposition
\item Valuation rings and discrete valuation rings
\end{enumerate}

\subsection{References}

\begin{enumerate}
\item M Reid, Undergraduate commutative algebra, 1995
\item M Atiyah and I G Macdonald, Introduction to commutative algebra, 1969
\end{enumerate}

\section{Rings and ideals}

\begin{definition}
A commutative \textbf{ring} with 1 is a set $ A $ with two operations $ + $ and $ \cdot $, and two elements $ 0 $ and $ 1 $ such that the following holds.
\begin{enumerate}
\item $ \rb{A, +} $ is a group with zero $ 0 $.
\item Multiplication is
\begin{enumerate}
\item associative ($ \rb{xy}z = x\rb{yz} $ for all $ x, y, z \in A $),
\item commutative ($ xy = yx $ for all $ x, y \in A $), and
\item distributive over addition ($ x\rb{y + z} = xy + xz $ for all $ x, y, z \in A $).
\end{enumerate}
\item $ x \cdot 1 = 1 \cdot x = x $ for all $ x \in A $.
\end{enumerate}
\end{definition}

\begin{example}
$ \Z $ is a ring. The set of even integers $ 2\Z $ is not a ring because it does not contain $ 1 $.
\end{example}

\begin{remark}
Can it happen that $ 0 = 1 $? $ x \cdot 0 = x \cdot \rb{0 + 0} = x \cdot 0 + x \cdot 0 $ gives $ x \cdot 0 = 0 $. But $ x \cdot 1 = x $. Then $ x = 0 $ for all $ x \in A $, so $ A = \cb{0} $.
\end{remark}

Let $ A $ be a commutative ring with $ 1 $.

\begin{definition}
A \textbf{ring homomorphism} $ f : A \to B $ is a homomorphism of abelian groups such that $ f\rb{xy} = f\rb{x}f\rb{y} $ for any $ x, y \in A $ and $ f\rb{1} = 1 $.
\end{definition}

\begin{proposition}
A composition of homomorphisms is a homomorphism.
\end{proposition}

An \textbf{isomorphism} is a bijective homomorphism. If $ f : A \to B $ is an isomorphism, we write $ A \cong B $.

\marginpar{Lecture 2 \\ Monday \\ 08/10/18}

\begin{definition}
A subset $ I \subset A $ is called an \textbf{ideal} if $ I $ is a subgroup of $ \rb{A, +} $ and $ AI = I $. Equivalently, for any $ a \in A $ and any $ x \in I $ we have $ ax \in I $. The \textbf{quotient ring} $ A / I $ is the quotient group $ \cb{a + I \mid a \in A} $, which is actually a ring by $ \rb{a + I}\rb{b + I} = ab + I $. $ 1 + I $ is the $ 1 $ in $ A / I $. $ f : A \to A / I $ such that $ f\rb{a} = a + I $ is a surjective ring homomorphism. An ideal $ I \subset A $ is \textbf{principal} if there is $ r \in A $ such that $ I = rA $.
\end{definition}

\begin{proposition}
There is a natural bijection between the ideals of $ A $ that contain a fixed ideal $ I $ and the ideals of $ A / I $.
\end{proposition}

\begin{proof}
Suppose $ J \subset A $ is an ideal containing $ I $. Then associate to $ J $ its image $ f\rb{J} \subset A / I $. To check this, note that since $ f : A \to A / I $ is surjective, for any $ x \in A / I $ there is a $ y \in A $ such that $ f\rb{y} = x $. Hence $ xf\rb{J} = f\rb{y}f\rb{J} = f\rb{yJ} \subset f\rb{J} $. Conversely, take an ideal $ M \subset A / I $ and associate to it $ f^{-1}\rb{M} \subset A $. This is an ideal in $ A $. To check that for all $ a \in A $ we have $ af^{-1}\rb{M} \subset f^{-1}\rb{M} $, we note that this is equivalent to $ f\rb{a}M \subset M $, which is true. These maps are inverses to each other.
\end{proof}

\begin{definition}
Let $ g : A \to B $ be a homomorphism of rings. The \textbf{image} is the subset $ Im\rb{g} = \cb{x \in B \mid \exists y \in A, \ g\rb{y} = x} $. The \textbf{kernel} is the subset $ Ker\rb{g} = \cb{y \in A \mid g\rb{y} = 0} $.
\end{definition}

The image is a subring of $ \rb{B, +} $ but not necessarily an ideal, but the kernel is.

\begin{example}
Let $ g : \Z \hookrightarrow \Q $. $ 2\Z $ is an ideal in $ \Z $, but not in $ \Q $.
\end{example}

An isomorphism theorem states that $ A / Ker\rb{g} \cong Im\rb{g} = g\rb{A} $ by $ a \mapsto a + Ker\rb{g} $.

\section{Polynomial rings}

Let $ R $ be a ring. Define $ R\sb{X} $ as the ring of polynomials $ \sum_{i = 0}^n a_iX^i $ with coefficients $ a_i \in R $ and
$$ \rb{\sum_{i = 0}^k a_iX^i}\rb{\sum_{j = 0}^m b_jX^i} = \sum_{k = 0}^{n + m} \rb{\sum_{k = i + j} a_ib_j}X^k. $$
Define $ R\sb{X_1, X_2} $ to be the ring $ R\sb{X_1}\sb{X_2} $. In general, $ R\sb{X_1, \dots, X_n} = R\sb{X_1} \dots \sb{X_2} $.

\section{Zero-divisors, nilpotents, units}

\begin{definition}
A \textbf{zero-divisor} in $ A $ is an element $ x \in A $ such that there exists $ y \in A $, $ y \ne 0 $, with the property that $ xy = 0 $. A ring with no non-zero zero-divisors is called an \textbf{integral domain}. A \textbf{nilpotent} is an element $ x \in A $ such that $ x^n = 0 $ for some $ n \ge 1 $. A \textbf{unit} $ a \in A $ is an element such that there exists $ b \in A $ with the property that $ ab = 1 $. Such elements are also called \textbf{invertible}. $ b $ is denoted by $ a^{-1} $. The units form a group under multiplication, denoted by $ A^* $.
\end{definition}

\begin{example}
In $ A = \Z $, $ \Z^* = \cb{1, -1} $ and $ \Z $ is an integral domain. In $ A = \Z / 4 = \cb{4\Z, 1 + 4\Z, 2 + 4\Z, 3 + 4\Z} $, $ 2 + 4\Z $ is a zero-divisor in $ \Z / 4 $ that is also nilpotent.
\end{example}

\marginpar{Lecture 3 \\ Tuesday \\ 09/10/18}

\begin{definition}
A \textbf{field} is a ring in which $ 0 \ne 1 $ and every non-zero element is a unit. So if $ k $ is a field, then $ k \setminus \cb{0} = k^* $.
\end{definition}

\begin{proposition}
Let $ A $ be a non-zero ring. Then the following are equivalent.
\begin{enumerate}
\item $ A $ is a field.
\item The only ideals in $ A $ are $ \rb{0} = \cb{0} $ and $ \rb{1} = A $.
\item Every homomorphism $ A \to B $, where $ B \ne 0 $, is injective.
\end{enumerate}
\end{proposition}

\begin{proof}
\hfill
\begin{itemize}[leftmargin=2cm]
\item[$ 1 \implies 2 $] Let $ I \subset A $ be a non-zero ideal. Then there exists $ x \in I $, $ x \ne 0 $. Then $ x $ is a unit, i.e. there exists $ y \in A $ such that $ xy = 1 $. For all $ a \in A $, $ a = a.1 = a.y.x \in \rb{x} $. Thus $ I = A $.
\item[$ 2 \implies 3 $] Let $ f : A \to B $. $ Ker\rb{f} $ is an ideal of $ A $. If $ Ker\rb{f} \ne \cb{0} $, then $ Ker\rb{f} = A $. But then $ 1 \in Ker\rb{f} $ and $ f\rb{1} = 0 $ but $ f\rb{1} = 1 $ so in $ B $ we have that $ 0 = 1 $. Then $ B = \cb{0} $, which is a contradiction.
\item[$ 3 \implies 1 $] Let $ x \in A $, $ x \ne 0 $. If $ 1 \in \rb{x} = xA $, then $ x $ is a unit. If $ 1 \notin \rb{x} $, then $ x $ is not a unit. If $ 1 \notin \rb{x} $, then consider the map $ A \to A / \rb{x} $ sending $ a \mapsto a + \rb{x} $. Since $ 1 \notin \rb{x} $, $ 1 + \rb{x} $ is not zero in $ A / \rb{x} $. So this is a non-injective homomorphism to a non-zero ring. This contradicts $ 3 $.
\end{itemize}
\end{proof}

\section{Prime ideals and maximal ideals}

\begin{definition}
An ideal $ P \subset A $ is a \textbf{prime ideal} if for any $ x, y \in A $, $ xy \in P $ implies $ x \in P $ or $ y \in P $. An ideal $ M \subset A $ is called \textbf{maximal} if there does not exist an ideal $ I $ in $ A $ such that $ M \subsetneq I \subsetneq A $.
\end{definition}

\begin{lemma}
An ideal $ P \subset A $ is prime if and only if $ A / P $ is an integral domain. An ideal $ M \subset A $ is maximal if and only if $ A / M $ is a field.
\end{lemma}

\begin{proof}
Let $ x, y \in A $ such that $ xy \in P $. Then $ \rb{x + P}\rb{y + P} = xy + P = P $. If $ x \notin P $ and $ y \notin P $, then $ x + P \ne P $ and $ y + P \ne P $. These are zero-divisors in $ A / P $. Conversely, if $ A / P $ is not an integral domain, then it has zero-divisors. So there exist $ x, y \in A $ such that $ \rb{x + P}\rb{y + P} = P $. This implies $ xy \in P $. Since $ P $ is prime, $ x \in P $ or $ y \in P $. So one of $ x + P $ and $ y + P $ is zero in $ A / P $. Recall that there is a bijection between the ideals in $ A $ containing $ M $ with the ideals in $ A / M $. Thus $ M \subset A $ is maximal if and only if the only ideals in $ A / M $ are $ \rb{0} $ and $ \rb{1} $, if and only if $ A / M $ is a field.
\end{proof}

\begin{remark}
Every field is an integral domain, hence every maximal ideal is prime. The converse is false. Take any integral domain which is not a field, such as $ \Z $. Then $ \rb{0} \in \Z $ is a prime ideal which is not a maximal ideal.
\end{remark}

\begin{proposition}
If $ f : A \to B $ is a homomorphism of rings, and $ P \subset B $ is a prime ideal, then $ f^{-1}\rb{P} $ is a prime ideal in $ A $.
\end{proposition}

\begin{proof}
Assume that for some $ x, y \in A $ we have $ xy \in f^{-1}\rb{P} $. Then $ f\rb{xy} = f\rb{x}f\rb{y} \in P $. Then $ f\rb{x} \in P $ or $ f\rb{y} \in P $. Then $ x \in f^{-1}\rb{P} $ or $ y \in f^{-1}\rb{P} $.
\end{proof}

\begin{remark}
This does not hold for maximal ideals. Let $ f : \Z \hookrightarrow \Q $. $ f^{-1}\rb{\rb{0}} = \rb{0} $, but $ \rb{0} $ is maximal in $ \Q $ and not maximal in $ \Z $. But if $ f : A \to B $ is a surjective homomorphism of rings, then $ f^{-1} $ sends maximal ideals of $ B $ to maximal ideals of $ A $. (Exercise)
\end{remark}

\begin{theorem}
\label{thm:4.6}
Every non-zero ring contains at least one maximal ideal.
\end{theorem}

We need Zorn's lemma, which belongs to set theory. A \textbf{partially ordered set} or \textbf{poset} is a set $ S $ equipped with a \textbf{partial order}. By definition it is a reflexive, transitive, antisymmetric binary relation $ \le $,
$$ x \le x, \qquad x \le y, y \le z \implies x \le z, \qquad x \le y, y \le x \implies x = y. $$
We don't require that for arbitrary $ x $ and $ y $ in $ S $, we have either $ x \le y $ or $ y \le x $. A subset $ T \subset S $ is called a \textbf{chain} if for any $ x \in T $, $ y \in T $ we have $ x \le y $ or $ y \le x $. An \textbf{upper bound} for a subset $ T \subset S $ is an element $ x \in S $ such that for any $ t \in T $ we have $ t \le s $. A \textbf{maximal element} in $ S $ is an element $ x \in S $ such that if $ y \in S $ and $ y \ge x $, then $ y = x $.

\marginpar{Lecture 4 \\ Friday \\ 12/10/18}

\begin{theorem}[Zorn's lemma]
If $ S $ is a non-empty partially ordered set such that every chain in $ S $ has an upper bound in $ S $, then $ S $ contains a maximal element.
\end{theorem}

\begin{proof}[Proof of Theorem \ref{thm:4.6}]
Let $ A $ be a non-zero ring. To apply Zorn's lemma it is enough to show that every growing chain of ideals $ I_1 \subset I_2 \subset \dots $, such that $ 1 \in I_i $ for all $ i $, has an upper bound which is an ideal not equal to $ A $, so not containing $ 1 $. Then Zorn's lemma applied to the set of ideals of $ A $ not containing $ 1 $ and ordered by inclusion, implies the existence of a maximal ideal. So we have a chain $ I_j $, where $ j $ is an element of a set $ J $. Consider $ I = \cup_{j \in J} I_j $. Claim that $ I $ is an ideal in $ A $ and $ 1 \notin I $.
\begin{enumerate}
\item $ 1 \notin I $ is clear. Because otherwise $ 1 \in I $ gives $ 1 \in I_j $ for $ j \in J $, but it is a contradiction.
\item For any $ a \in A $ we have $ aI \subset I $, so for all $ x \in I $, $ ax \in I $. But then $ x \in I_j $ for some $ j $. Then $ ax \in I_j \subset I $.
\item Suppose $ x, y \in I $. Must show $ x + y \in I $. There exists $ j_1 \in J $ such that $ x \in I_{j_1} $. Similarly, there exists $ j_2 \in J $ such that $ y \in I_{j_2} $. Recall that $ I_j $ for $ j \in J $ is a chain. Hence either $ j_1 \le j_2 $ or $ j_2 \le j_1 $. This means that either $ I_{j_1} \subset I_{j_2} $ or $ I_{j_2} \subset I_{j_1} $. Without loss of generality assume that $ I_{j_1} \subset I_{j_2} $. Then $ x, y \in I_{j_2} $. Hence $ x + y \in I_{j_2} $, hence $ x + y \in I $. This proves that $ I $ is an ideal not containing $ 1 $.
\end{enumerate}
\end{proof}

\begin{definition}
A ring with a unique maximal ideal is called a \textbf{local ring}.
\end{definition}

\begin{corollary}
\label{cor:4.9}
Let $ I $ be an ideal of $ A $ and $ I \ne A $. Then $ I $ is contained in a maximal ideal of $ A $.
\end{corollary}

\begin{proof}
There is a bijection between the ideals of $ A $ containing $ I $ and the ideals in $ A / I $. If $ I \subset J \subset A $, then $ J \mapsto J / I $. $ J / I $ is an ideal in $ A / I $. By Theorem \ref{thm:4.6}, $ A / I $ contains a maximal ideal, say $ M \subset A / I $. Let $ f : A \to A / I $ be the map sending $ x \mapsto x + I $. Consider $ f^{-1}\rb{M} \subset A $. This is an ideal in $ A $. In general, if $ I \subset J \subset A $ are ideals, then $ f $ induces an isomorphism of rings $ A / J \to \rb{A / I}\rb{J / I} $. For additive groups, this is one of the standard isomorphisms theorems, but this respects multiplication, so is an isomorphism of rings. Now, we know that $ M $ maximal in $ A / I $ implies that $ \rb{A / I} $ is a field. This ring is isomorphic to $ A / f^{-1}\rb{M} $. Hence $ A / f^{-1}\rb{M} $ is also a field. Therefore, $ f^{-1}\rb{M} $ is maximal in $ A $.
\end{proof}

\begin{corollary}
\label{cor:4.10}
Every non-unit is contained in a maximal ideal.
\end{corollary}

\begin{proof}
If $ x \in A $ is a non-unit, consider $ \rb{x} $. $ 1 \notin \rb{x} $, otherwise $ x $ is a unit. By Corollary \ref{cor:4.9} $ \rb{x} $ is contained in a maximal ideal of $ A $.
\end{proof}

\begin{example}
\hfill
\begin{enumerate}
\item Every field is a local ring. In this case $ \rb{0} $ is a maximal ideal.
\item Let $ k $ be a field. Consider the ring of formal power series $ k\sb{\sb{t}} = \cb{a_0 + a_1t + \dots \mid a_i \in k} $, such that
$$ \rb{\sum_{i = 0}^\infty a_it^i}\rb{\sum_{j = 0}^\infty b_jt^j} = a_0b_0 + \rb{a_0b_1 + a_1b_0}t + \dots. $$
Then the principal ideal $ \rb{t} $ is a maximal ideal. Indeed, $ k\sb{\sb{t}} / \rb{t} \cong k $ is a field. (TODO Exercise: $ k\sb{\sb{t}} \setminus \rb{t} = k\sb{\sb{t}}^* $)
\item $ \Z_{\rb{p}} = \cb{a / b \mid a, b \in \Z, \ b \ne 0, \ p \nmid b} $. (TODO Exercise: $ \rb{p} $ is a maximal ideal. There are no other maximal ideals)
\end{enumerate}
\end{example}

If $ A $ is a local ring with maximal ideal $ M $, then $ A / M $ is called the \textbf{residue field} of $ A $.

\begin{lemma}[Prime avoidance]
\label{lem:4.12}
Let $ A $ be a ring and $ P \subset A $ be a prime ideal. Suppose that $ I_1, \dots, I_n $ are ideals in $ A $ such that $ \cap_{i = 1}^n I_i \subset P $. Then there exists $ j $, $ 1 \le j \le n $, such that $ I_j \subset P $. If $ \cap_{i = 1}^n I_i = P $, then there exists $ j $, $ 1 \le j \le n $, such that $ I_j = P $.
\end{lemma}

\begin{proof}
Suppose our claim is false. Then there exists $ a_j \in I_j $ such that $ a_j \notin P $ for $ j = 1, \dots, n $. Then $ a_1 \dots a_n \in \cap_{j = 1}^n I_i \subset P $. $ \rb{a_1 \dots a_{n - 1}}a_n \in P $ gives $ a_1 \dots a_{n - 1} \in P $ or $ a_n \in P $. But $ a_n \notin P $, so $ a_1 \dots a_{n - 2} \in P $, a contradiction. The second statement follows. We know that $ I_k \subset P $ for some $ k $, $ 1 \le k \le n $, but $ P = \cap_{j = 1}^n I_j \subset I_k $. Hence $ P = I_k $.
\end{proof}

\marginpar{Lecture 5 \\ Monday \\ 15/10/18}

\section{Nilradical and the Jacobson radical}

\begin{proposition}
Let $ A $ be a ring. The set $ N\rb{A} $ of all nilpotent elements of $ A $ is an ideal in $ A $. It is called the \textbf{nilradical} of $ A $. The quotient ring $ A / N\rb{A} $ has no non-zero nilpotents.
\end{proposition}

\begin{proof}
Clearly, if $ x^n = 0 $ and $ y^n = 0 $, then $ \rb{xy}^n = 0 $, if $ n \ge m $. $ \rb{x + y}^{n + m} $ is the sum with coefficients of of monomials in which either the power of $ x $ is $ \ge n $ or the power of $ y $ is $ \ge m $. So this is zero. Let $ a \in A $. Then $ \rb{ax}^n = 0 $. Therefore, $ N\rb{A} $ is an ideal. Now let $ t + N\rb{A} $ for $ t \in A $ be a nilpotent element in $ A / N\rb{A} $. For some $ k $ we have $ t^k + N\rb{A} $ is the trivial coset. That is, $ t^k \in N\rb{A} $. Thus $ \rb{t^k}^l = 0 $ for some $ l > 0 $. Hence $ t \in N\rb{A} $ , so $ t + N\rb{A} $ is the zero element of $ A / N\rb{A} $.
\end{proof}

\begin{proposition}
The nilradical $ N\rb{A} $ is the intersection of all prime ideals of $ A $.
\end{proposition}

\begin{proof}
\hfill
\begin{itemize}
\item[$ \subset $] $ N\rb{A} \subset \cap_{P \subset A} P $, where $ P $ is a prime ideal of $ A $. Take $ x \in A $, $ x^n = 0 $. Take a prime ideal $ P \subset A $. We have that $ P \ni x^n = x \dots x $ gives $ x \in P $.
\item[$ \supset $] Now let $ f \in A $ be a non-nilpotent element, that is $ 0 \notin \cb{f^i \mid i \ge 1} $. Let $ \Sigma $ be the set of ideals of $ A $ that do not intersect $ \cb{f^i \mid i \ge 1} $. $ \Sigma $ contains the zero ideal $ \rb{0} $, so $ \Sigma \ne \emptyset $. Order the elements of $ \Sigma $ by inclusion. Every chain in $ \Sigma $ has an upper bound. If $ I_j $ for $ j \in J $ is a chain, then $ \cup_{j \in J} I_j $ is an ideal of $ A $. Moreover, if $ f^k \in \cup_{j \in J} I_j $, then $ f^k \in I_{j_0} $ for some $ j_0 \in J $, but this is impossible. By Zorn's Lemma, we know that $ \Sigma $ has a maximal element. Call it $ P $. Claim that $ P $ is a prime ideal. To prove this, assume that $ x, y \in A $ such that $ x, y \notin P $. We must show that $ xy \notin P $. Consider $ P + \rb{x} $, all elements of the form $ \alpha + rx $, where $ \alpha \in P $ and $ r \in A $. $ x \notin P $ gives $ P \ne P + \rb{x} $. By construction, $ P $ is maximal in $ \Sigma $, hence $ P + \sigma $ is not in $ \Sigma $, that is, there exists $ n \ge 1 $ such that $ f^n \in P + \rb{x} $. Similarly, there exists $ m $ such that $ f^m \in P + \rb{y} $. Therefore, $ f^{n + m} $ belongs to $ P + \rb{xy} $. If $ xy \in P $, then $ P + \rb{xy} = P $ but then $ f^{n + m} \in P $, which is absurd because $ P \in \Sigma $. Thus $ xy \notin P $. This shows that $ P $ is a prime ideal and $ f \notin P $.
\end{itemize}
\end{proof}

What happens if we consider the intersection of all maximal ideals of $ A $. This intersection is called the \textbf{Jacobson radical} of $ A $. It is denoted by $ J\rb{A} $.

\begin{proposition}
\label{prop:5.3}
$ x \in J\rb{A} $ if and only if $ 1 - xy $ is a unit in $ A $ for all $ y \in A $.
\end{proposition}

\begin{proof}
Suppose that $ x \in J\rb{A} $, that is $ x $ is contained in every maximal ideal of $ A $, but $ 1 - xy $ is not a unit for some $ y \in A $. By Corollary \ref{cor:4.10} every non-unit is contained in some maximal ideal, so there exists a maximal ideal $ M \subset A $ such that $ 1 - xy \in M $. Since $ x \in M $ we conclude that $ 1 \in M $, which is impossible. Conversely, suppose $ x \notin J\rb{A} $, that is, $ x \notin M $ for some maximal ideal $ M \subset A $. Consider the sum of two ideals $ M + \rb{x} $. This is an ideal in $ A $, such that $ M \subsetneq M + \rb{x} $. Since $ M $ is maximal, we have $ M + \rb{x} = A $. Therefore $ 1 = m + xy $, where $ m \in A $ and $ y \in A $. Now $ 1 - xy = m \in M $ cannot be a unit.
\end{proof}

Let $ I \subset A $ be an ideal. The \textbf{radical} $ rad\rb{I} $ or $ r\rb{I} $ or $ \sqrt{I} $ is defined as $ \cb{x \in A \mid \exists n \ge 1, \ x^n \in I} $.

\begin{proposition}
$ r\rb{I} $ is the intersection of all prime ideals of $ A $ that contain $ I $.
\end{proposition}

\begin{proof}
Use the bijection between ideals containing $ I $ and the ideals in $ A / I $.
\end{proof}

\marginpar{Lecture 6 \\ Tuesday \\ 16/10/18}

\begin{definition}
Let $ J $ be an index set. Suppose we have a ring $ R_j $ for $ j \in J $. $ \prod_{j \in J} R_j $ has a natural structure of a ring. $ 0 $ in $ \prod_{j \in J} R_j $ is $ \rb{0, \dots, 0} $ and $ 1 $ in $ \prod_{j \in J} $ is defined as $ \rb{1, \dots, 1} $, and
$$ \rb{r_j}_{j \in J} + \rb{r'_j}_{j \in J} = \rb{r_j + r'_j}_{j \in J}, \qquad \rb{r_j}_{j \in J} \cdot \rb{r'_j}_{j \in J} = \rb{r_j \cdot r'_j}_{j \in J}. $$
$ \prod_{j \in J} R_j $ is called the \textbf{product of rings} $ R_j $ for $ j \in J $. If $ R $ is a ring equipped with homomorphisms $ f_j : R \to R_j $ for each $ j \in J $, then $ \rb{f_j} : R \to \prod_{j \in J} R_j $ is a homomorphism of rings.
\end{definition}

Recall that $ N\rb{R} = \cap_{P \subset R} P $, where $ P $ are prime ideals of $ R $. Consider the product ring $ \prod_{P \subset R} R / P $. Putting together the canonical surjective maps $ R \to R / P $ by $ x \mapsto x + P $ for all $ P \subset R $ we obtain a homomorphism $ f : R \to \prod_{P \subset R} R / P $. $ Ker\rb{f} = \cup_{P \subset R} Ker\sb{R \to R / P} = \cap_{P \subset R} = N\rb{R} $. Hence we get an injective homomorphism $ R / N\rb{R} \to \prod_{P \subset R} R / P $. Similarly, we get an injective homomorphism $ R / J\rb{R} \to \prod_{M \subset R} R / M $, where $ M $ are maximal ideals of $ R $ and $ J\rb{R} $ is the Jacobson radical of $ R $.

\section{Localisation of rings}

Localisation refers to introducing denominators.

\begin{example}
From $ R = \Z $ to $ \Q = \cb{a / b \mid a, b \in \Z, \ b \ne 0} $.
\end{example}

\begin{definition}
A subset $ S \subset A $ is called a \textbf{multiplicative set} if $ 1 \in S $, $ 0 \not\in S $, and if $ a, b \in S $, then $ ab \in S $, that is $ S $ is closed under multiplication.
\end{definition}

\begin{example}
\hfill
\begin{enumerate}
\item Take any $ a \in A $ which is not nilpotent, that is $ a^n = 0 $ for $ n \ge 1 $. Then $ \cb{1, a, a^2, \dots} $ is a multiplicative set.
\item Let $ P \subset A $ be a prime ideal. Then $ A \setminus P $ is a multiplicative set. Indeed, $ x, y \notin P $ gives $ xy \notin P $.
\item Let $ P_j \subset A $, for $ j \in J $, be a family of prime ideals of $ A $. Then $ A \setminus \cup_{j \in J} P_j = \cap_{j \in J} \rb{A \setminus P_j} $ is a multiplicative set.
\item $ A^* $ is a multiplicative set in $ A $.
\item The set of all non-zero-divisors of $ A $ is a multiplicative set.
\item Let $ I \subset A $ be an ideal. Then $ 1 + I = \cb{1 + x \mid x \in I} $ is a multiplicative set.
\end{enumerate}
\end{example}

\begin{definition}
Let $ A $ be a ring with a multiplicative set $ S $. Consider $ A \times S $, that is the set of pairs of elements $ \rb{a, s} $, where $ a \in A $ and $ s \in S $. Define an equivalence relation $ \sim $ as follows. $ \rb{a, s} \sim \rb{b, t} $ if and only if there exists $ u \in S $ such that $ u\rb{at - bs} = 0 $. Define $ S^{-1}A $ to be the set of equivalence classes of $ \sim $. Write the equivalence class of $ \rb{a, s} $ as $ a / s $. Define multiplication on $ S^{-1}A $ as
$$ \dfrac{a}{s} \cdot \dfrac{b}{t} = \dfrac{ab}{st}. $$
Define addition on $ S^{-1}A $ as
$$ \dfrac{a}{s} + \dfrac{b}{t} = \dfrac{at + bs}{st}. $$
Define $ 0 $ in $ S^{-1}A $ as $ 0 / 1 $ and we define $ 1 $ in $ S^{-1}A $ as $ 1 / 1 $.
\end{definition}

(TODO Exercise: check that if $ \rb{a, s} \sim \rb{a', s'} $ and $ \rb{b, t} \sim \rb{b', t'} $, then $ \rb{ab, st} \sim \rb{a'b', s't'} $)
(TODO Exercise: check that if $ \rb{a, s} \sim \rb{a', s'} $ and $ \rb{b, t} \sim \rb{b', t'} $, then $ \rb{at + bs, st} \sim \rb{a't' + b's', s't'} $)
(TODO Exercise: with this definition $ S^{-1}A $ is a ring)

\begin{remark}
$ \sim $ is indeed an equivalence relation. $ \rb{a, s} \sim \rb{a, s} $, $ \rb{a, s} \sim \rb{b, t} $ gives $ \rb{b, t} \sim \rb{a, s} $. Let us check that if $ \rb{a, s} \sim \rb{b, t} $ and $ \rb{b, t} \sim \rb{c, r} $, then $ \rb{a, s} \sim \rb{c, r} $. There exist $ u, v \in S $ such that $ u\rb{at - bs} = 0 $ and $ v\rb{br - ct} = 0 $. Then $ uv\rb{atr - bsr} = 0 $ and $ uv\rb{brs - cts} = 0 $, so $ uvt\rb{ar - bs} = 0 $.
\end{remark}

\begin{lemma}
Let $ A $ be a ring with a multiplicative set $ S $. Then $ f : A \to S^{-1}A $ defined by $ f\rb{x} = x / 1 $ is a homomorphism of rings. $ Ker\rb{f} = 0 $ if and only if $ S $ contains no zero-divisors.
\end{lemma}

\begin{proof}
$$ f\rb{x + y} = \dfrac{x + y}{1} = \dfrac{x}{1} + \dfrac{y}{1}, \qquad f\rb{xy} = \dfrac{xy}{1} = \dfrac{x}{1} \cdot \dfrac{y}{1}. $$
$ Ker\rb{f} = \cb{x \mid \exists u \in S, \ ux = 0} $ since $ x / 1 = 0 / 1 $ if and only if there exists $ u \in S $ such that $ u\rb{x \cdot 1 - 0 \cdot 1} = 0 $.
\end{proof}

\begin{example}
Let $ k $ be a field. Explore what happens when $ A = k\sb{x, y} / \rb{xy} $ and $ S = \cb{1, x, \dots} $. Determine $ S^{-1}A $ and $ Ker\rb{f} $.
\end{example}

\marginpar{Lecture 7 \\ Friday \\ 19/10/18}

Lecture 7 is a problem class.

\marginpar{Lecture 8 \\ Monday \\ 22/10/18}

\begin{lemma}[Universal property of localisation]
Let $ A $ be a ring with a multiplicative set $ S \subset A $. Suppose $ g : A \to B $ is a homomorphism such that $ g\rb{S} \subset B^* $, that is for all $ s \in S $, $ g\rb{s} $ is a unit in $ B $. Then there exists a unique homomorphism $ h : S^{-1}A \to B $ such that $ g = h \circ f $, where $ f : A \to S^{-1}A $ is the canonical map.
\end{lemma}

\begin{proof}
Define $ h\rb{a / s} = g\rb{a}g\rb{s}^{-1} $ since $ g $ invertible. Check that $ h $ is well-defined, that is if $ a / s = a' / s' $, then $ u\rb{as' - a's} = 0 $ for $ u \in S $. Apply $ g $ and get $ g\rb{u}\rb{g\rb{a}g\rb{s'} - g\rb{a'}g\rb{s}} = 0 $. $ g\rb{u} \in B^* $ and $ g\rb{a}g\rb{s'} = g\rb{a'}g\rb{s} $. Hence $ g\rb{a}g\rb{s}^{-1} = g\rb{a'}g\rb{s'}^{-1} $. Take any $ a \in A $. Then $ f\rb{a} = a / 1 $, hence $ \rb{h \circ f}\rb{a} = g\rb{a} $. Finally, let us show there is only one homomorphism $ h : S^{-1}A \to B $ such that $ g = h \circ f $. Suppose $ h' : S^{-1}A \to B $ is such that $ g = h' \circ f $, so that for any $ a \in A $ we have $ g\rb{a} = h'\rb{a} $. For any $ s \in S $, $ s^{-1} $ is an element of $ S^{-1}A $, and so is $ s $. $ 1 = s^{-1}s $ gives $ 1 = h'\rb{1} = h'\rb{s^{-1}}h'\rb{s} $. Thus $ h'\rb{s^{-1}} = h'\rb{s}^{-1} = g\rb{s}^{-1} $ because $ h' $ on the image of $ A $ in $ S^{-1}A $ is the same as $ g $. Comparing this with the definition of $ h $ we see that $ h' = h $.
\end{proof}

Let $ I \subset A $ be an ideal. Define $ S^{-1}I = \cb{x / s \mid x \in I, \ s \in S} $. This is an ideal in $ S^{-1}I $. It is the ideal generated by $ f\rb{I} \subset S^{-1}A $.

\begin{proposition}
Let $ A $ be a ring with a multiplicative set $ S $. Let $ I_1, \dots, I_n $ be ideals in $ A $. Then
\begin{enumerate}
\item $ S^{-1}\rb{I_1 + \dots + I_n} = S^{-1}I_1 + \dots + S^{-1}I_n $,
\item $ S^{-1}\rb{I_1 \dots I_n} = S^{-1}I_1 \dots S^{-1}I_n $,
\item $ S^{-1}\rb{\cap_{j = 1}^n I_j} = \cap_{j = 1}^n S^{-1}I_j $, and
\item $ r\rb{S^{-1}I} = S^{-1}r\rb{I} $, where $ r\rb{I} $ is the radical of $ I $.
\end{enumerate}
\end{proposition}

\begin{proposition}
\label{prop:6.8}
Every ideal of $ S^{-1}A $ is of the form $ S^{-1}I $ for some ideal $ I \subset A $.
\end{proposition}

\begin{proof}
Start with an ideal $ J \subset S^{-1}A $. Consider $ f^{-1}\rb{J} \subset A $. This is an ideal. Call it $ I $. Claim that $ J = S^{-1}I $. Pick any element $ a / s \in J $. Then $ a \in J $. Since $ f\rb{a} = a / 1 \in J $ we have that $ a \in I $. Therefore, $ a / s \in S^{-1}I $. This proves $ J \subset S^{-1}I $. But it is clear that $ S^{-1}I \subset J $. Indeed, $ x \in I $ then $ x / 1 \in J $. But $ J $ is an ideal, hence $ x / s \in J $.
\end{proof}

\begin{theorem}
\label{thm:6.9}
The prime ideals in $ S^{-1}A $ are the ideals $ S^{-1}P $, where $ P $ is a prime ideal of $ A $ such that $ P \cap S \ne \emptyset $. Thus we have a bijection between the set of prime ideals in $ S^{-1}A $ and the set of prime ideals in $ A $ that do not intersect $ S $.
\end{theorem}

\begin{proof}
Suppose that $ P $ is a prime ideal in $ A $, $ P \cap S \ne \emptyset $. Claim that $ S^{-1}P $ is a prime ideal in $ S^{-1}A $. If $ \rb{a / s}\rb{b / t} \in S^{-1}P $, then $ \rb{a / s}\rb{b / t} = c / u $, where $ c \in P $, $ u \in S $. This is equivalent to $ v\rb{abu - cst} = 0 $ for some $ v \in S $. $ \rb{ab}\rb{vu} = c \in P $ such that $ v \in P $. $ vu \in S $ and $ S \cap P = \emptyset $, so $ vu \notin P $. But $ P \subset A $ is a prime ideal, hence $ ab \in P $. Thus $ a \in P $ gives $ a / s \in S^{-1}P $ or $ b \in P $ gives $ b / t \in S^{-1}P $. This proves $ S^{-1}P \subset S^{-1}A $ is prime. For any ideal $ J \subset S^{-1}A $, we know that $ f^{-1}J $ is an ideal in $ S $. Moreover, if $ J $ is prime, then $ f^{-1}J \subset A $ is prime. Let us show that $ f^{-1}J \cap S = \emptyset $. Otherwise, take $ s \in S \cap f^{-1}J $, so $ s / 1 \in J $. But $ 1 / s \in J^{-1}A $, hence $ 1 = \rb{1 / s}s \in J $, so $ J = S^{-1}A $. But $ J $ is a prime ideal, so $ J \ne S^{-1}A $. To show that $ P \mapsto S^{-1}P $ and $ J \mapsto f^{-1}J $ are the identity maps, we need to check that $ P = f^{-1}\rb{S^{-1}P} $ and $ J = S^{-1}f^{-1}\rb{J} $. $ S^{-1}P = \cb{x / s \mid x \in P, \ s \in S} $. If $ y \in f^{-1}\rb{S^{-1}P} \subset A $  is such that $ f\rb{y} = x / s $, then $ y / 1 = x / s $. Hence $ ys = x \in P $. Since $ P \cap S = \emptyset $, $ s \notin P $. Therefore, $ y \in P $. Hence $ P = f^{-1}\rb{S^{-1}A} $. Now let us prove that $ J = S^{-1}f^{-1}\rb{J} $. But in Proposition \ref{prop:6.8} we showed that there is an ideal $ I \subset A $ such that $ J = S^{-1}I $. In the proof of Proposition \ref{prop:6.8} we have taken $ I = f^{-1}\rb{J} $. So we are done.
\end{proof}

\marginpar{Lecture 9 \\ Tuesday \\ 23/10/18}

\section{Determinants}

\begin{lemma}
Let $ f\rb{x_1, \dots, x_n} \in \Z\sb{x_1, \dots, x_n} $. If $ f $ as a function $ \Z^n \to \Z $ is zero, that is $ f $ only takes zero values on arbitrary elements of $ \Z^n $, then $ f $ is the zero polynomial.
\end{lemma}

\begin{proof}
Induction in $ n $. If $ n = 1 $, then $ f\rb{x} $ is a polynomial with infinitely many roots. So $ f\rb{x} $ is the zero polynomial, so cannot have more than $ \deg\rb{f} $ roots. Assume we know the lemma for $ n - 1 $ variables. Write $ f\rb{x_1, \dots, x_n} = \sum_{i = 0}^N f_i\rb{x_1, \dots, x_{n - 1}}x_n^i $ for $ f_j\rb{x_1, \dots, x_{n - 1}} \in \Z\sb{x_1, \dots, x_{n - 1}} $. Fix $ x_1, \dots, x_{n - 1} $. We get a polynomial in one variable $ x_n $, so this polynomial has zero coefficients. This implies that each $ f_i\rb{x_1, \dots, x_n} $ takes only zero values. By the induction assumption, each $ f_i $ is the zero polynomial.
\end{proof}

\begin{remark}
\label{rem:7.2}
This means that if a polynomial formula with coefficients in $ \Z $ is true in $ \Z $, this is true in an arbitrary commutative ring.
\end{remark}

\begin{example}
$ \rb{x + y}^n = \sum_{i = 0}^n \two{n}{i}x^iy^{n - i} $ is true in any ring.
\end{example}

The underlying fact is the existence of a canonical map $ \Z \to R $ by $ 1 \mapsto 1 $.

\begin{definition}
Let $ R $ be a commutative ring. Let $ A = \rb{a_{ij}} $ be a square matrix for $ 1 \le i \le n $ and $ 1 \le j \le n $, with entries in $ R $. Then $ \det\rb{A} $ is defined as $ \rb{-1}^{i + 1}a_{i1}M_{i1} + \dots \rb{-1}^{i + n}a_{in}M_{in} $ for $ i $ fixed. Here $ M_{ij} $ is the determinant of the $ \rb{n - 1} \times \rb{n - 1} $ submatrix of $ A $ obtained by removing the $ i $-th row and the $ j $-th column.
\end{definition}

\begin{proposition}
$ \det\rb{A} = \rb{-1}^{i + 1}a_{i1}M_{i1} + \dots \rb{-1}^{i + n}a_{in}M_{in} $.
\end{proposition}

\begin{proof}
This is known for matrices with entries in $ \C $, so by Remark \ref{rem:7.2} this holds in any commutative ring.
\end{proof}

\begin{remark}
The official definition is
$$ \det\rb{A} = \sum_{\pi \in S_n} sgn\rb{\pi}a_{1\pi\rb{1}} \dots a_{n\pi\rb{n}}, $$
where $ sgn : S_n \to \cb{\pm 1} $.
\end{remark}

\begin{proposition}
For $ i \ne j $,
$$ \rb{-1}^{j + 1}a_{i1}M_{j1} + \dots + \rb{-1}^{j + n}a_{in}M_{jn} = 0, $$
$$ \rb{-1}^{j + 1}a_{1i}M_{1j} + \dots + \rb{-1}^{j + n}a_{ni}M_{nj} = 0. $$
\end{proposition}

Define the \textbf{adjacent} matrix as an $ n \times n $ matrix $ A^v_{ij} = \rb{-1}^{i + j}M_{ji} $. Putting together all the previous identities we get the following.

\begin{theorem}
$ A \cdot A^v = A^v \cdot A = \det\rb{A} I_n $.
\end{theorem}

\marginpar{Lecture 10 \\ Friday \\ 26/10/18}

\section{Modules}

\begin{definition}
Let $ A $ be a ring. A \textbf{module} $ M $ over $ A $ is an abelian group $ \rb{M, 0, +} $ with an action $ \cdot $ of $ A $ on $ M $, that is $ A \times M \to M $ by $ a \cdot m = am $, such that the following axioms hold.
\begin{enumerate}
\item $ 1 \cdot m = m $ for all $ m \in M $ and $ a \in A $.
\item $ \mu \cdot \rb{\lambda \cdot m} = \rb{\mu\lambda} \cdot m $ $ \lambda, \mu \in A $.
\item $ \lambda\rb{x + y} = \lambda x + \lambda y $ for all $ \lambda \in A $ and $ x, y \in M $.
\item $ \rb{\mu + \lambda}x = \mu x + \lambda x $ for all $ \mu, \lambda \in A $ and $ x \in M $.
\end{enumerate}
\end{definition}

\begin{example}
\hfill
\begin{enumerate}
\item $ M = A $. More generally, consider an ideal $ I \subset A $. $ A $ acts on $ I $ by $ A \times I \to I $ by $ a \cdot x = ax $.
\item If $ A $ is a field, then an $ A $-module is the same as a vector space over this field.
\item Take $ M $ to be any abelian group. Take $ A = \Z $. Define an action of $ \Z $ as follows. $ 1 \cdot m = m $ and $ n \cdot m = \rb{1 + \dots + 1} \cdot m = m + \dots + m = nm $. $ 0 = n + \rb{- n} \in \Z $, then $ 0 = \rb{n + \rb{-n}} \cdot m = nm + \rb{-n}m $. Hence $ \rb{-n} \cdot m = -\rb{n \cdot m} = -\rb{m + \dots + m} $. So, there is exactly one way to equip any abelian group with the structure of a $ \Z $-module.
\item Let $ k $ be a field and let $ A = k\sb{x} $. A $ k\sb{x} $-module is a vector space over $ k $ with extra structure $ x \times M \to M $. This is a linear transformation of $ M $. It can be arbitrary. Thus a $ k\sb{x} $-module is a pair $ \rb{M, f} $, where $ M $ is a $ k $-vector space and $ f : M \to M $ is linear transformation of $ M $.
\end{enumerate}
\end{example}

\begin{definition}
Let $ M $ and $ N $ be $ A $-modules. A map $ f : M \to N $ is called a \textbf{homomorphism of $ A $-modules} if $ f $ is a homomorphism of abelian groups and $ f\rb{a, m} = af\rb{m} $ for any $ a \in A $ and $ m \in M $. If $ f : M \to N $ and $ g : M \to N $ are homomorphisms of $ A $-modules, then so is $ f + g $, so we get $ Hom_A\rb{M, N} $, a group of such homomorphisms. This is also an $ A $-module via the action $ \rb{a, f\rb{a}} \mapsto a \cdot f\rb{a} $.
\end{definition}

\begin{definition}
A \textbf{submodule} $ N \subset M $ is a subgroup, stable under the action of $ A $. Then $ M / N $ is naturally an $ A $-module with $ A $-action inherited from $ M $. Define $ \rb{N : M} = \cb{a \in A \mid raM \subset rN \subset N} $. This is an ideal in $ A $. In particular, can do this when $ N = 0 $. Note $ Ann\rb{M} = \rb{0 : M} = \cb{a \in A \mid aM = 0} $. This is called the \textbf{annihilator} of $ M $.
\end{definition}

\begin{definition}
If $ f : M \to N $ is a homomorphism of $ A $-modules, then $ Ker\rb{f} $ is an $ A $-module and $ Im\rb{f} \cong M / Ker\rb{f} $ is as isomorphism of $ A $-modules.
\end{definition}

\begin{definition}
An $ A $-module $ M $ is \textbf{finitely generated} if there exist $ m_1, \dots, m_n $ in $ M $ such that $ M = \cb{a_1m_1 + \dots + a_nm_n \mid a_i \in A} $.
\end{definition}

\begin{example}
A \textbf{free} $ A $-module of rank $ n $ is the set $ A^n = \cb{\rb{a_1, \dots, a_n} \mid a_i \in A} $ with coordinate-wise addition. $ a \in A $ acts on $ \rb{a_1, \dots, a_n} $ by sending it to $ \rb{aa_1, \dots, aa_n} $. If $ f\rb{1, 0, \dots, 0} = m_1 $, $ f : A^m \to M $ is an example of an $ A $-module homomorphism.
\end{example}

\begin{lemma}
\label{lem:8.7}
Let $ A $ be a ring. Let $ M $ be a finitely generated $ A $-module and let $ A \subset A $ be an ideal such that $ JM = M $, that is sums of $ xm $, where $ x \in J $ and $ m \in M $, give all of $ M $. Then there exists $ a \in J $ such that $ \rb{1 - a}M = 0 $.
\end{lemma}

\begin{proof}
Let $ m_1, \dots, m_n $ be a set of generators of $ M $. $ m_i \in M = JM $, so $ m_i = x_{i1}m_1 + \dots + x_{in}m_n $, where $ x_{ij} \in J $. Let $ X = \rb{x_{ij}}_{1 \le i, j \le n} $, so
$$ \rb{I_n - X}\begin{pmatrix} m_1 \\ \vdots \\ m_n \end{pmatrix} = 0. $$
Let $ \rb{I_n - X}^v $ be the adjunct matrix of $ I_n - X $. Then $ \rb{I_n - X}^v\rb{I_n - X} = \det\rb{I_n - X}I_n $. Hence
$$ \det\rb{I_n - X}\begin{pmatrix} m_1 \\ \vdots \\ m_n \end{pmatrix} = \begin{pmatrix} 0 \\ \vdots \\ 0 \end{pmatrix}. $$
$ \det\rb{I_n - X} = \prod_{i = 1}^n \rb{1 - x_{ii}} + J \equiv 1 \mod J $. So $ \det\rb{I_n - X} = 1 - a $, where $ a \in J $. $ \rb{1 - a}m_i = 0 $ for all $ i $ gives $ \rb{1 - a}M = 0 $.
\end{proof}

\marginpar{Lecture 11 \\ Monday \\ 29/10/18}

\begin{corollary}[Nakayama's lemma]
Let $ A $ be a ring and let $ M $ be an $ A $-module, which is finitely generated. Let $ I \subset A $ be an ideal contained in the Jacobson radical $ J\rb{A} $. Then $ IM = M $ implies $ M = 0 $.
\end{corollary}

\begin{proof}
Lemma \ref{lem:8.7} gives an $ a \in I $ such that $ \rb{1 - a}M $. But $ a \in J\rb{A} $. By Proposition \ref{prop:5.3} $ 1 - a \in A^* $ so that there exists $ u \in A^* $ such that $ u\rb{1 - a} = 1 $, so $ M = 1 \cdot M  = u\rb{1 - a} \cdot M = 0 $.
\end{proof}

Another proof considers $ M = \rb{m_1, \dots, m_n} $. Let us call a generating set minimal, if no proper set is a generating set. Assume that $ m_1, \dots, m_n $ is a minimal generating set. $ IM = M $ implies that $ m_1 = a_1m_1 + \dots + a_nm_n $, where $ a_i \in I $. $ \rb{1 - a_1}m_1 = a_2m_2 + \dots + a_nm_n $. Proposition \ref{prop:5.3} says that $ 1 - a_1 \in A^* $. Hence $ m_1 = \rb{1 - a_1}^{-1}a_2m_2 + \dots + \rb{1 - a_1}^{-1}a_nm_n $. This is a contradiction, because $ m_2, \dots, m_n $ is a generating set.

\section{Localisation of modules}

\begin{definition}
Let $ A $ be a ring with a multiplicative set $ S $, and let $ M $ be an $ A $-module. Define $ \sim $ on $ M \times S $ by $ \rb{m, s} \sim \rb{n, t} $ if and only if there exists $ u \in S $ such that $ u\rb{tm - sn} = 0 $. This is an equivalence relation. Denote the equivalence class of $ \rb{m, s} $ by $ m / s $. Then the set of these equivalence classes form a module denoted by $ S^{-1}M $ over $ S^{-1}A $. The action of $ S^{-1}A $ on $ S^{-1}M $ is $ \rb{a / s}\rb{m / t} = \rb{am / st} $. $ m / s + n / t = \rb{mt + ns} / st $. The zero in $ S^{-1}M $ is $ 0 / 1 $.
\end{definition}

\begin{definition}
Let $ A $ be a ring and let $ P \subset A $ be a prime ideal. Then $ S = A \setminus P $ is a multiplicative set. The ring $ S^{-1}A $ is denoted $ A_P $. It is called the localisation of $ A $ at $ P $. Recall that by Theorem \ref{thm:6.9} the prime ideals of $ A_P $ are of the form $ S^{-1}I $, where $ I \subset A $ is a prime ideal such that $ I \cap \rb{A \setminus P} = \emptyset $, if and only if $ I \subset P $.
\end{definition}

\begin{theorem}
Let $ A $ be a ring with a prime ideal $ P $. Then $ a \in A_P $ is a unit if and only if $ a \notin PA_P = S^{-1}P = \rb{A \setminus P}^{-1}P $. The ideal $ PA_P $ is the unique maximal ideal of $ A_P $. So $ A_P $ is a local ring.
\end{theorem}

\begin{proof}
Suppose $ a / s \in A_P $ is a unit. Then for some $ b / t \in A_P $ we have $ \rb{a / s}\rb{b / t} = 1 $. $ ab / st - 1 / 1 = 0 $ if and only if there exists $ u \in S $ such that $ u\rb{ab - st} = 0 $. $ uab = ust \in S = A \setminus P $. Hence $ a \notin P $, so that $ a / s \notin PA_P $. Conversely, if $ a / s \notin PA_P $, then $ a \notin P $ and $ s \in S $ gives $ a \in S = A \setminus P $. So $ a / s $ is a unit whose inverse is $ s / a $. $ PA_P $ is a maximal ideal, because joining any new element will be the whole ring, as this element must be a unit.
\end{proof}

\begin{example}
$ \Z_{\rb{p}} = \cb{a / b \mid a, b \in \Z, \ \rb{p, b} = 1} $ and
$$ p\Z_{\rb{p}} = \cb{\dfrac{a}{b} \ \Big| \ a, b \in \Z, \ p \mid a, \ \rb{p, b} = 1}, \qquad \Z_{\rb{p}}^* = \cb{\dfrac{a}{b} \ \Big| \ a, b \in \Z, \ p \nmid a, \ \rb{p, b} = 1}. $$
Do the same for $ A = k\sb{x} $ and $ P = \rb{f\rb{x}} $, where $ f\rb{x} $ is irreducible.
\end{example}

\begin{proposition}
Let $ M $ be an $ A $-module. Then $ M = 0 $ if and only if $ M_P = 0 $ for all maximal ideals $ P \subset A $.
\end{proposition}

\begin{proof}
Suppose $ M \ne 0 $. Choose $ x \in M $, $ x \ne 0 $. Define $ I = Ann\rb{x} = \cb{a \in A \mid ax = 0} $. This is an ideal in $ A $, and $ I \ne A $ because $ 1 \cdot x = x $, so $ 1 \notin I $. Let $ P $ be a maximal ideal such that $ I \subset P $. Claim that $ M_P \ne 0 $. Consider $ x / 1 \in M_P $. If $ M_P = 0 $, then $ x / 0 = 0 / 1 $, so $ ux = 0 $ for some $ u \in A \setminus P $. $ u \in I = Ann\rb{x} $ but $ u \notin P $. This is a contradiction because $ I \subset P $.
\end{proof}

\marginpar{Lecture 12 \\ Tuesday \\ 30/10/18}

\section{Chain conditions: Noetherian and Artinian rings}

\begin{lemma}
Let $ \Sigma $ be a partially ordered set. Then the following properties are equivalent.
\begin{enumerate}
\item Every non-empty subset of $ \Sigma $ has a maximal element.
\item Every ascending chain $ x_1 \le x_2 \le \dots $ is stationary, that is there exists $ n $ such that for any $ m \ge 0 $ we have $ x_{n + m} = x_n $.
\end{enumerate}
\end{lemma}

\begin{proof}
\hfill
\begin{itemize}[leftmargin=2cm]
\item[$ 1 \implies 2 $] Any ascending chain has a maximal element, say $ x_n $. Hence $ x_{m + n} = x_n $, for all $ m \ge 0 $.
\item[$ 2 \implies 1 $] Suppose $ S \subset \Sigma $ does not have a maximal element. Choose $ x_1 \in S $. There exists $ x_2 \in S $ such that $ x_2 > x_1 $. If $ x_1 < \dots < x_2 $ are chosen, then since $ x_n $ is not a maximal element, we can choose $ x_{n + 1} > x_n $. This constructs an ascending chain that is not stationary.
\end{itemize}
\end{proof}

\begin{definition}
A ring $ A $ is called \textbf{Noetherian} if every ascending chain of ideals in $ A $ is stationary. An $ A $-module $ M $ is Noetherian if every chain of submodules of $ M $ is stationary. In particular, a ring $ A $ is Noetherian if it is a Noetherian module over $ A $. A ring $ A $ is called \textbf{Artinian} if every descending chain of ideals is stationary. An $ A $-module $ M $ is Artinian if every descending chain of submodules is stationary.
\end{definition}

\begin{example}
Let $ \Z \supset \rb{n} $ is Noetherian. $ \rb{a} \subset \ab{b} $ if and only if $ b $ divides $ a $. $ \rb{15} \subsetneq \rb{5} \subsetneq \rb{1} = \Z $. But $ \rb{2} \supsetneq \rb{4} \supsetneq \dots \supsetneq \rb{2^n} \supsetneq \dots $ is an infinite descending chain of ideals so $ \Z $ is not Artinian. If $ A $ is a finite ring, then it is trivially both Noetherian and Artinian.
\end{example}

\begin{proposition}
Let $ A $ be a ring and let $ M $ be an $ A $-module. Then $ M $ is Noetherian if and only if every submodule of $ M $ is finitely generated.
\end{proposition}

\begin{proof}
Suppose $ M $ is Noetherian, but $ N \subset M $ is a submodule that is not finitely generated. Then take $ x_1 \in N $. Since $ N \ne \rb{x_1} $, the submodule generated by $ x_1 $, we can find $ x_2 \in N \setminus \rb{x_1} $. This gives $ \rb{x_1} \subsetneq \rb{x_1, x_2} $ and so on. This produces an ascending chain which is not stationary, a contradiction. Now suppose that every submodule of $ M $ is $ f \cdot g $. Consider any ascending chain $ M_1 \subset M_2 \subset \dots $. Let $ N = \cup_{i \ge 1} M_i $. This is a submodule of $ M $. By assumption $ N = \rb{x_1, \dots, x_n} $ for some $ x_i \in N $. For each $ x_i $ there is an $ M_j $ in our chain such that $ x_i \in M_j $. So there will be some $ M_l $ that contains $ x_1, \dots, x_n $. Then $ N = M_l $. And clearly for any $ m \ge 0 $ we have $ M_l \subset M_{l + m} \subset N = M_l $, so $ M_{l + m} = M_l $. So $ M $ is Noetherian.
\end{proof}

\begin{remark}
Applying this to the $ A $-module $ A $ we see that $ A $ is Noetherian if and only if every ideal is finitely generated. Hence every principal ideal domain is Noetherian.
\end{remark}

\begin{example}
$ \Z $, $ k\sb{x} $, $ k\sb{x_1, \dots, x_n} $. Hilbert's basis theorem says that if $ R $ is Noetherian, then $ R\sb{x} $ is also Noetherian.
\end{example}

\begin{proposition}
\label{prop:10.4}
Let $ A $ be a ring. Let $ M $ be an $ A $-module and $ N \subset M $ a submodule. Then $ M $ is Noetherian if and only if $ N $ and $ M / N $ are both Noetherian $ A $-modules.
\end{proposition}

\begin{proof}
Suppose $ M $ is Noetherian. Then clearly $ N $ is Noetherian. $ M / N $ is Noetherian too. Indeed, let $ L $ be a submodule of $ M / N $. Let $ T $ be the inverse image of $ L $ in $ M $. Then we have a surjective homomorphism of $ A $-modules $ T \to L $. Since $ T $ is finitely generated, so that $ T = \rb{x_1, \dots, x_n} $ for some $ x_i \in T $. Then the images of $ x_1, \dots, x_n $ generate $ L $. Now assume $ N $ and $ M / N $ are Noetherian. This can also be proved using ascending chains. Take any ascending chain $ M_1 \subset M_2 \subset \dots $. Then $ N \cap M_1 \subset N \cap M_2 \subset \dots $ is an ascending chain of submodules of $ N $. Let $ n_1 \in \N $ be such that for all $ i \ge 0 $, $ N \cap M_{n + i} = N \cap M_{n_1} $. Consider $ \rb{M_i + N} / N \subset M / N $. This is just the set of cosets $ x + N $, where $ x \in M_i $. In fact $ \rb{M_i + N} / N \cong M_i / M \cap N $. We obtain an ascending chain $ \rb{M_1 + N} / N \subset \rb{M_2 + N} / N \subset \dots \subset \rb{M_{n_2} + N} / N = \rb{M_{n_1} + N} / N = \dots $. Take $ n = \max\rb{n_1, n_2} $. It works, that is $ M_n = M_{n + 1} = \dots $. Indeed, take any $ x \in M_{n + i} $ for $ i \ge 0 $. Then there exists $ y \in M_n $ such that $ x + N = y + N $. Thus $ x - y \in N \cap M_{n + i} $. But this is $ N \cap M_n $. So there exists $ z \in N \cap M_n $ such that $ x - y = z $. Hence $ x = y + z \in M_n $.
\end{proof}

\marginpar{Lecture 13 \\ Friday \\ 02/11/18}

Lecture 13 is a problem class.

\marginpar{Lecture 14 \\ Monday \\ 05/11/18}

(TODO Exercise: Do the same in the Artinian case)

\begin{corollary}
Let $ A $ be a Noetherian or Artinian ring. Let $ M $ be a finitely generated $ A $-module. Then $ M $ is Noetherian or Artinian.
\end{corollary}

\begin{proof}
Let $ M = \rb{m_1, \dots, m_n} $ for $ m_i \in M $. $ M = \cb{a_1m_1 + \dots + a_nm_n \mid a_i \in A} $. Let $ A^{\oplus n} = \cb{\rb{a_1, \dots, a_n} \mid a_i \in A} $ be a free $ A $-module of rank $ n $. There is a homomorphism of $ A $-modules $ A^{\oplus n} \to M $ sending $ \rb{a_1, \dots, a_n} $ to $ a_1m_1 + \dots + a_nm_n $. It is surjective. By Proposition \ref{prop:10.4} it is enough to show that $ A^{\oplus n} $ is Noetherian. Prove by induction in $ n $. Clearly, $ A $ is Noetherian. $ A^{\oplus \rb{n - 1}} \subset A^{\oplus n} $. The quotient $ A^{\oplus n} / A^{\oplus \rb{n - 1}} \cong A $ by $ \rb{a_1, \dots, a_n} \mapsto a_n $. By Proposition \ref{prop:10.4} $ A^{\oplus \rb{n - 1}} $ and $ A $ Noetherian implies that $ A^{\oplus n} $ is Noetherian too.
\end{proof}

\begin{corollary}
Let $ A $ be a ring and let $ M $ be an $ A $-module. Suppose that we have $ 0 = M_0 \subset \dots M_n = M $ are $ A $-submodules of $ M $. Then $ M $ is Noetherian or Artinian if and only if each quotient $ M_{i + 1} / M_i $ is Noetherian or Artinian.
\end{corollary}

\begin{proof}
Use Proposition \ref{prop:10.4}.
\end{proof}

\begin{lemma}
Let $ A $ be a Noetherian ring. Let $ S \subset A $ be a multiplicative set. Then $ S^{-1}A $ is Noetherian.
\end{lemma}

\begin{proof}
Consider a non-empty set $ \Sigma $ of ideals of $ S^{-1}A $. There is a canonical homomorphism of rings $ f : A \to S^{-1}A $ by $ f\rb{a} = a / 1 $. If $ I $ is an ideal of $ S^{-1}A $, then $ f^{-1}\rb{I} $ is an ideal in $ A $. Then $ I = S^{-1}f^{-1}\rb{I} $. Now $ \Sigma $ gives a non-empty set of ideals of $ A $ under $ I \to f^{-1}\rb{I} $. Let $ J $ be a maximal element of this set. Then $ S^{-1}J $ is a maximal element of $ \Sigma $. Hence $ S^{-1}A $ is Noetherian.
\end{proof}

\section{Primary decomposition}

\begin{definition}
An ideal $ Q $ in a ring $ R $ not equal to $ R $, that is a proper ideal, is called \textbf{primary} if all $ x, y \in R $ such that $ xy \in Q $ we have $ x \in Q $ or $ y^n \in Q $ for some $ n $. Equivalently, $ I \subsetneq R $ is called primary if every zero-divisor in $ R / I $ is nilpotent.
\end{definition}

\begin{example}
Let $ p $ be a prime number. Then $ \rb{p^m} $ for $ m \ge 1 $ is a primary ideal in $ \Z $. $ ab \in \rb{p^m} $ if and only if $ p^m \mid ab $. Consider $ a $. If $ p \nmid a $, then $ p^m \mid b $, hence $ b \in \rb{p^m} $. Otherwise $ p \mid a $, then $ p^m \mid a^m $, so $ a^m \in \rb{p^m} $.
\end{example}

\marginpar{Lecture 15 \\ Tuesday \\ 06/11/18}

Lecture 15 is a test.

\marginpar{Lecture 16 \\ Friday \\ 09/11/18}

\begin{example}
$ \rb{f\rb{x}^n} \subset k\sb{x} $ for $ f\rb{x} $ irreducible is primary.
\end{example}

\begin{example}
Let $ R = k\sb{x, y} $ and $ I = \rb{x^3, y^5, xy} $. Claim that $ I $ is primary. Take any $ f\rb{x, y} = f_0 + xg\rb{x, y} + yh\rb{x, y} $. If $ f_0 = 0 $, since $ x $ and $ y $ are nilpotent, when considered as elements of $ R / I $, $ f\rb{x, y} $ is nilpotent. If $ f_0 \ne 0 $, $ f\rb{x, y} $ is a sum of a unit and a nilpotent, hence a unit. In particular, any zero-divisor in $ R / I $ is nilpotent.
\end{example}

\begin{example}
Let $ R = k\sb{x, y} $ and $ I = \rb{xy} $. $ xy \in I $, but $ x^n \notin I $ for all $ n \ge 0 $. Hence $ I $ is not a primary ideal.
\end{example}

\begin{example}
Even simpler, $ \rb{6} \subset \Z $ is not a primary ideal.
\end{example}

\begin{proposition}
Let $ I \subset R $ be an ideal. If the radical $ r\rb{I} $ is a maximal ideal, then $ I $ is primary. In particular, any power of a maximal ideal is primary.
\end{proposition}

\begin{proof}
Consider $ R / I $. $ r\rb{I} / I $ is the nilradical of the ring $ R / I $, which is the intersection of all prime ideals of $ R / I $. We are given that $ r\rb{I} $ is a maximal ideal, so $ r\rb{I} / I $ is a maximal ideal of $ R / I $. Hence $ r\rb{I} / I $ is the unique prime ideal of $ R / I $. If $ x \notin r\rb{I} / I $, then $ x \in \rb{R / I}^* $. Indeed, every non-unit is contained in a maximal ideal by Corollary \ref{cor:4.10}, but there is only one maximal ideal and $ x $ is not in it. If $ x \in r\rb{I} / I $, then $ x $ is nilpotent. So all zero-divisor of $ R / I $ are nilpotent, hence $ I $ is a primary ideal of $ R $. Now let $ M \subset R $ be a maximal ideal. Then $ M^n $ is primary, since $ r\rb{M^n} = M $. Indeed, for any $ x \in M $ $ x^n \in M^n $, so $ M \subset r\rb{M^n} $. Since $ M $ is maximal we must have $ M = r\rb{M^n} $.
\end{proof}

\begin{example}
In the example $ I = \rb{x^3, xy, y^5} \supset \rb{x, y}^5 $.
\end{example}

\begin{proposition}
Let $ I \subset R $ be a primary ideal. Then the radical $ r\rb{I} $ is a prime ideal of $ R $. It is the smallest prime ideal of $ R $ containing $ I $.
\end{proposition}

\begin{proof}
Let $ x, y \in R $ for $ xy \in r\rb{I} $. Then there exists $ n $ such that $ x^ny^n \in I $. If $ x^n \in I $, then $ x \in r\rb{I} $. Suppose $ x^n \notin I $. Since $ I $ is primary, there exists $ m $ such that $ \rb{y^n}^m \in I $. Then $ y \in r\rb{I} $. This proves that $ r\rb{I} $ is prime. Note that $ r\rb{I} $ is the intersection of all prime ideals containing $ I $. Hence if $ r\rb{I} $ is a prime ideal, it is the smallest prime ideal containing $ I $.
\end{proof}

\begin{definition}
Let $ P \subset R $ be a prime ideal. An ideal $ I \subset R $ is called \textbf{$ P $-primary}, if $ I $ is a primary ideal such that $ r\rb{I} = P $.
\end{definition}

\begin{lemma}
\label{lem:11.4}
Let $ I_1, \dots, I_n $ be $ P $-primary ideals in $ R $, where $ P $ is a prime ideal. Then $ \cap_{j = 1}^n I_j $ is also a $ P $-primary ideal.
\end{lemma}

\begin{proof}
Assume $ n = 2 $. The general case by induction. $ r\rb{I_1} = r\rb{I_2} = P $ and $ r\rb{I_1 \cap I_2} = r\rb{I_1} \cap r\rb{I_2} $. Hence $ r\rb{I_1 \cap I_2} = P $. Let us show that $ I_1 \cap I_2 $ is primary. Take $ x, y \in R $ such that $ xy \in I_1 \cap I_2 \subset I_1 $. If $ x \notin I_1 \cap I_2 $, then, say, $ x \in I_1 $. We know that $ y^n \in I_1 $ for some $ n \ge 0 $. Hence $ y \in r\rb{I_1} = P = r\rb{I_1 \cap I_2} $, so that $ y^m \in I_1 \cap I_2 $.
\end{proof}

Warning that it is not true in general that if $ r\rb{I} $ is prime, then $ I $ is primary. True if $ r\rb{I} $ is maximal though.

\marginpar{Lecture 17 \\ Monday \\ 12/11/18}

\begin{definition}
Let $ R $ be a ring, and let $ I \subsetneq R $ be an ideal. Call $ I $ \textbf{irreducible} if for any two ideals $ J $ and $ K $ in $ R $ such that $ I = J \cap K $ we have either $ J = I $ or $ K = I $. $ I $ is \textbf{reducible}, that is not irreducible, if $ I = J_1 \cap J_2 $, where $ I \subsetneq J_i $ for $ i = 1, 2 $.
\end{definition}

\begin{note}
$ x \in R $, which is not a unit, is irreducible if $ x $ is not a product of two non-units.
\end{note}

\begin{proposition}
\label{prop:11.5}
\hfill
\begin{enumerate}
\item Any prime ideal is irreducible.
\item If $ R $ is Noetherian, then any irreducible ideal is primary.
\end{enumerate}
\end{proposition}

\begin{proof}
\hfill
\begin{enumerate}
\item Let $ P $ be a prime ideal. Suppose $ P = I \cap J $. Note that $ IJ \subset I \cap J $. By the prime avoidance lemma \ref{lem:4.12} $ I \cap J \subset P $ implies that $ I \subset P $ or $ J \subset P $. Say, $ I \subset P = I \cap J \subset I $. Thus $ I = P $.
\item Let $ I \subset R $ be an irreducible ideal. Go over to $ R / I $. An equivalent statement is given that the zero ideal in a ring is irreducible, that is $ \rb{0} $ is not the intersection of two non-zero ideals, show that $ xy = 0 $, $ x \ne 0 $ implies $ y^n = 0 $ for some $ n $. So let $ A = R / I $. We work in $ A $, so $ x, y \in A $. $ R $ Noetherian gives $ A $ is Noetherian. Consider $ \cb{\alpha \in A \mid \alpha y = 0} = Ann\rb{y} \subset Ann\rb{y^2} \subset \dots $. These are ideals in $ A $. There is an $ n > 0 $ such that $ Ann\rb{y^n} = Ann\rb{y^{n + 1}} $. We want to show that some $ y^k = 0 $, that is $ \rb{y^k} = \rb{0} $. Claim that can take $ k = n $. Let us prove that $ 0 = \rb{x} \cap \rb{y^n} \ne \rb{0} \cap \rb{y^n} $. By the irreducibility of the zero ideal, this imply $ \rb{y^n} = 0 $. Suppose that there exists $ a \ne 0 $, $ \rb{a} \in \rb{x} \cap \rb{y^n} $. Then $ a = rx $ for some $ r \in A $. Then $ ay = rxy = 0 $. But $ a \in \rb{y^n} $, so $ a = by^n $ for some $ b \in A $. We obtain $ by^{n + 1} = 0 $. In other words, $ b \in Ann\rb{y^{n + 1}} = Ann\rb{y^n} $ so that $ by^n = 0 $ so $ a = 0 $. We proved that $ y^n = 0 $. Therefore, $ I \subset R $ is a primary ideal.
\end{enumerate}
\end{proof}

Let $ R $ be a ring and let $ I \subsetneq R $ be an ideal. A \textbf{primary decomposition} of $ I $ is an expression of $ I $ as an intersection of finitely many primary ideals.

\begin{theorem}[Noether]
Any proper ideal in a Noetherian ring has a primary decomposition.
\end{theorem}

\begin{proof}
Let $ I \subsetneq R $ be an ideal. We want to prove that $ I $ is an intersection of finitely many irreducible ideals using Proposition \ref{prop:11.5}. Suppose that this is not true. Look at all the ideals of $ R $ that cannot be written as intersections of finitely many irreducible ideals. Since $ R $ is Noetherian, this set has a maximal element, say $ J $. By construction, $ J $ is not an irreducible ideal of $ R $. Hence $ J $ is reducible, so $ J = J_1 \cap J_2 $, where $ J \subsetneq J_1 $ and $ J \subsetneq J_2 $. As $ J $ is a maximal element of our set of ideals, $ J_1 $ and $ J_2 $ are not in this set. Therefore, $ J_1 $ and $ J_2 $ each can be written as an intersection of finitely many irreducible ideals. Then $ J = J_1 \cap J_2 $ is also an intersection of finitely many irreducible ideals. This is a contradiction. Thus our set is empty, and so theorem is proved.
\end{proof}

Recall that if $ I $ and $ J $ are ideals, then $ \rb{I : J} = \cb{r \in R \mid rJ \subset I} $.

\begin{lemma}
\label{lem:11.7}
Let $ R $ be a ring with a prime ideal $ P $. Let $ I \subset R $ be a $ P $-primary ideal, that is $ P = r\rb{I} $. Let $ x \in R $. Then
\begin{enumerate}
\item $ x \in I $, then $ \rb{I : \rb{x}} = R $.
\item $ x \notin I $, then $ \rb{I : \rb{x}} $ is a $ P $-primary ideal.
\item $ x \notin P $, then $ \rb{I : \rb{x}} = I $.
\end{enumerate}
\end{lemma}

\marginpar{Lecture 18 \\ Tuesday \\ 13/11/18}

\begin{proof}
\hfill
\begin{enumerate}
\item Obvious. $ x \in I $ gives $ 1 \cdot x \in I $ so $ 1 \in \rb{I : \rb{x}} $.
\item We want to prove the following.
\begin{enumerate}
\item $ r\rb{\rb{I : \rb{x}}} = P $. Take $ y \in \rb{I : \rb{x}} $. Then $ yx \in I $. We know that $ I $ is primary and $ x \notin I $. Hence $ y^n \in I $ for some $ n \ge 1 $. Therefore, $ y \in r\rb{I} = P $. We proved that $ I \subset \rb{I : \rb{x}} \subset P $. This implies $ P = r\rb{I} \subset r\rb{\rb{I : \rb{x}}} \subset r\rb{P} = P $. This shows that $ r\rb{\rb{I : \rb{x}}} = P $. So (a) is proved.
\item $ \rb{I : \rb{x}} $ is primary. We need to show that if $ yz \in \rb{I : \rb{x}} $, so $ y\rb{xz} = xyz \in I $, and $ y \notin r\rb{\rb{I : \rb{x}}} $, so $ y^n \notin \rb{I : \rb{x}} $ for all $ n $ gives $ y^nx \notin I $, then we must show $ z \in \rb{I : \rb{x}} $. But $ I $ is primary and $ y^n \not I $ for all $ n $, by definition of primary ideals we must have $ xz \in I $. Hence $ z \in \rb{I : \rb{x}} $. So (b) is proved.
\end{enumerate}
Hence $ 2 $ is proved.
\item Let $ y \in \rb{I : \rb{x}} $. Then $ xy \in I $. $ x \notin P = r\rb{I} $ hence no power of $ x $ is in $ I $. Hence $ y $ must be in $ I $.
\end{enumerate}
\end{proof}

We know that any ideal of a Noetherian ring has a primary decomposition $ I = I_1 \cap \dots \cap I_n $, where each $ I_i \subset R $ is primary. Let us call this decomposition \textbf{minimal} if $ r\rb{I_i} $ are distinct prime ideals for $ i = 1, \dots, n $. Indeed, this can be arranged with Lemma \ref{lem:11.4} because $ \cap_{s = 1}^n $, where each $ J_s $ is a $ P $-primary ideal, is again a $ P $-primary ideal and we have $ I_j \not\supset \cap_{l \ne j} I_l $, which can clearly be arranged by removing redundant ideals.

\begin{theorem}[First uniqueness theorem]
Let $ I = \cap_{j = i}^m I_j $ be a minimal primary decomposition. Then the prime ideals $ r\rb{I_1}, \dots, r\rb{I_n} $ are uniquely determined by $ I $, so they do not depend on the choice of a primary decomposition.
\end{theorem}

\begin{proof}
Consider $ \rb{I : \rb{x}} $ for $ x \in R $. Look at $ r\rb{\rb{I : \rb{x}}} $ and consider the prime ideals of $ R $ that can be written as $ r\rb{\rb{I : \rb{x}}} $. Claim that such prime ideals are precisely $ r\rb{I_1}, \dots, r\rb{I_n} $. $ \rb{I : \rb{x}} = \rb{\cap_{j = 1}^n I_j : \rb{x}} = \cap_{j = 1}^n \rb{I_j : \rb{x}} $. Hence $ r\rb{\rb{I : \rb{x}}} = \cap_{j = 1}^n r\rb{\rb{I : \rb{x}}} $. Lemma \ref{lem:11.7} gives
\begin{enumerate}
\item $ x \in I_j $ gives $ \rb{I_j : \rb{x}} = R $, so $ r\rb{\rb{I_j : \rb{x}}} = R $, and
\item $ x \notin I_j $ gives $ \rb{I_j : \rb{x}} $ is $ P_j $-primary, so $ r\rb{\rb{I_j : \rb{x}}} = P_j $.
\end{enumerate}
Therefore, $ r\rb{\rb{I : \rb{x}}} = \cap_{x \notin I_j} P_j $. If $ r\rb{\rb{I : \rb{x}}} $ is prime, we know by the prime avoidance lemma \ref{lem:4.12} that $ r\rb{\rb{I : \rb{x}}} = P_j $ for some $ P_j $. Conversely, for each $ j $, by minimality of our primary decomposition, there exists $ x_j \notin I_j $, but $ x_j \in \cap_{l \ne j} I_l $. Then $ r\rb{\rb{I_l : \rb{x_j}}} = R $ for $ l \ne j $, so $ r\rb{\rb{I_j : \rb{x_j}}} = P_j $. Hence $ r\rb{\rb{I : \rb{x_j}}} = P_j $.
\end{proof}

\end{document}


% !TeX encoding = UTF-8
% !TeX spellcheck = it_IT
% !TeX root = tabellesecondo.tex
\documentclass[openany,a4paper]{book}%
% see http://www.tex.ac.uk/cgi-bin/texfaq2html?label=noroom
\usepackage{base}
\usepackage[big]{layaureo}
\usepackage{copyright}
\usepackage{grafica}
\usepackage{forest}
\usepackage{stand_class}
\usepackage{matematica}
\usepackage{amsthm}
\usepackage{tabelle}
\DeclareCaptionFormat{grafico}{\textbf{Grafico \thefigure}#2#3}
\DeclareCaptionFormat{esempio}{\textbf{Esempio \thefigure}#2#3}
\newcolumntype{L}{>{$\displaystyle}l<{$}}
\newcolumntype{C}{>{$\displaystyle}c<{$}}
\newcolumntype{R}{>{$\displaystyle}r<{$}}
%\newcolumntype{T}{>{\centering\arraybackslash}p{1em}}
%\newcolumntype{W}{>{\sffamily\Large $}c<{$}}
%\newcolumntype{N}[1]{>{\centering\rule[-1mm]{0pt}{4.75mm}}m{#1}}
\newcolumntype{M}[1]{>{\centering}p{#1}}
\newcommand\pilH{\rule{0pt}{2.5ex}}
\newcommand\pilD{\rule[-1ex]{0pt}{0pt}}
\newlength{\gnat}
\newlength{\gnam}
\usepackage{imakeidx}
\makeindex[options=-s ../Mod_base/oldclaudio.sti]
\usepackage{date}
\usepackage{pagina}
\usepackage{unita_misura}
\usepackage[grumpy,mark,markifdirty,raisemark=0.95\paperheight]{gitinfo2}
\usepackage[toc,page]{appendix}

\renewcommand{\appendixtocname}{Appendice}

\renewcommand{\appendixpagename}{Appendice}
\usepackage[italian]{varioref}
\usepackage{hyperxmp}
\usepackage[pdfpagelabels]{hyperref}
\usepackage[italian,noabbrev]{cleveref}
\usepackage{tcolorboxgest}
\title{Esercizi svolti secondo}
\author{Claudio Duchi}
\date{\datetime}
\hypersetup{%
	pdfencoding=auto,
	urlcolor={blue},
	pdftitle={Appunti matematica secondo},
	pdfsubject={terzo},
	pdfstartview={FitH},
	pdfpagemode={UseOutlines},
	pdflicenseurl={http://creativecommons.org/licenses/by-nc-nd/3.0/},
	pdflang={it},
	pdfmetalang={it},
	pdfkeywords={ },
	pdfcopyright={Copyright (C) 2019, Claudio Duchi},
	pdfcontacturl={http://breviariomatematico.altervista.org},
	pdfcontactpostcode={},
	pdfcontactphone={},
	pdfcontactemail={claduc},
	pdfcontactcountry={Italy},
	pdfcontactcity={Perugia},
	pdfcontactaddress={},
	pdfcaptionwriter={Claudio Duchi},
	pdfauthortitle={},%
	pdfauthor={Claudio Duchi},
	linkcolor={blue},
	colorlinks=true,
	citecolor={red},
	breaklinks,
	bookmarksopen,
	verbose,
	baseurl={http://breviariomatematico.altervista.org}
}

\newcommand{\tabincludegraphics}[2][]{%
  $\vcenter{\hbox{\includegraphics[#1]{#2}}}$}
%\newcommand{\tabincludestandalone}[2][]{%
%	$\vcenter{\hbox{\includestandalone[#1]{#2}}}$}

\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\makeatletter
\renewcommand\frontmatter{%
	\cleardoublepage
	\@mainmatterfalse
	%\pagenumbering{roman}
}
\renewcommand\mainmatter{%
	\cleardoublepage
	\@mainmattertrue
	%\pagenumbering{arabic}
}
\makeatother
\usepackage{indice}
\usepackage{utili}

\usepackage{CDloghi}
\listfiles
\input{compilaUNO}
\begin{document}
\frontmatter
\begin{titlepage}
		\begin{center}
	 	\Lgrandedue\\[1cm]
	 \textsc{\LARGE Claudio Duchi}\\[1.2cm]
	 \HRule \\[0.4cm]
	 	{ \huge \bfseries APPUNTI DI MATEMATICA}\\[0.4cm]
	 {\LARGE \textsc{SECONDO}}
	 \HRule \\[1.2cm]
	 \vfill
		\polylogo[5.5]{15}
		{\large $-$\DTMnow$-$}
	\end{center}
	{\centering
	Release:\gitReln\ (\gitAbbrevHash)\ Autore:\gitAuthorName\
	\gitCommitterDate \\
}
\end{titlepage}
\setcounter{page}{2}
\CDcopyright
\tableofcontents
\listoftables
\addcontentsline{toc}{chapter}{\listtablename}
\listoffigures
\addcontentsline{toc}{chapter}{\listfigurename}
\renewcommand\lstlistlistingname{Elenco esempi}
\addcontentsline{toc}{chapter}{\lstlistlistingname}
\addcontentsline{toc}{section}{Esempi}
\lstlistoflistings{}
{
	%	https://tex.stackexchange.com/questions/318486/number-freestyle-causes-an-overlay-in-the-list-of-tcolorboxes/318512#318512
	\makeatletter
	\renewcommand{\l@tcolorbox}{\@dottedtocline{1}{0pt}{3em}}
	\makeatother
	\tcblistof[\section*]{thm}{Esempi}
	\addcontentsline{toc}{section}{Contro esempi}
	\tcblistof[\section*]{cthm}{Contro esempi}
}
%\listoftodos
\mainmatter%
\input{compilaDUE}
\backmatter
\addcontentsline{toc}{chapter}{\indexname}
\printindex
\appendix
%	\input{terzo/Tabelle_goniometriche}
\chapter{Mezzi usati}
\CDMezziUsati

\end{document}


\documentclass[10pt,a4paper]{article}
\usepackage{amsmath}

%%%%%%%%%%%%%%%%%%%%%%%%%%%
% MODIFY:

\newcommand{\authorA}{ALEX PASQUALI (03754113)}
\newcommand{\authorB}{NICOLA GUGOLE (03753996)}
\newcommand{\groupNumber}{A} % - YOUR GROUP
\newcommand{\exerciseNumber}{3} % - THE NUMBER OF THE EXERCISE
\newcommand{\sourceCodeLink}{\url{https://github.com/AlexPasqua/MLCMS-exercises}}

\newcommand{\workPerAuthor}{
\authorA&Task 1&50\%\\
      &Task 2&50\%\\
      &Task 3&50\%\\
      &Task 4&50\%\\
      &Task 5&50\%\\
      \hline
\authorB&Task 1&50\%\\
      &Task 2&50\%\\
      &Task 3&50\%\\
      &Task 4&50\%\\
      &Task 5&50\%\\
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%

\input{./imports.tex}

\begin{document}

\frontpage

\begin{task}{1, Vector fields, orbits, and visualization}
This tasks consists of displaying the phase portraits displayed in figure 2.5 of \cite{kuznetsov}.
In particular they are a \textit{node} and a \textit{focus} phase portraits, both \textit{stable} and \textit{unstable}, plus an \textit{unstable saddle} phase portrait.\\
The linear dynamical system in object has a state space $X=\mathbb{R}^2$, $I=\mathbb{R}$ and parameter $\alpha\in\mathbb{R}$.
Its flow is defined as follows:
\begin{equation}\label{eq:sys-task1}
    \frac{\partial\phi_{\alpha}(t,x)}{\partial t}\Bigr|_{t=0}=A_{\alpha}x
\end{equation}
where $x\inX$, $t\in I$ and $A$ is a 2x2 real matrix parametrized by $\alpha$.
Specifically, we obtained these portraits with the following configurations
(where $\lambda_1$ and $\lambda_2$ indicate the 2 eigenvalues of $A$):
\begin{itemize}
    \item \textbf{Unstable focus:} $\alpha=0.1,\ A=
    \begin{bmatrix}
    \alpha & \alpha \\
    -\frac{1}{4} & 0
    \end{bmatrix},\
    \lambda_1 = 0.05+0.15i,\ \lambda_2 = 0.05-0.15i$

    \item \textbf{Unstable saddle:} $\alpha=-0.2,\ A=
    \begin{bmatrix}
    -\alpha & \alpha \\
    -\frac{1}{4} & 0
    \end{bmatrix},\
    \lambda_1 = 0.345,\ \lambda_2 = -0.145$

    \item \textbf{Unstable node:} $\alpha=2,\ A=
    \begin{bmatrix}
    \alpha & \alpha \\
    -\frac{1}{4} & 0
    \end{bmatrix},\
    \lambda_1 = 1.707,\ \lambda_2 = 0.293$

    \item \textbf{Stable node:} $\alpha=-0.25,\ A=
    \begin{bmatrix}
    \alpha & 0 \\
    0 & -1
    \end{bmatrix},\
    \lambda_1 = -0.25,\ \lambda_2 = -1$

    \item \textbf{Stable focus:} $\alpha=0.1,\ A=
    \begin{bmatrix}
    -\alpha & \alpha \\
    -\frac{1}{4} & 0
    \end{bmatrix},\
    \lambda_1 = -0.05+0.15i,\ \lambda_2 = -0.05-0.15i$
\end{itemize}
These systems are of course \textbf{not} topologically equivalent because their phase portraits (\hyperref[fig:task1-phase-portraits]{Figure \ref{fig:task1-phase-portraits}}) show qualitatively distinct behaviors around their fixed point.
In particular, some of them are stable (Figure \ref{fig:task1-phase-portraits}(d) and \ref{fig:task1-phase-portraits}(e)) and some unstable (Figure \ref{fig:task1-phase-portraits}(a), \ref{fig:task1-phase-portraits}(b) and \ref{fig:task1-phase-portraits}(c)).
Moreover, Figure \ref{fig:task1-phase-portraits}(a)-(e) represent focuses,
Figure  \ref{fig:task1-phase-portraits}(b) represents a saddle and Figure \ref{fig:task1-phase-portraits}(c)-(d) represent nodes.

\begin{figure}[H]
    \centering
    \subfloat[a]{\includegraphics[width=0.3\textwidth]{images/unstable_focus.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.3\textwidth]{images/unstable_saddle.png}}
    \hfill
    \subfloat[c]{\includegraphics[width=0.3\textwidth]{images/unstable_node.png}}
    \vfill
    \subfloat[d]{\includegraphics[width=0.3\textwidth]{images/stable_node.png}}
    \subfloat[e]{\includegraphics[width=0.3\textwidth]{images/stable_focus.png}}
    \caption{Phase portraits of task 1, namely:
    (a) Unstable focus;
    (b) Unstable saddle;
    (c) Unstable node;
    (d) Stable node;
    (e) Stable focus.}
    \label{fig:task1-phase-portraits}
\end{figure}
\end{task}

% TASK 2 -----------------------------------------------
\begin{task}{2, Common bifurcations in nonlinear systems}
This task asks for the analysis of the bifurcation for two dynamical systems: $$\dot x = \alpha - x^2$$
\begin{center}
    and
\end{center} $$\dot x = \alpha - 2x^2 - 3$$
The bifurcation diagrams for the two systems are described in \textbf{\hyperref[fig:task2]{Figure \ref{fig:task2}}}.

The two systems express a similar behaviour, with both having no steady state before a parametric value coincides with the \textit{bifurcation point} (e.g. $\alpha=0$ for the \textit{left} model). From then on the system has two different steady states. The bifurcation type for these two systems is called \textit{saddle-node bifurcation}, with one of the two steady states being repulsive and one attractive, colored in \textit{orange} and \textit{blue} in the \textbf{\hyperref[fig:task2]{Figure \ref{fig:task2}}}.

To answer the rest of the task questions it is relevant to cite (\cite{kuznetsov}, p.59): "\textit{For instance, it is natural to expect that two equivalent systems have the
same number of equilibria and cycles of the same stability types. The "relative
position" of these invariant sets and the shape of their regions of attraction
should also be similar for equivalent systems.}".\\
Therefore it is safe to assert that the two systems are not topologically equivalent at $\alpha=1$ since the system on the \textit{left} has two steady states and system on the \textit{right} has no steady states. On the contrary, the two systems are topologically equivalent at $\alpha=-1$, since they have the same number of steady states and they actually have the same \textit{normal form}. One might hypothesize the two systems have the same normal form since their bifurcation diagrams are qualitatively equivalent and taking a look at the graphics there are some hints giving more proofs, using the two differences in the system (the $x^2$ coefficient and the $x^0$ coefficient):
\begin{itemize}
    \item the basic coefficient difference is having the $+3$ at the end of the equation, an element that simply delays the whole bifurcation. In fact the bifurcation point difference between the two systems is exactly $3$.
    \item the coefficient multiplying $x^2$ is simply changing the amplitude of the $y$ coordinate, stretching it by two times, which coincides with the multiplying coefficient, which is $2$.
\end{itemize}

It is therefore possible to obtain a mapping between the two dynamical systems, using a delay followed by a multiplication to map back the \textit{right} system into the \textit{left} one.

\begin{figure}[H]
    \centering
    \subfloat[a]{\includegraphics[width=0.45\textwidth]{images/task2_1.png}}\label{fig:task2_1}
    \hfill
    \subfloat[b]{\includegraphics[width=0.45\textwidth]{images/task2_2.png}}\label{fig:task2_2}
    \caption{bifurcation diagrams for the two requested systems - \textit{alpha} on the x axis, \textit{x} coordinate on the y axis}
    \label{fig:task2}
\end{figure}

\end{task}

% TASK 3 -----------------------------------------------
\begin{task}{3, Bifurcations in higher dimensions} \label{sec:task3}
In this task an important bifurcation for systems with one parameter (but for two-dimensional state spaces) is analyzed: \textit{the Andronov-Hopf bifurcation}, representable with the vector field in normal form:
$$\dot x_1 = \alpha x_1 - x_2 - x_1(x_1^2 + x_2^2)$$
$$\dot x_2 = x_1 + \alpha x_2 - x_2(x_1^2 + x_2^2)$$

\paragraph{Task 3.1:}
The change in behaviour of such a system can be shown to intuitively understand the bifurcation that is happening. \textbf{\hyperref[fig:andronov-hopf-bifurcation]{Figure \ref{fig:andronov-hopf-bifurcation}}} gives three different portraits by varying the $\alpha$ parameter, specifically setting it to -1, 0 and 1:
\begin{itemize}
    \item for $\alpha=-1$ a single attractive stable point can be located in the origin.
    \item  for $\alpha=1$ an unstable point is located at the origin and a stable \textit{limit cycle} is present near the origin.
    \item for $\alpha=0$, as reported in \cite{kuznetsov} (p 85), a \textit{weekly attractive focus} is present in the origin. This parametric value represents the bifurcation point, moving from a stable fixed point to a limit cycle behaviour.
\end{itemize}
\begin{figure}[H]
    \centering
    \subfloat[a]{\includegraphics[width=0.3\textwidth]{images/phase-1.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.3\textwidth]{images/phase0.png}}
    \hfill
    \subfloat[c]{\includegraphics[width=0.3\textwidth]{images/phase1.png}}
    \caption{bifurcation shown three phase diagrams at representative values of $\alpha$.}
    \label{fig:andronov-hopf-bifurcation}
\end{figure}

\paragraph{Task 3.2:}
The second part of the task asks for the numerical computation and visualization of two orbits (starting at \textbf{[2, 0]} and \textbf{[0.5, 0]}) given a specific $\alpha$ value (in the requested case $\alpha=1$). The two requested orbits have been computed taking advantage of \textit{Euler's method}. Given the particular $\alpha$ value one should expect for any point not starting in the origin to converge to the limit cycle, either by repulsion from the origin or by attraction from outside the limit cycle.

\textbf{\hyperref[fig:plot-traj]{Figure \ref{fig:plot-traj}}} show the method implemented to perform the task, where different parameters gave the possibility of tuning the number of iterations as well as the time step for the algorithm. The core of the method is highlighted by the \textit{orange box}, where the two odes are assigned to be used by the underlying Euler's method step.
\begin{figure}[H]
    \centering
    \includegraphics[scale=0.5]{images/plot_traj.png}
    \caption{snippet for trajectory plotting}
    \label{fig:plot-traj}
\end{figure}

Finally \textbf{\hyperref[fig:trajectories]{Figure \ref{fig:trajectories}}} plots the result, which follow the expectations. The blue dot denotes the starting point for each trajectory.
\begin{figure}[H]
    \centering
    \subfloat[a]{\includegraphics[width=0.3\textwidth]{images/traj0,2.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.3\textwidth]{images/traj05,0.png}}
    \caption{system orbits starting at point (2,0) and (0.5,0) for $\alpha = 1$}
    \label{fig:trajectories}
\end{figure}

\paragraph{Task 3.3:}
The last subtask asks for the analysis of a double parametered bifurcation, the \textit{cusp bifurcation}, with the following normal form:
$$\dot x = \alpha_1 + \alpha_2 x - x^3$$
Following the hint provided in the exercise sheet, the core snippet shown in \textbf{\hyperref[fig:cusp-code]{Figure \ref{fig:cusp-code}}} generates the data triples by first sampling $\alpha_2$ and $x$ values, to then compute the relative $\alpha_1$ values by reversing the normal form (we know that a fixed point is a point such that $\dot x = 0$).

\begin{figure}[H]
    \centering
    \includegraphics[scale=1]{images/cusp_bifurc.png}
    \caption{\textit{cusp} implementation core snippet}
    \label{fig:cusp-code}
\end{figure}

The 3D plot of such a system (with an adequate colormap to try and highlight better the surface shape) is shown in \textbf{\hyperref[fig:cusp-3d]{Figure \ref{fig:cusp-3d}}} from two different points of view. An \textit{hysteresis phenomenon} is visible and is responsible for the cusp generation.

\begin{figure}[H]
    \centering
    \subfloat[a]{\includegraphics[width=0.4\textwidth]{images/cusp3d1.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.4\textwidth]{images/cusp3d2.png}}
    \caption{\textit{cusp} bifurcation system in 3D from 2 different angulations}
    \label{fig:cusp-3d}
\end{figure}
\end{task}

The bifurcation gets his name in fact by the presence of a \textit{cusp} shape when projecting the $x$ dimension in the $\alpha_1$ and $\alpha_2$ plane. The particular surface shown in \textbf{\hyperref[fig:cusp-3d]{Figure \ref{fig:cusp-3d}}} does in fact imply that for a given ($\alpha_1$, $\alpha_2$) configuration there can be one or more than one steady states, implying a bifurcation. In \textbf{\hyperref[fig:cusp-projection]{Figure \ref{fig:cusp-projection}}} is shown a projection where coordinates with multiple $x$ values are shown in \textit{orange} and ones with only one value are shown in \textit{blue}. To achieve such a feat the alphas values coming out of the snippet shown in \textbf{\hyperref[fig:cusp-code]{Figure \ref{fig:cusp-code}}} have been rounded to overcome floating point granularity not giving the expected result. This procedure was nevertheless not flawless, bringing also some noise due to the original value sampling fused with the rounding previously explained.

\begin{figure}[H]
    \centering
    \includegraphics[scale=1]{images/cusp.png}
    \caption{\textit{cusp} projection on the alpha space}
    \label{fig:cusp-projection}
\end{figure}

% TASK 4 -----------------------------------------------
\begin{task}{4, Chaotic dynamics}
In this task we analyze some aspects of the \textit{logistic map} system, expressed by the following discrete map:
\begin{equation}\label{eq:logistic-map}
    x_{n+1} = r x_n (1 - x_n)
\end{equation}
with $x_n \in \mathbb{R},\ n \in \mathbb{N}$ and $r \in (0, 4]$.\\
To analyze this system, we created some helping functions that have been put in the script \texttt{utilities.py}, in particular:
\begin{itemize}
    \item \texttt{logistic}: computes the new state $x_{n+1}$ of the system (\hyperref[eq:logistic-map]{Eq. \ref{eq:logistic-map}}) given the current state $x_n$ and the $r$ parameter.

    \item \texttt{plot\_logistic\_map\_bifurcations}: takes 2 values of the parameter $r$ - a minimum ($r_m{min}$) and a maximum one ($r_{max})$ - and plots the behavior of the system of Eq. \ref{eq:logistic-map} $\forall r \in [r_{min},\ r_{max}]$.\\
    To do this, the system is run $n$ times for $m$ iterations, of which, only the last $p$ values are kept.
    This because, starting from an initial point $x_0$, the system will need a certain number of steps to reach a steady state, and since the objective of this plot is to show the steady states associated to different values of $r$, all the states assumed by the system in this initial phase are not of interest, and are therefore discarded.\\
    Note: we do not keep only the last state assumed by the system during the $m$ iterations because the system may find itself in a limit cycle or in a chaotic behaviour, therefore it is needed to have more than 1 value to see if there are a certain number of recurrent states associated to a certain value of $r$.\\
    The code of this function is shown in \hyperref[fig:plot-logistic-map-bifurcations]{Figure \ref{fig:plot-logistic-map-bifurcations}}.

    \item \texttt{logistic\_map\_cobweb\_plot}: shows the cobweb plot, which is a tool used to investigate the qualitative behavior of one-dimensional iterated functions, such as the logistic map \cite{cobweb}.
\end{itemize}

\begin{figure}[t]
    \centering
    \includegraphics[scale=0.8]{images/code-plot_logistic_map_bifurcations.png}
    \caption{Code of the function \texttt{plot\_logistic\_map\_bifurcations}}
    \label{fig:plot-logistic-map-bifurcations}
\end{figure}

\paragraph{Task 4.1:}
By varying $r$ from 0 to 2, the bifurcation diagram obtained with the function \texttt{plot\_logistic\_map\_bifurcations} illustrated previously is shown in Figure \hyperref[fig:logistic-bifurcs]{\ref{fig:logistic-bifurcs}(a)}.\\
It is possible to see that there is one steady state for each value of $r$, in particular:
\begin{itemize}
    \item $r \in (0,\ 1] \implies x = 0$
    \item $r \in (1,\ 2] \implies x = \frac{r - 1}{r}$
\end{itemize}
In this case, there is no bifurcation and the steady state of the system is always one ($\forall r \in (0, 2]$).
This fixed point is attractive, because, since each point in the bifurcation diagram is obtained plotting the last $p$ states assumed by the system for a certain value of $r$, if the steady state in object was repulsive, we would have multiple points per value of $r$, instead this is not the case.\\
Furthermore, in the cobweb plot in Figure \ref{fig:cobweb-4.1} it is possible to see how the system tends to a certain steady state: 0 for $r = 0.8$, 0.44 for $r = 1.8$.

\begin{figure}[b]
    \centering
    \subfloat[a]{\includegraphics[width=0.3\textwidth]{images/logistic_bifurc_r0-2.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.3\textwidth]{images/logistic_bifurc_r2-4.png}}
    \hfill
    \subfloat[c]{\includegraphics[width=0.3\textwidth]{images/logistic_bifurc_r0-4.png}}
    \caption{Bifurcations of the logistic map with:
    $r \in (0,\ 2]$ (a);
    $r \in [2, 4]$ (b);
    $r \in (0, 4]$ (c).}
    \label{fig:logistic-bifurcs}
\end{figure}

\begin{figure}[t]
    \centering
    \subfloat[a]{\includegraphics[width=0.45\textwidth]{images/cobweb_r0.8.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.45\textwidth]{images/cobweb_r1.8.png}}
    \caption{Cobweb plot with (a) $r = 0.8$ and (b) $r = 1.8$.}
    \label{fig:cobweb-4.1}
\end{figure}

\paragraph{Task 4.2:}
Varying $r$ from 2 to 4, the number of steady states continue to double more and more often, with the exceptions of few stability islands.
This behavior is shown in Figure \ref{fig:logistic-bifurcs}(b).
Moreover, Figure \ref{fig:cobweb-4.2} shows the various limit cycles with an increasing number of steady states as $r$ increases.

\begin{figure}[H]
    \centering
    \subfloat[a]{\includegraphics[width=0.3\textwidth]{images/cobweb_r2.5.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.3\textwidth]{images/cobweb_r3.2.png}}
    \hfill
    \subfloat[c]{\includegraphics[width=0.3\textwidth]{images/cobweb_r3.8.png}}
    \caption{Cobweb plot with (a) $r = 2.5$, (b) $r = 3.2$ and (c) $r = .8$.}
    \label{fig:cobweb-4.2}
\end{figure}

\paragraph{Task 4.3:}
Figure \hyperref[fig:logistic-bifurcs]{\ref{fig:logistic-bifurcs}(c)} shows the bifurcations of the logistic map for $r \in (0,\ 4]$.
\begin{itemize}
    \item $\forall r \in (0,\ 1]:\ x = 0$ is a steady state
    \item $\forall r \in (1,\ 3):\ x = \frac{r-1}{r}$ is a steady state
    \item $\forall r \geq 3$ there are limit cycles that include a different number of points, initially an oscillation between two states, then at roughly 3.4 the oscillation becomes between four states.
    This number tend to increase (doubling) as $r$ increases, until at approximately $r=3.57$ the behaviour becomes chaotic with some exceptions being sporadic stability islands where once again oscillation between a little number of states is present.
\end{itemize}

\paragraph{Part 2 - Lorenz attractor:}
The focus of this part is to analyze the \textit{Lorenz attractor} \cite{lorenz}.
The system is defined as follows:
\begin{equation}\label{eq:lorenz}
    \begin{split}
        &\frac{\partial x}{\partial t} = \sigma(y - x)\\
        &\frac{\partial y}{\partial t} = x(\rho - z) - y\\
        &\frac{\partial z}{\partial t} = x y - \beta z
    \end{split}
\end{equation}
where $x,\ y$ and $z$ represent the coordinates of a point/state of the system, while $\sigma,\ \rho$ and $\beta$ are parameters.\\
The system has been simulated for 1000 seconds and its trajectory has been plotted.
Specifically, starting from $x_0 = (10,\ 10,\ 10)$ we obtain the plot depicted in Figure \hyperref[fig:lorenz-trajs-1000s]{\ref{fig:lorenz-trajs-1000s}(a)}, while \hyperref[fig:lorenz-trajs-1000s]{\ref{fig:lorenz-trajs-1000s}(b)} shows the plot starting from $\hat{x}_0 = (10+10^{-8},\ 10,\ 10)$.
In both cases the parameters were set to $\sigma = 10,\ \beta = 8/3,\ \rho = 28$.\\
Since the image is a little dense, simulations have been run with the same configurations but for 200 seconds instead of 1000.
This is shown in Figure \ref{fig:lorenz-trajs-200s}.\\
Since the system is chaotic, the minimal perturbation in the starting point (going from $x_0$ to $\hat{x}_0$) is visible on a macroscopic scale when plotting the trajectory of the system starting from that point.
The difference between the two trajectories, expressed as $\|x(t)-\hat{x}(t)\|^2\ \forall t$, is shown in Figure \ref{fig:lorenz-trajs-differences}, where it is possible to notice how this difference assumes relatively large values.
Specifically, this distance becomes larger than 1 after 13.48 seconds.

\begin{figure}[H]
    \centering
    \subfloat[a]{\includegraphics[width=0.45\textwidth]{images/lorenz_traj_10-10-10.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.45\textwidth]{images/lorenz_traj_10-10-10_perturbed.png}}
    \caption{Trajectories of the \textit{Lorenz attractor} simulated for 1000 seconds, starting from (a) $x_0 = (10,\ 10,\ 10)$ and (b) $\hat{x}_0 = (10+10^{-8},\ 10,\ 10)$ with $\sigma = 10,\ \beta = 8/3,\ \rho = 28$.}
    \label{fig:lorenz-trajs-1000s}
\end{figure}

\begin{figure}[H]
    \centering
    \subfloat[a]{\includegraphics[width=0.45\textwidth]{images/lorenz_traj_10-10-10_200s.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.45\textwidth]{images/lorenz_traj_10-10-10_perturbed_200s.png}}
    \caption{Trajectories of the \textit{Lorenz attractor} simulated for 200 seconds, starting from (a) $x_0 = (10,\ 10,\ 10)$ and (b) $\hat{x}_0 = (10+10^{-8},\ 10,\ 10)$ with $\sigma = 10,\ \beta = 8/3,\ \rho = 28$.}
    \label{fig:lorenz-trajs-200s}
\end{figure}

\begin{figure}[H]
    \centering
    \subfloats[a]{\includegraphics[width=0.45\textwidth]{images/lorenz_trajs_differences.png}}
    \hfill
    \subfloats[a]{\includegraphics[width=0.45\textwidth]{images/lorenz_trajs_differences_closeup.png}}
    \caption{The difference between the trajectory of the \textit{Lorenz attractor} starting from $x_0=(10,\ 10,\ 10)$ and $\hat{x}_0=(10+19^{-8},\ 10,\ 10)$.
    For each value $t$ on the x-axis the plot shows $\|x(t)-\hat{x}(t)\|^2$.\\
    (b) shows simply a close-up of (a): the plot is the same but the x and y axes have been shortened.}
    \label{fig:lorenz-trajs-differences}
\end{figure}

Now, setting $\rho = 0.5$ and repeating these tests, it is possible to observe in Figure \ref{fig:lorenz-trajs-1000s-r0.5} that the trajectories are identical to each other, but very different from before, indicating that a bifurcation occurs for a certain value of $\rho$ between 0.5 and 28.

\begin{figure}[H]
    \centering
    \subfloat[a]{\includegraphics[width=0.45\textwidth]{images/lorenz_traj_10-10-10_r0.5.png}}
    \hfill
    \subfloat[b]{\includegraphics[width=0.45\textwidth]{images/lorenz_traj_10-10-10_perturbed_r0.5.png}}
    \caption{Trajectories of the \textit{Lorenz attractor} simulated for 1000 seconds, starting from (a) $x_0 = (10,\ 10,\ 10)$ and (b) $\hat{x}_0 = (10+10^{-8},\ 10,\ 10)$ with $\sigma = 10,\ \beta = 8/3,\ \rho = 0.5$.}
    \label{fig:lorenz-trajs-1000s-r0.5}
\end{figure}

\end{task}

\begin{task}{5, Bifurcations in crowd dynamics}
\paragraph{Task 5.1 - 5.2:}
The Jupyter notebook \texttt{sir\_bed\_mode\_unfinished.ipynb}, as the name suggests, is not complete.
The main aspect that had to be addressed is the fact that the equations that define the SIR model are not implemented (\hyperref[fig:sir-eqq-code]{Figure \ref{fig:sir-eqq-code}}).
It was straight forward to implement those equations having all the parameters needed (passed as arguments to the function): $\mu_0,\ \mu_1,\ \beta,\ A,\ d,\ \nu$ and $b$.\\
Other than that all the functions present in the notebook (namely \texttt{mu}, \texttt{R0}, \texttt{h} and \texttt{model}) have been moved to a new script called \texttt{sir\_utilities.py}.
Furthermore some code present in the notebook - for example the one to plot the system's trajectories and the behavior of the 3 variables (S, I, R) over time - has been put in specific functions placed in the new script to make everything more modular, tidy and reusable.\\
As a final point, the documentation has been improved or added when (partially) missing.

\begin{figure}[H]
    \centering
    \subplots[a]{\includegraphics[width=0.45\textwidth]{images/code_SIR_eqq_unfinished.png}}
    \hfill
    \subplots[b]{\includegraphics[width=0.45\textwidth]{images/code_SIR_eqq_finished.png}}
    \caption{The code implementing the SIR model's equations. (a) the unfinished code given in the example notebook; (b) the completed code.}
    \label{fig:sir-eqq-code}
\end{figure}

\paragraph{Task 5.3:}
The parameterized proposed scenario follows the ruled behaviour described in \textbf{\hyperref[kuznetsov]{\cite{kuznetsov}, Section 4}}, where the study of  parameterized models being non \textit{globally asymptotically stable} in $E_0$ is carried out. $E_0$ is in our case the initial condition [200, 0, 0] and our parameterized system is non \textit{globally asymptotically stable} in that point since $R0 < 1$ (0.99) and $\beta > d + \nu + \mu_0$ ($11.5 > 11.1$).

The scenario does therefore produce a bifurcation when varying the \texttt{b} parameter, as graphically portrayed in \textbf{\hyperref[fig:sir-bifurcation]{Figure \ref{fig:sir-bifurcation}}}.
What is represented in the aforementioned figure is a trajectory plotting by varying \texttt{b} in the range $(0.01, 0.03)$ (with 0.001 as step), with each subfigure showing the trajectory of three different initial points:
\begin{itemize}
    \item first point is initiated with \textbf{[195.3, 0.052, 4.4]} as SIR values. Its trajectory is colored in \textbf{red} and its initial (\textbf{x symbol}) and final (\textbf{romboid symbol}) trajectory landmarks are colored in \textbf{black}.
    \item second point is initiated with \textbf{[195.7, 0.03, 3.92]} as SIR values. Its trajectory is colored in \textbf{green} and its initial (\textbf{x symbol}) and final (\textbf{romboid symbol}) trajectory landmarks are colored in \textbf{light violet}.
    \item last point is initiated with \textbf{[193, 0.08, 6.21]} as SIR values. Its trajectory is colored in \textbf{blue} and its initial (\textbf{x symbol}) and final (\textbf{romboid symbol}) trajectory landmarks are colored in \textbf{orange}.
\end{itemize}
To discuss the behaviour change when increasing \texttt{b}:
\begin{itemize}
    \item for \textbf{$b < 0.022$} the system shows a local attractive point in [193.666, 0.057, 5.71] for the three points in consideration, resembling ever more a stable focus as $b$ increases in value (\textbf{\hyperref[fig:sir-bifurcation]{Figure \ref{fig:sir-bifurcation}}.c-d}).
    \item at \textbf{$b = 0.022$} the system encounters its bifurcation point, with [193.666, 0.057, 5.71] being a weak stable point since it is attracting the nearest point (the red plot) while a new behaviour shows up, with the other two points being attracted to a limit cycle (\textbf{\hyperref[fig:sir-bifurcation]{Figure \ref{fig:sir-bifurcation}}.f}). In particular the limit cycle is attractive both from the inside (the green plot) and from the outside (the blue plot).
    \item for \textbf{$b > 0.022$} the system slowly converges once again to having an attractive steady state, which is actually $E_0$ [200, 0, 0] (\textbf{\hyperref[fig:sir-bifurcation]{Figure \ref{fig:sir-bifurcation}}.g-h}).
\end{itemize}
Just to address it, \textbf{\hyperref[fig:sir-bifurcation]{Figure \ref{fig:sir-bifurcation}}} is composed of 2D images since 3D images such as the one portrayed in \textbf{\hyperref[fig:sir-bifurcation-3d]{Figure \ref{fig:sir-bifurcation-3d}}} do in our opinion make it harder to visualize single points while not adding much more qualitative information with respect to 2D.
\begin{figure}[h]
    \centering
    \includegraphics[scale=0.32]{images/5.3.big.png}
    \caption{bifurcation point in 3D}
    \label{fig:sir-bifurcation-3d}
\end{figure}

\pagebreak
\begin{figure}[ht!]
 \centering
 \subfloat[a]{\includegraphics[width=0.32\textwidth]{images/5.3.1.png}}%
 \subfloat[b]{\includegraphics[width=0.32\textwidth]{images/5.3.2.png}}%
 \subfloat[c]{\includegraphics[width=0.32\textwidth]{images/5.3.3.png}}\\
 \subfloat[d]{\includegraphics[width=0.32\textwidth]{images/5.3.4.png}}%
 \subfloat[e]{\includegraphics[width=0.32\textwidth]{images/5.3.5.png}}%
 \subfloat[f]{\includegraphics[width=0.32\textwidth]{images/5.3.6.png}}\\
 \subfloat[g]{\includegraphics[width=0.32\textwidth]{images/5.3.7.png}}%
 \subfloat[h]{\includegraphics[width=0.32\textwidth]{images/5.3.8.png}}%
 \caption{showing SIR behaviour change by varying \texttt{b} - time evolution from left to right and up to down}%
 \label{fig:sir-bifurcation}%
\end{figure}
\pagebreak

\paragraph{Task 5.4:}
The bifurcation shown in the previous paragraph appears at $b = 0.022$. Following the \textbf{Lemma 4.3} in \cite{kuznetsov} it is possible to demonstrate it is a \textit{Hopf Bifurcation}, going locally from a steady state to a limit cycle as we previously have seen in \textbf{\hyperref[sec:task3]{Section Task 3}}. The calculations are shown in file \texttt{EX3/task5.ipynb} following the lemma conditions. Eventually, the normal form is the one mentioned in the same aforementiond section:
$$\dot x_1 = \alpha x_1 - x_2 - x_1(x_1^2 + x_2^2)$$
$$\dot x_2 = x_1 + \alpha x_2 - x_2(x_1^2 + x_2^2)$$

\paragraph{Task 5.5:}
The \textit{basic reproduction number} is defined in \cite{SHAN20141662} as:
\begin{equation}
    \mathbb{R}_0 = \frac{\beta}{d + \nu + \mu_1}\ .
\end{equation}
Therefore, the variables used to compute it are $\beta,\ d,\ \nu$ and $\mu_1$, and they represent respectively the average number of contacts per unit of time with infectious people ($\beta$), the natural death rate per capita (d), the disease-induced death rate per capita ($\nu$) and the maximum recovery rate (dependant of the number of available hospital beds) ($\mu_1$).
% \footnote{$\beta$: the average number of contacts per unit of time with infectious people;\\
% d: per capita natural death rate;\\
% $\nu$: per capita disease-induced death rate;\\
% $\mu_1$: maximum recovery rate (dependant of the number of available hospital beds).}.
This reproduction rate indicates how easily the infection spreads among the population, so, since $\beta$ is at the numerator, if it increases or decreases, $\mathbb{R}_0$ will behave the same way (increasing or decreasing).
In \cite{SHAN20141662}, it is stated that, for classic epidemiological models with different demographics, the dynamics are almost completely characterized by $\mathbb{R}_0$.
The disease will be eliminated if $\mathbb{R}_0 < 1$, otherwise the disease will persist.

\paragraph{Task 5.6:}
The \textit{disease free equilibrium} is defined in \cite{SHAN20141662} as $E_0\left(\frac{A}{d},\ 0,\ 0\right)$, and, for $\mathbb{R}_0 < 1$ it is an \textbf{attracting node}.
This means that, for values of the S, I and R variables that are near to $\frac{A}{d}$, 0 and 0, the system will quickly reach $E_0$ and it will not move from that state as the simulation goes on.
Practically speaking, the infection will not be able to spread through the population, since the steady state's component corresponding to the number of infected people (I) is going to stay 0.\\
If we get further from $E_0$, though, things change: for $b > 0.022$ the system always gets to $E_0$, while for $b < 0.022$ we found another attractive point in $(193.666,\ 0.057,\ 5.71)$.
This happens only when starting from a point that is not too near and not too far from $E_0$.
This behavior can be observed in Figure \ref{fig:task5.6}.

\begin{figure}[H]
    \centering
    \subfloats[a]{\includegraphics[width=0.3\textwidth]{images/task6_after_bif_1.png}}
    \hfill
    \subfloats[b]{\includegraphics[width=0.3\textwidth]{images/task6_after_bif_2.png}}
    \hfill
    \subfloats[c]{\includegraphics[width=0.3\textwidth]{images/task6_after_bif_3.png}}
    \vfill
    \subfloat[d]{\includegraphics[width=0.3\textwidth]{images/task6_before_bif_1.png}}
    \hfill
    \subfloats[e]{\includegraphics[width=0.3\textwidth]{images/task6_before_bif_2.png}}
    \hfill
    \subfloats[f]{\includegraphics[width=0.3\textwidth]{images/task6_before_bif_3.png}}
    \caption{With $b < 0.022$ the system always reaches $E_0=(\frac{A}{d}=200,\ 0,\ 0)$ ((a), (b), (c)).\\
    With $b > 0.022$:
    (d) starting far from $E_0$, the system reaches $E_0$ anyway;
    (f) starting near $E_0$, the system reaches $E_0$ anyway;
    (e) starting in between near and far from $E_0$, the system reaches the point [193.666, 0.057, 5.71).\\
    It is worth noticing that this point gets reached from many different starting points, even if in the figure only one example is shown for the sake of simplicity.}
    \label{fig:task5.6}
\end{figure}
\end{task}

\newpage
\bibliographystyle{plain}
\bibliography{Literature}

\end{document}