\documentclass[11pt]{scrartcl} % vim: tw=50 \usepackage{notesheader} \begin{document} \title{Numbers and Sets} \author{} \date{\today} \maketitle \tableofcontents \newpage \setcounter{section}{-1} \section{Introductory Remarks} The course consists of these notes; there is no \emph{need} to look at any books, but it may be of some use. There will be 4 example sheets for this course. \newpage \section{Proofs} \begin{definition*}[Proof] A proof is a sequence of true statements without logical gaps, establishing some conclusion. \end{definition*} \noindent We have to start somewhere, and have agreed assumptions (axioms). \\\\ We want to prove things because: \begin{itemize} \item[---] We want to know they are true; \item[---] We hope to gain insight into why they are true; \item[---] We might be lucky and the proof is beautiful. \end{itemize} \subsection{Examples of statements} \begin{enumerate}[(1)] \item There are infinitely many primes $p$ such that $2p + 1$ is also prime. \item There are infinitely many primes $p$ such that one of $p + 2, p + 4, \dots, p + 246$ is also prime. \item There is always a prime between $n$ and $2n$ for any integer $n$. \item There is no algorithm which will factor an $n$-digit integer in at most $n^3$ steps. \item Every non-constant polynomial with complex coefficients has a root (in the complex numbers). \item $m \times n = n \times m$ for all integers $m$ and $n$. \item $1 + 1 = 2$. \end{enumerate} \noindent \textbf{Remarks} \begin{enumerate}[(1)] \item No-one knows if it's true. \item Was proved in 2014. \item Not obvious but true. \item Would be a disaster if false! \item The Fundamental Theorem of Algebra. \item Worth thinking about\dots \item Does it need proving? \end{enumerate} \newpage \subsection{Some proofs and non-proofs} \begin{assertion*} For all positive integers $n$, $n^3 - n$ is a multiple of 3. \end{assertion*} \begin{proof} For any positive integer $n$, we have \[ n^3 - n = n(n^2 - 1) = n(n + 1)(n - 1) = (n - 1)n(n + 1) \] One of the three consecutive integers $n - 1$, $n$ and $n + 1$ must be a multiple of 3, and hence, so must their product. \end{proof} \begin{notation*} The symbol $\hspace{-1em}\qed$ is used to mean ``end of proof'' \end{notation*} \begin{assertion*} For any positive integer $n$, if $n^2$ is even then so is $n$. \end{assertion*} \begin{fakeproof} Given a positive integer $n$, which is even, we can write $n = 2k$ for some positive integer $k$. Hence $n^2 = (2k)^2 = 2(2k^2)$, which is even. \end{fakeproof} \\\\ Nonsense! We wanted to show ``if $A$ then $B$'' but we have shown ``if $B$ then $A$''.s \begin{assertion*} For any positive integer $n$, if $n^2$ is a multiple of 9, then so is $n$. \end{assertion*} \noindent This assertion is simply false: take $n = 6$. To guess that ``if $A$ then $B$'' is false, then it is enough to show that there is \emph{one} instance where $A$ is true and $B$ is false. \begin{center} \emph{``One counterexample is enough''} \end{center} \noindent Back to: ``if $n^2$ is even, then $n$ is even.'' \begin{proof} Suppose on the contrary that $n$ is \emph{not} even. Then $n$ is odd, so $n = 2k + 1$ for some integer $k$. Thus \[ n^2 = (2k + 1)^2 = 4k^2 + 4k + 1 = 2(2k^2 + 2k) + 1 ,\] which is odd, contradicting the assumption that $n^2$ is even. \contradiction \end{proof} \noindent This is a proof by contradiction. \begin{notation*}[Contradiction] \contradiction denotes some kind of contradiction in a proof. \end{notation*} \noindent To show ``if $A$ then $B$'' we shows that there is no case where $A$ is true and $B$ is false. In other words, showing $A \implies B$ is the same as showing $\mathrm{NOT}\ B \implies \mathrm{NOT}\ A$. \begin{assertion*} The solution to $x^2 - 5x + 6 = 0$ is $x = 2$ or $x = 3$. This is in fact two assertions: \begin{enumerate}[(i)] \item $x = 2$ and $x = 3$ are solutions; \item there are no other solutions. \end{enumerate} \end{assertion*} \begin{proof} \phantom{.} \begin{enumerate}[(i)] \item If $x = 2$ or $x = 3$, \\ then $x - 2 = 0$ or $x - 3 = 0$ \\ so $(x - 2)(x - 3) = 0$ \\ so $x^2 - 5x + 6 = 0$. \item If $x^2 - 5x + 6 = 0$ \\ then $(x - 2)(x - 3) = 0$ \\ then $(x - 2)(x - 3) = 0$ \\ so $x - 2 = 0$ or $x - 3 = 0$ \\ so $x = 2$ or $x = 3$. \end{enumerate} \end{proof} Or an alternative proof that is more concise: \begin{proof} \begin{align*} x &= 2 \qquad \text{or} \qquad x &= 3 \\ \iff x - 2 &= 0 \qquad \text{or} \qquad x - 3 &= 0 \\ \iff (x - 2)(x - 3) &= 0 \\ \iff x^2 - 5x + 6 = 0 \end{align*} \end{proof} It is vital that every step is $\iff$! \bigskip \begin{assertion*} Every positive real is $\ge 1$. \end{assertion*} \begin{fakeproof} Let $r$ be the least positive real. Then either $r = 1$ or $r < 1$ or $r > 1$. \\ If $r > 1$, then $0 < r^2 < r$, contradicting the assumption that $r$ is the least positive real. \\ If $r > 1$, then $0 < \sqrt{r} < r$, again \contradiction. Hence $r = 1$. \end{fakeproof} \smallskip \noindent Nonsense! We don't know that there is a smallest positive real. \begin{moral*} Every claim must be justified. \end{moral*} \subsection{Combining Assertions} \begin{notation*}[Combining assertions] If $A$ and $B$ are assertions, we can (but we usually don't) write $A \wedge B$ for ``$A$ AND $B$'', $A \vee B$ for ``$A$ OR $B$'', and $\neg A$ for ``NOT $A$''. \end{notation*} \noindent The truth of these assertions depends on the truth of $A$ and $B$, summarised in the \emph{truth table}. \begin{center} \begin{tabular}{cc|c} $A$ & $B$ & $A \wedge B$ \\ \hline $F$ & $F$ & $F$ \\ $F$ & $T$ & $F$ \\ $T$ & $F$ & $F$ \\ $T$ & $T$ & $T$ \end{tabular} \hspace{3em} \begin{tabular}{cc|c} $A$ & $B$ & $A \vee B$ \\ \hline $F$ & $F$ & $F$ \\ $F$ & $T$ & $T$ \\ $T$ & $F$ & $T$ \\ $T$ & $T$ & $T$ \end{tabular} \hspace{3em} \begin{tabular}{c|c} $A$ & $\neg A$ \\ \hline $T$ & $F$ \\ $F$ & $T$ \end{tabular} \end{center} \begin{center} \begin{tabular}{cc|c} $A$ & $B$ & $A \implies B$ \\ \hline $F$ & $F$ & $T$ \\ $F$ & $T$ & $T$ \\ $T$ & $F$ & $F$ \\ $T$ & $T$ & $T$ \end{tabular} \end{center} \noindent Note, for example, that $\neg (A \wedge B)$ is equivalent to $(\neg A) \vee (\neg B)$, by comparing truth tables. \\ Also, $A \implies B$ is equivalent to $(\neg A) \vee B$ and hence $B \vee (\neg A)$, and hence to $(\neg B) \implies (\neg A)$. \subsection{Qualifiers and Negations} An assertion may involve ``quantifiers'', for example $\forall n$ (``for all $n$''), $\exists x$ (``there exists $x$''). \bigskip \[ \neg (\forall x A(x)) \qquad \text{means} \qquad \exists x \neg A(x) \] \[ \neg (\exists x B(x)) \qquad \text{means} \qquad \forall x \neg B(x) \] The order of quantifiers matters! \newpage \section{Elementary Number Theory} Intuitively, the natural numbers consist of \[ 1, 1 + 1, 1 + 1 + 1, 1 + 1 + 1 + 1, \dots \] How do you know you have captured all natural numbers? How do you know they are all distinct? \subsection{Our Axioms} We shall assume: \\ The natural numbers, written as $\NN$, is a set containing a special element `1' with an operation `+1' satisfying \begin{enumerate}[(i)] \item $\forall n \in \NN$, $n + 1 \neq 1$; \item $\forall m, n \in \NN$, if $m \neq n$, then $m + 1 \neq n + 1$; \item for any property $P(n)$, if $P(1)$ is true and $\forall n \in \NN$, $P(n) \implies P(n + 1)$, then $P(n)$ is true for all natural numbers. \end{enumerate} \noindent (i) - (iii) are known as the \emph{Peano axioms}. \\ (iii) is called the \emph{induction axiom}. \\ (i) \& (ii) capture the idea that any two natural numbers are distinct; (iii) captures our intuitive notion that the list is complete (take $P(n) = \text{``$n$ is on the list''})$. \begin{notation*} Now we can write $2$ for $1 + 1$, $3$ for $1 + 1 + 1$, etc, and we can define an operation `+k' for any natural number k in the following way: \[ \text{for every natural number $n$}, n + (k + 1) = (n + k) + 1 .\] (by induction, taking the statement $P(k) = \text{`` `+k' is defined``}$). Similarly, we can define multiplication, powers, etc. \end{notation*} \noindent One can check that the ``normal'' rules of arithmetic apply: \begin{enumerate}[(1)] \item $\forall a, b$ we have $a + b = b + a$ ($+$ is commutative); \item $\forall a, b$ we have $ab = ba$ ($\cdot$ is commutative); \item $\forall a, b, c$ we have $a + (b + c) = (a + b) + c$ ($+$ is associative); \item $\forall a, b, c$ we have $a(bc) = (ab)c$ ($\cdot$ is associative); \item $\forall a, b, c$ we have $a(b + c) = ab + ac$ (multiplication is distributive over addition). \end{enumerate} \begin{definition*}[Greater than] We define `$a < b$'' if $a + c = b$ for some $c \in \NN$. One can verify that \begin{enumerate}[(1)] \setcounter{enumi}{5} \item $\forall a, b, c \qquad a < b \implies a + c < b + c$; \item $\forall a, b, c \qquad a < b \implies ac < bc$; \item $\forall a, b, c \qquad a < b \wedge b < c \implies a < c$; \item $\forall a \qquad \neg (a < a).$ \end{enumerate} \end{definition*} \noindent Recall the induction axiom: If $P(1)$ holds and $\forall n \in \NN$, $P(n) \implies P(n + 1)$, then $P(n)$ holds $\forall n \in \NN$. This is also known as the \emph{(Weak) Principle of Induction} (WPI). A more useful form is the following. \begin{definition*}[Strong Pinciple of Induction (SPI)] If \begin{enumerate}[(i)] \item $P(1)$ holds and \item $\forall n \in \NN$, we have $P(m) \forall m \le n \implies P(n + 1)$, \end{enumerate} then $P(n)$ holds $\forall n \in \NN$. \end{definition*} \noindent In fact, WPI and SPI are equivalent. To see that WPI implies SPI, apply the former to $Q(n) = ``P(m) \forall m \le n''$. \begin{theorem*}[Well-ordering Principle (WOP)] If $P(n)$ holds for some $n \in \NN$, then there is a least natural number $n \in \NN$ such that $P(n)$ holds. \end{theorem*} \noindent ``Every non-empty subset of $\NN$ has a minimal element.'' \begin{assertion*} SPI is equivalent to WOP. \end{assertion*} \begin{proof} To show that WOP implies SPI, we assume (i) and (ii), and show that $P(n)$ holds $\forall n \in \NN$, using WOP. Suppose, on the contrary, that $P(n)$ is not true $\forall n \in \NN$. Then $C = \{n \in \NN : P(n) \text{ is false}\} \neq \emptyset$. By WOP, $C$ has a minimal element, $m$ say. Now $\forall k < m$, $k \not\in C$ (by minimality of $M$), so $P(k)$ holds $\forall k < m$. But by (ii) of SPI, $P(m)$ holds, so contradicting $m \in C$. Hence SPI holds. To show that SPI implies WOP, suppose there is no least $n \in \NN$ such that $P(n)$ holds. We want to show that $P(n)$ does not hold for any $n \in \NN$, using SPI. Consider $Q(n) = ``\neg P(n)''$. Certainly $P(1)$ is false (else 1 would be the minimal element), so $Q(1)$ holds. Given $n \in \NN$, suppose that $Q(k)$ is true $\forall k < n$. Then $P(k)$ is false $\forall k < n$. So $P(n)$ is false as otherwise $n$ would be the minimal element for which $P$ holds. Hence $Q(n)$ is true, and so (ii) of SPI holds, so $Q(n)$ is true $\forall n \in \NN$. Thus $P(n)$ is false $\forall n \in \NN$. \end{proof} \noindent WOP enables us to prove $P(n)$ is true $\forall n \in \NN$ as follows: If not, then there is a minimal counterexample, and we try and derive a contradiction. \subsection{The Integers} The integers, written $\ZZ$, consist of all symbols \[ n, -n, \text{where $n$ is in the natural numbers, and } 0 .\] In other words \[ \ZZ = \NN \cup \{-n : n \in \NN\} \cup \{0\} .\] Can define $+$ and $\cdot$ etc on $\ZZ$ from $\NN$, and check that the usual rules of arithmetic hold. We also have the following properties: \begin{enumerate}[(1)] \setcounter{enumi}{9} \item $\forall a \in \ZZ \qquad a + 0 = a$ (identity for $+$) \item $\forall a \in \ZZ, \exists b \in \ZZ$ such that $a + b = 0$ (inverses for $+$). \end{enumerate} Define ``$a < b$'' if $a + c = b$ for some $c \in \NN$. Then rules (6), (8), (9) continue to hold, but (7) must be modified: \begin{enumerate} \item[(7')] $\forall a, b, c \in \ZZ \qquad a < b \wedge c > 0 \implies ac < bc$. \end{enumerate} \subsection{The Rationals} The rationals, written $\QQ$, consist of all expressions of the form \begin{center} $\frac{a}{b}$, where $a$, $b$ are integers with $b \neq 0$, and $\frac{a}{b}$ and $\frac{c}{d}$ are regarded as the same if $ad = bc$. \end{center} \noindent Define $\frac{a}{b} + \frac{c}{d} = \frac{ad + bc}{bd}$, and one can check that it does not matter how we wrote $\frac{a}{b}$ or $\frac{c}{d}$. \\\\ We similarly define multiplication, and define \begin{center} ``$\frac{a}{b} < \frac{c}{d}$'' where $b, d > 0$ if $ad < bc$. \end{center} One can check that rules (6), (7'), (8) and (9) still apply. \\\\ In addition: \begin{enumerate}[(1)] \setcounter{enumi}{11} \item $\forall a \in \QQ, a \neq 0, \exists b \text{ such that } ab = 1$ (inverses for $\cdot$) \end{enumerate} \begin{remark*} $\NN \subset \ZZ \subset \QQ$ \end{remark*} \begin{notation*}[Subsets] The symbol $\subset$ means ``contained in'' or ``is a subset of''. \end{notation*} \subsection{Primes} Given $a, b \in \ZZ$ we say ``$a$ divides $b$''if $\exists c \in \ZZ$ such that $b = ac$. We might also ``$a$ is a divisor of $b$'' or ``$a$ is a factor of $b$'', or ``$b$ is a multiple of $a$''. We write $a \mid b$. \begin{remark*} For any $b \in \ZZ$, $\pm 1$ and $\pm b$ are always factors; all other factors (if they exist) are called \emph{proper} or sometimes ``non-trivial''. \end{remark*} \begin{definition*}[Primes] A natural number $n \ge 2$ is \emph{prime} if its only factors are $\pm 1$ and $\pm n$. \end{definition*} \begin{definition*}[Composite numbers] If $n \ge 2$ is not prime, then it is \emph{composite}. \end{definition*} \begin{proposition*} Every natural number $n \ge 2$ can be written as a product of primes. \end{proposition*} \begin{proof} By induction on $n$. True for $n = 2$. Let $n > 2$ and suppose that the claim holds up to and including $n - 1$. If $n$ is a prime, then done. If $n$ is composite, $n = a \cdot b$ for some $1 < a, b < n$. By the induction hypothesis, we have $a = p_1 \cdots p_k$, $b = q_1 \cdots q_l$ for some primes $p_1 \cdots p_kq\cdots q_l$. Hence $n = ab = p_1 \cdots p_kq_1 \cdots q_l$ is a product of primes. \end{proof} \begin{theorem*} There are infinitely many primes. \end{theorem*} \begin{proof} (Euclid 300BC) Suppose there are finitely many primes, say $p_1, \dots, p_k$. Let $N = p_1 \cdots p_k + 1$. Then $p_1 \nmid N$, else $p_1 | N - p_1 \cdots p_k = 1$. Note that $\nmid$ means ``does not divide''. Likewise, none of $p_2, p_3, \dots, p_k$ divide $N$, contradicting the fact that $N$ can be written as a product of primes. \end{proof} \noindent Can a number have more than one factorisation into primes? Our proof that every number has a prime factorisation does not give uniqueness. \\ Clearly, $21 = 3 \times 7$ is unique. \\ What about $295869$? $= 3 \times 7 \times 73 \times 193$ \\ Why is $9040 \times 40099 \neq 6701 \times 54151$? \\\\ We will need the following claim: \begin{proposition*}[Euclid's Lemma] If $p$ is a prime and $p \mid ab$, then $p \mid a$ or $p \mid b$. \end{proposition*} \begin{definition*}[Highest Common Factor] Given $a, b \in \NN$, a natural number $c$ is the \emph{highest common factor} (hcf), or \emph{greatest common divisor} (gcd) of $a$ and $b$ if \begin{enumerate}[(i)] \item $c \mid a$ and $c \mid b$ (``$c$ is a common divisor of $a$ and $b$'') \item $d \mid a \wedge d \mid b \implies d \mid c$ ``every common factor of $a$ and $b$ divides $c$'' \end{enumerate} We write ``$c = \mathrm{hcf}(a, b)$'' or ``$c = \gcd(a, b)$'', or simply ``$c = (a, b)$''. \end{definition*} \begin{example*} The factors of 12 are 1, 2, 3, 4, 6, 12 and the factors of 18 are 1, 2, 3, 6, 9, 18. So the common factors are 1, 2, 3, 6, hence $\mathrm{hcf}(12, 18) = 6$. But if $a$ and $b$ had common factors 1, 2, 3, 4, 6, then $a$ and $b$ would have no $\mathrm{hcf}$ (according to (ii)). So we need to show that $\mathrm{hcf}(a, b)$ always exists. \end{example*} \begin{proposition*}[Division Algorithm] Let $n, k \in \NN$. Then we can write $n = qk + r$, where $q$ and $r$ are integers with $0 \le r \le k - 1$. \end{proposition*} \begin{proof} By induction on $n$. True for $n = 1$. Suppose $n - 1 = qk + r$ for some $q, r \in \ZZ$ such that $0 \le r \le k - 1$. If $r < k - 1$, then $n = (n - 1) + 1 = qk + (r + 1)$. If $r = k - 1$, then $n = (n - 1) + 1 = qk + (k - 1) + 1 = (q + 1)k$. \end{proof} \subsubsection*{Euclid's Algorithm} \begin{center} \begin{tabular}{c|cc|c} $\text{INPUT}$ & $a$ & $b$ & $a = 372 \qquad b = 162$ \\ \hline & & $q_1r_1 \in \ZZ$ & \\ $\text{STEP 1}$ & $a = q_1b + r_1$ & $0 \le r_1 \le b - 1$ & $372 = 2 \cdot 162 + 48$ \\ $2$ & $b = q_2r_1 + r_2$ & $0 \le r_2 < r_1$ & $162 = 3 \cdot 48 + 18$ \\ $3$ & $r_1 = q_3\cdot r_2 + r_3$ & $0 \le r_3 < r_2$ & $48 = 2\cdot 18 + 12$ \\ & $\vdots$ & & \\ $n$ & $r_{n - 2} = q_nr_{n - 1} + r_n$ & $0 \le r_n < r_{n - 1}$ & $18 = 1 \cdot 12 + 6$ \\ $n + 1$ & $r_{n - 1} = r_{n = 1}r_n + r_{n + 1}$ & $= 0$ & $12 = 2 \cdot 6$ \\ \hline $\text{OUTPUT}$ & $r_n$ & & 6 \end{tabular} \end{center} \noindent Note that the algorithm terminates in $\le b$ steps, since $b > r_1 > r_2 > \cdots \ge 0$. \begin{theorem*} The output of Euclid's algorithm with input $a$, $b$ is $\mathrm{hcf}(a, b)$. \end{theorem*} \begin{proof} \phantom{.} \begin{enumerate}[(i)] \item Have $r_n \mid r_{n - 1}$ (as $r_{n + 1} = 0$ at STEP $n + 1$) \\ so $r_n \mid r_{n - 2}$ (STEP $n$) \\ so $r_n \mid r_i \,\,\,\forall i = 1, \dots, n - 1$ (by induction) \\ Hence $r_n \mid b$ (STEP 2) and $r_n \mid a$ (STEP 1). \item Given $d$ such that $d \mid a$ and $d \mid b$, \\ have $d \mid r_1$ (STEP 1) \\ so $d \mid r_2$ (STEP 2) \\ and $d \mid r_i \forall i = 1, \dots, n$ by induction. \qedhere \end{enumerate} \end{proof} \begin{definition*}[Coprime] When $\mathrm{hcf}(a, b) = 1$, we also say that $a$ and $b$ are \emph{coprime}. \end{definition*} \begin{example*}[$\mathrm{hcf}(87, 52)$] \begin{align*} 87 &= 1 \cdot 52 + 35 \\ 52 &= 1 \cdot 35 + 17 \\ 35 &= 2 \cdot 17 + 1 \\ 17 &= 17 \cdot 1 \end{align*} so $\mathrm{hcf}(87, 52) = 1$. \\ We can also reverse the algorithm: \begin{align*} 1 &= 35 - 2 \cdot 17 \\ &= 35 - 2 \cdot (52 - 1 \cdot 35) \\ &= -2 \cdot 52 + 3 \cdot 35 \\ &= -2 \cdot 52 + 3 \cdot (87 - 1 \cdot 52) \\ &= -5 \cdot 52 + 3 \cdot 87 \end{align*} \end{example*} \begin{theorem*} For all natural numbers $a$ and $b$, there exists some integers $x$ and $y$ such that \[ xa + yb = \mathrm{hcf}(a, b) \] ``We can write $\mathrm{hcf}(a, b)$ as a linear combination of $a$ and $b$.'' \end{theorem*} \begin{proof}[1] Run Euclid's algorithm with input $a$, $b$ to obtain an output $r_n$ say. At STEP $n$, have $r_n = xr_{n - 1} + yr_{n - 2}$ for some $x, y \in \ZZ$. But $r_{n - 1}$ is expressible as $xr_{n - 2} + yr_{n - 3}$ for some $x, y \in \ZZ$, from STEP $n - 1$, whence $r_n = xr_{n - 2} + yr_{n - 3}$ for some $x, y \in \ZZ$. Continuing by induction, we have $\forall i = 2, \dots, n - 1$, $r_n = xr_i + yr_{i - 1}$ for some $x, y \in \ZZ$. Thus $r_n = xa + yb$ for some $x, y \in \ZZ$, from STEP 1 and 2. \end{proof} \begin{remark*} Euclid's algorithm not only proves that $x, y \in \ZZ$ exist, but it gives us a quick way to find them. \end{remark*} \begin{proof}[2] Let $h$ be the least positive linear combination of $a$ and $b$, i.e. the least positive integer of the form $xa + yb$ for some $x, y \in \ZZ$. \\ We will show that $h = \mathrm{hcf}(a, b)$. \\ To see that part (ii) of the definition of hcf holds, observe that given $d$ such that $d \mid a$ and $d \mid b$, then we have that $d \mid ax + by \,\,\,\forall x, y \in \ZZ$, so in particular, $d \mid h$. \\ To verify part (i), suppose that $h \nmid a$. Then we can write $a = qh + r$ for some $q, r \in \ZZ$ with $0 < r < h$ (note that the strict inequality on the 0 comes from the fact that we have assumed that $h \nmid a$). Hence $r = a - qh = a - q(xa + yb)$ is also a positive linear combination of $a$ and $b$, and strictly smaller than $h$ contradicting the definition of $h$. Therefore $h \mid a$, and by the same argument $h \mid b$. \\ Therefore $h = \mathrm{hcf}(a, b)$. \end{proof} \begin{remark*} Proof 2 also tells us that the $\mathrm{hcf}(a, b)$ exists and is a linear combination of $a$ and $b$, \emph{but} gives no way to find $\mathrm{hcf}(a, b)$ or the coefficients $x$, $y$. \end{remark*} \noindent Is there a solution in integers $x, y$ to the equation \[ 320x + 72y = 33 ?\] No, as LHS always even and the RHS odd. \\ What about $87x + 52y = 33$? Yes, as we had $x', y' \in \ZZ$ such that $87x' + 52y' = 1$, so $x = 33x'$, $y = 33y'$ is an integer solution. \begin{corollary}[B\'ezout's Theorem] Let $a, b \in \NN$. Then the equation $ax + by = c$ has a solution in integers $x, y$ if and only if $\mathrm{hcf}(a, b) \mid c$. \end{corollary} \begin{proof} Let $h = \mathrm{hcf}(a, b)$. \\ To prove that ``only if'' direction, suppose there are $x, y \in \ZZ$ such that $ax + by = c$. Then since $h \mid a$ and $h \mid b$, then $h \mid c$. \\ Conversely, suppose $h \mid c$. But this implies that there exist $x , y \in \ZZ$ such that $h = ax + by$. But then \[ c = \frac{c}{h} \cdot h = \frac{c}{h} (ax + by) = a\left( x \cdot \frac{c}{h} \right) + b \left( y \cdot \frac{c}{h} \right) \qedhere \] \end{proof} \noindent Now we will prove Euclid's Lemma, which was stated earlier. \begin{proposition*}[Euclid's Lemma] If $p$ is a prime and $p \mid ab$, then $p \mid a$ or $p \mid b$. \end{proposition*} \begin{proof} Suppose $p \mid ab$ but $p \nmid a$. We will show that $p \mid b$. Since $p$ is prime, $\mathrm{hcf}(a, p)$ must be either 1 or $p$, but since $p \nmid a$ it cannot be $p$, hence we must have that $\mathrm{hcf}(a, p) = 1$. Thus there exist $x, y \in \ZZ$ such that $xp + ya = 1$. \\ It follows that $xpb + yab = b$ hence $b$ is a multiple of $p$ (as each of $p$ and $ab$ is). \end{proof} \subsubsection*{Remarks} \begin{enumerate}[(1)] \item Similarly, $p \mid a_1a_2 \cdots a_n \implies p \mid a_i$ for some $i = 1, \dots, n$. Indeed, the proposition tells us that if $p \mid a_1a_2 \cdots a_n$, then $p \mid a_1$ or $p \mid a_2 \cdots a_n$. Proceed by induction on the number of terms in the product. \item We do need $p$ prime. \end{enumerate} \begin{theorem*}[Fundamental Theorem of Arithmetic] Every natural number $n \ge 2$ is expressible as a product of primes, uniquely up to reordering. \end{theorem*} \begin{proof} We have already proved existence of a factorisation, so we need only prove that it is unique. To prove this, we use induction on $n$. It is clearly true for $n = 2$. Given $n \ge 2$, suppose $n = p_1p_2 \cdots p_k = q_1q_2 \cdots q_l$, where $p_i$, $q_j$ are all prime. We want to show that $k = l$, and after reordering $p_i = q_i \,\,\,\forall i = 1, \dots, k$. We have that $p_1 \mid n$, hence $p \mid q_1 \cdots q_l$, so $p_1$ must divide one of the factors in this product, so $p_1 \mid q_i$ for some $i$. Relabelling the $q_i$, we may assume that $p_1 \mid q_1$. Since $q_1$ is prime, we must have $p_1 = q_1$, so $\frac{n}{p_1} = p_2 \cdots p_k = q_2 \cdots q_l < n$. By the induction hypothesis, $k = l$, and after reordering, $p_2 = q_2$, \dots, $p_k = q_k$, so the factorisations were the same. \end{proof} \begin{remark*} There are ``arithmetical systems'' (permitting addition, subtraction, multiplication) where factorisation is \emph{not} unique. \\ For example, consider $\ZZ[\sqrt{-3}]$, meaning all complex numbers of the form $x + y\sqrt{-3} = x + y\sqrt{3}i$, where $x, y \in \ZZ$. We can add, subtract and multiply two elements of $\ZZ[\sqrt{-3}]$ to get another element of $\ZZ[\sqrt{-3}]$. For example \[ (1 + \sqrt{-3}) \cdot (1 - \sqrt{-3}) = 1 + \sqrt{-3} - \sqrt{-3} - (\sqrt{-3})^2 = 1 + 3 = 4 .\] In $\ZZ[\sqrt{-3}]$ we can define what it means to be a ``prime'', and both $1 + \sqrt{-3}$ and $1 - \sqrt{-3}$ happen to be primes in this sense. But we can also write $4 = 2 \cdot 2$, so factorisation is not unique. \end{remark*} \subsection{Some Applications of the Fundamental Theorem of Arithmetic} \begin{enumerate}[(i)] \item What are the factors of $n = 2^3 \cdot 3^7 \cdot 11$? All numbers of the form $2^a \cdot 3^b \cdot 11^c$, where $0 \le a \le 3$, $0 \le b \le 7$ and $0 \le c \le 1$ are factors. There are no other others: if for example, $7 \mid n$, then we would have a factorisation of $n$ involving 7, contradicting uniqueness. More generally, the factors of $n = p_1^{a_1} \cdots p_k^{a_k}$ are precisely the numbers of the form $p_1^{b_1} \cdots p_k^{b_k}$, with $0 \le b_i \le a_i \,\, \forall i = 1, \dots, k$. \item What are the common factors of \[ 2^3 \cdot 3^7 \cdot 5 \cdot 11^3 \qquad \text{and} \qquad 2^4 \cdot 3^2 \cdot 11 \cdot 13 ?\] All numbers of the form $2^a \cdot 3^b \cdot 5^c \cdot 11^d \cdot 13^e$, where $e = c = 0$ and $0 \le a \le 3$, $0 \le b \le 2$ and $0 \le d \le 1$. Thus the $\mathrm{hcf}$ is $2^3 \cdot 3^2 \cdot 11$. In general, the $\mathrm{hcf}$ of $p_1^{a_1} \cdots p_k^{a_k}$ and $p_1^{b_1} \cdots p_k^{b_k}$, where $a_i, b_i \ge 0$, is $p_1^{\min\{a_1, b_1\}} \cdots p_k^{\min\{a_k, b_k\}}$. \item What are the common multiples of the two numbers in the previous example? All numbers of the form $a2^a \cdot 3^b \cdot 5^c \cdot 11^d \cdot 13^e$, where $a \ge 4$, $b \ge 7$, $c \ge 1$, $d \ge 3$, $e \ge 1$, \emph{times} any integer! Hence $2^4 \cdot 3^7 \cdot 5 \cdot 11^3 \cdot 13$ is a common multiple, and any other common multiple is a multiple of it. We say that it is the \emph{least common multiple} ($\mathrm{lcm}$) of our two numbers. In general, the $\mathrm{lcm}$ of $p_1^{a_1} \cdots p_k^{a_k}$ and $p_1^{b_1} \cdots p_k^{b_k}$, with $a_i, b_i \ge 0$, is $p_1^{\max\{a_1, b_1\}} \cdots p_k^{\max\{a_k, b_k\}}$. Since \[ \min\{a_i, b_i\} + \max\{a_i, b_i\} = a_i + b_i ,\] we have \[ \mathrm{hcf}(x, y) \cdot \mathrm{lcm}(x, y) = x \cdot y ,\] for any $x$, $y$. \item Another proof of the infinitude of primes, due to Erd\H{o}s (1930): \\ Let $p_1, \dots, p_k$ be primes. Any number which is a product of just these primes is of the form $(*) = p_1^{j_1} \cdot p_2^{j_2} \cdots p_k^{j_k} = m^2 \cdot p_1^{i_1} \cdot p_2^{i_2} \cdots p_k^{i_k}$ where $i_k = 0,1$. Let $M \in \NN$. If a number $\le M$ is of the form $(*)$, then $m^2 \le M$, i.e. $m \le \sqrt{M}$. So there are at most $\sqrt{M} \cdot 2^k$ numbers of the form $(*)$ that are $\le M$. \\ If $M > \sqrt{M} \cdot 2^k$, i.e. $M > 4^k$, then there must be a number $\le M$ which is \emph{not} of the form $(*)$, which must have a prime factor not amongst the $p_1, \dots, p_k$ (because otherwise we could write it in the form $(*)$). The first proof we saw of the infinitude of primes told us that the $k$-th prime is $< 2^{2^k}$. This proof by Erd\H{o}s tells us that the $k$-th prime is $< 4^k$. In fact, we know that the $k$-th prime is $\sim k \log k$, by the Prime Number Theorem. \end{enumerate} \subsection{Modular Arithmetic} Let $n \ge 2$ be a natural number. Then the \emph{integers modulo $n$}, written $\ZZ_n$ or $\ZZ/n\ZZ$, consist of the integers, with two regarded as the same if they differ by a multiple of $n$. For example, in $\ZZ_7$, 2 is the same as 16. If $x$ and $y$ are the same in $\ZZ_n$, we write \[ x \equiv y \pmod{n} \qquad \text{or} \qquad x \equiv y (n) \qquad \text{or} \qquad x = y \text{ in $\ZZ_n$} \] The first two are read as ``$x$ is equivalent to $y$ modulo $n$'' and the last one is read in the obvious way. For example $2 \equiv 16 \pmod{7}$. Thus \begin{align*} x \equiv y \pmod{n} &\iff n \mid x - y \\ &\iff x = y + kn \qquad \text{for some $k \in \ZZ$} \end{align*} \newpage Similarly to visualising the natural numbers using the number line, we can view $\ZZ_n$ as a circle: \begin{center} \begin{tsqx} ! size(5cm); ! for (int i = 0; i < 10; ++i) { ! dot(dir(36*i)); ! } label $0$ @ 1.1*dir(0) label $1$ @ 1.1*dir(36) label $2$ @ 1.1*dir(72) label $n - 1$ @ 1.1*dir(288) label $n$ @ 1.1*dir(324) unitcircle \end{tsqx} \end{center} \begin{remark*} If $a \equiv a' \pmod{n}$ and $b \equiv b' \pmod{n}$, then \[ n \mid (a - a') + (b - b') = (a + b) - (a' + b') \implies a + b \equiv a' + b' \pmod{n} \] Similarly, \[ n \mid (a - a') \cdot b + a' \cdot (b - b') = ab - a'b' \implies ab = a'b' \pmod{n} .\] So we can \emph{arithmetic} modulo $n$. \end{remark*} \begin{example*} Does $2a^2 + 3b^3 = 1$ have a solution with $a, b \in \ZZ$? \end{example*} \begin{answer*} There are no solutions \end{answer*} \begin{proof} If there is a solution, then $2a^2 \equiv 1 \pmod{3}$, but $2 \cdot 0^2 \equiv 0$ $2 \cdot 1^2 \equiv 1$, $2 \cdot 2^2 \equiv 2 \pmod{3}$. \end{proof} \subsection{Solving Congruences} \begin{example*} Solve $7x \equiv 2 \pmod{10}$. \\ We note that $3 \cdot 7 \equiv 1 \pmod{10}$, so $3 \cdot 7 x \equiv 3 \cdot 2 \pmod{10}$ hence $x \equiv 6 \pmod{10}$. \end{example*} Given $a, b \in \ZZ$, we say that $b$ is an \emph{inverse of $a$ modulo $n$} if $ab \equiv 1 \pmod{n}$. We say $a$ is \emph{invertible modulo $n$}, or is a \emph{unit modulo $n$}, if it has inverse. \\ For example, in $\ZZ_{10}$, the inverse of 3 is 7 and both 3 and 7 are units modulo 10. \\ On the other hand, 4 is \emph{not} a unit modulo 10 since $4x \not\equiv 1 \pmod{10} \,\,\forall z \in \ZZ$. \subsubsection*{Remarks} If $a$ is a unit modulo $n$ then\dots \begin{enumerate}[(1)] \item Its inverse is unique. Proof: suppose $\exists b, b'$ such that $ab \equiv ab' \equiv 1 \pmod{n}$, then $b \equiv bab \equiv bab' \equiv b' \pmod{n}$. \item We can write $a^{-1}$ for its inverse. \item And $ab \equiv ac \pmod{n}$ always implies that $b \equiv c \pmod{n}$ ``We cancel units, multiplying both sides by $a^{-1}$.'' This is \emph{not} true in general: $4 \cdot 3 \equiv 4 \cdot 8 \pmod{10}$ but $3 \not\equiv 8 \pmod{10}$. \end{enumerate} \begin{proposition*} Let $p$ be prime. Then every $a \not\equiv 0 \pmod{p}$ is a unit modulo $p$. \end{proposition*} \begin{proof} Have $(a, p) = 1$, so $\exists x, y \in \ZZ$ such that $ax + py = 1$. Hence $ax = 1 - py$, so $ax \equiv 1 \pmod{p}$ for some $x \in \ZZ$. \end{proof} \begin{proposition*} Let $n \ge 2$. Then $a$ is a unit modulo $n$ if and only if $(a, n) = 1$. \end{proposition*} \begin{proof} \phantom{.}\\[-3\baselineskip] \begin{align*} (a, n) = 1 &\iff ax + ny = 1 \qquad \text{for some $x, y \in \ZZ$} \\ &\iff ax = 1 - ny \\ &\iff ax \equiv 1 \pmod{n} \qquad \text{for some $x \in \ZZ$.} \qedhere \end{align*} \end{proof} \begin{corollary} If $(a, n) = 1$, then the congruence $ax \equiv b \pmod{n}$ has a unique solution. In particular, if $(a, n) = 1$, then there is a unique inverse of $a$, $a^{-1}$ modulo $n$. \end{corollary} What if $ax \equiv b \pmod{n}$ with $(a, n) \neq 1$, say $(a, n) = d > 1$? \\ Then $n \mid ax - b$ so $d \mid ax - b$ and $d \mid a$, so if there is a solution, then $d \mid b$. \\ Conversely, if $d \mid b$, then $n = d \cdot n'$, $a = d \cdot a'$, $b = d \cdot b'$, and \begin{align*} ax \equiv b \pmod{n} &\iff ax - b = kn \qquad \text{for some $k \in \ZZ$} \\ &\iff d \cdot a' \cdot x - d \cdot b' = k \cdot d \cdot n' \\ &\iff a'x - b' = kn' \\ &\iff a'x \equiv b' \pmod{n'}. \end{align*} Note $(a', n') = 1$. \\ So if $(a, n) = d > 1$, the congruence $ax \equiv b \pmod{n}$ has no solution unless $d \mid b$, in which case the solutions are exactly those of $\frac{a}{d}x \equiv \frac{b}{d} \pmod{\frac{n}{d}}$. \subsubsection*{Examples} \begin{enumerate}[(1)] \item Solve $7x \equiv 4 (30)$. \\ We have $(7, 30) = 1$, so by Euclid $13 \cdot 7 - 3 \cdot 30 = 1$. Hence $13 \cdot 7 \equiv 1 \pmod{30}$, whence $x \equiv 4 \cdot 13 \equiv 22 \pmod{30}$. \\ Suppose $x'$ is also a solution, that is, $7x' \equiv 4 \pmod{30}$. Then $7x \equiv 7x' \pmod{30}$, so $x \equiv x' \pmod{30}$ since 7 is a unit modulo 30. \\ \ul{Short form:} \[ 7x \equiv 4 \pmod{30} \] \[ \iff 13 \cdot 7 x \equiv 13 \cdot 4 \pmod{30} \] \[ \iff x \equiv 22 \pmod{30} .\] \item Solve $10x \equiv 12 \pmod{34}$. \begin{align*} 10 x \equiv 12 \pmod{34} &\iff 10x = 12 + 34y \qquad \text{for some $y \in \ZZ$} &\iff 5x = 6 + 17y \\ &\iff 5x \equiv 6 \pmod{17} \end{align*} so now we're back in situation (1), and solve as before. \end{enumerate} \subsection{Solving Simultaneous Congruences} Note \[ x \equiv 5 \pmod{12} \implies \begin{cases} x \equiv 1 & \pmod{4} \\ x \equiv 2 & \pmod{3} \end{cases} \] Is the converse true, i.e. does $x \equiv 1 \pmod{4}$ and $x \equiv 2 \pmod{3}$ imply $x \equiv 5 \pmod{12}$? \\ We inspect: \[ x \equiv 1 \pmod{4} \qquad x \equiv 1\,\,\,5\,\,\,9 \pmod{12} \] \[ x \equiv 2 \pmod{3} \qquad x \equiv 2\,\,\,5\,\,\,8\,\,\,11 \pmod{12} \] Note that 5 is a common solution. \\ What about \[ \begin{cases} x \equiv 1 & \pmod{4} \\ x \equiv 2 & \pmod{6} \end{cases} ?\] \begin{theorem*}[(12) The Chinese Remainder Theorem] Let $m$, $n$ be coprime, and $a, b \in \ZZ$. Then there is a unique solution modulo $mn$ to the simultaneous congruences \[ x \equiv a \pmod{m} \qquad\text{and} \qquad x \equiv b \pmod{n} .\] That is, there is a solution $x$ to $x \equiv a \pmod{m}$ and $x \equiv b \pmod{n}$, and $y$ is a solution if and only if $x \equiv y \pmod{mn}$. \end{theorem*} \begin{proof} Existence: Since $(m, n) = 1$, $\exists s, t \in \ZZ$ with $sm + tn = 1$. Note \[ sm \equiv t \pmod{n} \qquad\text{and} \qquad tn \equiv 1 \pmod{m} \] \[ sm \equiv 0 \pmod{m} \qquad\text{\phantom{and}}\qquad tn \equiv 0 \pmod{n} .\] Hence $x = a(tn) + b(sm) \equiv a \pmod{m}$ and $x = a(tn) + b(sm) \equiv b \pmod{n}$. \\ Uniqueness: Suppose $y$ is also a solution, that is, \begin{align*} &y \equiv a \pmod{m} \qquad \text{and} \qquad y \equiv b \pmod{n} \\ &\iff y \equiv x \pmod{m} \qquad \text{and} \qquad y \equiv x \pmod{n} \\ &\iff m \mid y - x \qquad \text{and} \qquad n \mid y - x \\ &\iff mn \mid y - x \qquad \text{since $(m, n) = 1$} \\ &\iff y \equiv x \pmod{mn} \qedhere \end{align*} \end{proof} \begin{remark*} Theorem 12 can be extended, by induction, to more than two moduli: if $m_1, m_2, \dots, m_k$ are pairwise coprime, then $\forall a_1, a_2, \dots, a_k \in \ZZ$, \begin{align*} \exists x \in \ZZ \text{ such that } x &\equiv a_1 \pmod{m_1} \\ x &\equiv a_2 \pmod{m_2} \\ &\vdots \\ x &\equiv a_k \pmod{m_k} \end{align*} \end{remark*} \noindent We denote by $\varphi(m)$ the number of integers $a$ such that $1 \le a \le m$ and $(a, m) = 1$, that is, the number of units modulo $n$. We call $\varphi$ the \emph{Euler totient function}. Define $\varphi(1) = 1$. \\ For example when $p$ is prime, $\varphi(p) = p - 1$, and $\varphi(p^2) = p^2 - p$. When $p$, $q$ are distinct primes, \[ \varphi(pq) = pq - p - q + 1 .\] \bigskip \noindent How do powers of an integer behave modulo $p$? \begin{example*} Modulo 7, $2^1 \equiv 2$, $2^2 \equiv 4$, $2^3 \equiv 1$, $2^4 \equiv 2$ then repeat $4, 1, 2, 4, 1, 2, \dots$. \\ Modulo 11 $2^1 \equiv 2$, $2^2 \equiv 4$, $2^3 \equiv 8$, $2^4 \equiv 5$, $2^5 \equiv 10$, $2^6 \equiv 9$, $2^7 \equiv 7$, $2^8 \equiv 3$, $2^9 \equiv 6$, $2^{10} \equiv 1$, then repeats. \end{example*} \begin{theorem*}[(13) Fermat's Little Theorem] Let $p$ be prime. Then $a^p \equiv a \pmod{p}$ for all $a \in \ZZ$. Equivalently, $a^{p - 1} \equiv 1 \pmod{p}$ for all $a \not\equiv 0 \pmod{p}$. \end{theorem*} \begin{proof} If $a \not\equiv 0 \pmod{p}$, then $a$ is a unit modulo $p$. Thus $ax \equiv ay \pmod{p}$ if and only if $x \equiv y \pmod{p}$. Hence the numbers $a, 2a, 3a, \dots, (p - 1)a$ are pairwise incongruent (distinct) modulo $p$ and $\not\equiv 0 \pmod{p}$, so they are $1, 2, 3, \dots, p - 1$ in some order. Hence \[ a \cdot 2a \cdot 3a \cdots (p - 1)a \equiv 1 \cdot 2 \cdot 3 \cdots (p - 1) \pmod{p} \] so \[ a^{p - 1}(p - 1)! \equiv (p - 1)! \pmod{p} \] But $(p - 1)!$ is a unit modulo $p$ (since it is a product of units), so we can cancel it to obtain \[ a^{p - 1} \equiv 1 \pmod{p} \qedhere\] \end{proof} \begin{theorem*}[Fermat-Euler Theorem] Let $(a, m) = 1$. Then $a^{\varphi(m)} \equiv 1 \pmod{m}$. \end{theorem*} \begin{proof} Let $U = \{x \in \NN : 0 < x < m : (x, m) = 1\}$ be the set of units modulo $m$. Label the elements $u_1, u_2, \dots, u_{\varphi(m)}$. Then $au_1, au_2, \dots, au_{\varphi(m)}$ are all distinct and invertible modulo $m$ (since $a$ is a unit), and hence they are $u_1, u_2, \dots, u_{\varphi(m)}$, in some order. \\ It follows that \[ au_1 \cdot au_2 \cdots au_{\varphi(m)} \equiv u_1 \cdot u_2 \cdots u_{\varphi(m)} \pmod{m} \] that is \[ a^{\varphi(m)} z = z \pmod{m} \] where $z = u_1 u_2 \cdots u_{\varphi(m)}$ is a product of units modulo $m$, whence itself is a unit. We may cancel it to obtain $a^{\varphi(m)} \equiv 1 \pmod{m}$. \end{proof} \bigskip \noindent What is $(p - 1)!$ modulo $p$? \begin{example*} When $p = 5$, $4! = 24 \equiv -1 \pmod{5}$ and when $p = 7$, $6! = 720 \equiv -1 \pmod{7}$. \end{example*} \begin{lemma}[14] Let $p$ be a prime. Then $x^2 \equiv 1 \pmod{p} \iff x \equiv \pm 1 \pmod{p}$. \end{lemma} \begin{remark*} Modulo 8, $1^2 = 3^2 = 5^2 = 7^2 = 1$, so this lemma is not true in general. \end{remark*} \begin{proof} \begin{align*} x^2 \equiv 1 \pmod{p} &\iff x^2 - 1 \equiv 0 \pmod{p} \\ &\iff (x + 1)(x - 1) \equiv 0 \pmod{p} \end{align*} Recall Euclid's Lemma: if $p$ is prime and $p \mid ab$, then $p \mid a$ or $p \mid b$, so if $p$ is prime, then $ab \equiv 0 \pmod{p}$ if and only if $a \equiv 0 \pmod{p}$ or $b \equiv 0 \pmod{p}$. \\ Hence \begin{align*} x^2 \equiv 1 \pmod{p} &\iff x + 1 \equiv \pmod{p} \qquad \text{or} \qquad x - 1 \equiv 0 \pmod{p} \\ &\iff x \equiv -1 \pmod{p} \qquad \text{or} \qquad x \equiv 1 \pmod{p} \qedhere \end{align*} \end{proof} \begin{remark*} More generally, a non-zero polynomial of degree $k$ over $\ZZ_p$ has at most $k$ roots in $\ZZ_p$. \end{remark*} \begin{theorem*}[Wilson's Theorem] Let $p$ be a prime. Then $(p - 1)! \equiv -1 \pmod{p}$. \end{theorem*} \begin{proof} True for $p = 2$, so assume $p > 2$. \\ Note that the units modulo $p$ come in pairs whose product is 1, together with some elements that are self inverse, i.e. $x$ such that $x \cdot x \equiv 1 \pmod{p}$. But by Lemma 14, the elements of $\ZZ_p$ that are self-inverse are $+1$ and $-1$, so the remaining $p - 3$ elements of $\ZZ_p$ come in inverse pairs. \\ For example when $p = 11$ the pairs are $(1, 1), (2, 6), (3, 4), (5, 9), (7, 8), (10, 10)$. \\ Hence $(p - 1)!$ is the product of $\frac{p - 3}{2}$ pairs of inverses together with $+1$ and $-1$, so $(p - 1)! \equiv -1 \pmod{p}$. \end{proof} \bigskip \noindent When is $-1$ a square modulo $p$? (If ever.) \begin{example*} When $p = 5$, $2^2 \equiv 4 \equiv -1 \pmod{5}$. When $p = 7$, $0^2 = 0$, $1^1 = 1$, $2^2 = 4$, $3^2 = 2$ modulo 7, and we don't need to check 4, 5, 6 as $(-x)^2 = x^2$. So $-1$ is not a square number modulo 7. When $p = 13$, $5^2 \equiv -1 \pmod{13}$. No luck when $p = 19$. \end{example*} \begin{proposition*}[16] Let $p$ be an odd prime. Then $-1$ is a square modulo $p$ if and only if $p \equiv 1 \pmod{4}$. \end{proposition*} \begin{proof} Suppose $p \equiv 1 \pmod{4}$. By Wilson's Theorem, \begin{align*} -1 &\equiv (p - 1)! &\pmod{p} \\ &\equiv 1 \cdot 2 \cdot 3 \cdots \left( \frac{p - 1}{2} \right) \left( -\frac{p - 1}{2} \right) \cdots (-3)(-2)(-1) &\pmod{p} \\ &\equiv (-1)^{\frac{p - 1}{2}} \left( \left( \frac{p - 1}{2} \right) ! \right)^2 &\pmod{p} \end{align*} But if $p = 4k + 1$ for some $k \in \ZZ$, then \[ -1 \equiv (-1)^{2k} ((2k)!)^2 \pmod{p} ,\] so $-1$ is a square modulo $p$. \\ Suppose, on the other hand, that $p \equiv -1 \pmod{4}$, i.e. $p = 4k + 3$ for some $k \in \ZZ$. \\ If $-1$ were a square modulo $P$, i.e. if there were $z \in \ZZ$ such that $z^2 \equiv -1 \pmod{p}$, then by Fermat's Little Theorem, \[ 1 \equiv z^{p - 1} \equiv z^{4k + 2} \equiv z^{2(2k + 1)} \equiv (-1)^{2k + 1} \equiv -1 \pmod{p} \] a contradiction. \end{proof} \begin{remark*} When $p \equiv 1 \pmod{4}$, Wilson's Theorem tells us a solution to the equation $x^2 \equiv -1 \pmod{p}$. For example, when $p = 29 = 4 \cdot 7 + 1$, $x = (2 \cdot 7)!$ works. \end{remark*} \subsection{Public Key Cryptography} Let us agree to write messages as sequences of numbers, for example $A \to 00$, $B \to 01$, \dots, $Z \to 25$, $! \to 26$, etc. \\ I wish for my IA students to be able to send me messages in encrypted form in such a way that I can decrypt them easily but the same is not true of any third-party observer. We use the RSA Scheme. \subsubsection*{RSA Scheme (Rivest, Shamir, Adlemann)} I think of two large primes $p, q$. Let $n = pq$, and pick an \emph{encoding exponent} $e$ coprime to $\phi(n) = (p - 1)(q - 1)$. \\ I publish the pair $(n, e)$. \\ To send me a message (i.e. a sequence of numbers) you chop it into pieces / numbers $M < n$ and send me $M^e \pmod{n}$, computed quickly by repeated squaring (binary exponentiation). \medskip \noindent To decrypt, I work out $d$ such that $ed \equiv 1 \pmod{\phi(n)}$, i.e. some $d$ such that $ed = k\phi(n) + 1$ for some $k \in \ZZ$. Then I compute \[ (M^e)^d \equiv M^{k \phi(n) + 1} \equiv M \pmod{n} \] by Fermat-Euler. \bigskip \noindent Note that in order to decrypt in this way, needed $n$ and $d$, or $n$, $e$ and $\phi(n)$. Finding $\phi(n)$ is as hard as finding the prime factors of $n$, which is believed to be computationally hard. \\ It is not known if RSA can be broken without factorisation. \newpage \begin{center} \LARGE\bfseries CHAPTER III: The Reals \end{center} \newpage \setcounter{section}{0} \section{Motivation} \noindent We had seen $\NN \subset \ZZ \subset \QQ$. \\ Why not stop here? \setcounter{proposition}{0} \begin{proposition} There is no rational $x$ with $x^2 = 2$. \end{proposition} \begin{proof}[1] Suppose $x^2 = 2$. Note we can assume $x > 0$ since $(-x)^2 = x^2$. If $x$ is rational and position, then $x = \frac{a}{b}$ for some $a, b \in \NN$. Thus $\frac{a^2}{b^2} = 2$, or $a^2 = 2b^2$. But the exponent of 2 in the prime factorisation of $a^2$ is even while the exponent of 2 in the prime factorisation of $2b^2$ is odd, contradicting the Fundamental Theorem of Arithmetic. \end{proof} \begin{note*} The same proof shows that if $\exists x \in \QQ$ with $x^2 = n$ for some $n \in \NN$, then $n$ must be a square. \end{note*} \begin{proof}[2] Suppose $x^2 = 2$ for some $x = \frac{a}{b}$ with $a, b \in \NN$. Then for any $c, d \in \ZZ$, $cx + d$ is of the form $\frac{e}{b}$ for some $e \in \ZZ$. Thus if $cx + d > 0$, then $cx + d \ge \frac{1}{b}$. But $0 < x - 1 < 1$ as $1 < x < 2$ so if $n$ is sufficiently large, \[ 0 < (x - 1)^n < \frac{1}{b} \] But for any $n \in \NN$, $(x - 1)^n$ is of the form $cx + d$ for some $c, d \in \ZZ$, since we can binomially expand and use $x^2 = 2$. This is a contradiction. \end{proof} \bigskip \noindent So ``$\QQ$ has a gap''. \\ How do we express this fact making reference only to $\QQ$? \begin{center} \begin{tsqx} ! usepackage("amsfonts"); (-3,0)->>(3,0) label $\mathbb{Q}$ @ (3.2,0) ! for (int i = -2; i < 3; ++i) { ! label(string(i), (i,-0.25)); (i,-0.1)--(i,0.1) ! } (0,-0.5)->>(1.42,-0.5) (0,-0.5)->>(-1.42,-0.5) label all $x$ such that $x^2 < 2$ @ (0,-0.7) \end{tsqx} \end{center} \noindent 2 is an upper bound for the set of $x$ such that $x^2 < 2$, but so is 1.5, and 1.42, \dots \begin{customenv}{Crucial point} In $\QQ$, there is no least upper bound. \end{customenv} \newpage \section{Reals} The real numbers, written $\RR$ are a set with elements 0 and 1 $(0 \neq 1)$, equipped with operations $+$ and $\cdot$, and an ordering $<$ such that \begin{enumerate}[(1)] \item $+$ is commutative and associative with identity 0, and every $x$ has an inverse under $+$; \item $\cdot$ is commutative and associative with identity 1, and every $x \neq 0$ has an inverse under $\cdot$; \item $\cdot$ distributive over $+$, that is, for all $a, b, c \in \RR$ \[ a(b + c) = ab + ac ;\] \item $\forall a, b$, exactly one of $a < b$ or $a = b$ or $a > b$ holds, and $\forall a, b, c$, \[ a < b \text{ and } b < c \implies a < c ;\] \item $\forall a, b, c$, $a < b \implies a + c < b + c$ and $a < b \implies ac < bc$ if $c > 0$. \item Given any set $S$ of reals that is non-empty and bounded above, $S$ has a least upper bound. (This is known as the \emph{least upper bound axiom}.) \end{enumerate} \noindent We say that a set $S$ is \emph{bounded above} if $\exists x \in \RR$ such that $x \ge y \,\,\forall y \in S$. Such an $x$ is called an \emph{upper bound for $S$}. $x$ is the \emph{least upper bound for $S$} if $x$ is an upper bound for $S$ and every other upper bound $x'$ satisfies $x' \ge x$. \\ When $x$ is a least upper bound for $S$, we may write ``$\mathrm{LUB}(S) = x$'' or ``$\mathrm{supremum}(S) = x$'' or ``$\sup(S) = x$''. \subsubsection*{Remarks} \begin{enumerate}[(i)] \item From (1)-(5), we can check, for example, that $0 < 1$. Indeed, if not, then $1 < 0$ ($0 \neq 1$) so \[ 0 = 1 - 1 < 0 - 1 = -1 \] so \[ 0 = 0 \cdot (-1) < (-1)(-1) = 1 ,\] a contradiction. \item We may consider $\QQ$ as contained in $\RR$, by identity $\frac{a}{b} \in \QQ$ with $a \cdot b^{-1} \in \RR$. \item $\QQ$ does not satisfy (6), for example the set of $x$ such that $x^2 < 2$ does not have a supremum. \item In (6), the words ``non-empty'' and ``bounded above'' are crucial: \begin{itemize} \item If $S$ is empty then every $x \in \RR$ is an upper bound for $S$, so there is no least upper bound. \item If $S$ is not bounded above, then it has no upper bound, and certainly no \emph{least} upper bound. \end{itemize} \item It is possible to construct $\RR$ ``out of'' $\QQ$ and check (1)-(6) hold, but it takes a lot of effort. \end{enumerate} \subsubsection*{Examples} \begin{enumerate}[(1)] \item $S = \{x \in \RR : 0 \le x \le 1\} = [0,1]$ (``the set of $x \in \RR$ such that $0 \le x \le 1$'') \begin{center} \begin{tsqx} ! usepackage("amsfonts"); (-3,0)->>(3,0) label $\mathbb{R}$ @ (3.2,0) ! for(int i = -2; i < 3; ++i) { (i,-0.1)--(i,0.1) ! label(string(i), (i,-0.25)); ! } ! dot((0,0.3)); ! dot((1,0.3)); (0,0.3)--(1,0.3) \end{tsqx} \end{center} Is 2 an upper bound for $S$? Yes: $\forall x \in S$, $x \le 2$. \\ Is $\frac{3}{4}$ an upper bound for $S$? No: $\frac{7}{8} \in S$ and $\frac{7}{8} > \frac{3}{4}$. \\ The least upper bound of $S$ is 1 because \begin{itemize} \item 1 is an upper bound (as $\forall x \in S$, $x \le 1$) \item every other upper bound $y$ has $y \ge 1$ (as $1 \in S$). \end{itemize} Hence $\sup(S) = 1$. \item $S = \{x \in \RR : 0 < x < 1\} = (0,1)$ \begin{center} \begin{tsqx} ! usepackage("amsfonts"); (-3,0)->>(3,0) label $\mathbb{R}$ @ (3.2,0) ! for(int i = -2; i < 3; ++i) { (i,-0.1)--(i,0.1) ! label(string(i), (i,-0.25)); ! } ! dot((0,0.3), filltype=FillDraw(fillpen=white, drawpen=black)); ! dot((1,0.3), filltype=FillDraw(fillpen=white, drawpen=black)); (0,0.3)--(1,0.3) \end{tsqx} \end{center} Is 2 an upper bound for $S$? Yes: $\forall x \in S$, $x \le 2$. \\ Is $\frac{3}{4}$ an upper bound for $S$? No: $\frac{7}{8} \in S$ and $\frac{7}{8} > \frac{3}{4}$. \\ We have $\sup(S) = 1$ because \begin{itemize} \item 1 is an upper bound (as $\forall x \in S$, $x \le 1$); \item no upper bound $c$ is such that $c < 1$. Indeed, $c$ is certainly greater than 0 (in fact $c \ge \frac{1}{2}$ since $\frac{1}{2} \in S$), so if $c < 1$, then $0 < c < 1$, so $\frac{c + 1}{2} \in S$ with $\frac{1 + c}{2} > c$. \end{itemize} \begin{center} \begin{tsqx} ! size(4cm); (-0.2,0)--(1.2,0) C := (0.6,0) label $0$ @ (0,-0.1) label $1$ @ (1,-0.1) label $c$ @ C+(0,-0.1) (0,-0.05)--(0,0.05) (1,-0.05)--(1,0.05) (0.6,-0.05)--(0.6,0.05) label $\frac{1+c}{2}$ @ (0.8,0.3) (0.8,0.25)->>(0.8,0) \end{tsqx} \end{center} Hence $\sup(S) = 1$. \begin{remark*} If $S$ has a greatest element, then $\sup(S) = \max(S) \in S$. But $\sup(S)$ can exist when $\max(S)$ does not, in which case $\sup(S) \not\in S$. \end{remark*} \item $S = \{1 - \frac{1}{n} : n \in \NN\} = \{0, \frac{1}{2}, \frac{2}{3}, \frac{3}{4}, \dots\}$. \begin{center} \begin{tsqx} (-1.3,0)->>(1.3,0) ! usepackage("amsfonts"); label $-1$ @ (-1,-0.1) label $0$ @ (0,-0.1) label $1$ @ (1,-0.1) (-1,-0.05)--(-1,0.05) (0,-0.05)--(0,0.05) (1,-0.05)--(1,0.05) ! for (int i=2; i < 8; ++i) { (1-(1/i),-0.05)--(1-(1/i),0.05) ! } label $\mathbb{R}$ @ (1.4,0) \end{tsqx} \end{center} Clearly 1 is an upper bound. Is there an upper bound $ < 1$? \begin{proposition}[Axiom of Archimedes] $\NN$ is not bounded above in $\RR$. \begin{center} \begin{tsqx} (-1,0)->>(6,0) ! usepackage("amsfonts"); label $\mathbb{R}$ @ (6.1,0) ! for (int i = 1; i < 5; ++i) { label "+string(i)+" @ (i,-0.2) (i,-0.05)--(i,0.05) ! } \end{tsqx} \end{center} \end{proposition} \begin{proof} Suppose on the contrary that $\NN$ is bounded above. Let $c = \sup(\NN)$. By definition $c - 1$ is no an upper bound for $\NN$, so $\exists n \in \NN$ such that $n > c - 1$. But then $n + 1 \in \NN$ with $n + 1 > c$, contradicting the fact that $c$ was an upper bound. \end{proof} \begin{corollary} For all $t > 0$, $\exists n \in \NN$ with $\frac{1}{n} < t$. \begin{center} \begin{tsqx} (-0.2,0)->>(0.5,0) ! usepackage("amsfonts"); label $\mathbb{R}$ @ (0.6,0) label $0$ @ (0,-0.1) label $t$ @ (0.2,-0.1) label $\frac{1}{n}$ @ (0.1,-0.1) (0,-0.05)--(0,0.05) (0.1,-0.05)--(0.1,0.05) (0.2,-0.05)--(0.2,0.05) \end{tsqx} \end{center} \end{corollary} \begin{proof} Given $t > 0$, by Proposition 2, $\exists n \in \NN$ such that $n > \frac{1}{t}$. Hence $\frac{1}{n} < t$. \end{proof} A set $S$ is said to be \emph{bounded below} if $\exists x$ such that $x \le y \,\,\forall y \in S$. Such an $x$ is called a \emph{lower bound for $S$}. If $S$ is non-empty and bounded below, then $-S = \{-y : y \in S\}$ is non-empty and bounded below, then $-S = \{-y : y \in S\}$ is non-empty and bounded above, so it has a least upper bound, $c$ say. Hence $-c$ is the \emph{greatest lower bound of $S$}. We denote it by ``$\mathrm{GLB}(S)$'', or ``$\mathrm{infimum}(S)$'' or ``$\inf(S)$''. \\ Corollary 3 immediately implies that $\inf(\{\frac{1}{n} : n \in \NN\}) = 0$. \\ Proposition 2 and Corollary 3 show that there are no ``infinitely large'' or ``infinitely small'' numbers in $\RR$. \bigskip \noindent Back to Example (3): we have $\sup(S) = 1$, for suppose $c < 1$ is an upper bound for $S$. Then $1 - \frac{1}{n} < c\,\,\forall n \in \NN$, so $0 < 1 - c < \frac{1}{n}\,\,\forall n \in \NN$ contradicting Corollary 3. \end{enumerate} \begin{theorem*}[4] There exists $x \in \RR$ with $x^2 = 2$. \end{theorem*} \begin{proof} Let $S = \{x \in \RR : x^2 < 2\}$. \begin{center} \begin{tsqx} (-2.3,0)--(-1.4,0) (-1.4,0)--(1.4,0) red (1.4,0)->>(2.3,0) ! for (int i = -2; i < 3; ++i) { (i,-0.05)--(i,0.05) label "+string(i)+" @ (i,-0.2) ! } \end{tsqx} \end{center} Note that $S$ is non-empty since for example $1 \in S$. It is also bounded above, for example by 2. Hence $S$ has a supremum, which we denote by $c$, say. \\ Observe that $1 < c < 2$. We claim that $c^2 = 2$. Suppose on the contrary that $c^2 < 2$. For $0 < t < 1$, have \begin{align*} (c + t)^2 &= c^2 + 2ct + t^2 \\ &< c^2 + 5t \\ &< 2 \end{align*} for small $t$ (namely, $t < \frac{2 - c^2}{5}$). But this contradicts the assumption that $c$ was an upper bound for $S$ (since $c + t \in S$). Suppose now that $c^2 > 2$. For $0 < t < 1$, have \begin{align*} (c - t)^2 &= c^2 - 3ct + t^2 \\ &\ge c^2 - 4t \\ &> 2 \end{align*} for small $t$ (namely, $t < \frac{c^2 - 2}{4}$). This contradicts the assumption that $c$ is the \emph{least} upper bound for $S$ (since $c - t$ is an upper bound for $S$). \end{proof} \begin{remark*} The same proof shows that $\sqrt[n]{x}$ exists $\forall n \in \NN$, $\forall x \in \RR$, $x > 0$. (i.e. $\forall n \in \NN$, $\forall x \in \RR$, $x > 0$; $\exists y \in \RR$ such that $y^n = x$.) \end{remark*} \noindent A real that is not rational is called \emph{irrational}. For example, $\sqrt{2}$, $\sqrt{3}$, $\sqrt{5}$, $\sqrt{6}$ are irrational. Also, $2 + 3\sqrt{5}$ is irrational. Indeed, if $2 + 3\sqrt{5} = \frac{a}{b}$ with $a, b \in \NN$, then $\sqrt{5} = \frac{a - 2b}{3b} \in \QQ, \,\,\,\contradiction$. \qed \bigskip \noindent The rationals are \emph{dense} in $\RR$, in the sense that $\forall a < b \in \RR$, $\exists c \in \QQ$ with $a < c < b$. \begin{center} \begin{tsqx} (-0.2,0)->>(1.5,0) (0,0.02)--(0,-0.02) (0.3,0.02)--(0.3,-0.02) (0.5,0.02)--(0.5,-0.02) (1,0.02)--(1,-0.02) label $0$ @ (0,-0.06) label $a$ @ (0.3,-0.06) label $c$ @ (0.5,-0.06) label $b$ @ (1,-0.06) \end{tsqx} \end{center} Indeed, we may assume that $a \ge 0$. By corollary 3, $\exists n \in \NN$ with $\frac{1}{n} < b - a$. By the Axiom of Archimedes, $\exists N \in \NN$ such that $N > b$. Let $T = \{k \in \NN : \frac{k}{n} \ge b\}$, then $Nn \in T$, so $T \neq \emptyset$. By the Well-Ordering Principle, $T$ has a least element $m$. Set $c = (m - 1) \cdot \frac{1}{n}$. Since $m - 1 \not\in T$, $c < b$. If $c \le a$, then $\frac{m}{n} = c + \frac{1}{n} < a + b - a = b$. \contradiction Hence $a < c < b$. \qed \begin{notation*} $\emptyset$ denotes the empty set. \end{notation*} \begin{notation*} For some sets $S_1$ and $S_2$, $S_1 \setminus S_2$ denotes the set of elements in $S_1$ but not $S_2$. \end{notation*} \noindent The irrationals are also dense in $\RR$, i.e. $\forall a < b \in \RR$, $\exists c \in \RR \setminus \QQ$ with $a < c < b$. Indeed take a rational $c$ with $a \sqrt{2} < c < b\sqrt{2}$, then $a < \frac{c}{\sqrt{2}} < b$. \section{Sequences} \begin{definition*} A \emph{sequence} is an enumerated collection of objects in which repetitions are allowed and order matters. We write $a_1, a_2, a_3, \dots$ or $(a_n)_{n = 1}^\infty$. \end{definition*} \noindent What does it mean for a sequence $a_1, a_2, \dots$ to tend to a limit $\ell$? It is \emph{not} enough that the terms $a_n$ get closer to $\ell$, for example, would not want $\frac{1}{2}$, $\frac{3}{4}$, $\frac{4}{5}$, \dots to tend to 37. And it is \emph{not} enough that the $a_n$ get arbitrarily close to $\ell$, $\forall \varepsilon > 0$, $\exists n \in \NN$ such that $\ell - \varepsilon < a_n < \ell + \varepsilon$, for example would not want $\frac{1}{2}, 10, \frac{2}{3}, 10, \frac{3}{4}, 10, \dots$ to tend to 1. \\ We want the sequence to get \emph{and stay} within $\varepsilon$ of $\ell$. \begin{definition*}[Limits] We say that the sequence $a_1, a_2, a_3, \dots$ tends to the limit $\ell \in \RR$ as $n$ tends to infinity if, $\forall \varepsilon > 0$, $\exists N \in \NN$ such that $\forall n \ge N$, $\ell - \varepsilon < a_n < \ell + \varepsilon$. \begin{center} \begin{tsqx} (-0.2,0)->>(1.5,0) (0.3,0.02)--(0.3,-0.02) (0.7,0.02)--(0.7,-0.02) (0.5,0.02)--(0.5,-0.02) label $\ell - \varepsilon$ @ (0.3,-0.06) label $\ell$ @ (0.5,-0.06) label $\ell + \varepsilon$ @ (0.7,-0.06) ! dot((-0.1,0)); ! dot((0.1,0)); ! dot((0.25,0)); ! dot((0.35,0)); ! dot((0.4,0)); ! dot((0.42,0)); ! dot((0.45,0)); ! dot((0.48,0)); ! dot((0.53,0)); ! dot((0.55,0)); ! dot((0.59,0)); ! dot((0.63,0)); ! dot((0.75,0)); ! dot((0.9,0)); ! dot((1.3,0)); \end{tsqx} \end{center} More compactly: $\forall \varepsilon > 0, \exists N \in \NN$ such that $\forall n \ge N$, \[ |a_n - \ell| < \varepsilon .\] \end{definition*} \begin{notation*} The \emph{absolute value} $|x|$ of $x \in \RR$ is defined by \[ |x| = \begin{cases} x & \text{if $x \ge 0$} \\ -x & \text{if $x < 0$} \end{cases} .\] We think of $|a - b|$ as the ``distance between $a$ and $b$ on the number line'', for example $|2 - 9| = |9 - 2| = 7$. It is easy to check the triangle inequality \[ |a - b| \le |a - c| + |c - b| .\] \end{notation*} \noindent When $a_n$ tends to $\ell$ as $n$ tends to infinity, we also write ``$a_n \to \ell$ as $n \to \infty$'' or ``$\lim_{n \to \infty} a_n = \ell$'' or ``$(a_n)_{n = 1}^\infty$ converges to $\ell$''. If there is a limit $\ell$ but it is not specified, we simply say ``$(a_n)_{n = 1}^\infty$ converges''. \bigskip \noindent If $(a_n)_{n = 1}^\infty$ does not converge , then we say it \emph{diverges}. \subsubsection*{Examples} \begin{enumerate}[(1)] \item $\frac{1}{2}, \frac{2}{3}, \frac{3}{4}, \frac{4}{5}, \dots$, so $a_n = 1 - \frac{1}{n}$. Given $\varepsilon > 0$, choose $N > \frac{1}{\varepsilon}$ (by the Axiom of Archimedes). If $n \in \NN$, then \[ |a_n - 1| = \left|1 - \frac{1}{n} - 1\right| = \frac{1}{n} \le \frac{1}{N} < \varepsilon .\] Hence $a_n \to 1$ as $n \to \infty$. \item $0, \frac{1}{2}, 0, \frac{1}{4}, \frac{1}{6}, \dots$ defined by \[ a_n = \begin{cases} \frac{1}{n} & \text{$n$ even} \\ 0 & \text{$n$ odd} \end{cases} \] Given $\varepsilon > 0$, pick $N > \frac{1}{\varepsilon}$. If $n \ge N$, then \[ |a_n - 0| \le \frac{1}{n} \le \frac{1}{N} < \varepsilon .\] Hence $a_n \to 0$ as $n \to \infty$. \item $\frac{1}{2}, \frac{1}{2} + \frac{1}{4}, \frac{1}{2} + \frac{1}{4} + \frac{1}{8}, \dots$, and we can verify by induction that $a_n = 1 - \frac{1}{2^n}$. Given $\varepsilon > 0$, choose $N > \frac{1}{\varepsilon}$. If $n \ge N$, then \[ |a_n - 1| = \frac{1}{2^n} \le \frac{1}{n} \le \frac{1}{N} < \varepsilon .\] Hence $a_n \to 1$ as $n \to \infty$. \item $-1, 1, -1, 1, -1, 1, \dots$ defined by $a_n = (-1)^n$ \begin{center} \begin{tsqx} (-2,0)->>(2,0) (-1,0.02)--(-1,0.02) (0,0.02)--(0,0.02) (1,0.02)--(1,0.02) label $-1$ @ (-1,-0.06) label $0$ @ (0,-0.06) label $1$ @ (1,-0.06) \end{tsqx} \end{center} If $a_n$ does not tend to $\ell$, we write ``$a_n \not\to \ell$''. We say that it is divergent (note: it does not mean ``goes off to infinity''). \end{enumerate} \noindent We implicitly assumed that if a limit exists, then it is unique. We'll prove this now. \begin{proof} Suppose $a_n \to \ell$ and $a_n \to k$ as $n \to \infty$, with $l \neq k$. Choose $\eps = \half|\ell - k|$. Then $\exists N \in \NN$ such that $|a_n - \ell| < \eps \,\,\forall n \ge N$ and $\exists M \in \NN$ such that $|a_n - k| < \eps \,\,\forall n \ge M$. But then for any $n \ge \max\{N, M\}$, \[ 2\eps = |\ell - k| \le |a_n - \ell| + |a_n - k| < 2\eps \qquad \contradiction \] \end{proof} \noindent A sequence is \emph{bounded} if there is a real number $B$ such that $|a_n| \le B$ for all $n \in \NN$. \bigskip \noindent Notice that a convergent sequence is bounded; for if $a_n \to \ell$ as $n \to \infty$, then $\exists N \in \NN$ such that $\forall n \ge N$, $|a_n - \ell| < 1$. Hence $|a_n| \le \max\{|a_1|, |a_2|, \dots, |a_{N-1}|, |\ell| + 1\}$. \bigskip \noindent We say a sequence $(a_n)_{n = 1}^\infty$ is \emph{monotonic} if it is either increasing or decreasing. It is \emph{increasing} if $a_{n + 1} \ge a_n \,\,\forall n \in \NN$. \begin{theorem*}[5] Every bounded monotonic sequence converges. \begin{center} \begin{tsqx} (-1.3,0)->>(1.3,0) (1,-0.05)--(1,0.05) ! dot((0,0)); ! dot((0.5,0)); ! dot((0.7,0)); ! dot((0.8,0)); ! dot((0.9,0)); ! dot((0.95,0)); ! dot((0.97,0)); \end{tsqx} \end{center} \end{theorem*} \begin{proof} Suppose $(a_n)$ is increasing. Then the set $\{a_n : n \ge 1\}$ is non-empty and is bounded above (because $(a_n)$ is bounded), so it has a supremum $\ell$, say. Given $\eps > 0$, $\ell - \eps$ is no an upper bound for $\{a_n : n \ge 1\}$, so there is some $N \in \NN$ with $a_N > \ell - \eps\,\,\forall n \ge \NN$. Thus $\ell - \eps < a_n < \ell\,\,\forall n \in \NN$. Hence for all $n \ge N$, $|a_n - \ell| < \eps$, so $a_n \to \ell$. Decreasing case is similar. \end{proof} \subsubsection*{Remarks} \begin{enumerate}[(1)] \item Note that for an increasing sequence to converge, we only need to know that it is bounded above. \item The sequence $(a_n)$ with $a_n = n$ is increasing but not bounded (and in fact, it diverges). \item Theorem 5 is in fact equivalent to the least Upper Bound Axiom. \item Can show that every sequence has a monotonic subsequence. \end{enumerate} \begin{proposition*}[6] If $a_n \le d\,\,\forall n$ and $a_n \to c$ as $n \to \infty$, then $c \le d$. \end{proposition*} \begin{proof} Suppose $c > d$. Let $\eps = |c - d|$. Then $\exists N \in \NN$ such that $\forall n \ge N$, $|a_n - c| < \eps$. But $|a_n - c| < \eps \implies a_n > d$. \contradiction \end{proof} \begin{remark*} If $a_n < d\,\,\forall n$ and $a_n \to c$ as $n \to \infty$, we need not have $c < d$. For example, $\frac{1}{2}, \frac{1}{2} + \frac{1}{4}, \half + \frac{1}{4} + \frac{1}{8}, \dots$ Each term is $ < 1$, but $\lim_{n \to \infty} a_n = 1$. \end{remark*} \begin{proposition*}[6] If $a_n \to c$ as $n \to \infty$ and $b_n \to d$ as $n \to \infty$, then $a_n + b_n \to c + d$ as $n \to \infty$. \end{proposition*} \begin{proof} Given $\eps > 0$ $\exists N \in \NN$ such that $\forall n \ge N$, $|a_n - c| < \frac{\eps}{2}$ and $\exists M \in \NN$ such that $\forall n \ge M$, $|b_n - d| < \frac{\eps}{2}$. Choose $N^* = \max\{M, N\}$. Then $\forall n \ge N^*$, \begin{align*} |a_n + b_n - (c + d)| &\le |a_n - c| + |b_n - d| \\ &\le \frac{\eps}{2} + \frac{\eps}{2} \\ &=\eps \end{align*} \end{proof} \subsection{Series} In the reals, the sum of two numbers is defined, so by induction, finite sums are defined. But infinite sums are not! Nevertheless, for example \[ 1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \frac{1}{5} - \cdots = \log 2 .\] Let $(a_n)$ be a sequence. Then $s_k = \sum_{n = 1}^k a_n$ is the $k$-th partial sum of the \emph{series} whose $n$-th term is $a_n$. We write $\sum_{n = 1}^\infty a_n = \lim_{k \to \infty} s_k$ if the limit exists. \subsubsection*{Examples} \begin{enumerate}[(1)] \item The series whose $n$-th term is $a_n = r^N$, for some $|r| < 1$, is known as the \emph{geometric series}. \begin{align*} s_k &= r + r^2 + r^2 + \cdots + r^k \\ &= r \cdot \frac{1 - r^k}{1 - r} \\ &\to \frac{r}{1 - r} \end{align*} as $k \to \infty$ since $r^k \to 0$. Hence $\sum_{n = 1}^\infty r^n = \frac{r}{1 - r}$. \item The series whose $n$-th term is given by $a_n = \frac{1}{n}$ is known as the \emph{harmonic series}. \begin{align*} s_k &= 1 + \frac{1}{2} + \ub{\frac{1}{3} + \frac{1}{4}}_{\text{each $\ge \frac{1}{4}$}} + \ub{\frac{1}{5} + \frac{1}{6} + \frac{1}{7}+ \frac{1}{8}}_{\text{each $\ge \frac{1}{8}$}} + \ub{\frac{1}{9}} _{\ge \frac{1}{16}}+ \cdots + \frac{1}{2^k} \\ &\ge 1 + \frac{1}{2} + \frac{1}{4} + \frac{1}{4} + \frac{1}{8} + \frac{1}{8} + \frac{1}{8} + \frac{1}{8} + \frac{1}{16} + \cdots + \frac{1}{2^k} \end{align*} In general, \[ \frac{1}{2^m + 1} + \frac{1}{2^m + 2} + \cdots + \frac{1}{2^{m + 1}} \ge \frac{2^m}{2^{m + 1}} = \half .\] Hence $S_{2^k} \ge 1 + \frac{k}{2}$. So the partial sums are increasing and unbounded, so $\sum_{n = 1}^\infty \frac{1}{n}$ diverges. \item $a_n = \frac{1}{n^2}$ \[ S_{2^k - 1} = 1 + \ub{\frac{1}{2^2} + \frac{1}{3^2}}_{\le 2 \cdot \frac{1}{2^2}} + \ub{\frac{1}{4^2} + \frac{1}{5^2} + \frac{1}{6^2} + \frac{1}{7^2}}_{\le 4 \cdot \frac{1}{4^2}} + \cdots + \frac{1}{(2^k - 1)^2} \] In general, \[ \frac{1}{(2^m)^2} + \frac{1}{(2^m + 1)^2} + \cdots + \frac{1}{(2^{m + 1} - 1)^2} \le \frac{2^m}{(2^m)^2} = \frac{1}{2^m} ,\] so \[ s_{2^k - 1} \le 1 + \frac{1}{2} + \frac{1}{2^2} + \cdots + \frac{1}{2^{k - 1}} < 2 \] by example (1). By Theorem 5, $\sum_{n = 1}^\infty \frac{1}{n^2}$ converges as partial sums increasing and bounded above. In fact $\sum_{n = 1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}$. \end{enumerate} \subsection{Decimal Expansions} Let $(d_n)$ be a sequence with $d_n \in \{0, 1, 2, \dots, 9\}$. Then $\sum_{n = 1}^\infty \frac{d_n}{10^n}$ converges to some limit $r$, where $0 \le r < 1$, because the partial sums $s_m = \sum_{n = 1}^m \frac{d_n}{10^n}$ are increasing and bounded by \[ \sum_{n = 1}^\infty \frac{9}{10^n} = \frac{9}{10} \cdot \frac{1}{1 - \frac{1}{10}} = 1 .\] We say that $0.d_1d_2d_3\dots$ is the \emph{decimal expansion} of $r$. \bigskip \noindent Does every $x$, $0 \le x < 1$, have a decimal expansion? \bigskip \noindent Pick $d_1 \in \ZZ$ maximal such that $\frac{d_1}{10} \le x < 1$. Then $d_1 \le 9$ because $x < 1$ and $x - \frac{d_1}{10} < \frac{1}{10}$ because $d_1$ maximal. Now pick $d_2 \in \ZZ$ maximal such that \[ \frac{d_2}{100} \le x - \frac{d_1}{10} .\] Then $d_2 \le 9$ because $x - \frac{d_1}{10} < \frac{1}{10}$ and \[ x - \frac{d_2}{10} - \frac{d_2}{100} < \frac{1}{100} \] because $d_2$ maximal. Inductively, pick $d_n \in \ZZ$ maximal with \[ \frac{d_n}{10^n} \le x - \sum_{j = 1}^{n - 1} \frac{d_j}{10^j} \] so $0 \le x - \sum_{j = 1}^n \frac{d_j}{10^j} < \frac{1}{10^n}$. Since $\frac{1}{10^n} \to 0$ as $n \to \infty$, $x - \sum_{j = 1}^n \frac{d_j}{10^j} \to 0$, i.e. \[ x = \sum_{j = 1}^\infty \frac{d_j}{10^j} = 0.d_1d_2d_3\dots \] \subsubsection*{Remarks} \begin{enumerate}[(1)] \item Decimal expansions need not be unique, e.g. $0.47999\dots = 0.48000\dots$ \\ Suppose $0.a_1a_2a_3\dots = 0.b_1b_2b_3\dots$. We may suppose $a_j = b_j$ for $j < K$ for some $K$ and $a_K < b_K$. Then \[ \sum_{j = k + 1}^\infty \frac{a_j}{10^j} \le \sum_{j = k+1}^\infty \frac{9}{10^j} = \frac{9}{10^{k + 1}} \cdot \frac{1}{1 - \frac{1}{10}} = \frac{1}{10^k} .\] Hence we must have $b_k = a_k + 1$ and $a_j = 0$, $b_j = 0$ $\forall j > K$. \item A decimal expansion is \emph{periodic} if, after a finite number of terms, say $l$ digits, it repeats in blocks, of length $k$ say, i.e. $\exists l, k$ such that $d_{n + k} = d_n\,\,\forall n > l$. \bigskip \noindent A periodic decimal is rational, for example \begin{align*} x &= 0.7832147147147147\dots \\ 10^4x - 7832 &= 0.147147147147\dots \\ &= 147 \sum_{j = 1}^\infty \frac{1}{10^{3j}} \\ &= 147 \cdot \frac{1}{10^3} \cdot \frac{1}{1 - \frac{1}{10^3}} \end{align*} so $x \in \QQ$. \bigskip \noindent Conversely, if $x \in \QQ$, then $x$ has a periodic decimal expansion. To see this, we write $x = \frac{p}{2^a5^bq}$ where $a, b, p, q \in \ZZ$, $a, b, q \ge 0$, $(q,10) = 1$. Then $10^{\max(a, b)}x = \frac{t}{q} = n = \frac{c}{q}$, where $n \in \ZZ$, $c \in \ZZ$ and $0 \le c < q$. By Fermat-Euler, $10^{\phi(q)} \equiv 1 \pmod{q}$ or $10^{\phi(q)} - 1 = kq$ for some $k \in \NN$. Hence \[ \frac{c}{q} = \frac{kc}{kq} = \frac{kc}{10^{\phi(q)} - 1} = kc \sum_{j = 1}^\infty \frac{1}{(10^{\phi(q)})^j} \] Since $0 \le kc < kq$, we can write $kc$ as a $\phi(q)$-digit number $d_1d_2\dots d_{\phi(q)}$. Then \[ \frac{c}{q} = 0.d_1d_2\dots d_{\phi(q)}d_1d_2\dots d_{\phi(q)} d_1\dots \] and so $x$ is periodic. \end{enumerate} \subsection{Euler's number $e$} Define \[ e = 1 + \frac{1}{1!} + \ub{\frac{1}{2!}}_{= \frac{1}{2}} + \ub{\frac{1}{3!}}_{\le \frac{1}{4}} + \ub{\frac{1}{4!}}_{\le \frac{1}{8}} + \cdots \] Note that by Theorem 5 this series converges, because the partial sums are increasing and bounded by \[ 1 + 1 + \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \cdots = 3 \] If we define $0! = 1$, then \[ e = \sum_{j = 0}^\infty \frac{1}{j!} .\] \begin{proposition*}[7] $e$ is irrational. \end{proposition*} \begin{proof} Suppose $e$ were rational, i.e. $e = \frac{p}{q}$ where $p, q \in \NN$ and $q > 1$ since $2 < e < 3$. Then $q!e \in \NN$. But \begin{align*} q!e &= \ub{q! + \frac{q!}{1!} + \frac{q!}{2!} + \frac{q!}{3!} + \cdots + \frac{q!}{q!}}_{\in \NN} + \ub{\frac{q!}{(q+1)!} + \frac{q!}{(q+2)!} + \cdots}_{\text{show: $< 1$}} \\ &= N + x \end{align*} where \begin{align*} x &= \sum_{j = q+1}^\infty \frac{q!}{j!} \\ &= \sum_{j = 1}^\infty \frac{q!}{(q+j)!} \\ &= \frac{1}{q+1} + \ub{\frac{1}{(q+1)(q+2)}}_{\le \frac{1}{(q+1)^2}} + \ub{\frac{1}{(q+1)(q+2)(q+3)}}_{\le \frac{1}{(q+1)^3}} + \cdots \end{align*} an in general $\frac{q!}{(q+j)!} \le \frac{1}{(q+1)^j}$, so \[ x \le \frac{1}{q + 1} + \frac{1}{(q+1)^2} + \frac{1}{(q+)^3} + \cdots = \frac{1}{q} < 1 \] as $q \ge 2$. Hence $0 < x < 1$, contradicting that $q!e \in \NN$, so $e$ is irrational. \end{proof} \bigskip \noindent We say a real number $x$ is \emph{algebraic} if it is a root of a (non-zero) polynomial with integer coefficients (or rational coefficients - same thing!). \subsubsection*{Examples} \begin{enumerate}[(1)] \item Every rational number is algebraic: \[ x = \frac{p}{q} \implies qx - p = 0 \] \item $\sqrt{2}$ is algebraic: it satisfies $x^2 - 2 = 0$. \end{enumerate} A real number is \emph{transcendental} if it is not algebraic. \begin{theorem*}[(9) Liouville 1851] The number $L = \sum_{n = 1}^\infty \frac{1}{10^{n!}}$ is transcendental. \end{theorem*} \noindent We will need two facts about polynomials. \begin{lemma*}[Fact A] For any polynomial $p$, $\exists$ constant $K$ such that \[ |p(x) - p(q)| \le K|x - y| \qquad \forall 0 \le x, y \le 1 .\] \end{lemma*} \begin{proof} Suppose \[ p(x) = a_dx^d + a_{d - 1}x^{d - 1} + \cdots + a_1x + a_0 .\] Then \begin{align*} p(x) - p(y) &= a_d(x^d - y^d) + a_{d - 1}(x^{d - 1} - y^{d - 1}) + \cdots + a_1(x - y) \\ &= (x - y) [a_d(x^{d - 1} + x^{d - 2}y + \cdots y^{d - 1}) + \cdots a_1] \end{align*} so \[ |p(x) - p(y)| \le |x - y|[(|a_d| + |a_{d - 1}| + \cdots + |a_1|) \cdot d] .\] \end{proof} \begin{lemma*}[Fact B] A non-zero polynomial of degree $d$ has at most $d$ roots. \end{lemma*} \begin{proof} Given a polynomial $p$ of degree $d$, we may assume that the fact holds for all polynomials of degree $ < d$ and that $p$ has a root $a$, say (otherwise we're done). By long division, we may write \[ p(x) = (x - a)q(x) \] for some polynomial $q$ of degree $d - 1$. So each root of $p$ is either $a$ or a root of $q$. But by the induction hypothesis, $q$ has at most $d - 1$ roots. \end{proof} \bigskip \begin{proof}[of Theorem 9] Write \[ L_n = \sum_{k = 0}^n \frac{1}{10^{k!}} \] so $L_n \to L$. Suppose there is a polynomial $p$ of which $L$ is a root. Then by Fact A, there exists $K$ such that $|p(x) - p(y)| \le K|x - y|\,\,\forall 0 \le x, y \le 1$. Note \[ |L - L_n| = \sum_{k = n}^\infty \frac{1}{10^{k!}} \le \frac{2}{10^{(n + 1)!}} .\] Suppose $p$ has degree $d$, i.e. $p(x) = a_dx^d + a_{d - 1}x^{d - 1} + \cdots + a_1x + a_0$ with $a_i \in \ZZ$, $a_d \neq 0$. Notice that \[ L_n = \frac{s}{10^{n!}} \] for some $s \in \NN$, so $p(L_n) = \frac{t}{10^{dn!}}$ for some $t \in \NN$. By Fact B, for sufficiently large $n$, $L_n$ is not a root of $p$. Hence \[ |p(L_n)| \ge \frac{1}{10^{dn!}} \] i.e. $|p(L_n) - p(L)| \ge \frac{1}{10^{dn!}}$. Therefore \[ \frac{1}{10^{dn!}} \le K \frac{2}{10^{(n+1)!}} .\] a contradiction for sufficiently large $n$. \end{proof} \subsubsection*{Remarks} \begin{enumerate}[(1)] \item The same proof shows that any real number $x$ such that $\forall n \in \NN$, $\exists$ rational $\frac{p}{q}$ with \[ 0 < \left| x - \frac{p}{q} \right| < \frac{1}{q^n} \] is transcendental. \\ ``$x$ has a very god rational approximation $\implies$ transcendental'' \item Such $x$ are known as \emph{Liouville numbers}. \item This proof does not show that $e$ is transcendental, but in fact it is. \item We will give another proof of the existence of transcendental numbers in Chapter IV. \end{enumerate} \subsection{Complex Numbers} Since polynomials have no real roots, e.g. $x^2 + 1$. We will try to define $x$ with $x^2 = -1$ ``into existence''. \begin{center} \begin{tsqx} ! size(3cm); (-0.2,0)->>(1.5,0) (0,-0.2)->>(0,1.5) ! usepackage("amsfonts"); label $\mathbb{R}$ @ (1.6,0) ! dot((0,1)); label $(0,1) = i$ @ (0.45,1) \end{tsqx} \end{center} \begin{definition*}[Complex numbers] The \emph{complex numbers}, written $\CC$, consist of $\RR^2$ (the set of all ordered pairs $(a, b)$ with $a, b \in \RR$) together with operations $+$ and $\cdot$ defined by \[ (a, b) + (c, d) = (a + c, b + d) \] \[ (a, b) \cdot (c, d) = (ac - bd, ad + bc) \] We can view $\RR$ as contained in $\CC$ by identifying $a \in \RR$ with $(a, 0) \in \CC$. Note that \[ (a, 0) + (b, 0) = (a + b, 0) \] \[ (a, 0) \cdot (b, 0) = (ab, 0) \] Now let $i = (0,1)$. Then \[ i^2 = (0,1) \cdot (0,1) = (-1,0) .\] Note that every $z \in \ZZ$ is of the form $a = bi$ with $a, b \in \RR$. Indeed, \[ (a, b) = a(1, 0) + b(0, 1) = a + bi .\] \end{definition*} \subsubsection*{Remarks} \begin{enumerate}[(1)] \item $\CC$ obeys all the usual rules of arithmetic. In particular, it obeys (1)-(3) as set out for $\RR$, including that $\forall z \neq 0$, $\exists w$ such that $zw = 1$. Indeed, given $z = a + bi$, note that \[ (a + bi)(a - bi) = a^2 + b^2 \implies (a + bi) \frac{a - bi}{a^2 + b^2} = 1 .\] A structure obeying rules (1)-(3) is called a \emph{field}, e.g. $\CC$, $\RR$, $\QQ$, $\ZZ_p$ with $p$ a prime, but \emph{not} $\ZZ$! \item Every non-zero polynomial (even allowing complex coefficients) has a root in $\CC$. This is known as the Fundamental Theorem of Algebra. \end{enumerate} \newpage \begin{center} \LARGE\bfseries CHAPTER III: Sets, Functions and Relations \end{center} \resetcounters \newpage \section{Sets, Functions and Relations} A \emph{set} is a collection of mathematical objects. For example $\RR$, $\NN$, $\{1, 5, 9\}$, $[-2, 3]$. The order of elements in the set is immaterial, and elements are only counted once. For example \[ \{1, 3, 7\} = \{1, 7, 3\} \qquad \text{and} \qquad \{3, 4, 4 8\} = \{3, 4, 8\} .\] We write $x \in A$ if $x$ is an element of the set $A$, and $x \not\in A$ if not. Two sets are equal if they have the same elements. That is, if $\forall x$, $x \in A \iff x \in B$, then $A = B$. In particular, there is only one empty set $\emptyset$. A set $B$ is a \emph{subset} of $A$, written ``$B \subseteq A$'' or ``$B \subset A$'', if every element of $B$ is an element of $A$. \begin{center} \begin{tsqx} ! size(3cm); CP (0,0) (0,2) lightblue 0.5 / black CP (0,0) (0,1) blue 0.5 / black label $A$ @ (2.2,0) label $B$ @ (1.2,0) \end{tsqx} \end{center} $B$ is said to be a \emph{proper} subset of $A$ if $B \subseteq A$ and $B \neq A$ (also write $B \subsetneq A$). \\ Note that $A = B$ if and only if $A \subseteq B$ and $B \subseteq A$. If $A$ is a set and $P$ is a property of (some) elements of $A$, we can write $\{x \in A : P(x)\}$ for the subset of $A$ comprising those elements for which $P(x)$ holds. For example $\{n \in \NN : n \text{ is prime}\} = \{2, 3, 5, 7, 11, \dots\} \subseteq \NN$. \\ If $A$ and $B$ are sets, then their \emph{union} $A \cup B$ is \[ A \cup B = \{x : x \in A \text{ or } x \in B\} \] \begin{center} \begin{tsqx} ! size(4cm); CR (-0.7,0) 1 lightblue / black CR (0.7,0) 1 lightblue / black CR (-0.7,0) 1 CR (0.7,0) 1 label $A$ @ (-0.7,1.2) label $B$ @ (0.7,1.2) \end{tsqx} \end{center} Their \emph{intersection} $A \cap B$ is defined to be \[ A \cap B = \{x : x \in A \text{ and } x \in B\} .\] \begin{center} \begin{tsqx} ! size(4cm); X_1 := IP CR (-0.7,0) 1 (0,-1)--(0,1) X_2 := OP CR (-0.7,0) 1 (0,-1)--(0,1) part1 = arc3 (-0.7,0) X_2 X_1 part2 = arc3 (0.7,0) X_1 X_2 part1--part2--cycle lightblue / black CR (-0.7,0) 1 CR (0.7,0) 1 label $A$ @ (-0.7,1.2) label $B$ @ (0.7,1.2) \end{tsqx} \end{center} We say $A$ and $B$ are \emph{disjoint} if $A \cap B = \emptyset$. Note that we can view intersection as a special case of subset selection: \[ A \cap B = \{x \in A : x \in B\} .\] Similarly, have the \emph{set difference} $A \setminus B = \{x \in A : x \not\in B\}$. ``$A$ but not $B$'' or ``$A$ minus $B$''. \begin{center} \begin{tsqx} ! size(4cm); X_1 := IP CR (-0.7,0) 1 (0,-1)--(0,1) X_2 := OP CR (-0.7,0) 1 (0,-1)--(0,1) part1 = arc3 (-0.7,0) X_1 X_2 part2 = arc3 (0.7,0) X_1 X_2 reverse(part1)--part2--cycle lightblue / black CR (-0.7,0) 1 CR (0.7,0) 1 label $A$ @ (-0.7,1.2) label $B$ @ (0.7,1.2) \end{tsqx} \end{center} Note that $\cup$ and $\cap$ are commutative and associative. Also, $\cup$ is distributive over $\cap$, i.e. \[ A \cup (B \cap C) = (A \cup B) \cap (A \cup C) ,\] \emph{and} $\cap$ is distributive over $\cup$, i.e. \[ A \cap (B \cup C) = (A \cap B) \cup (A \cap C) .\] To prove $A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$, show that $LHS \subseteq RHS$ and $RHS \subseteq LHS$, so $LHS = RHS$. \\ If $x \in A \cap (B \cup C)$, then $x \in A$ and $x \in B \cup C$, so $x \in A$ and $(x \in B$ or $x \in C$). If $x \in B$, then $x \in A \cap B$, and if $x \in C$, then $x \in A \cap C$. Hence, in any case, $x \in (A \cap B) \cup (A \cap C)$. \\ Conversely, if $x \in (A \cap B) \cup (A \cap C)$, then $x \in A \cap B$ or $x \in A \cap C$. If $x \in A \cap B$, then $x \in A$ and $x \in B \cup C$. If $x \in A \cap C$, then $x \in A$ and $x \in B \cup C$, so in any case $x \in A \cap (B \cup C)$. \hfill\qed \bigskip \noindent If $A_1, A_2, A_3, \dots$ are sets, then \begin{align*} \bigcap_{n = 1}^\infty A_n &= A_1 \cap A_2 \cap A_3 \cap \cdots \\ &= \{x : x \in A_n \text{ for all $n \in \NN$}\} \end{align*} Similarly, \begin{align*} \cup_{n = 1}^\infty A_n &= A_1 \cup A_2 \cup A_3 \cup \cdots \\ &= \{x : x \in A_n \text{ for some $n \in \NN$}\} \end{align*} \begin{remark*} $\cup_{n = 1}^\infty A_n$ is \emph{not} the ``limit'' of anything! \end{remark*} \noindent More generally, given an index set $I$ and a collection of sets $A_i$ indexed by $I$, we write \[ \bigcap_{i \in I} A_i = \{x : x \in A_i\,\,\forall i \in I\} \] and \[ \cup_{i \in I} A_i = \{x : x \in A_i \text{ for some $i \in I$}\} .\] Given sets $A$ and $B$, we can form their \emph{Cartesian product} \[ A \times B = \{(a, b) : a \in A, b \in B\} ,\] which is the set of \emph{ordered pairs} $(a, b)$ with $a \in A$, $b \in B$. Here $(a, b) = (a', b') \iff a = a' \wedge b = b'$. [Note we can define $(a, b) = \{a, \{a, b\}\}$]. We can extend to ordered triples and so on, for example \begin{align*} \RR^3 &= \RR \times \RR \times \RR \\ &= \{(x, y, z) : x \in \RR, y \in \RR, z \in \RR\} \end{align*} For any set $X$, can form the \emph{power set} $\mathcal{P}(X)$ consisting of all subsets of $X$, that is, \[ \mathcal{P}(X) = \{Y : Y \subseteq X\} \] For example, if $X = \{1, 2\}$, then $\mathcal{P}(X) = \{\emptyset, \{1\}, \{2\}, \{1, 2\}\}$. \begin{remark*} Given a set $A$, we can form $\{x \in A : P(c)\}$ for any property $P$. But we \emph{cannot} form $\{x : P(X)\}$. Indeed suppose \[ X = \{x : x \text{ is a set and } x \not\in x\} \] were a set. Then $X \in X$ implies that $X \not\in X$ \contradiction, but $X \not\in X$ implies that $X \in X$ \contradiction. This is known as \emph{Russell's Paradox}. Similarly, there is not `universal' set $Y$, meaning that $\forall x, x \in Y$. Otherwise we could form $X$ above by subset selection: \[ X = \{x \in Y : x \not\in x\} .\] \end{remark*} \begin{moral*} To guarantee that a given set exists, it should be obtained from known sets (e.g. $\NN$, $\RR$) in one of the ways described above. \end{moral*} \subsection{Finite Sets} Write \[ \NN_0 = \NN \cup \{0\} = \{0, 1, 2, 3, \dots\} \] Given $n \in \NN_0$, we say a set $A$ has \emph{size} $n$ if we can write $A = \{a_1, a_2, \dots, a_n\}$ with the elements $a_i$ distinct. For example, $\{1, 3, 7\}$ has size 3, $\emptyset$ has size 0. \bigskip \noindent We say $A$ is \emph{finite} if $\exists n \in \NN_0$ such that $A$ has size $n$, and $A$ is \emph{infinite} otherwise. \begin{proposition} A set of size $n$ has exactly $2^n$ subsets. \end{proposition} \begin{proof}[1] May assume that our set is $\{1, 2, \dots, n\}$. To specify a subset $S$ of $\{1, 2, \dots, n\}$ we must say if $1 \in S$ or $1 \not\in S$, then if $2 \in S$ or $2 \not\in S$, and so on. Hence the number of choices for $S$ is \[ \ub{2}_{1 \in S?} \cdot \ub{2}_{2 \in S?} \cdot \ub{2}_{3 \in S?} \cdots \ub{2}_{n \in S?} = 2^n .\qedhere \] \end{proof} \begin{proof}[2] By induction on $n$. Clearly true for $n = 0$. Given $n > 0$, and $T \subseteq \{1, 2, \dots, n - 1\}$, how many $S \subseteq \{1, 2, \dots, n\}$ are there such that $S \cap \{1, \dots, n - 1\} = T$? There are exactly 2, namely $T$ and $T \cup \{n\}$. Hence the number of subsets of $\{1, 2, \dots, n\}$ is \[ 2 \times \text{number of subsets of $\{1, 2, \dots, n - 1\}$} = 2 \cdot 2^{n - 1} = 2^n \qedhere \] \end{proof} If $A$ has size $n$ we write ``$|A| = n$'' or ``$\# A = n$''. \\ So Proposition 1 says that $|A| = n \implies |\mathcal{P}(A)| = 2^n$. \bigskip \noindent Given $n \in \NN_0$ and $0 \le k \le n$, we write ${n \choose k}$ ``$n$ choose $k$'' for the number of subsets of an $n$-element set that are of size $k$. In other words, \[ {n \choose k} = |\{S \subseteq \{1, 2, \dots, n\} : |S| = k\}|. \] ${n \choose k}$ is called a \emph{binomial coefficient}. For example, the subsets of size 2 of $\{1, 2, 3, 4\}$ are precisely \[ \{1, 2\}, \{1, 2\}, \{1, 4\}, \{2, 3\}, \{2, 4\}, \{3, 4\} ,\] so ${4 \choose 2} = 6$. Note that by definition ${n \choose 0} = 1$, ${n \choose n} = 1$, ${n \choose 1} = n$ ($n > 0$) and also \[ {n \choose 0} + {n \choose 1} + {n \choose 1} + \cdots + {n \choose n - 1} + {n \choose n} = 2^n .\] Also, we have ${n \choose k} = {n \choose n - k} \,\,\forall n \in \NN_0, 0 \le k \le n$. For example ${8 \choose 3} = {8 \choose 5}$. Indeed, specifying which $k$ elements to pick is the same as specifying which $n - k$ elements \emph{not} to pick. Moreover, \[ {n \choose k} = {n - 1 \choose k - 1} + {n - 1 \choose k} \qquad \forall n \in NN, 1 \le k \le n - 1 .\] For example, ${8 \choose 3} = {7 \choose 2} + {7 \choose 3}$. Indeed, the number of subsets of $\{1, 2, \dots, n\}$ of size $k$ that do not include $n$ is ${n - 1 \choose k}$, while the number of subsets of $\{1, 2, \dots, n\}$ of size $k$ that do include $n$ is ${n - 1 \choose k - 1}$. \\ We obtain Pascal's Triangle: \[ \begin{array}{*{11}c} & & & & & 1 & & & & & \\ & & & & 1 & & 1 & & & & \\ & & & 1 & & 2 & & 1 & & & \\ & & 1 & & 3 & & 3 & & 1 & & \\ & 1 & & 4 & & 6 & & 4 & & 1 & \\ 1 & & 5 & & 10 & & 10 & & 5 & & 1 \\ & & & & & \cdots & & & & & \end{array} \] The $n$-th row contains the numbers ${n \choose k}$. Each row starts and ends with a 1, and the remaining entries are the sum of the two terms immediately above. \begin{proposition} \[ {n \choose k} = \frac{n(n - 1)(n - 2) \cdots (n - k + 1)}{k(k - 1)(k - 2) \cdots 2 \cdot 1} = \frac{n!}{k!(n - k)!} .\] \end{proposition} \begin{proof} Given a set of size $n$, there are $n(n - 1)(n - 2) \cdots (n - k + 1)$ ways to pick $k$ elements, one by one, in order. But each subset of size $k$ is picked in $k(k - 1)(k - 2) \cdots 2 \cdot 1$ ways by this method. Hence the number of subsets of size $k$ in $\{1, 2, \dots, n\}$ is \[ \frac{n(n - 1)(n - 2) \cdots (n - k + 1)}{k(k - 1)(k - 2) \cdots 2 \cdot 1} . \qedhere \] \end{proof} Note that the formula tells us, for example, that \[ {n \choose 2} = \frac{n(n - 1)}{2} \sim \frac{n^2}{2} \] \[ {n \choose 3} = \frac{n(n - 1)(n - 2)}{6} \sim \frac{n^3}{6} \] for large $n$. \setcounter{customtheorem}{1} \begin{theorem}[Binomial Theorem] For all $a, b \in \RR$, $n \in \NN$ \[ (a +b)^n = {n \choose 0}a^n + {n \choose 1}a^{n - 1}b + {n \choose 2}a{n - 2}b^2 + \cdots + {n \choose n - 1} ab^{n - 1} + {n \choose n} b^n .\] \end{theorem} \begin{proof} When we expand \[ (a + b)^n = (a+b)(a+b) \cdots (a+b) \] we obtain terms of the form $a^{n - k}b^k$ ($0 \le k \le n$) and the number of terms of the form $a^{n - k}b^k$ is ${n \choose k}$ as we must specify $k$ brackets from which to pick $b$. Hence \[ (a + b)^n = \sum_{k = 0}^n {n \choose k} a^{n - k}b^k . \qedhere\] \end{proof} \begin{example*} \[ (1 + x)^n = 1 + nx + \frac{n(n - 1)}{2}x^2 + {n \choose 3} x^3 + \cdots + {n \choose n - 1}x^{n - 1} + x^n \] so for small $x$, a good approximation to $(1 + x)^n$ is $1 + nx$, for example $(1.00001)^8 \approx 1.00008$. A better approximation is $1 + nx + \frac{n(n - 1)}{2}x^2$, for example $(1.00001)^8 \approx 1.00008 + 28(0.00001)^2$. \end{example*} What can we say about the relationship between sizes of unions and intersections of finite sets? \\ For example \[ |A \cup B| = |A| + |B| - |A \cap B| \] Also, \[ |A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |B \cap C| - |A \cap C| + |A \cap B \cap C| .\] \setcounter{customtheorem}{3} \begin{theorem*}[Inclusion-Exclusion Principle] Let $S_1, S_2, \dots, S_n$ be finite sets. Then \[ |S_1 \cup S_2 \cup \cdots \cup S_n| = \sum_{|A| = 1} |S_A| - \sum_{|A| = 2} |S_A| + \sum_{|A| = 3} |S_A| - \cdots + (-1)^{n + 1} \sum_{|A| = n} |S_A| ,\] where $S_A = \bigcap_{i \in A} S_i$ and $\sum_{|A| = k}$ is taken over all $A \subseteq \{1, 2, \dots, n\}$ of size $k$. Equivalently, \[ |\cup_{i = 1}^n S_i| = \sum_{k = 1}^n (-1)^{k + 1} \sum_{\substack{A \subseteq \{1, 2, \dots, n\} \\|A| = k}} \left| \bigcap_{i \in A} S_i \right| .\] \end{theorem*} \begin{proof} Let $x \in S_1 \cup S_2 \cup \cdots \cup S_n$, say $x \in S_i$ for $k$ of the $S_i$. We want $x$ to be counted exactly once in the RHS. Indeed, \[ \#\{A : |A| = 1 \text{ with $x \in S_A$}\} = k ,\] and \[ \#\{A : |A| = 2 \text{ with $x \in S_A$}\} = {k \choose 2} \] and in general, \[ \#\{A : |A| = r \text{ with $x \in S_A$}\} = {k \choose r} \] for $r \le k$, and $=0$ for $r > k$. Thus the number of times $x$ is counted on the RHS is \begin{align*} k - {k \choose 2} + {k \choose 3} - \cdots + (-1)^{k + 1} {k \choose k} &= 1 - \left( 1 - k + {k \choose 2} - {k \choose 3} + \cdots -(-1)^{k + 1}{k \choose k} \right) \\ &= 1 - (1 - 1)^k \\ &= 1 \end{align*} for $k \ge 1$ (and $k = 0$ doesn't happen since $x$ is in the union). \end{proof} \subsection{Functions} Given sets $A$ and $B$, a function $f$ from $A$ to $B$ is a ``rule'' that assigns to every $x \in A$ a unique element $f(x) \in B$. \bigskip \noindent More formally, a \emph{function} from $A$ to $B$ is a subset $f \subseteq A \times B$ such that for all $x \in A$, there is a unique $y \in B$ such that $(x, y) \in f$. \\ If $f$ is a function from $A$ to $B$, we write $f : A \to B$. If $(x, y) \in f$, we can write $f(x) = y$ or $x \mapsto y$. \subsubsection*{Examples} \begin{enumerate}[(1)] \item $f : \RR \to \RR$, $x \mapsto x^2$ is a function. \item $f : \RR \to \RR$, $x \mapsto \frac{1}{x}$ is \emph{not} a function ($f(0) = $?) \item $f : \RR \to \RR$, $x \mapsto \pm \sqrt{|x|}$ is \emph{not} a function. \item $f : \RR \to \RR$, $x \mapsto \begin{cases} 1 & \text{if $x$ is rational} \\ 0 & \text{otherwise} \end{cases}$ is a function. \item $f : \{1, 2, 3, 4, 5\} \to \{1, 2, 3, 4\}$ given by \begin{center} \begin{tsqx} ! size(5cm); shift(-1,0)*yscale(1.5)*xscale(0.5)*unitcircle label $1$ @ (-1,1) label $2$ @ (-1,0.5) label $3$ @ (-1,0) label $4$ @ (-1,-0.5) label $5$ @ (-1,-1) shift(1,0)*yscale(1.25)*xscale(0.5)*unitcircle label $1$ @ (1,0.75) label $2$ @ (1,0.25) label $3$ @ (1,-0.25) label $4$ @ (1,-0.75) (-0.8,1)->>(0.8,0.75) (-0.8,0.5)->>(0.8,-0.25) (-0.8,0)->>(0.8,0.75) (-0.8,-0.5)->>(0.8,-0.25) (-0.8,-1)->>(0.8,-0.75) \end{tsqx} \end{center} \item $f : \{1, 2, 3\} \to \{1, 2, 3\}$ \begin{center} \begin{tsqx} ! size(5cm); shift(-1,0)*yscale(1)*xscale(0.5)*unitcircle label $1$ @ (-1,0.5) label $2$ @ (-1,0) label $3$ @ (-1,-0.5) shift(1,0)*yscale(1)*xscale(0.5)*unitcircle label $1$ @ (1,0.5) label $2$ @ (1,0) label $3$ @ (1,-0.5) (-0.8,0.5)->>(0.8,0.5) (-0.8,0)->>(0.8,-0.5) (-0.8,-0.5)->>(0.8,0) \end{tsqx} \end{center} \item $f : \{1, 2, 3\} \to \{1, 2, 3, 4\}$ \begin{center} \begin{tsqx} ! size(5cm); shift(-1,0)*yscale(1)*xscale(0.5)*unitcircle label $1$ @ (-1,0.5) label $2$ @ (-1,0) label $3$ @ (-1,-0.5) shift(1,0)*yscale(1.25)*xscale(0.5)*unitcircle label $1$ @ (1,0.75) label $2$ @ (1,0.25) label $3$ @ (1,-0.25) label $4$ @ (1,-0.75) (-0.8,0.5)->>(0.8,0.75) (-0.8,0)->>(0.8,-0.75) (-0.8,-0.5)->>(0.8,0.25) \end{tsqx} \end{center} \item $f : \{1, 2, 3, 4\} \to \{1, 2, 3\}$ \begin{center} \begin{tsqx} ! size(5cm); shift(-1,0)*yscale(1.25)*xscale(0.5)*unitcircle label $1$ @ (-1,0.75) label $2$ @ (-1,0.25) label $3$ @ (-1,-0.25) label $4$ @ (-1,-0.75) shift(1,0)*yscale(1)*xscale(0.5)*unitcircle label $1$ @ (1,0.5) label $2$ @ (1,0) label $3$ @ (1,-0.5) (-0.8,0.75)->>(0.8,-0.5) (-0.8,0.25)->>(0.8,-0.5) (-0.8,-0.25)->>(0.8,0) (-0.8,-0.75)->>(0.8,0.5) \end{tsqx} \end{center} \end{enumerate} \noindent We say $f : A \to B$ is \emph{injective} if $\forall a, a' \in A$, $a \neq a' \implies f(a) \neq f(a')$. Equivalently, $f$ is injective if $f(a) = f(a') \implies a = a'$. Examples (5) and (8) are not injective, but (6) and (7) are. \bigskip \noindent We say $f : A \to B$ is \emph{surjective} if $\forall b \in B$, $\exists a \in A$ such that $f(a) = b$. Examples (5) and (7) are not surjective, but (6) and (8) are. \bigskip \noindent We say $f : A \to B$ is \emph{bijective} if it is both injective and surjective. Example (6) is the only bijection. If $f : A \to B$ is a bijection, then everything in $B$ is ``hit'' exactly once (that is, $f$ pairs the elements of $A$ and $B$). A \emph{permutation} of $A$ is a bijection $A \to A$. \bigskip \noindent Given $f : A \to B$, we say $A$ is the \emph{domain} of $f$ and $B$ is its \emph{range}. The \emph{image} of $f$ is the set $f(A) = \{f(a) : a \in A\} = \{b \in B : f(a) = b \text{ for some $a \in A$}\}$. The image of $f$ is also sometimes denoted $\mathrm{Im}(f)$. For example, if $f : \RR \to \RR$, $x \mapsto x^2$, then $\mathrm{Im}(f) = \{y \in \RR : y \ge 0\}$. \bigskip \noindent When specifying a function we must specify its domain and range. For example ``Is the function $f(x) = x^2$ injective?'' is meaningless, as $f : \NN \to \NN$, $x \mapsto x^2$ is injective, but $f : \ZZ \to \ZZ$, $x \mapsto x^2$ is \emph{not}. \subsubsection*{Observations} \begin{enumerate}[(1)] \item $f$ is surjective if and only if $f(A) = B$. In particular, if $|B| > |A|$ then there can be not surjection from $A$ to $B$. \item There can be no injection from $A$ to $B$ is $|A| > |B|$. \item If $f : A \to A$, then $f$ is injective if and only if $f$ is surjective. \item There is no bijection from $A$ to any proper subset of $A$. \end{enumerate} \noindent Note that (3) and (4) do \emph{not} hold for infinite sets: \begin{enumerate}[(a)] \item $f : \NN \to \NN$, $x \mapsto x + 1$ is injective but not surjective. \begin{center} \begin{tsqx} ! size(5cm); ! usepackage("amsfonts"); shift(-1,0)*yscale(1.5)*xscale(0.5)*unitcircle label $1$ @ (-1,1) label $2$ @ (-1,0.5) label $3$ @ (-1,0) label $4$ @ (-1,-0.5) label $\vdots$ @ (-1,-1) shift(1,0)*yscale(1.5)*xscale(0.5)*unitcircle label $1$ @ (1,1) label $2$ @ (1,0.5) label $3$ @ (1,0) label $4$ @ (1,-0.5) label $\vdots$ @ (1,-1) (-0.8,1)->>(0.8,0.5) (-0.8,0.5)->>(0.8,0) (-0.8,0)->>(0.8,-0.5) (-0.8,-0.5)->>(0.8,-1) label $\mathbb{N}$ @ (-1,-1.8) label $\mathbb{N}$ @ (1,-1.8) \end{tsqx} \end{center} \item $g : \NN \to \NN$, $x \mapsto \begin{cases} x - 1 & \text{if $x \neq 1$} \\ 1 & \text{if $x = 1$} \end{cases}$ is surjective but not injective. \begin{center} \begin{tsqx} ! size(5cm); ! usepackage("amsfonts"); shift(-1,0)*yscale(1.5)*xscale(0.5)*unitcircle label $1$ @ (-1,1) label $2$ @ (-1,0.5) label $3$ @ (-1,0) label $4$ @ (-1,-0.5) label $\vdots$ @ (-1,-1) shift(1,0)*yscale(1.5)*xscale(0.5)*unitcircle label $1$ @ (1,1) label $2$ @ (1,0.5) label $3$ @ (1,0) label $4$ @ (1,-0.5) label $\vdots$ @ (1,-1) (-0.8,1)->>(0.8,1) (-0.8,0.5)->>(0.8,1) (-0.8,0)->>(0.8,0.5) (-0.8,-0.5)->>(0.8,0) label $\mathbb{N}$ @ (-1,-1.8) label $\mathbb{N}$ @ (1,-1.8) \end{tsqx} \end{center} \item $h : \NN \to \NN \setminus \{1\}$, $x \mapsto x + 1$ is a bijection from $\NN$ to a proper subset. \begin{center} \begin{tsqx} ! size(5cm); ! usepackage("amsfonts"); shift(-1,0)*yscale(1.5)*xscale(0.5)*unitcircle label $1$ @ (-1,1) label $2$ @ (-1,0.5) label $3$ @ (-1,0) label $4$ @ (-1,-0.5) label $\vdots$ @ (-1,-1) shift(1,0)*yscale(1.5)*xscale(0.5)*unitcircle label $2$ @ (1,1) label $3$ @ (1,0.5) label $4$ @ (1,0) label $5$ @ (1,-0.5) label $\vdots$ @ (1,-1) (-0.8,1)->>(0.8,1) (-0.8,0.5)->>(0.8,0.5) (-0.8,0)->>(0.8,0) (-0.8,-0.5)->>(0.8,-0.5) label $\mathbb{N}$ @ (-1,-1.8) label $\mathbb{N} \setminus \{1\}$ @ (1,-1.8) \end{tsqx} \end{center} \end{enumerate} \subsubsection*{Further Examples} \begin{enumerate}[(i)] \item For any set $X$, we have the \emph{identity function} $\mathrm{id}_X : X \to X$, $x \mapsto x$. \item Given a set $X$ and $A \subseteq X$, we have the \emph{indicator function} (or \emph{characteristic function}) of $A$, $1_A : X \to \{0, 1\}$, $x \mapsto \begin{cases} 1 & \text{if $x \in A$} \\ 0 & \text{if $x \not\in A$} \end{cases}$ \item A sequence of reals $x_1, x_2, \dots, $ is a function $\NN \to \RR$, $n \mapsto x_n$. \item The operation $+$ on $\NN$ is a function $\NN \times \NN \to \NN$, $(a, b) \mapsto a + b$. \item A set $X$ has size $n$ if and only if there is a bijection $\{1, 2, \dots, n\} \to X = \{a_1, \dots, a_n\}$, $i \mapsto a_i$. \end{enumerate} \noindent Given $f : A \to B$ and $g : B \to C$, the \emph{composition} $g \circ f : A \to C$ is defined by $a \mapsto g(f(a))$. \begin{notation*} The notation ``$g \circ f$'' can be read as ``$g$ composed with $f$'', or ``$g$ circle $f$'' or ``$g$ after $f$''. \end{notation*} \noindent For example if $f : \RR \to \RR$, $x \mapsto 2x$ and $g : \RR \to \RR$, $x \mapsto x + 1$ then $g \circ f(x) = g(f(x) = g(2x) = 2x + 1$ and $f \circ g(x) = f(g(x)) = f(x + 1) = 2(x + 1)$. So in general, $\circ$ is \emph{not} commutative. In the example above, $f \circ g \neq g \circ f$ since $f \circ g(1) = 4 \neq 3 = g \circ f(1)$. \bigskip \noindent However, $\circ$ is associative, i.e. given $f : A \to B$, $g : B \to C$, $h : C \to D$, we have $h \circ (g \circ f) = (h \circ g) \circ f$. Indeed, for every $x \in A$, \[ (h \circ (g \circ f))(x) = h((g \circ f)(x)) = h(g(f(x))) \] and \[ ((h \circ g) \circ f)(x) = h \circ g(f(x)) = h(g(f(x))) .\] We may therefore drop the brackets and write $h \circ g \circ f$ without ambiguity. \bigskip \noindent We say $f : A \to B$ is \emph{invertible} if $\exists g : B \to A$ such that $g \circ f = \mathrm{id}_A$ and $f \circ g = \mathrm{id}_B$. \begin{example*} $f : \RR \to \RR$, $x \mapsto 2x + 1$ and $g : \RR \to \RR$, $x \mapsto \frac{x - 1}{2}$. Indeed, $\forall x \in \RR$, \[ (g \circ f)(X) = g(2x + 1) = \frac{2x + 1 - 1}{2} = x \] so $g \circ f = \id_\RR$. Also, $\forall x \in \RR$, \[ (f \circ g)(x) = f \left( \frac{x - 1}{2} \right) = 2 \left( \frac{x - 1}{2} \right) + 1 = x ,\] so $f \circ g = \id_\RR$. Hence $f$ is invertible with inverse $g$. \end{example*} \begin{note*} For $f : \NN \to \NN$, $x \mapsto x + 1$ and $g : \NN \to \NN$, $x \mapsto \begin{cases} x - 1 & \text{if $x \neq 1$} \\ 1 & \text{if $x = 1$} \end{cases}$. We have $g \circ f = \id_\NN$ but $f \circ g \neq \id_\NN$ because $f \circ g(1) \neq 1$. \end{note*} \bigskip \noindent We had said $f : A \to B$ is invertible if $\exists g : B \to A$ such that $g \circ f = \id_A$ and $f \circ g = \id_B$. \bigskip \noindent Given $f : A \to B$, when is there a map $g : B \to A$ such that $g \circ f = \id_A$? If such a $g$ exists, and $a, a' \in A$ are such that $f(a) = f(a')$, then $gf(a) = gf(a')$, so $a = a'$. Thus $f$ must be injective. Conversely, if $f$ is injective, we can find $g$ such that $g \circ f = \id_A$: $b \in f(A)$, let $g(b) = a$, where $a$ is the unique element of $A$ with $f(a) = b$; if $b \not\in f(A)$, let $g(b)$ be anything you like. \bigskip \noindent Given $f : A \to B$, when is there a map $g : B \to A$ such that $f \circ g = \id_B$? We need $f(g(B))$, so $f$ must be surjective. Conversely, if $f$ is surjective, we can find $f : B \to A$ with $f \circ g = \id_B$: for each $b \in B$, pick some $a \in A$ with $f(a) = b$ and put $g(b) = a$. \bigskip \noindent It follows that $f : A \to B$ is invertible if and only if $f$ is bijective. We write $f^{-1} : B \to A$ for the inverse of $f$ when it exists. \begin{note*} Given $f : A \to B$ and $U \subseteq B$, we sometimes write \[ f^{-1}(U) = \{a \in A : f(a) \in U\} \] for the \emph{preimage} of $U$. This does \emph{not} mean that $f$ has an inverse! \end{note*} \subsection{Relations} A relation on a set $X$ is a subset $R \subseteq X \times X$. We usually write $aRb$ for $(a, b) \in R$. (This is read as ``$a$ is related to $b$''.) \subsubsection*{Examples} of relations on $\NN$. \begin{enumerate}[(i)] \item $aRb$ if $a, b$ have the same final digit; \item $aRb$ if $a \mid b$; \item $aRb$ if $a \neq b$; \item $aRb$ if $a = b = 1$; \item $aRb$ if $|a - b| \le 3$; \item $aRb$ if either $a, b \le 4$ or $a, b \ge 5$. \end{enumerate} \noindent There are three properties that a relation might have that are of special interest: \begin{itemize} \item $R$ is \emph{reflexive} if $\forall x \in X$, $xRx$. \item $R$ is \emph{symmetric} if $x, y \in X$, $xRy \implies yRx$. \item $R$ is \emph{transitive} if $\forall x, y, z \in X$, $xRy \text{ and }yRz \implies xRz$. \end{itemize} \begin{center} \begin{tabular}{c|cccccc} \textbf{Example} & 1 & 2 & 3 & 4 & 5 & 6 \\ \hline reflexive & \cmark & \cmark & \xmark & \xmark & \cmark & \cmark \\ symmtric & \cmark & \xmark & \cmark & \cmark & \cmark & \cmark \\ transitive & \cmark & \cmark & \xmark & \cmark & \xmark & \cmark \\ \end{tabular} \end{center} \noindent A relation $R$ is an \emph{equivalence relation} if it is reflexive, symmetric and transitive. We often write $a \sim b$ for $aRb$. So (1) and (6) are equivalence relations. We have already seen another one: \begin{enumerate}[(1)] \item[(7)] $X = \ZZ$ with $a \sim b$ if $a \equiv b \pmod{5}$. \end{enumerate} This equivalence relation partitions $\ZZ$ into ``pieces'' consisting of related elements, namely \[ \{x \in \ZZ : x \equiv 0 \pmod{5}\}, \{x \in \ZZ : x \equiv 1 \pmod{5}\}, \dots, \{x \in \ZZ : x \equiv 4 \pmod{5}\} .\] Given a set $X$ a \emph{partition} of $X$ is a collection of pairwise disjoint subsets (called ``parts'') whose union is $X$. \bigskip \noindent If $\sim$ is an equivalence relation on $X$, then the \emph{equivalence class} of $x \in X$ is \[ [x] = \{y \in Y : y \sim x\} .\] For example in (1), $[376] = \{\text{all natural numbers ending in 6}\}$. In (7), $[12] = \{y : y \equiv 2 \pmod{5}\}$. \begin{observation*} Given a partition of $X$, there is an equivalence relation $R$ whose equivalence classes are precisely the parts of the partition: just define $a \sim b$ if $a$ and $b$ lie in the same part. \end{observation*} \setcounter{customtheorem}{4} \begin{theorem} Let $\sim$ be any equivalence relation on $X$. Then the equivalence classes form a partition of $X$. \end{theorem} \begin{proof} Since $\sim$ is reflexive, we have $x \in [x]\,\, \forall \,\, x \in X$. Thus \[ \bigcup_{x \in X} [x] = X .\] It remains to show that $\forall x, y \in X$, either $[x] \cap [y] = \emptyset$ or $[x] = [y]$. Suppose $[x] \cap [y] \neq \emptyset$, and let $z \in [x] \cap [y]$. Then $z \sim x$, so by symmetry $x \sim z$, and $z \sim y$. Thus by transitivity, $x \sim y$. Let now $w \in [y]$, so $y \sim w$. Since $x \sim y$ and $y \sim w$, by transitivity, $x \sim w$. Thus $w \in [x]$. Hence if $[x] \cap [y] \neq \emptyset$, then $[y] \subseteq [x]$. \end{proof} This is a useful viewpoint: it is now easy to see that there is an equivalence relation on $\NN$ with 3 equivalence classes, of which 2 are infinite and 1 is finite - simply take a partition of $\NN$ with this property. \bigskip \noindent Given an equivalence relation $R$ and a set $X$, the \emph{quotient of $X$ by $R$} is \[ X / R = \{[x] : x \in X\} .\] For example in (7), $X / R$ has size (5), in (1), $X / R$ has size 10. In fact, this explains why we sometimes write $\ZZ / 5\ZZ$ instead of $\ZZ_5$. The map $q : X \to X / R$, $x \mapsto [x]$ is the \emph{quotient map} (or \emph{projection map}). \bigskip \noindent \textbf{Another example} on $\ZZ \times \NN$, define $(a, b)R(c, d)$ if $ad = bc$. It is easy to see that is an equivalence relation. For example \[ [(1, 2)] = \{(1, 2), (2, 4), (3, 6), \dots\} \] so we could regard $\ZZ \times \NN / R$ as a copy of $\QQ$, by identifying $[(a, b)]$ with $\frac{a}{b} \in \QQ$. The quotient map $q : \ZZ \times \NN \to \ZZ \times \NN / R$, $(a, b) \mapsto \frac{a}{b}$. \newpage \section{Countability} We would like to talk about sizes of infinite sets, for example $\NN$ ``looks smaller than'' $\ZZ$, and a lot smaller than $\QQ$, which in turn looks smaller than $\RR$. \bigskip \noindent We say a set $X$ is \emph{countable} if $X$ is finite or there is a bijection $X \to \NN$. That is, $X$ is countable if and only if we can list the elements of $X$ as $x_1, x_2, x_3, \dots$ (might terminate). \subsubsection*{Examples} \begin{enumerate}[(1)] \item Any finite set is countable. \item $\NN$ is countable. \item $\ZZ$ is countable, as we may list $\ZZ$ as \[ 0, 1, -1, 2, -2, 3, \dots \] i.e. \[ x_n = \begin{cases} \frac{n}{2} & \text{if $n$ is even} \\ -\frac{n - 1}{2} & \text{if $n$ is odd} \end{cases} \] \end{enumerate} \setcounter{customlemma}{0} \begin{lemma} Any subset of $\NN$ is countable \end{lemma} \begin{proof} If $S \subseteq \NN$ is non-empty, by Well Ordering Principle there is a least element $s_1 \in S$. If $S \setminus \{s_1\} \neq \emptyset$, by Well Ordering Principle there is a least element $s_2 \in S \setminus \{s_1\}$. If $S \setminus \{s_1, s_2\} \neq \emptyset$, \dots \\ If at some point this process stops, then $S = \{s_1, s_2, \dots, s_m\}$ is finite. If it goes on forever, the map $g : \NN \to S$ given by $g(n) = s_n$ is well-defined (for every $n$, there is a unique $s_n$) and is injective. It is also surjective because if $k \in S$, then $k \in \NN$, and there are $< k$ elements of $S$ less than $k$, so $k = s_n$ for some $n \le k$. \end{proof} \begin{remark*} In $\RR$, let \[ S = \left\{ \frac{1}{2}, \frac{2}{3}, \frac{3}{4}, \dots \right\} \cup \{1\} ,\] then $S$ is countable as we can list it as \[ 1, \frac{1}{2}, \frac{2}{3}, \frac{3}{4}, \dots \] but if we had tried to list the elements in increasing order (as in the proof of Lemma 1) then I would not list all the list. \end{remark*} \setcounter{customtheorem}{1} \begin{theorem} The following statements are equivalent: \begin{enumerate}[(i)] \item $X$ is countable; \item there is an injection $X \to \NN$; \item $X = \emptyset$ or there is a surjection $\NN \to X$. \end{enumerate} \end{theorem} \begin{proof} Plainly (i) $\implies$ (ii) for if $X$ is finite, it obviously injects into $\NN$, and if $X$ bijects with $\NN$, then it certainly injects into $\NN$. \\ Conversely, if there is an injection $f : X \to \NN$, then $f$ is a bijection between $X$ and $S = f(X)$. If $S$ is finite, then so is $X$. If $S$ is infinite, then by Lemma 1, there is a bijection $g : S \to \NN$, and thus $X \to^f S = f(X) \to^g \NN$ is a bijection. So (ii) $\implies$ (iii). \\ Plainly (iii) $\implies$ (i), if $X \neq \emptyset$ and there is a surjection $f : \NN \to X$, define $g : X \to \NN$ by $g(a) = \min f^{-1}(\{a\})$, which exists by the Well Ordering Principle. Since $g$ is injective, so by (ii) $\implies$ (i), $X$ is countable, i.e. (iii) $\implies$ (i). \end{proof} \setcounter{customcorollary}{2} \begin{corollary} Any subset of a countable set is countable. \end{corollary} \begin{proof} If $Y \subseteq X$ and $X$ is countable, then take the injection $X \to \NN$ restricted to $Y$. \end{proof} \setcounter{customtheorem}{3} \begin{theorem} $\NN \times \NN$ is countable. \end{theorem} \begin{proof}[1] Define $a_1 = (1,1)$ and $a_n$ inductively by writing \[ a_{n - 1} = (p, q), \qquad a_n = \begin{cases} (p - 1, q + 1) & \text{$p \neq 1$} \\ (1, p + q) & \text{otherwise} \end{cases} \] \begin{center} \begin{tsqx} ! size(5cm); (-0.2,0)->>(6,0) (0,-0.2)->>(0,6) ! for (int i=1; i < 5; ++i) { ! for (int j=1; j < 5; ++j) { ! dot((i,j)); ! } ! } label $\cdots$ @ (5,1) label $\vdots$ @ (1,5) (1,1)--(2,1)--(1,2)--(3,1)--(2,2)--(1,3) (1,3)--(4,1)--(3,2)--(2,3)--(1,4) \end{tsqx} \end{center} This list includes every point $(x, y) \in \NN \times \NN$ by induction on $x + y$. \end{proof} \bigskip \begin{proof}[2] Define $f : \NN \times \NN \to \NN$, $(x, y) \mapsto 2^x3^y$. Then $f$ is injective. \end{proof} \setcounter{customcorollary}{4} \begin{corollary} $\ZZ \times \ZZ$ is countable. \end{corollary} \begin{proof} Since $\ZZ$ is countable, there is an injection $\ZZ \to \NN$, so because $\NN \times \NN$ is countable, we have an injection \[ \ZZ \times \ZZ \to \NN \times \NN \to \NN .\] \end{proof} \noindent By induction, $\ZZ^k$ is countable for any $k \in \NN$. \setcounter{customtheorem}{5} \begin{theorem} A countable union of countable sets is countable. \end{theorem} \begin{proof}[1] May assume that our countable sets are indexed by $\NN$, so given countable sets $A_1, A_2, A_3, \dots$, we wish to show $\bigcup_{n \in \NN} A_n$ is countable. \\ For each $i \in \NN$, since $A_i$ is countable, may list its elements as \[ a_1^{(i)}, a_2^{(i)}, a_3^{(i)}, \dots \] (might terminate). Define \[ f : \bigcup_{n \in \NN} A_n \to \NN, \qquad x \mapsto 2^i 3^j .\] where $x = a_j^{(i)}$ for the least $i$ satisfying $x \in A_i$ (as $x$ could be in more than one of the $A_i$). This is an injection. \end{proof} \begin{proof}[2] Let $I$ be a countable index set, and for each $i \in I$, $A_i$ is a countable set. Since $I$ is countable, there is an injection $f : I \to \NN$, and for each $i \in I$, since $A_i$ is countable, there is an injection $g_i : A_i \to \NN$. We construct an injection $h : A = \bigcup_{i \in I} A_i \to \NN \times \NN$ as follows: for each $x \in A$, pick $m_x = \min\{j \in \NN : x \in A_i, f(i) = j\}$, which exists by Well Ordering Principle. Let $i_x$ be such that $f(i_x) = m_x$ ($i_x$ is unique because $f$ is injective). Set $h(x) = (m_x, g_{i_x}(x))$. This $h$ is an injection. \end{proof} \begin{example*} \[ \QQ = \bigcup_{n \in \NN} \frac{1}{n} \ZZ = \bigcup_{n \in \NN} \left\{ \frac{m}{n} : m \in \ZZ \right\} ,\] so $\QQ$ is a countable union of countable sets, hence countable. \end{example*} \begin{theorem} The set $\Abb$ of algebraic numbers is countable. \end{theorem} \begin{proof} It suffices to show that the set of all polynomials with integer coefficients is countable, as then $\Abb$ is a countable union of finite sets, so by Theorem 6, is countable. \\ In fact, it suffices to show that for each $d \in \NN$, the set $P_d$ of all integer polynomials of degree $d$ is countable, again by Theorem 6. \\ But the map $P_d \to \ZZ^{d + 1}$ by \[ p(x) = a_d x^d + a_{d - 1}x^{d - 1} + \cdots + a_1x + a_0 \mapsto (a_d, a_{d - 1}, \dots, a_1, a_0) \] is an injection, so since $\ZZ^{d + 1}$ is countable, $P_d$ is countable. \end{proof} A set is \emph{uncountable} if it is not countable. Do uncountable sets exists? \begin{theorem} $\RR$ is uncountable. \end{theorem} \begin{proof} If $\RR$ were countable, we would be able to list all the reals as $r_1, r_2, r_3, \dots$. Write each $r_n$ in decimal form in some way. \[ r_1 = n_1.d_{11}d_{12}d_{13}d_{14}\dots \] \[ r_2 = n_2.d_{21}d_{22}d_{23}d_{24}\dots \] \[ r_3 = n_3.d_{31}d_{32}d_{33}d_{34}\dots \] \[ \vdots \] Define $r = 0.d_1d_2d_3\dots$ by \[ d_n = \begin{cases} 1 & \text{if $d_{nn} \neq 1$} \\ 2 & \text{if $d_{nn} = 1$} \end{cases} \] This $r$ has only one decimal expansion and is not on the list (because $\forall\,\, n \in \NN$, $r \neq r_n$). This contradicts the assumption that $\RR$ is countable. \end{proof} \noindent This is known as a ``diagonal argument'', due to Cantor (1875). Note that it in fact shows that $(0, 1)$ is uncountable. \setcounter{customcorollary}{8} \begin{corollary} There are uncountably many transcendental numbers. \end{corollary} \begin{proof} If $\RR \setminus \Abb$ were countable, then since $\Abb$ is countable, $\RR = \RR \setminus \Abb \cup \Abb$ would be countable. \contradiction \end{proof} \setcounter{customtheorem}{9} \begin{theorem} $\mathcal{P}(\NN)$ is uncountable. \end{theorem} \begin{proof}[1] If $\mathcal{P}(\NN)$ were countable, we could list the subsets of $\NN$ as $S_1, S_2, S_3, \dots$. Let $S = \{n \in \NN : n \not\in S_n\}$. Then $S$ is not on our list since $\forall\,\, n \in \NN$, $S \neq S_n$ (as $S$ and $S_n$ differ in their membership of the element $n$). \contradiction Hence $\mathcal{P}(\NN)$ is uncountable. \end{proof} Note that this is again a ``diagonal argument''. \begin{proof}[2] Note that there is an injection from $(0, 1)$ into $\mathcal{P}(\NN)$: write $x \in (0, 1)$ in binary $0.x_1x_2x_3$ with $x_i \in \{0, 1\}$ (not ending in an infinite string of 1s) and set $f(x) = \{n : n : x_n = 1\}$, for example \[ 0.11101000\dots \mapsto \{1, 2, 3, 5\} .\] This is an injection. \end{proof} \bigskip \noindent In fact, Proof 1 of Theorem 10 shows that following. \begin{theorem} For any set $X$, there is no bijection between $X$ and $\mathcal{P}(X)$. \end{theorem} \begin{proof} Given any function $f : X \to \mathcal{P}(X)$, we shall show that $f$ is not a surjection. Indeed, let \[ S = \{x \in X : x \not\in f(x)\} .\] Then $S$ does not belong to the image of $f$, since $\forall\,\,x \in X$, $S$ and $f(x)$ differ in the element $x$, and thus $S \neq f(x)$. \end{proof} \subsubsection*{Remarks} \begin{enumerate}[(1)] \item This is reminiscent of Russell's Paradox. \item In fact, it gives another proof that there is no universal set. For suppose we had such a universal set $V$, then we would have $\mathcal{P}(V) \subseteq V$, in which case there would certainly be a surjection from $V$ to $\mathcal{P}(V)$. \end{enumerate} \begin{example*} Let $\{A_i : i \in I\}$ be a family of open intervals of $\RR$ which are pairwise disjoint. Must the family be countable? Note we can't simply count them from left to right; there isn't necessarily a clear choice for the ``next'' interval, and there is no guarantee that we will count all of them. The family $\{A_i : i \in I\}$ is nevertheless countable. \end{example*} \begin{proof}[1] Each interval $A_i$ contains a rational, and $\QQ$ is countable, so since the intervals are disjoint, we have an injection from $I$ into $\QQ$. Hence the family $\{A_i : i \in I\}$ is countable. \end{proof} \bigskip \begin{proof}[2] The set $\{i \in I : \text{$A_i$ has length $\ge 1$}\}$ is countable as it injects into $\ZZ$. Similarly, the set $\{i \in I : \text{$A_i$ has length $\ge \half$}\}$ is countable as it injects into $\half \ZZ$. More generally, for each $n \in \NN$, $\{i \in I : \text{$A_i$ has length $\ge \frac{1}{n}$}\}$ is countable. Now $\{A_i : i \in I\}$ is countable as it is a countable union of countable sets. \end{proof} \subsubsection*{Summary} To show that $X$ is uncountable \begin{enumerate}[(1)] \item Run a diagonal argument on $X$; \item Inject your favourite uncountable set into $X$. \end{enumerate} To show that $X$ is countable: \begin{enumerate}[(1)] \item list it (may be fiddly); \item inject it into $\NN$; \item use ``countable unions of countable sets are countable''; \item if ``in/near'' $\RR$, consider $\QQ$. \end{enumerate} \bigskip \noindent Intuitively, we think of ``$A$ bijects with $B$'' as saying that ``$A$ and $B$ are of the same size'', ``$A$ injects into $B$'' as saying that ``$A$ is at most as big as $B$'', and ``$A$ surjects onto $B$'' as saying that ``$A$ is at least as big as $B$'' (for $B \neq \emptyset$). For these interpretations to make sense, we need that if ``$A$ is at most as big as $B$'', then ``$B$ is at least as big as $A$'', and conversely. \setcounter{customlemma}{11} \begin{lemma} Given non-empty sets $A$ and $B$, $\exists\,\, \text{injection} f : A \to B \iff \exists\,\, \text{surjection} g : B \to A$. \end{lemma} \begin{proof} Suppose $f : A \to B$ is injective. Fix $a_0 \in A$. Define \[ g : B \to A, \qquad b \mapsto \begin{cases} \text{unique $a \in A$ such that $f(a) = b$} & \text{if it exists} \\ a_0 & \text{otherwise} \end{cases} \] Then $g$ is surjective. \\ Conversely, suppose $g : B \to A$ is surjective. Define \[ f : A \to B, \qquad a \mapsto \text{some $b \in B$ such that $g(b) = a$.} \] Then $f$ is injective. \end{proof} \setcounter{customtheorem}{12} \begin{theorem}[Schr\"oder-Bernstein Theorem] If $f : A \to B$ and $g : B \to A$ are injections, then $\exists$ bijection $h : A \to B$. \end{theorem} \begin{proof} For $a \in A$, write $g^{-1}(a)$ for the $b \in B$ (if it exists) such that $g(b) = a$. Similarly, for $b \in B$, write $f^{-1}(b)$ for the $a \in A$ (if it exists) such that $f(a) = b$. \\ We call $g^{-1}(a), f^{-1}(g^{-1}(a)), g^{-1}(f^{-1}(g^{-1}(a))), \dots$ the ancestor sequence of $a \in A$ (might terminate). Similarly, we can determine the ancestor sequence of $b \in B$. Define \begin{align*} A_0 &= \{a \in A : \text{ancestor sequence of $a$ stops at an even time, i.e. last point is in $A$.}\} \\ A_1 &= \{a \in A : \text{ancestor sequence of $a$ stops at an even time, i.e. last point is in $B$}\} \\ A_\infty &= \{a \in A : \text{ancestor sequence does not stop}\} \end{align*} Similarly, define $B_0, B_1, B_\infty$. Note that $f$ bijects $A_0$ with $B_1$ (observing that every $b \in B$ has at least one ancestor, so is $f(a)$ for some $a \in A_0$), and similarly, $g$ bijects $B_0$ with $A_1$. And $f$ (or $g$) biject $A_\infty$ with $B_\infty$. Then the function $h : A \to B$ defined as \[ a \mapsto \begin{cases} f(a) & \text{if $a \in A_0$} \\ g^{-1}(a) & \text{if $a \in A_1$} \\ f(a) & \text{if $a \in A_\infty$} \end{cases} \] is a bijection. \end{proof} \bigskip \noindent This means that we have that if ``$A$ is at most as big as $B$'' and ``$B$ is at most as big as $A$'', then ``$A$ is of the same size as $B$''. \begin{example*} Is there a bijection from $[0, 1]$ to $[0, 1] \cup [2, 3]$? \\ Observe we have an injection $f : [0, 1] \to [0, 1] \cup [2, 3]$ by using $x \mapsto x$ and an injection $g : [0, 1] \cup [2, 3] \to [0, 1]$ using $x \mapsto \frac{x}{3}$, so by Schr\"oder-Bernstein there is a bijection between $[0, 1]$ and $[0, 1] \cup [2, 3]$. \end{example*} \noindent It would also be nice to be able to say that for any two sets $A$ and $B$, either $A$ injects into $B$ or $B$ injects into $A$. This is true, but harder to prove (see Part II Logic \& Set Theory). \bigskip \noindent \textbf{Question} Does every set $X$ inject into one of \[ \NN, \mathcal{P}(\NN), \mathcal{P}(\mathcal{P}(\NN)), \mathcal{P}(\mathcal{P}(\mathcal{P}(\NN))), \dots ?\] No, for example consider \[ X = \NN \cup \mathcal{P}(\NN) \cup \mathcal{P}(\mathcal{P}(\NN)) \cup \cdots \] Does every set $X'$ inject into one of \[ X, \mathcal{P}(X), \mathcal{P}(\mathcal{P}(X)), \mathcal{P}(\mathcal{P}(\mathcal{P}(X))), \dots ?\] No, for example consider \[ X' = X \cup \mathcal{P}(X) \cup \mathcal{P}(\mathcal{P}(X)) \cup \cdots \] Does every set $X''$ inject into one of \[ X', \mathcal{P}(X'), \mathcal{P}(\mathcal{P}(X')), \mathcal{P}(\mathcal{P}(\mathcal{P}(X'))), \dots ?\] No, for example consider \[ X'' = X' \cup \mathcal{P}(X') \cup \mathcal{P}(\mathcal{P}(X')) \cup \cdots \] Does every set $Y$ inject into one of $X, X', X'', \dots$? \\ No, for example \[ Y = X \cup X' \cup X'' \cup \cdots \] \newpage \section*{Panorama} \begin{itemize} \item II Logic \& Set Theory \item IA Analysis \item IB Groups, Rings and Modules \item II Number Theory \end{itemize} \newpage \begin{center} \bfseries\LARGE Chapter V: More about primes (non-examinable) \end{center} \resetcounters \newpage \noindent Bertrand postulated in 1845 that for every $n \in \NN$, there is always a prime between $n$ and $2n$, i.e. $n \le p < 2n$. The primes 2, 5, 11, 23, 47, 89, 179, 359, 719, 1439, 2879 show it to be true for $n \le 2^{11}$. Bertrand checked it for $n < 3,000,000$. Chebychev (1850) gave a proof. Erd\"os (1932) have an elementary proof based on the properties of ${2n \choose n}$. \begin{observation} \[ {2n \choose n} \ge \frac{2^{2n}}{2n + 1} \] \end{observation} \begin{proof} Since \[ \frac{{n \choose k + 1}}{{n \choose k}} = \frac{n - k}{k + 1} ,\] it is evident that ${n \choose k}$ increases for $k < \frac{n}{2}$, and decreases for $k > \frac{n}{2}$. In particular, ${2n \choose n}$ is the largest binomial coefficient, so \[ {2n \choose n} \ge \frac{\sum_{k = 0}^{2n} {2n \choose k}}{2n + 1} = \frac{2^{2n}}{2n + 1} \] \end{proof} \begin{observation} If $p \le n$ is a prime dividing ${2n \choose n}$, then $p \le \frac{2n}{3}$. \end{observation} \begin{proof} Suppose $\frac{2n}{3} < p \le n$, then \[ p \le n < 2p \le 2n < 3p \] so the numerator and denominator of \[ \frac{2n(2n - 1) \cdots (n + 1)}{n(n - 1) \cdots 3 \cdot 2 \cdot 1} \] are divisible by exactly one copy of $p$. \textit{Correction: this is only true assuming $p > 3$ or $n > 3$, in order to make sure we don't get any multiples of $p^2$.} \contradiction \end{proof} \begin{observation} If $p$ is a prime and $p^k \,\big|\, {2n \choose n}$, then $p^k \le 2n$. \end{observation} \begin{proof} The greatest power of $p$ dividing $n! = n(n - 1) \cdots 3 \cdot 2 \cdot 1$. \[ \ub{\left\lfloor \frac{n}{p} \right\rfloor}_{\substack{\text{multiples of} \\p \le n}} + \ub{\left\lfloor \frac{n}{p^2} \right\rfloor}_{\substack{\text{multiples of} \\p^2 \le n}} + \left\lfloor \frac{n}{p^3} \right\rfloor + \cdots = \sum_{i \ge 1} \frac{n}{p^i} \] Hence, if $k$ is a power of $p$ dividing ${2n \choose n} = \frac{2n!}{(n!)^2}$, then \begin{align*} k &= \sum_{i \ge 1} \left\lfloor \frac{2n}{p^i} \right\rfloor - 2 \sum_{i \ge 1} \left\lfloor \frac{n}{p^i} \right\rfloor \\ &= \sum_{i = 1}^l \left( \left\lfloor \frac{2n}{p^i} \right\rfloor - 2 \left\lfloor \frac{n}{p^i} \right\rfloor \right) &&\text{where $l$ is the greatest power of $p$ such that $p^l \le 2n$.} \\ &\le \sum_{i = 1}^l 1 &&\text{since $\lfloor 2x \rfloor - 2 \lfloor x \rfloor \le 1$} \\ &= l \end{align*} so $k \le l$ and thus $p^k \le p^l < 2n$. \end{proof} \begin{observation} For all $m \in \NN$, \[ \prod_{\substack{p \le m\\\text{$p$ prime}}} p \le 4^m .\] \end{observation} \begin{proof} By induction on $m$. True for $m = 2$. If $m > 2$ is even, then \[ \prod_{p \le m} p = \prod_{p \le m - 1} p \le 4^{m - 1} < 4^m .\] If $m = 2k + 1$ is odd, then all primes $k + 2 \le p \le 2k + 1$ divide \[ {2k + 1 \choose k} = \frac{(2k + 1)!}{k!(k + 1)!} = \frac{(2k + 1) \cdot 2k \cdots (k + 2)}{k \cdot (k - 1) \cdots 3 \cdot 2 \cdot 1} \] Thus, \[ \prod_{k + 2 \le p \le 2k + 1} p \le {2k + 1 \choose k} = {2k + 1 \choose k + 1} \le \frac{2^{2k + 1}}{2} = 4^k .\] By the inductive hypothesis, \[ \prod_{p = m} p = \prod_{p \le k + 1} p \cdot \prod_{k + 2 \le p \le 2k + 1} p \le 4^{k + 1} \cdot 4^k = 4^{2k + 1} . \qedhere\] \end{proof} \setcounter{customtheorem}{4} \begin{theorem}[Bertrand's Postulate] For all $n \in \NN$, there exists a prime $p$ with $n \le p < 2n$. \end{theorem} \begin{proof} Clearly the primes factors of ${2n \choose n}$ are all less than $2n$ (assuming $n > 1$ so that $2n$ is not prime). Suppose the theorem fails. Then all prime factors of ${2n \choose n}$ are in fact less than $n$. But by Observation 2, they are all less than $\frac{2n}{3}$. Consider the prime factorisation of ${2n \choose n}$. By Observation 3, each prime contributes at most $2n$ to the factorisation. Moreover, if $p > \sqrt{2n}$, then $p$ contributes at most $p$ to the factorisation (since $p^2 > 2n$). Now by Observation 1 and the above \begin{align*} \frac{2^{2n}}{2n + 1} &\le {2n \choose n} \\ &\le \prod_{p \le \sqrt{2n}} 2n \prod_{\sqrt{2n} < p \le 2n / 3} p \\ &\le (2n)^{\sqrt{2n}} \cdot \prod_{p < 2n / 3} p \end{align*} But by Observation 4, \[ \prod_{p < 2n / 3} p \le 4^{2n / 3} .\] so \[ \frac{4^n}{2n + 1} \le (2n)^{\sqrt{2n}} \cdot 4^{2n / 3} ,\] Which fails when $n$ is large. How large? This is equivalent to \[ 4^{n / 3} \le (2n + 1)(2n)^{\sqrt{2n}} \] and $2n + 1 \le (2n)^2 \le (2n)^{\sqrt{2n} / 3}$ for $n \ge 18$. So \[ 4^{n / 3} \le (2n)^{4\sqrt{2n} / 3} \] or \[ 4^n \le (2n)^{4\sqrt{2n}} \] With $r = \sqrt{2n}$, this is \[ 4^{r^2 / 2} \le r^{8r} \] or \[ 4^r \le r^{16} \] which fails when $r = 2^6 = 64$ and larger. So proof holds when $n \ge 2^{11}$, and also true for smaller values of $n$. \end{proof} \end{document}