├── .gitignore ├── LICENSE ├── README.md ├── clean.sh ├── latex-clean.sh └── latex ├── COMP0147-Notes.pdf ├── COMP0147-Notes.tex ├── ch-binary-relations.tex ├── ch-counting.tex ├── ch-euclidean-algorithm.tex ├── ch-functions.tex ├── ch-groups.pdf ├── ch-groups.tex ├── ch-linear-algebra.tex ├── ch-permutations.tex ├── ch-set-theory.tex ├── citations.bib ├── font-cfg.tex ├── math-ops.tex ├── theorem-cfg.tex └── utils.tex /.gitignore: -------------------------------------------------------------------------------- 1 | ## Core latex/pdflatex auxiliary files: 2 | *.aux 3 | *.lof 4 | *.log 5 | *.lot 6 | *.fls 7 | *.out 8 | *.toc 9 | *.fmt 10 | *.fot 11 | *.cb 12 | *.cb2 13 | .*.lb 14 | *.mtc 15 | 16 | ## Intermediate documents: 17 | *.dvi 18 | *.xdv 19 | *-converted-to.* 20 | # these rules might exclude image files for figures etc. 21 | # *.ps 22 | # *.eps 23 | # *.pdf 24 | 25 | ## Generated if empty string is given at "Please type another file name for output:" 26 | .pdf 27 | 28 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 29 | *.bbl 30 | *.bcf 31 | *.blg 32 | *-blx.aux 33 | *-blx.bib 34 | *.run.xml 35 | 36 | ## Build tool auxiliary files: 37 | *.fdb_latexmk 38 | *.synctex 39 | *.synctex(busy) 40 | *.synctex.gz 41 | *.synctex.gz(busy) 42 | *.pdfsync 43 | 44 | ## Auxiliary and intermediate files from other packages: 45 | # algorithms 46 | *.alg 47 | *.loa 48 | 49 | # achemso 50 | acs-*.bib 51 | 52 | # amsthm 53 | *.thm 54 | 55 | # beamer 56 | *.nav 57 | *.pre 58 | *.snm 59 | *.vrb 60 | 61 | # changes 62 | *.soc 63 | 64 | # cprotect 65 | *.cpt 66 | 67 | # elsarticle (documentclass of Elsevier journals) 68 | *.spl 69 | 70 | # endnotes 71 | *.ent 72 | 73 | # fixme 74 | *.lox 75 | 76 | # feynmf/feynmp 77 | *.mf 78 | *.mp 79 | *.t[1-9] 80 | *.t[1-9][0-9] 81 | *.tfm 82 | 83 | #(r)(e)ledmac/(r)(e)ledpar 84 | *.end 85 | *.?end 86 | *.[1-9] 87 | *.[1-9][0-9] 88 | *.[1-9][0-9][0-9] 89 | *.[1-9]R 90 | *.[1-9][0-9]R 91 | *.[1-9][0-9][0-9]R 92 | *.eledsec[1-9] 93 | *.eledsec[1-9]R 94 | *.eledsec[1-9][0-9] 95 | *.eledsec[1-9][0-9]R 96 | *.eledsec[1-9][0-9][0-9] 97 | *.eledsec[1-9][0-9][0-9]R 98 | 99 | # glossaries 100 | *.acn 101 | *.acr 102 | *.glg 103 | *.glo 104 | *.gls 105 | *.glsdefs 106 | 107 | # gnuplottex 108 | *-gnuplottex-* 109 | 110 | # gregoriotex 111 | *.gaux 112 | *.gtex 113 | 114 | # htlatex 115 | *.4ct 116 | *.4tc 117 | *.idv 118 | *.lg 119 | *.trc 120 | *.xref 121 | 122 | # hyperref 123 | *.brf 124 | 125 | # knitr 126 | *-concordance.tex 127 | # TODO Comment the next line if you want to keep your tikz graphics files 128 | *.tikz 129 | *-tikzDictionary 130 | 131 | # listings 132 | *.lol 133 | 134 | # makeidx 135 | *.idx 136 | *.ilg 137 | *.ind 138 | *.ist 139 | 140 | # minitoc 141 | *.maf 142 | *.mlf 143 | *.mlt 144 | *.mtc[0-9]* 145 | *.slf[0-9]* 146 | *.slt[0-9]* 147 | *.stc[0-9]* 148 | 149 | # minted 150 | _minted* 151 | *.pyg 152 | 153 | # morewrites 154 | *.mw 155 | 156 | # nomencl 157 | *.nlg 158 | *.nlo 159 | *.nls 160 | 161 | # pax 162 | *.pax 163 | 164 | # pdfpcnotes 165 | *.pdfpc 166 | 167 | # sagetex 168 | *.sagetex.sage 169 | *.sagetex.py 170 | *.sagetex.scmd 171 | 172 | # scrwfile 173 | *.wrt 174 | 175 | # sympy 176 | *.sout 177 | *.sympy 178 | sympy-plots-for-*.tex/ 179 | 180 | # pdfcomment 181 | *.upa 182 | *.upb 183 | 184 | # pythontex 185 | *.pytxcode 186 | pythontex-files-*/ 187 | 188 | # thmtools 189 | *.loe 190 | 191 | # TikZ & PGF 192 | *.dpth 193 | *.md5 194 | *.auxlock 195 | 196 | # todonotes 197 | *.tdo 198 | 199 | # easy-todo 200 | *.lod 201 | 202 | # xmpincl 203 | *.xmpi 204 | 205 | # xindy 206 | *.xdy 207 | 208 | # xypic precompiled matrices 209 | *.xyc 210 | 211 | # endfloat 212 | *.ttt 213 | *.fff 214 | 215 | # Latexian 216 | TSWLatexianTemp* 217 | 218 | ## Editors: 219 | # WinEdt 220 | *.bak 221 | *.sav 222 | 223 | # Texpad 224 | .texpadtmp 225 | 226 | # Kile 227 | *.backup 228 | 229 | # KBibTeX 230 | *~[0-9]* 231 | 232 | # auto folder when using emacs and auctex 233 | ./auto/* 234 | *.el 235 | 236 | # expex forward references with \gathertags 237 | *-tags.tex 238 | 239 | # standalone packages 240 | *.sta 241 | 242 | # generated if using elsarticle.cls 243 | *.spl 244 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 许杰友 Jieyou Xu (Joe) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # COMP0147 Discrete Mathematics for Computer Scientists Notes 2 | Notes for UCL COMP0147 Discrete Mathematics Course. Latest compiled PDF version available at (https://github.com/jieyouxu/COMP0147-Discrete-Mathematics-Notes/releases). 3 | 4 | ## Core Topics 5 | - Foundations 6 | + Sets 7 | + Binary Relations 8 | + Equivalence Relations 9 | + Modular Arithmetics 10 | + Functions 11 | + Injections 12 | + Surjections 13 | + Bijections 14 | + Cardinality of Sets 15 | + Groups 16 | + Symmetric Group 17 | + Permutations 18 | + Sign of Permutations 19 | + Order of Permutations 20 | + Abstract Groups 21 | + Lagrange's Theorem 22 | + Euclid's Algorithm 23 | * Solving Linear Congruences 24 | * Fermat's Little Theorem 25 | * Euler Totient Function 26 | * Application of Public Key Cryptography 27 | - Linear Algebra 28 | + Correspondence between Linear Maps and Matrices 29 | + Associativity and Non-commutativity of Matrix Manipulation 30 | + Gaussian Elimination 31 | + Inverting Matrices 32 | + Determinants 33 | + Eigenvalues and Eigenvectors 34 | - Counting 35 | + Counting Fundamental Principles 36 | + Multiplication Principle 37 | + Inclusion-exclusion Principle 38 | -------------------------------------------------------------------------------- /clean.sh: -------------------------------------------------------------------------------- 1 | ./latex-clean.sh latex 2 | -------------------------------------------------------------------------------- /latex-clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | arg=${1:-.} 4 | exts="aux bbl blg brf idx ilg ind lof log lol lot out toc synctex.gz maf mtc mtc0 mtc1 mtc2 run.xml .bib" 5 | 6 | if [ -d $arg ]; then 7 | for ext in $exts; do 8 | rm -f $arg/*.$ext 9 | done 10 | 11 | rm -f $arg/*-blx.bib 12 | else 13 | for ext in $exts; do 14 | rm -f $arg.$ext 15 | done 16 | 17 | rm -f $arg-blx.bib 18 | fi 19 | -------------------------------------------------------------------------------- /latex/COMP0147-Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jieyouxu/COMP0147-Discrete-Mathematics-Notes/e59483b863c93c3fe253ec23740bb876e789dfac/latex/COMP0147-Notes.pdf -------------------------------------------------------------------------------- /latex/COMP0147-Notes.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper, twoside, headsepline]{scrbook} 2 | 3 | \usepackage{amsmath} 4 | \usepackage{amsthm} 5 | \usepackage{amssymb} 6 | \usepackage{enumitem} 7 | \usepackage{mathtools} 8 | \usepackage{geometry} 9 | \usepackage{float} 10 | \usepackage{booktabs} 11 | 12 | % Quotes and Citations 13 | \usepackage[utf8]{inputenc} 14 | \usepackage{babel} 15 | \usepackage[autostyle, style=english]{csquotes} 16 | \usepackage[style=numeric, backend=bibtex, block=ragged, sorting=none]{biblatex} 17 | \addbibresource{citations.bib} 18 | 19 | % Links 20 | \usepackage[hidelinks, breaklinks]{hyperref} 21 | 22 | % Fonts 23 | \input{font-cfg.tex} 24 | 25 | % Math 26 | \input{math-ops.tex} 27 | 28 | % Enumitem 29 | \setlist{nolistsep} 30 | 31 | % Utils 32 | \input{utils.tex} 33 | 34 | % Theorems, Corollary, Lemma, Remark 35 | \input{theorem-cfg.tex} 36 | 37 | % Title and Author 38 | \title{COMP0147 Discrete Mathematics for Computer Scientists Notes} 39 | \author{Joe} 40 | 41 | \begin{document} 42 | \newgeometry{centering} %%% Center title page 43 | \maketitle 44 | \restoregeometry 45 | \blankpage 46 | 47 | %% Acknowledgements 48 | Notes adapted from: 49 | \begin{itemize} 50 | \item Lecture notes by Max Kanovich and Robin Hirsch \cite{kanovich-hirsch}. 51 | \item \textit{A First Course in Abstract Algebra} by Joseph J. Rotman \cite{rotman}. 52 | \end{itemize} 53 | 54 | %% Table of Contents 55 | \tableofcontents 56 | 57 | %% Content 58 | \input{ch-set-theory.tex} 59 | \input{ch-functions.tex} 60 | \input{ch-permutations.tex} 61 | \input{ch-binary-relations.tex} 62 | \input{ch-groups.tex} 63 | \input{ch-euclidean-algorithm.tex} 64 | \input{ch-linear-algebra.tex} 65 | \input{ch-counting.tex} 66 | 67 | %% Bibliography 68 | \printbibliography 69 | 70 | \end{document} 71 | -------------------------------------------------------------------------------- /latex/ch-binary-relations.tex: -------------------------------------------------------------------------------- 1 | \chapter{Binary Relations} 2 | 3 | \begin{definition}[Binary Relation] 4 | A binary relation $R(x, y)$ describes some relationship between $x$ and $y$ where $R \colon X \to Y$, $R \subseteq X \times Y$, $x \in X$ and $y \in Y$. This relation can be expressed in infix notation as $xRy$. 5 | \end{definition} 6 | 7 | \section{Equivalence Relations} 8 | \begin{definition}[Equivalence Relation] 9 | A binary relation $E(x, y)$ is an \textit{equivalence relation} on $X$ iff it satisfies all three conditions: 10 | \begin{enumerate} 11 | \item \textbf{Reflexivity} 12 | \subitem $\Forall x \in X \colon E(x, x)$ 13 | \item \textbf{Symmetry} 14 | \subitem $\Forall x, y \in X \colon E(x, y) \to E(y, x)$ 15 | \item \textbf{Transitivity} 16 | \subitem $\Forall x, y, z \in X \colon E(x, y) \land E(y, z) \to E(x, z)$ 17 | \end{enumerate} 18 | \end{definition} 19 | 20 | \section{Equivalence Classes} 21 | \begin{definition}[Equivalence Class] 22 | If $a \in X$, the \textit{equivalence class} $[a]$ is 23 | \begin{equation} 24 | [a] \coloneqq \set{x \in X \colon E(x, a)} \subseteq X 25 | \end{equation} 26 | \end{definition} 27 | 28 | \begin{definition}[Congruence and Equivalence Class of mod $m$ on $\Int$] 29 | For \textit{congruence mod} $m$ on $\Int$, if $a \in \Int$ then the \textit{congruence class} of $a$ is 30 | \begin{equation} 31 | [a]_m \coloneqq \set{x \in \Int \colon x = a + km} 32 | \end{equation} 33 | Where $k \in \Int$. Since $x = a + km \Leftrightarrow x \equiv a \bmod m$, then the \textit{equivalence class} of $a$ is also the \textit{congruence class}. 34 | \begin{equation} 35 | \Leftrightarrow [a]_m \coloneqq \set{x \in \Int \colon x \equiv a \bmod m} 36 | \end{equation} 37 | \end{definition} 38 | 39 | \begin{definition}[Set of Remainders] 40 | Over $\Int$, the \textit{remainder} $r$ from the integer division $k \div m$ is \begin{equation} 41 | r \bmod m \equiv k \bmod m 42 | \end{equation} 43 | Then the set of remainders $G_m$ from the integer division $k \div m$ is defined by 44 | \begin{equation} 45 | G_m \coloneqq \set{0, 1, 2, \dots, m - 2, m - 1} 46 | \end{equation} 47 | \end{definition} 48 | 49 | \section{Quotient Groups} 50 | \begin{definition}[Quotient Group] 51 | A \textit{quotient group} is a group constructed via congruence mod $m$. 52 | \end{definition} 53 | 54 | \begin{definition}[Congruence Class] 55 | If $m \ge 2$ and $a \in \Int$ then the \textit{congruence class} of $a \bmod m$ is $[a] \subseteq \Int$ 56 | \begin{align} 57 | [a] &\coloneqq \set{b \in \Int \colon b \equiv a \bmod m} \\ 58 | & \Leftrightarrow \set{a + km \colon k \in \Int} \\ 59 | & \Leftrightarrow \set{\dots, a - 2m, a - m, a, a + m, a + 2m, \dots} 60 | \end{align} 61 | \end{definition} 62 | 63 | \begin{remark} 64 | Let $E(x, y) \coloneqq \enquote{x - y \equiv 0 \bmod 2}$, that is, $x - y$ is divisible by $2$. Then, 65 | \begin{equation} 66 | [k]_2 \coloneqq \set{y \colon E(k, y)} 67 | \end{equation} 68 | 69 | Where $[k]_2$ is the congruence class of integers modulo $2$. 70 | 71 | Computing $[0]_2$ and $[1]_2$ yields 72 | \begin{itemize} 73 | \item $[0]_2 = \set{0, 2, -2, 4, -4, \dots, 2n, -2n, \dots}$ 74 | \item $[1]_2 = \set{1, -1, 3, -3, \dots, 2n + 1, \dots}$ 75 | \end{itemize} 76 | 77 | Observe that 78 | \begin{equation} 79 | [1]_2 \oplus [1]_2 \Leftrightarrow [2]_2 \Leftrightarrow [0]_2 80 | \end{equation} 81 | 82 | It can be deduced that $[0]_2$ and $[1]_2$ are two congruence (and equivalence) classes which partition the integers $\Int$ into two disjoint subsets -- integers which are odd, and integers which are even. This may be denoted as 83 | \begin{equation} 84 | \Int/E \equiv \set{\mathrm{EVEN}, \mathrm{ODD}} 85 | \end{equation} 86 | \end{remark} 87 | 88 | \begin{definition}[Congruence Modular Arithmetic $\pmod m$ on $\Int$] 89 | \begin{align} 90 | [a]_m \oplus [b]_m &\equiv [a + b]_m \\ 91 | [a]_m \otimes [b]_m &\equiv [a \cdot b]_m 92 | \end{align} 93 | 94 | If $a_1 \equiv a_2 \bmod m$ and $b_1 \equiv b_2 \bmod m$ then 95 | \begin{align} 96 | a_1 + b_1 &\equiv a_2 + b_2 \bmod m \\ 97 | a_1 \cdot b_1 &\equiv a_2 \cdot b_2 \bmod m \\ 98 | \end{align} 99 | \end{definition} 100 | 101 | \begin{remark} 102 | We may introduce addition ($+$) and multiplication ($\ast$) over the remainders $G_m$ previously defined as 103 | \begin{equation} 104 | G_m \coloneqq \set{0, 1, 2, \dots, m - 2, m - 1} 105 | \end{equation} 106 | 107 | For example, given $m = 3$, then the multiplication and addition table of $+ \pmod 3$ and $\ast \pmod 3$ over $G_3$ can be computed: 108 | \begin{table}[H] 109 | \centering 110 | \begin{tabular}{ l | l l l } 111 | \toprule 112 | $+ \pmod 3$ & 0 & 1 & 2 \\ 113 | \midrule 114 | 0 & 0 & 1 & 2 \\ 115 | 1 & 1 & 2 & 0 \\ 116 | 2 & 2 & 0 & 1 \\ 117 | \bottomrule 118 | \end{tabular} 119 | \quad 120 | \begin{tabular}{ l | l l l } 121 | \toprule 122 | $* \pmod 3$ & 0 & 1 & 2 \\ 123 | \midrule 124 | 0 & 0 & 0 & 0 \\ 125 | 1 & 0 & 1 & 2 \\ 126 | 2 & 0 & 2 & 1 \\ 127 | \bottomrule 128 | \end{tabular} 129 | \caption{Multiplication and Addition Table of $G_3$} 130 | \end{table} 131 | \end{remark} 132 | -------------------------------------------------------------------------------- /latex/ch-counting.tex: -------------------------------------------------------------------------------- 1 | \chapter{Counting} 2 | 3 | \section{Counting Basics} 4 | 5 | \subsection{Multiplication Principle} 6 | 7 | \begin{definition}[Multiplication Principle] 8 | The \textit{multiplication principle} is used to count number of \textit{tuples} $(t_1, t_2, t_3, \dots)$ where $t_i$ are selected from \textit{independent} sources. 9 | 10 | For any sets $A_1, A_2, \dots, A_n$, their Cartesian product 11 | \begin{equation} 12 | \lvert A_1 \times A_2 \times \cdots \times A_n \rvert \equiv \VSBars{A_1} \cdot \VSBars{A_2} \cdot \cdots \cdot \VSBars{A_n} 13 | \end{equation} 14 | \end{definition} 15 | 16 | \begin{remark} 17 | For the set $E_2 = \set{0, 1}$, 18 | \begin{equation} 19 | \VSBars{{E_2}^3} = \VSBars{E_2 \times E_2 \times E_2} = 2^3 = 8 20 | \end{equation} 21 | \end{remark} 22 | 23 | \begin{remark} 24 | The number of boolean $n$-tuples is $2^n$ 25 | \begin{equation} 26 | \VSBars{E_2^n} = \VSBars{ \underbrace{E_2 \times E_2 \times \cdots \times E_2}_{n} } = 2^n 27 | \end{equation} 28 | \end{remark} 29 | 30 | \begin{proof} 31 | For the Cartesian product $A \times B$ between any sets $A$ and $B$, 32 | \begin{equation} 33 | \VSBars{A \times B} \equiv \VSBars{A} \cdot \VSBars{B} 34 | \end{equation} 35 | \begin{table}[H] 36 | \centering 37 | \begin{tabular}{@{}c | cccc@{}} 38 | \toprule 39 | & $a_1$ & $a_2$ & $\cdots$ & $a_n$ \\ 40 | \midrule 41 | $b_1$ & $(a_1, b_1)$ & $(a_2, b_1)$ & $\cdots$ & $(a_n, b_1)$ \\ 42 | $b_2$ & $(a_1, b_2)$ & $(a_2, b_2)$ & $\cdots$ & $(a_n, b_2)$ \\ 43 | $\vdots$ & $\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ \\ 44 | $b_k$ & $(a_1, b_k)$ & $(a_2, b_k)$ & $\cdots$ & $(a_n, b_k)$ \\ 45 | \bottomrule 46 | \end{tabular} 47 | \end{table} 48 | \end{proof} 49 | 50 | \subsection{Addition Principle} 51 | 52 | \begin{definition}[Addition Principle (Inclusion-Exclusion Principle)] 53 | For any sets $A$ and $B$, 54 | \begin{equation} 55 | \VSBars{A \cup B} \equiv \VSBars{A} + \VSBars{B} - \VSBars{A \cap B} 56 | \end{equation} 57 | \end{definition} 58 | 59 | \begin{remark} 60 | This is used in probability where for any events $A$ and $B$ 61 | \begin{equation} 62 | \Prob{A \lor B} \equiv \Prob{A} + \Prob{B} - \Prob{A \land B} 63 | \end{equation} 64 | \end{remark} 65 | -------------------------------------------------------------------------------- /latex/ch-euclidean-algorithm.tex: -------------------------------------------------------------------------------- 1 | \chapter{Euclidean Algorithm} 2 | 3 | \section{Euclidean Algorithm Basics} 4 | 5 | \begin{definition}[Euclidean Algorithm] 6 | The \textit{Euclidean Algorithm} can be used to compute the \textit{greatest common divisor} of two integers $a, b \in \Int$, denoted $\gcd(a, b)$. 7 | 8 | Its process, given $a \ge b$ is 9 | \begin{align} 10 | a &= q_0 \cdot b + r_1 \\ 11 | b &= q_1 \cdot r_1 + r_2 \\ 12 | r_1 &= q_2 \cdot r_2 + r_3 \\ 13 | &\vdots \nonumber \\ 14 | r_{k - 1} &= q_k \cdot r_k + r_{k + 1} \\ 15 | r_k &= q_{k + 1} \cdot r_{k + 1} + r_{k + 2} \\ 16 | &\vdots \nonumber \\ 17 | r_{n - 1} &= q_n \cdot r_n + r_{n + 1} \\ 18 | r_n &= q_{n + 1} \cdot r_{n + 1} + 0 19 | \end{align} 20 | Such that $\gcd(a, b) \coloneqq r_{n + 1}$. 21 | \end{definition} 22 | 23 | \section{gcd(a, b) as a Linear Combination of a and b} 24 | 25 | \begin{proposition} 26 | Given $a, b \in \Int$, then for some $k_1, k_2 \in \Int$, and some $d \in \Int$, 27 | \begin{equation} 28 | d = \gcd(a, b) = k_1 a + k_2 b 29 | \end{equation} 30 | \end{proposition} 31 | 32 | \begin{remark} 33 | To solve the congruence $4 \ast x = 1 \Mod{17}$ for $x$, find $x$ in the form of $x = \Inverse{4} \Mod{17}$. 34 | 35 | For instance, to find $\gcd(34, 13)$ as a linear combination $k_1 a + k_2 b$, then first use the Euclidean algorithm to find $\gcd(34, 13)$: 36 | \begin{equation} 37 | \left. 38 | \begin{aligned} 39 | 34 &= 2 \cdot 13 + 8 \\ 40 | 13 &= 8 + 5 \\ 41 | 8 &= 5 + 3 \\ 42 | 5 &= 3 + 2 \\ 43 | 3 &= 2 + \boxed{1} \\ 44 | 2 &= 2 \cdot 1 + 0 45 | \end{aligned} 46 | \quad 47 | \right\vert 48 | \quad 49 | \begin{aligned} 50 | a &= 2 \cdot b + r_1 \\ 51 | b &= r_1 + r_2 \\ 52 | r_1 &= r_2 + r_3 \\ 53 | r_2 &= r_3 + r_4 \\ 54 | r_3 &= r_4 + \boxed{r_5} \\ 55 | r_4 &= 2 \cdot r_5 + 0 56 | \end{aligned} 57 | \end{equation} 58 | Note that 59 | \begin{equation} 60 | \begin{aligned} 61 | a &= 2 \cdot b + r_1 \\ 62 | b &= r_1 + r_2 \\ 63 | r_1 &= r_2 + r_3 \\ 64 | r_2 &= r_3 + r_4 \\ 65 | r_3 &= r_4 + \boxed{r_5} \\ 66 | r_4 &= 2 \cdot r_5 + 0 67 | \end{aligned} 68 | \quad 69 | \Leftrightarrow 70 | \quad 71 | \begin{aligned} 72 | r_1 &= a - 2b \\ 73 | r_2 &= b - r_1 \\ 74 | r_3 &= r_1 - r_2 \\ 75 | r_4 &= r_2 - r_3 \\ 76 | \boxed{r_5} &= r_3 - r_4 \\ 77 | \phantom{} &\phantom{} 78 | \end{aligned} 79 | \end{equation} 80 | It is now possible to \textit{collect} $k_1$ and $k_2$ in a bottom-up manner: 81 | \begin{align} 82 | \boxed{r_5} &= r_3 - r_4 \\ 83 | &= r_3 - (r_2 - r_3) \\ 84 | &= -r_2 + 2r_3 \\ 85 | &= -r_2 + 2(r_1 - r_2) \\ 86 | &= 2r_1 - 3r_2 \\ 87 | &= 2r_1 - 3(b - r_1) \\ 88 | &= -3b + 5r_1 \\ 89 | &= -3b + 5(a - 2b) \\ 90 | &= 5a - 13b 91 | \end{align} 92 | Hence $\gcd(34, 13) = gcd(a, b) = 5a - 13b$ for some $a, b \in \Int$. One may verify this by checking that 93 | \begin{equation} 94 | 5 \cdot 34 - 13 \cdot 13 = 170 - 169 = 1 95 | \end{equation} 96 | \end{remark} 97 | 98 | \section{Problems for Integers Modulo m} 99 | 100 | \begin{itemize} 101 | \item $\boxed{a \ast x = b \Mod{m} \Leftrightarrow x = \Inverse{a} \ast b \Mod{m}}$ 102 | \subitem For $\PosRat$, given some $a, b, m \in \Int$ 103 | \begin{align} 104 | a \ast x &= b \Mod{m} \\ 105 | \Leftrightarrow \Inverse{a} \ast a \ast x &= \Inverse{a} \ast b \Mod{m} \\ 106 | \Leftrightarrow x &= \Inverse{a} \ast b \Mod{m} 107 | \end{align} 108 | \item $\boxed{a^n \Mod{m} \Leftrightarrow (a \cdot a^2 \cdot a^4 \cdot a^8, \dots) \Mod{m}}$ 109 | \subitem That is, to decompose the exponent into smaller equivalences, and use identities such as $a^{\VSBars{G^{\times}_{m}}} = 1 \Mod{m}$. 110 | \item $\boxed{x^a = b \Mod{m} \Leftrightarrow x = b^{\Inverse{a}} \Mod{m}}$ 111 | \subitem For $\PosRat$, given some $a, b, m \in \Int$ 112 | \begin{align} 113 | x^a &= b \Mod{m} \\ 114 | x &= \sqrt[a]{b} \Mod{m} \\ 115 | x &= b^{\frac{1}{a}} \Mod{m} \\ 116 | x &= b^{\Inverse{a}} \Mod{m} 117 | \end{align} 118 | \item For the discrete logarithm: $\boxed{a^x = b \Mod{m} \Leftrightarrow x = \log_a{b} \Mod{m}}$ 119 | \end{itemize} 120 | 121 | \section{Multiplicative Group of Integers Modulo m} 122 | 123 | \begin{definition}[Relatively Prime, Coprime] 124 | Two integers $a, b \in \Int$ are \textit{relatively prime} (or \textit{coprime}) if 125 | \begin{equation} 126 | \gcd(a, b) = 1 127 | \end{equation} 128 | \end{definition} 129 | 130 | \begin{definition}[Multiplicative Group of mod $m$] 131 | Given $m \in \Int$, then 132 | \begin{equation} 133 | G^{\times}_{m} \coloneqq \set{a \in \Int \mid (1 \le a < m) \land (\gcd(a, b) = 1)} 134 | \end{equation} 135 | Forms a group $\left( G^{\times}_{m}, \ast \Mod{m} \right)$ under \textit{multiplicative modulo} $m$. 136 | 137 | \begin{enumerate} 138 | \item \textbf{Closure} 139 | \begin{equation} 140 | \Forall a, b, m \in G^{\times}_{m} \colon 141 | (\gcd(a, m) = 1) \land (\gcd(b, m) = 1) \to (\gcd(a \ast b, m) = 1) 142 | \end{equation} 143 | \item \textbf{Associativity} 144 | \subitem Given by multiplication on integers modulo $m$. 145 | \item \textbf{Neutral Element} 146 | \begin{equation} 147 | \Forall m \in G^{\times}_{m} \colon \gcd(1, m) = 1 148 | \end{equation} 149 | \item \textbf{Invertibility} 150 | \begin{equation} 151 | \Forall a \in G^{\times}_{m} \colon \Exists y \in G^{\times}_{m} \colon a \ast y = 1 \Mod{m} 152 | \end{equation} 153 | For which the inverse element $y$ is denoted $\Inverse{a}$, giving 154 | \begin{equation} 155 | \Forall a \in G^{\times}_{m} \colon a \ast \Inverse{a} = 1 \Mod{m} 156 | \end{equation} 157 | \end{enumerate} 158 | \end{definition} 159 | 160 | \begin{theorem}[Euler Totient Function] 161 | Given the \textit{multiplicative modulo group} $G^{\times}_{m}$, then 162 | \begin{equation} 163 | \phi(m) \coloneqq \lvert G^{\times}_{m} \rvert 164 | \end{equation} 165 | \end{theorem} 166 | 167 | \begin{theorem} 168 | If $p$ is prime then 169 | \begin{equation} 170 | \phi(p) \equiv p - 1 171 | \end{equation} 172 | \end{theorem} 173 | 174 | \begin{theorem} 175 | If $p$ is prime and $k \ge 1$ then 176 | \begin{equation} 177 | \phi(p^k) \equiv p^{k - 1}(p - 1) 178 | \end{equation} 179 | \end{theorem} 180 | 181 | \begin{theorem} 182 | If $a, b \in \Int$ and $a, b$ are \textit{relatively prime} (i.e. $\gcd(a, b) = 1$) then 183 | \begin{equation} 184 | \phi(ab) \equiv \phi(a) \phi(b) 185 | \end{equation} 186 | \end{theorem} 187 | 188 | \begin{theorem} 189 | If $a, m \in \Int$ are \textit{relatively prime} (i.e. $\gcd(a, m) = 1$) then 190 | \begin{equation} 191 | a^{\phi(m)} = 1 \Mod{m} 192 | \end{equation} 193 | \end{theorem} 194 | 195 | \begin{theorem}[Fermat's Little Theorem] 196 | Given $p$ is a prime number, then for any $a \in \Int$ 197 | \begin{equation} 198 | a^p \equiv a \Mod{p} 199 | \end{equation} 200 | 201 | Additionally, if $a, p \in \Int$ are \textit{relatively prime}, $\gcd(a, p) = 1$, 202 | \begin{equation} 203 | a^{p - 1} \equiv 1 \Mod{p} 204 | \end{equation} 205 | \end{theorem} 206 | 207 | \begin{remark} 208 | Given $a \in G^{\times}_{m}$, to find $x$ such that 209 | \begin{equation} 210 | a \ast x = b \Mod{m} 211 | \end{equation} 212 | Find $\Inverse{a} \Mod{m}$. 213 | 214 | For example, for 215 | \begin{equation} 216 | 13 \ast x = 6 \Mod{34} 217 | \end{equation} 218 | 219 | Since 220 | \begin{equation} 221 | x = \Inverse{13} \ast 6 \Mod{34} 222 | \end{equation} 223 | 224 | Find $\Inverse{13} \Mod{34}$ via the \textit{Euclidean algorithm} which gives 225 | \begin{equation} 226 | \Inverse{13} = 21 \Mod{34} 227 | \end{equation} 228 | 229 | Then 230 | \begin{align} 231 | x &= 21 \ast 6 \Mod{34} \\ 232 | &= 126 - 3 \ast 34 \Mod{34} \\ 233 | &= 24 \Mod{34} 234 | \end{align} 235 | \end{remark} 236 | 237 | \begin{remark} 238 | To compute expressions of the form 239 | \begin{equation} 240 | a^n \Mod{m} 241 | \end{equation} 242 | 243 | One should decompose $a^n$ to $a^n = a \cdot a^2 \cdot a^4 \cdot \cdots$, and use Fermat's Little Theorem and Euler Totient Function Identities whenever possible. 244 | \end{remark} 245 | 246 | \begin{remark} 247 | For equations of the form 248 | \begin{equation} 249 | x^a = b \Mod{m} 250 | \end{equation} 251 | Then 252 | \begin{equation} 253 | x = b^{\Inverse{a}} \Mod{m} 254 | \end{equation} 255 | 256 | If $\gcd(a, \phi(m)) = 1$ then 257 | \begin{align} 258 | a \ast y &= 1 \Mod{\phi(m)} \\ 259 | x &= b^y \Mod{m} 260 | \end{align} 261 | 262 | If $\gcd(b, m) = 1$, that is if $b, m$ are \textit{relatively prime} 263 | \begin{align} 264 | x^a &= (b^y)^a \Mod{m} \\ 265 | &= b^{a \ast y} \Mod{m} \\ 266 | &= b^{1 + k \phi(m)} \Mod{m} \\ 267 | &= b \ast (b^{\phi(m)})^k \Mod{m} \\ 268 | &= b \ast 1^k \Mod{m} \\ 269 | &= b \Mod{m} 270 | \end{align} 271 | \end{remark} 272 | 273 | 274 | \section{Rivest–Shamir–Adleman (RSA) Cryptography} 275 | 276 | \begin{definition}[RSA, Public Keys and Private Keys] 277 | Given actors Alice and Bob, the process of RSA is 278 | \begin{enumerate} 279 | \item Alice provides \textit{secrete} primes $p$ and $q$. 280 | \begin{equation} 281 | n = p \ast q 282 | \end{equation} 283 | \item Alice provides two integers $d$ and $e$ such that 284 | \begin{equation} 285 | d \ast e = 1 \Mod{\phi(p \ast q)} 286 | \end{equation} 287 | \item Alice distributes the pair $(n, e)$ to everyone. 288 | \item Encryption and Decryption is then 289 | \begin{align} 290 | \Encrypt{n}{e}{m} &\coloneqq m^e \Mod{n} \\ 291 | \Decrypt{n}{d}{m} &\coloneqq c^d \Mod{n} 292 | \end{align} 293 | \item Bob \textit{encrypts} message $m$ as the encrypted message $c$ where 294 | \begin{equation} 295 | c \coloneqq \Encrypt{n}{e}{m} 296 | \end{equation} 297 | And sends $c$ to Alice. 298 | \item Alice \textit{decrypts} $c$ as 299 | \begin{equation} 300 | m\prime = \Decrypt{n}{d}{c} 301 | \end{equation} 302 | Check that $\gcd(m, n) = 1$, that is if $m, n$ are \textit{relatively prime}, then 303 | \begin{align} 304 | m\prime \Mod{n} &= c^d \Mod{n} \\ 305 | &= (m^e)^d \Mod{n} \\ 306 | &= m^{d \ast e} \Mod{n} \\ 307 | &= m^{1 + k\phi(p \ast q)} \Mod{n} \\ 308 | &= m \Mod{n} 309 | \end{align} 310 | Then \textit{only} Alice can decrypt the encrypted message $c$ in polynomial time. 311 | \end{enumerate} 312 | \end{definition} 313 | 314 | \begin{remark} 315 | An example of the RSA process: 316 | \begin{enumerate} 317 | \item Alice provides secret primes $p = 3, q = 41$ 318 | \begin{equation} 319 | n = 3 \ast 41 = 123 320 | \end{equation} 321 | \item Alice provides two integers $d = 27, e = 3$ 322 | \begin{align} 323 | d \ast e \Mod{\phi(3 \ast 41)} &= 27 \ast 3 \Mod{\phi(3 \ast 41)} \\ 324 | &= 81 \Mod{[\phi(3) \ast \phi(41)]} \\ 325 | &= 81 \Mod{[2 \ast 40]} \\ 326 | &= 81 \Mod{80} \\ 327 | &= 1 \Mod{80} 328 | \end{align} 329 | \item Alice distributes $(n, e) = (123, 3)$ to everyone. 330 | \item The encryption and decryption functions are 331 | \begin{align} 332 | \Encrypt{n}{e}{m} &= m^3 \Mod{n} \\ 333 | \Decrypt{n}{d}{c} &= c^{27} \Mod{n} 334 | \end{align} 335 | \item Given a message $m = 5$ then Bob sends 336 | \begin{align} 337 | c &= 5^3 \Mod{123} \\ 338 | &= 125 \Mod{123} \\ 339 | &= 2 \Mod{123} 340 | \end{align} 341 | \item Alice receives the encrypted message $c = 2$ and decrypts with the fact that $\gcd(123, 5) = 1$ 342 | \begin{align} 343 | m\prime \Mod{123} &= 2^{27} \Mod{123} \\ 344 | &= 5 \Mod{123} 345 | \end{align} 346 | \end{enumerate} 347 | \end{remark} 348 | -------------------------------------------------------------------------------- /latex/ch-functions.tex: -------------------------------------------------------------------------------- 1 | \chapter{Functions} 2 | 3 | \section{Function Basics} 4 | 5 | \begin{definition}[Function] 6 | A function $f$ is a mapping from $X$ to $Y$ 7 | \begin{equation} 8 | f \colon X \mapsto Y 9 | \end{equation} 10 | \begin{itemize} 11 | \item $\Domain{f} = X$ 12 | \item $\Image{f} = f(X)$ 13 | \end{itemize} 14 | \end{definition} 15 | 16 | \begin{definition}[Total Function] 17 | A function is \textit{total} if 18 | \begin{equation} 19 | \Domain{f} = X 20 | \end{equation} 21 | \end{definition} 22 | 23 | \begin{definition}[Partial Function] 24 | A function is \textit{partial} if 25 | \begin{equation} 26 | \Domain{f} \subseteq X 27 | \end{equation} 28 | \end{definition} 29 | 30 | \begin{definition}[Surjection] 31 | A function $f \colon X \mapsto Y$ is \textit{surjective} iff 32 | \begin{equation} 33 | f(X) = Y \Leftrightarrow \Forall y \in Y \colon \Exists x \in X \colon f(x) = y 34 | \end{equation} 35 | Namely each $y \in Y$ has a corresponding $x \in X$. 36 | \end{definition} 37 | 38 | \begin{definition}[Injection (Encodings, One-to-one)] 39 | A function $f \colon X \mapsto Y$ is \textit{injective} iff 40 | \begin{align} 41 | &\Forall x_1, x_2 \in X \colon x_1 \neq x_2 \to f(x_1) \neq f(x_2) \\ 42 | \Leftrightarrow &\Forall x_1, x_2 \in X \colon f(x_1) = f(x_2) \to x_1 = x_2 43 | \end{align} 44 | Namely each distinct element $x \in X$ maps to a different element in $Y$. 45 | \end{definition} 46 | 47 | \begin{definition}[Bijection] 48 | A function $f \colon X \mapsto Y$ is \textit{bijective} iff $f$ is both \textit{injective} and \textit{surjective}. 49 | \begin{equation} 50 | \mathrm{Bijective}(f) \coloneqq \mathrm{Injective}(f) \land \mathrm{Surjective}(f) 51 | \end{equation} 52 | The \textit{inverse bijection} $\Inverse{f} \colon Y \mapsto X$ does exist. 53 | \end{definition} 54 | 55 | \section{Composition of Injections} 56 | \begin{proposition}[Composition of Injection] 57 | Given \textit{injections} $f \colon X \mapsto Y$ and $g \colon Y \mapsto Z$, then their \textit{composition} $h \colon X \mapsto Z$ is given by 58 | \begin{equation} 59 | h(x) \coloneqq (f \circ g)(x) \coloneqq g(f(x)) 60 | \end{equation} 61 | Then $h$ is also an \textit{injective} function. Namely $h = f \circ g$ where $h$ is composed from $f$ and $g$ with $f$ applied first. 62 | \end{proposition} 63 | 64 | \begin{proof} 65 | Given any $x_1, x_2 \in X$ where $x_1 \neq x_2$, then 66 | \begin{equation} 67 | f(x_1) \ne f(x_2) 68 | \end{equation} 69 | as $f$ is \textit{injective}, and thus 70 | \begin{equation} 71 | h(x_1) = g(f(x_1)) \neq g(f(x_2)) = h(x_2) 72 | \end{equation} 73 | $h$ is \textit{injective} consequently. 74 | \end{proof} 75 | 76 | \section{Composition of Surjection} 77 | \begin{proposition}[Composition of Surjection] 78 | Given \textit{surjections} $f \colon X \mapsto Y$ and $g \colon Y \mapsto Z$, then their \textit{composition} $h \colon X \mapsto Z$ is given by 79 | \begin{equation} 80 | h(x) \coloneqq (f \circ g)(x) \coloneqq g(f(x)) 81 | \end{equation} 82 | Then $h$ is also a \textit{surjective} function. 83 | \end{proposition} 84 | 85 | \begin{proof} 86 | To prove $h \colon X \mapsto Z$ is \textit{injective}, it is required to prove that 87 | \begin{equation} 88 | \Forall z \in Z \colon \Exists x \in X \colon h(x) = z 89 | \end{equation} 90 | Where $h(x) \Leftrightarrow (f \circ g)(x) \Leftrightarrow g(f(x))$. 91 | 92 | Given any element $z \in Z$ ($\Forall z \in Z$): 93 | \begin{enumerate} 94 | \item That $g \colon Y \mapsto Z$ is \textit{surjective} by definition, then $\Exists y \in Y \colon g(y) = z$. 95 | \item That $f \colon X \mapsto Y$ is \textit{surjective} by definition, then $\Exists x \in X \colon f(x) = y$. 96 | \end{enumerate} 97 | Then $\Forall z \in Z \colon \Exists x \in X \colon h(x) = (f \circ g)(x) = g(f(x)) = g(y) = z$ holds true. 98 | \end{proof} 99 | 100 | \section{Composition of Bijection} 101 | \begin{proposition}[Composition of Bijection] 102 | Given \textit{bijections} $f \colon X \mapsto Y$ and $g \colon Y \mapsto Z$, then their composition $h \colon X \mapsto Z$ is given by 103 | \begin{equation} 104 | h(x) \coloneqq (f \circ g)(x) \coloneqq g(f(x)) 105 | \end{equation} 106 | Then $h$ is also a \textit{bijective} function; an \textit{inverse bijection} $\Inverse{h} \colon Z \mapsto X$ also exists. 107 | \end{proposition} 108 | 109 | \section{Cardinality of Sets} 110 | \begin{definition}[Cardinality] 111 | The number of elements in a set $X$ is denoted $\VSBars{X}$. 112 | \end{definition} 113 | 114 | \begin{definition}[Equal Cardinality and Bijection] 115 | \begin{equation} 116 | \VSBars{X} = \VSBars{Y} 117 | \end{equation} 118 | Holds true if there exists a \textit{bijection} $h \colon X \mapsto Y$ (one-to-one correspondence between $X$ and $Y$). 119 | 120 | Namely, $X$ and $Y$ have the same number of distinct elements, and each distinct element $x \in X$ corresponds to exactly one distinct element $y \in Y$. 121 | \end{definition} 122 | 123 | \begin{theorem}[Cantor-Bernstein] 124 | Given 125 | \begin{enumerate} 126 | \item \textit{injective} function $f \colon X \mapsto Y$ 127 | \item \textit{injective} function $g \colon Y \mapsto X$ 128 | \end{enumerate} 129 | Then there exists a \textit{bijective} function $h \colon X \mapsto Y$. 130 | 131 | Equivalently, 132 | \begin{equation} 133 | (\VSBars{X} \le \VSBars{Y}) \land (\VSBars{Y} \le \VSBars{X}) \to (\VSBars{X} = \VSBars{Y}) 134 | \end{equation} 135 | \end{theorem} 136 | 137 | \begin{remark} 138 | Examples include countable sets, enumerable sets 139 | \begin{equation} 140 | \VSBars{\Rational} = \VSBars{\Int} = \VSBars{\NatNum} = \AlephZero 141 | \end{equation} 142 | Where the cardinality of countable sets such as the \textit{rational numbers}, \textit{integers} and the \textit{natural numbers} is denoted as "alpeh-zero" ($\AlephZero$). 143 | 144 | On the other hand, continuum such as the \textit{real numbers} are not countable and as such 145 | \begin{equation} 146 | \VSBars{\Real} > \AlephZero 147 | \end{equation} 148 | \end{remark} 149 | -------------------------------------------------------------------------------- /latex/ch-groups.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jieyouxu/COMP0147-Discrete-Mathematics-Notes/e59483b863c93c3fe253ec23740bb876e789dfac/latex/ch-groups.pdf -------------------------------------------------------------------------------- /latex/ch-groups.tex: -------------------------------------------------------------------------------- 1 | \chapter{Groups} 2 | 3 | \section{Group Basics} 4 | 5 | A \textit{group} is an abstract collection consisting of: 6 | \begin{itemize} 7 | \item A \textit{nonempty set} $G$. 8 | \item A \textit{binary operation} $\star \colon G \times G \to G$. 9 | \end{itemize} 10 | 11 | It has the following properties: 12 | \begin{enumerate} 13 | \item \textbf{Closure} 14 | \begin{equation} 15 | \Forall x, y \colon x \in G \land y \in G \to x \star y \in G 16 | \end{equation} 17 | \item \textbf{Associativity} 18 | \begin{equation} 19 | \Forall x, y, z \in G \colon (x \star y) \star z \equiv x \star (y \star z) 20 | \end{equation} 21 | \item \textbf{Neutral Element} 22 | \begin{equation} 23 | \Exists \epsilon \in G \colon \Forall x \in G \colon x \star \epsilon \equiv \epsilon \star x \equiv x 24 | \end{equation} 25 | That there exists an unique \textit{neutral} element $\epsilon \in G$. 26 | \item \textbf{Invertibility} 27 | \begin{equation} 28 | \Forall x \in G \colon \Exists y \in G \colon x \star y \equiv y \star x \equiv \epsilon 29 | \end{equation} 30 | That there exists an unique \textit{inverse} element $y \coloneqq \Inverse{x} \in G$ where $\Inverse{x}$ denotes the \textit{inverse} element of $x$. 31 | \end{enumerate} 32 | 33 | \begin{definition}[Commutative Group] 34 | An \textit{commutative group} (or \textit{abelian group}) is a \textit{group} for which its operation $\star \colon G \times G \to G$ satisfies the additional \textit{commutative} property: 35 | \begin{itemize} 36 | \item \textbf{Commutativity} 37 | \begin{equation} 38 | \Forall x, y \in G \colon x \star y \equiv y \star x 39 | \end{equation} 40 | \end{itemize} 41 | \end{definition} 42 | 43 | \section{Multiplicative Group} 44 | 45 | \begin{proposition}[Multiplicative Group] 46 | A \textit{multiplicative group} is a \textit{group} $(G, \ast)$ which has the binary operation $\ast \colon G \times G \to G$: 47 | \begin{itemize} 48 | \item \textbf{Closure, Associativity}. The multiplication operation $\ast \colon G \times G \to G$ is closed and is associative. 49 | \item \textbf{Neutral Element}. The neutral element $\epsilon$ is unique. 50 | \item \textbf{Invertibility}. The inverse element $\Inverse{x}$ is unique. 51 | \item For all $a, b \in G$ the equation 52 | \begin{equation} 53 | a \ast x = b 54 | \end{equation} 55 | Has the unique solution 56 | \begin{equation} 57 | x = \Inverse{a} \ast b 58 | \end{equation} 59 | \end{itemize} 60 | Since 61 | \begin{align} 62 | a \ast x = b &\Leftrightarrow \Inverse{a} \ast (a \ast x) = \Inverse{a} \ast b &\text{(Multiply by inverse element)} \\ 63 | &\Leftrightarrow (\Inverse{a} \ast a) \ast x = \Inverse{a} \ast b &\text{(Associativity)} \\ 64 | &\Leftrightarrow \epsilon \ast x = \Inverse{a} \ast b &\text{(Invertibility)} \\ 65 | &\Leftrightarrow x = \Inverse{a} \ast b &\text{(Neutral Element)} 66 | \end{align} 67 | \end{proposition} 68 | 69 | \begin{remark} 70 | An example of a multiplicative group is permutations under composition, namely $S_n$ is a group $(G, \circ)$ where $\circ \colon G \times G \to G$. 71 | 72 | For example, let $G$ be the set of permutations 73 | \begin{equation} 74 | \epsilon = \begin{pmatrix} 75 | 1 & 2 & 3 \\ 76 | 1 & 2 & 3 77 | \end{pmatrix} \quad 78 | \sigma_1 = \begin{pmatrix} 79 | 1 & 2 & 3 \\ 80 | 2 & 3 & 1 81 | \end{pmatrix} \quad 82 | \sigma_2 = \sigma_1^2 = \begin{pmatrix} 83 | 1 & 2 & 3 \\ 84 | 3 & 1 & 2 85 | \end{pmatrix} \quad 86 | \end{equation} 87 | 88 | To verify that $G$ does form a group with composition $\circ$, one may draw the multiplication table for the group. Note that 89 | \begin{equation} 90 | \sigma_2 \sigma_2 = \sigma_1^4 = \sigma_1^3 \sigma_1 = \epsilon \sigma_1 = \sigma_1 91 | \end{equation} 92 | 93 | \begin{table}[H] 94 | \centering 95 | \begin{tabular}{l | l l l} 96 | \toprule 97 | $\circ$ & $\epsilon$ & $\sigma_1$ & $\sigma_2$ \\ 98 | \midrule 99 | $\epsilon$ & $\epsilon$ & $\sigma_1$ & $\sigma_2$ \\ 100 | $\sigma_1$ & $\sigma_1$ & $\sigma_2$ & $\epsilon$ \\ 101 | $\sigma_2$ & $\sigma_2$ & $\epsilon$ & $\sigma_1$ \\ 102 | \bottomrule 103 | \end{tabular} 104 | \caption{Multiplication Table of Composition $\circ$ over $G$} 105 | \end{table} 106 | \end{remark} 107 | 108 | \section{Additive Group} 109 | 110 | \begin{definition}[Additive Group] 111 | An \textit{additive group} is a \textit{group} $(G, +)$ with the binary operation $+ \colon G \times G \to G$. It has the same properties of a general \textit{group}. 112 | \begin{enumerate} 113 | \item \textbf{Closure} 114 | \begin{equation} 115 | \Forall x, y \colon x \in G \land y \in G \to x + y \in G 116 | \end{equation} 117 | \item \textbf{Associativity} 118 | \begin{equation} 119 | \Forall x, y, z \in G \colon (x + y) + z \equiv x + (y + z) 120 | \end{equation} 121 | \item \textbf{Neutral Element} 122 | \begin{equation} 123 | \Exists \epsilon \in G \colon \Forall x \in G \colon x + \epsilon \equiv \epsilon + x \equiv x 124 | \end{equation} 125 | That there exists an unique \textit{neutral} element $0_G \in G$ (usually denoted simply as $0$). 126 | \item \textbf{Invertibility} 127 | \begin{equation} 128 | \Forall x \in G \colon \Exists y \in G \colon x + y \equiv y + x \equiv 0 129 | \end{equation} 130 | That there exists an unique \textit{inverse} element $y \coloneqq -x \in G$ where $-x$ denotes the \textit{inverse} element of $x$. 131 | \end{enumerate} 132 | \end{definition} 133 | 134 | \begin{remark} 135 | An example of an additive group is $(\Int, +)$ (i.e. addition over the integers). 136 | 137 | Then for any of such \textit{commutative group} $(G, +)$ 138 | \begin{itemize} 139 | \item \textit{Neutral element} $0$ is unique. 140 | \item \textit{Inverse element} $-x$ is unique. 141 | \item For any $a, b \in G$ the equation 142 | \begin{equation} 143 | a + x = b 144 | \end{equation} 145 | Has a unique solution 146 | \begin{align} 147 | (-a) + a + x &= (-a) + b \\ 148 | x &= (-a) + b = b - a 149 | \end{align} 150 | \end{itemize} 151 | \end{remark} 152 | 153 | \section{Associativity of Sequential Composition of Functions} 154 | 155 | \begin{definition}[Sequential Composition of Functions] 156 | Let $(f \circ g)$ denote the sequential composition of functions $f \colon X \to Y$ and $g \colon Y \to Z$ such that $(f \circ g) \colon X \to Z$ where $f$ is applied first then $g$, i.e. $\Forall x \in X \colon (f \circ g)(x) \coloneqq g(f(x))$. 157 | \end{definition} 158 | 159 | \begin{proposition}[Associativity of Sequential Composition of Functions] 160 | Given sets $X, Y$ and $Z$ and 161 | \begin{itemize} 162 | \item \textit{Injection} $f \colon A \to B$ 163 | \item \textit{Injection} $g \colon B \to C$ 164 | \item \textit{Injection} $h \colon C \to D$ 165 | \end{itemize} 166 | 167 | Then their composition is associative: 168 | \begin{equation} 169 | (f \circ g) \circ h \equiv f \circ (g \circ h) 170 | \end{equation} 171 | \end{proposition} 172 | 173 | \begin{proof}\ \\ 174 | Let $s = (f \circ g)$ and $t = (s \circ h)$, then $t(x) = h(s(x)) = h(g(f(x)))$.\\ 175 | Let $u = (g \circ h)$ and $v = (f \circ u)$, then $v(x) = u(f(x)) = h(g(f(x)))$.\\ 176 | Together they yield the desired equality $t(x) = v(x)$. 177 | \end{proof} 178 | 179 | \section{Subgroups} 180 | 181 | \begin{definition}[Subgroup] 182 | Given a \textit{group} $(G, \ast)$, then the subset $H \subseteq G$ is a \textit{subgroup} of $G$ if it fulfills the properties: 183 | \begin{enumerate} 184 | \item \textbf{Closure} 185 | \begin{equation} 186 | \Forall x, y \colon x \in H \land y \in H \to x \ast y \in H 187 | \end{equation} 188 | \item \textbf{Neutral Element} 189 | \begin{equation} 190 | \epsilon \in H 191 | \end{equation} 192 | That is, the \textit{neutral} element $\epsilon$ from $G$ is contained within the subset $H \subseteq G$. 193 | \item \textbf{Invertibility} 194 | \begin{equation} 195 | \Forall x \in H \colon \Inverse{x} \in H 196 | \end{equation} 197 | \end{enumerate} 198 | \end{definition} 199 | 200 | \section{Lagrange's Theorem} 201 | 202 | \begin{theorem}[Lagrange's Theorem] 203 | Given a finite \textit{group} of order $n$ $(G, \ast)$ where 204 | \begin{equation} 205 | G \coloneqq \set{ g_1, g_2, \dots, g_n } 206 | \end{equation} 207 | And its \textit{subgroup} $(H, \ast)$ of order $k \le n$ 208 | \begin{equation} 209 | H \coloneqq \set{ h1_, h_2, \dots, h_k } 210 | \end{equation} 211 | Then $k \vert n$ ($k$ divides $n$). 212 | 213 | $G$ can be \textit{partitioned} into $\ell$ disjoint subsets of the same size $k$ such that 214 | \begin{equation} 215 | n = k \ell 216 | \end{equation} 217 | \end{theorem} 218 | 219 | \begin{definition}[Left Coset] 220 | Given $(G, \ast)$ is a \textit{group}, $(H, \ast)$ is a \textit{subgroup} of $(G, \ast)$ and $g \in G$ then the \textit{left coset} $gH$ of $H$ in $G$ with respect to $g$ is defined as 221 | \begin{equation} 222 | gH \coloneqq \set{g \ast h \colon h \in H} 223 | \end{equation} 224 | \end{definition} 225 | 226 | \begin{remark} 227 | Visually, 228 | \begin{equation} 229 | G \equiv \left. \begin{matrix} 230 | &\boxed{{g_1} H} \\ 231 | &\boxed{{g_2} H} \\ 232 | &\vdots \\ 233 | &\boxed{{g_\ell} H} 234 | \end{matrix} \quad \right\} \ell \text{ disjoint subsets} 235 | \end{equation} 236 | 237 | To verify that the \textit{left cosets} together do in fact reconstruct $G$, check the multiplication table 238 | \begin{table}[H] 239 | \centering 240 | \begin{tabular}{c | c c c c} 241 | \toprule 242 | $\ast$ & $h_1$ & $h_2$ & $\cdots$ & $h_k$ \\ 243 | \midrule 244 | $g_1 H$ & $g_1 \ast h_1$ & $g_1 \ast h_2$ & $\cdots$ & $g_1 \ast h_k$ \\ 245 | $g_2 H$ & $g_2 \ast h_1$ & $g_2 \ast h_2$ & $\cdots$ & $g_2 \ast h_k$ \\ 246 | $\vdots$ & $\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ \\ 247 | $g_\ell H$ & $g_\ell \ast h_1$ & $g_\ell \ast h_2$ & $\cdots$ & $g_\ell \ast h_k$ \\ 248 | \bottomrule 249 | \end{tabular} 250 | \caption{Multiplication Table from $\ell$ Left Cosets, Each of Size $\lvert H \rvert = k$} 251 | \end{table} 252 | \end{remark} 253 | 254 | \begin{proposition}\label{prop:inverse-element-identity} 255 | For any $a, b \in G$ from $(G, \ast)$ 256 | \begin{equation} 257 | \Inverse{(a \ast b)} \equiv \Inverse{b} \ast \Inverse{a} 258 | \end{equation} 259 | \end{proposition} 260 | 261 | \begin{proof} 262 | \begin{align} 263 | \Inverse{(a \ast b)} &\Leftrightarrow \Inverse{(a \ast b)} \ast \epsilon &\text{(Neutral element)} \\ 264 | &\Leftrightarrow \Inverse{(a \ast b)} \ast (a \ast \Inverse{a}) &\text{(Invertibility)} \\ 265 | &\Leftrightarrow \Inverse{(a \ast b)} \ast \left((a \ast \epsilon) \ast \Inverse{a}\right) &\text{(Neutral element)} \\ 266 | &\Leftrightarrow \Inverse{(a \ast b)} \ast \left[(a \ast (b \ast \Inverse{b})) \ast \Inverse{a}\right] &\text{(Invertibility)} \\ 267 | &\Leftrightarrow \Inverse{(a \ast b)} \ast \left[(a \ast b) \ast (\Inverse{b} \ast \Inverse{a})\right] &\text{(Associativity)} \\ 268 | &\Leftrightarrow \left[ \Inverse{(a \ast b)} \ast (a \ast b) \right] \ast (\Inverse{b} \ast \Inverse{a}) &\text{(Associativity)} \\ 269 | &\Leftrightarrow \epsilon \ast (\Inverse{b} \ast \Inverse{a}) &\text{(Invertibility)} \\ 270 | &\Leftrightarrow \Inverse{b} \ast \Inverse{a} &\text{(Neutral Element)} 271 | \end{align} 272 | \end{proof} 273 | 274 | \begin{proof} 275 | For a constructive proof of Lagrange's Theorem: 276 | 277 | Let the binary relation $E(x, y)$ be defined on the \textit{group} $(G, \ast)$, with its \textit{subgroup} $(H, \ast)$ 278 | \begin{equation} 279 | E(x, y) \coloneqq \Inverse{x} \ast y \in H 280 | \end{equation} 281 | For the equivalence 282 | \begin{equation} 283 | x = y \Leftrightarrow \Inverse{x} \ast y = 1 284 | \end{equation} 285 | Then for each of the required properties: 286 | \begin{itemize} 287 | \item \textbf{Neutral Element} from \textit{Reflexivity} of $E(x, y)$ 288 | \begin{equation} 289 | \Forall x \in G \colon E(x, x) 290 | \end{equation} 291 | Since 292 | \begin{equation} 293 | E(x, x) \equiv \Inverse{x} \ast x \in H \equiv \epsilon \in H 294 | \end{equation} 295 | Then this satisfies the \textit{reflexivity} requirement for \textit{equivalence relations}, and proves the \textit{neutral element} requirement for \textit{subgroups}. 296 | \item \textbf{Invertibility} from \textit{Symmetry} of $E(x, y)$ 297 | \begin{equation} 298 | \Forall x, y \in G \colon E(x, y) \to E(y, x) 299 | \end{equation} 300 | Let for some $h \in H$, $\Inverse{x} \ast y = h$, then by proposition \ref{prop:inverse-element-identity} 301 | \begin{equation} 302 | \Inverse{y} \ast x \equiv \Inverse{(\Inverse{x} \ast y)} \equiv \Inverse{h} \in H 303 | \end{equation} 304 | Which satisfies the \textit{symmetry} requirement for \textit{equivalence relations}, and proves the \textit{invertibility} requirement for \textit{subgroups}. 305 | \item \textbf{Closure} from \textit{Transitivity} of $E(x, y)$ 306 | \begin{equation} 307 | \Forall x, y, z \in G \colon E(x, y) \land E(y, z) \to E(x, z) 308 | \end{equation} 309 | Let for some $h_1, h_2 \in H$, $\left( \Inverse{x} \ast y = h_1 \right) \land \left( \Inverse{y} \ast z = h_2 \right)$, then 310 | \begin{align} 311 | \Inverse{x} \ast z &\Leftrightarrow \Inverse{x} \ast \epsilon \ast z \\ 312 | &\Leftrightarrow (\Inverse{x} \ast y) \ast (\Inverse{y} \ast z) \\ 313 | &\Leftrightarrow h_1 \ast h_2 \in H 314 | \end{align} 315 | Which satisfies the \textit{transitivity} requirement for \textit{equivalence relations}, and proves the \textit{closure} requirement for \textit{subgroups}. 316 | \end{itemize} 317 | 318 | \end{proof} 319 | 320 | \begin{remark} 321 | To demonstrate Lagrange's Theorem, let the \textit{group} be constructed from $x \ast y \Mod{10}$. 322 | 323 | Let $(G, \ast)$ be a finite \textit{group} of order $n = 4$ where 324 | \begin{equation} 325 | G = \set{1, 3, 7, 9} 326 | \end{equation} 327 | 328 | And $(H, \ast)$ be its \textit{subgroup} of order $k = 2$ where 329 | \begin{equation} 330 | H = \set{1, 9} 331 | \end{equation} 332 | 333 | Constructing the multiplication table yields 334 | \begin{table}[H] 335 | \centering 336 | \begin{tabular}{c | c c} 337 | \toprule 338 | $\ast \Mod{10}$ & $1$ & $9$ \\ 339 | \midrule 340 | $1 \ast H$ & $1$ & $9$ \\ 341 | $3 \ast H$ & $3$ & $7$ \\ 342 | $7 \ast H$ & $7$ & $3$ \\ 343 | $9 \ast H$ & $9$ & $1$ \\ 344 | \bottomrule 345 | \end{tabular} 346 | \caption{Multiplication Table for $(G, \ast)$} 347 | \end{table} 348 | 349 | There are only $\ell = 2$ disjoint subsets (unique cosets) $gH$; $G$ can be partitioned into $\ell$ disjoint subsets, each of size $\lvert H \rvert = 2$ such that $4 = n = k\ell = 2 \cdot 2$. 350 | 351 | Visually, 352 | \begin{equation} 353 | G = \left. \begin{matrix} 354 | &\boxed{1 \ast H = 9 \ast H = \set{1, 9}} \\ 355 | &\boxed{3 \ast H = 7 \ast H = \set{3, 7}} 356 | \end{matrix} \quad \right\} \ell = 2 357 | \end{equation} 358 | \end{remark} 359 | 360 | \subsection{Equivalence Classes} 361 | 362 | \begin{definition}[Equivalence Class] 363 | Given \textit{group} $(G, \ast)$ and its \textit{subgroup} $(H, \ast)$, then the \textit{equivalence class} $[g]$ is defined as 364 | \begin{equation} 365 | [g] \coloneqq \set{y \in G \mid \Inverse{g} \ast y \in H} 366 | \end{equation} 367 | Then 368 | \begin{equation} 369 | \Forall h \in H \colon \Inverse{g} \ast y = h \Leftrightarrow y = g \ast h 370 | \end{equation} 371 | Which yields the equivalence 372 | \begin{equation} 373 | \set{y \in G \mid \Inverse{g} \ast y \in H} \equiv \set{y \in G \mid y \in gH} 374 | \end{equation} 375 | Hence 376 | \begin{equation} 377 | [g] \equiv gH 378 | \end{equation} 379 | That the \textit{equivalence class} $[g]$ is exactly the \textit{left coset} $gH$. 380 | 381 | Let $\ell$ be the number of disjoint equivalence class $[g]$, then $G$ can be partitioned into $\ell$ disjoint subsets where visually, 382 | \begin{equation} 383 | G = \left. \begin{matrix} 384 | &\boxed{ [g_1] \equiv g_1 H } \\ 385 | &\boxed{ [g_2] \equiv g_1 H } \\ 386 | &\vdots \\ 387 | &\boxed{ [g_\ell] \equiv g_\ell H } \\ 388 | \end{matrix} \quad \right\} \ell \text{ disjoint subsets} 389 | \end{equation} 390 | \end{definition} 391 | 392 | \begin{proposition} 393 | \begin{equation} 394 | \Forall g \in G \colon \lvert gH \rvert \equiv \lvert H \rvert \equiv k 395 | \end{equation} 396 | \end{proposition} 397 | 398 | \begin{proof} 399 | Let $I$ be the set of indices $I \coloneqq \set{1, \dots, k}$ 400 | \begin{align} 401 | &\Forall i, j \in I \colon (h_i = h_j) \leftrightarrow (g \ast h_i = g \ast h_j) \\ 402 | \Leftrightarrow &\Forall i, j \in I \colon (h_1 \ne h_j) \leftrightarrow (g \ast h_i \ne g \ast h_j) 403 | \end{align} 404 | \end{proof} 405 | 406 | \begin{remark} 407 | Let $A_n$ be the set of all \textit{even permutations} and $B_n$ be the set of all \textit{odd permutations}. 408 | 409 | Given the \textit{group} $(S_n, \ast)$, then $(A_n, \ast)$ is a \textit{subgroup} of $S_n$. 410 | 411 | With the multiplication table 412 | \begin{table}[H] 413 | \centering 414 | \begin{tabular}{c | c} 415 | \toprule 416 | $\ast$ & $A_n$ \\ 417 | \midrule 418 | $\epsilon \ast A_n$ & $A_n$ \\ 419 | $\sigma \ast A_n$ & $B_n$ \\ 420 | \bottomrule 421 | \end{tabular} 422 | \caption{Multiplication Table for Group $S_n$} 423 | \end{table} 424 | 425 | Since 426 | \begin{equation} 427 | \sigma \ast A_n \equiv \begin{cases} 428 | A_n &\text{if } \sigma \text{ is even} \\ 429 | B_n &\text{if } \sigma \text{ is odd} 430 | \end{cases} 431 | \end{equation} 432 | 433 | Hence, 434 | \begin{equation} 435 | \lvert A_n \rvert \equiv \frac{1}{2} \cdot \lvert S_n \rvert \equiv \frac{1}{2} \cdot n! 436 | \end{equation} 437 | \end{remark} 438 | 439 | \subsection{Order of an Element in Lagrange's Theorem} 440 | 441 | \begin{definition}[Order of an Element] 442 | Given a \textit{group} $(G, \ast)$ and element $a \in G$ then the \textit{order} of the element $a$ is the smallest $k \in \PosInt$ such that 443 | \begin{equation} 444 | a^{k} = \epsilon 445 | \end{equation} 446 | \end{definition} 447 | 448 | \begin{proposition} 449 | Given a \textit{group} $(G, \ast)$ with \textit{order} $n$, then for any $a \in G$, should its \textit{order} $k$ exist, then $k \vert n$ ($k$ divides $n$). 450 | \end{proposition} 451 | 452 | \begin{proposition} 453 | Given \textit{group} $(G, \ast)$, 454 | \begin{equation} 455 | \Forall a \in G \colon a^{\lvert G \rvert} \equiv 1 456 | \end{equation} 457 | \end{proposition} 458 | 459 | \begin{proof} 460 | With the \textit{cyclic subgroup} generated by $a \in G$ 461 | \begin{equation} 462 | \set{a^m \mid m \in \Int} = \set{\epsilon, a, a^2, \dots} 463 | \end{equation} 464 | \end{proof} 465 | 466 | \begin{remark} 467 | This may be used to calculate the modulo of integers raised to large exponents. For example, for $2^{20} \Mod{15}$. To compute this, let the \textit{multiplicative group} $(G, \ast)$ be defined over $G$ of \textit{order} $8$ where 468 | \begin{equation} 469 | G = \set{1, 2, 4, 7, 8, 11, 13, 14} 470 | \end{equation} 471 | And the \textit{binary operation} $x \ast y \coloneqq x \ast y \Mod{15}$. 472 | 473 | Note that $\Inverse{2} = 8 \Mod{15}$ and $\Inverse{4} = 4 \Mod{15}$. 474 | 475 | Since $\lvert G \rvert = 8$, 476 | \begin{equation} 477 | 2^8 = 1 \Mod{15} 478 | \end{equation} 479 | 480 | Then $2^{20} \Mod{15}$ can be calculated by decomposing its exponent: 481 | \begin{equation} 482 | 2^{20} = 2^{2 \cdot 8 + 4} = (2^8)^2 \ast 2^4 = 1 \ast 16 = 1 \Mod{15} 483 | \end{equation} 484 | \end{remark} 485 | -------------------------------------------------------------------------------- /latex/ch-linear-algebra.tex: -------------------------------------------------------------------------------- 1 | \chapter{Linear Algebra} 2 | 3 | \section{Matrix Basics} 4 | 5 | \begin{definition}[Matrix] 6 | A $(n \times m)$-dimension matrix $A$ has $n$ rows and $m$ columns, and each of its entries $a_{j, k}$, for $1 \le j \le n$ and $1 \le k \le m$ are denoted as 7 | \begin{equation} 8 | A = \begin{bmatrix} 9 | a_{1, 1} & a_{1, 2} & \dots & a_{1, m} \\ 10 | a_{2, 1} & a_{2, 2} & \dots & a_{2, m} \\ 11 | \vdots & \vdots & \ddots & \vdots \\ 12 | a_{n, 1} & a_{n, 2} & \dots & a_{n, m} \\ 13 | \end{bmatrix} 14 | \end{equation} 15 | \end{definition} 16 | 17 | \begin{definition}[Set of Matrices of Dimension $n \times m$] 18 | Let $\MatrixClass{n}{m}$ denote the set of all matrices with dimension $n \times m$, that is, having $n$ rows and $m$ columns. 19 | \end{definition} 20 | 21 | \begin{definition}[Square Matrix] 22 | A \textit{square matrix} is a matrix with dimension $n \times n$. 23 | \end{definition} 24 | 25 | \begin{definition}[Matrix Addition] 26 | Let $A, B \in \MatrixClass{n}{m}$ be two matrices of the same dimension $n \times m$. Then the sum matrix $C = A + B$ is defined to have entries 27 | \begin{equation} 28 | c_{j, k} = a_{j, k} + b_{j, k} 29 | \end{equation} 30 | 31 | That is, 32 | \begin{equation} 33 | \begin{split} 34 | \begin{bmatrix} 35 | a_{1, 1} & a_{1, 2} & \dots & a_{1, m} \\ 36 | a_{2, 1} & a_{2, 2} & \dots & a_{2, m} \\ 37 | \vdots & \vdots & \ddots & \vdots \\ 38 | a_{n, 1} & a_{n, 2} & \dots & a_{n, m} \\ 39 | \end{bmatrix} 40 | + 41 | \begin{bmatrix} 42 | b_{1, 1} & b_{1, 2} & \dots & b_{1, m} \\ 43 | b_{2, 1} & b_{2, 2} & \dots & b_{2, m} \\ 44 | \vdots & \vdots & \ddots & \vdots \\ 45 | b_{n, 1} & b_{n, 2} & \dots & b_{n, m} \\ 46 | \end{bmatrix} \\ 47 | \coloneqq 48 | \begin{bmatrix} 49 | a_{1, 1} + b_{1, 1} & a_{1, 2} + b_{1, 2} & \dots & a_{1, m} + b_{1, m} \\ 50 | a_{2, 1} + b_{2, 1} & a_{2, 2} + b_{2, 2} & \dots & a_{2, m} + b_{2, m} \\ 51 | \vdots & \vdots & \ddots & \vdots \\ 52 | a_{n, 1} + b_{n, 1} & a_{n, 2} + b_{n, 2} & \dots & a_{n, m} + b_{n, m} \\ 53 | \end{bmatrix} 54 | \end{split} 55 | \end{equation} 56 | \end{definition} 57 | 58 | \begin{definition}[Matrix Multiplication] 59 | Let $A$ be an $(l \times m)$ matrix and $B$ be an $(m \times n)$ matrix. Then their product $C = A \cdot B$ is the $(l \times n)$ matrix where each entry $c_{j, k}$ is 60 | \begin{equation} 61 | c_{j, k} \coloneqq \sum\limits^{m}_{s = 1} a_{j, s} b_{s, k} 62 | \end{equation} 63 | 64 | Note that matrix multiplication is \textit{not commutative}, that is, for most cases $A \cdot B \ne B \cdot A$ 65 | \end{definition} 66 | 67 | \begin{definition}[Identity Matrix] 68 | Let $I_n$ denote the \textit{identity} matrix with dimension $n \times n$ 69 | \begin{equation} 70 | I_n \coloneqq \begin{bmatrix} 71 | 1 & 0 & \cdots & 0 \\ 72 | 0 & 1 & \cdots & 0 \\ 73 | \vdots & \vdots & \ddots & \vdots \\ 74 | 0 & 0 & \cdots & 1 \\ 75 | \end{bmatrix} 76 | \end{equation} 77 | 78 | Notice that all diagonal entries $i_{j, k}$ with indices $j = k$ is $1$, while all other entries are $0$. 79 | 80 | Alternatively, the \textit{identity} matrix can be defined with entries $\delta_{j, k}$ where $\delta$ is the \textit{Kronecker symbol} such that 81 | \begin{equation} 82 | \delta_{j, k} \coloneqq \begin{cases} 83 | 1 & j = k \\ 84 | 0 & j \ne k 85 | \end{cases} 86 | \end{equation} 87 | \end{definition} 88 | 89 | \begin{definition}[Matrix Multiplication by Scalar $\lambda$] 90 | Let $\lambda \in \Real$ be a constant, then the multiplication of an $(n \times m)$-dimension matrix $A$ by $\lambda$ is defined as 91 | \begin{equation} 92 | \lambda A \coloneqq \begin{bmatrix} 93 | \lambda a_{1, 1} & \lambda a_{1, 2} & \cdots & \lambda a_{1, m} \\ 94 | \lambda a_{2, 1} & \lambda a_{2, 2} & \cdots & \lambda a_{2, m} \\ 95 | \vdots & \vdots & \ddots & \vdots \\ 96 | \lambda a_{n, 1} & \lambda a_{n, 2} & \cdots & \lambda a_{n, m} \\ 97 | \end{bmatrix} 98 | \end{equation} 99 | 100 | If the dimension of $A$ is $n \times n$, i.e. $A$ is a \textit{square matrix}, then $\lambda A$ is equivalently 101 | \begin{equation} 102 | \lambda A \coloneqq 103 | \begin{bmatrix} 104 | \lambda & 0 & \cdots & 0 \\ 105 | 0 & \lambda & \cdots & 0 \\ 106 | \vdots & \vdots & \ddots & \vdots \\ 107 | 0 & 0 & \cdots & \lambda \\ 108 | \end{bmatrix} 109 | \begin{bmatrix} 110 | a_{1, 1} & a_{1, 2} & \dots & a_{1, n} \\ 111 | a_{2, 1} & a_{2, 2} & \dots & a_{2, n} \\ 112 | \vdots & \vdots & \ddots & \vdots \\ 113 | a_{n, 1} & a_{n, 2} & \dots & a_{n, n} \\ 114 | \end{bmatrix} 115 | \end{equation} 116 | \end{definition} 117 | 118 | \begin{lemma} 119 | If $A$ is a matrix with dimension $n \times n$, $A$ is a \textit{square} matrix, then 120 | \begin{equation} 121 | A I \equiv I A \equiv A 122 | \end{equation} 123 | Where $I$ is the \textit{identity} matrix with dimension $n \times n$. 124 | \end{lemma} 125 | 126 | \begin{proof} 127 | Let $B = AI$, then 128 | \begin{equation} 129 | b_{j, k} = \sum\limits^{n}_{s = 1} a_{j, s} \delta_{s, k} 130 | \end{equation} 131 | Only $\delta_{k, k}$ is non-zero, thus $b_{j, k} = a_{j, k}$. The same is true for $IA$. 132 | \end{proof} 133 | 134 | \subsection{Matrix Addition and Multiplication Properties} 135 | 136 | \begin{proposition}[Associative Matrix Multiplication] 137 | Given matrices $A \in \MatrixClass{n}{m}, B \in \MatrixClass{m}{p}$ and $C \in \MatrixClass{p}{q}$ then 138 | \begin{equation} 139 | (A B) C \equiv A (B C) 140 | \end{equation} 141 | \end{proposition} 142 | 143 | \begin{proof} 144 | The entry $t_{j, l}$ of $T = (A B) C$ is 145 | \begin{equation} 146 | t_{j, l} = \sum^{p}_{k = 1} \left( \sum^{m}_{s = 1} a_{j, s} b_{s, k} \right) c_{k, l} \equiv \sum^{p}_{k = 1} a_{j, s} \left( \sum^{m}_{s = 1} b_{s, k} c_{k, l} \right) = u_{j, l} 147 | \end{equation} 148 | Where $u_{j, l}$ are entries of the matrix $U = A (B C)$ 149 | \end{proof} 150 | 151 | \begin{proposition}[Distributive Matrix Multiplication] 152 | Given matrices $A \in \MatrixClass{n}{m}, B \in \MatrixClass{m}{p}$ and $C \in \MatrixClass{p}{q}$ then 153 | \begin{align} 154 | A (B + C) &= A B + A C \\ 155 | (A + B) C &= A C + B C 156 | \end{align} 157 | \end{proposition} 158 | 159 | \begin{proof} 160 | Let $S = A (B + C)$ and $E = A B + A B$, then each entry $s_{j, l}$ from $S$ is 161 | \begin{equation} 162 | s_{j, l} = \sum\limits^{m}_{s = 1} a_{j, s} ( b_{s, l} + c_{s, l} ) \equiv \sum\limits^{m}_{s = 1} a_{j, s} b_{s, l} + \sum\limits^{m}_{s = 1} a_{j, s} c_{s, l} = e_{j, l} 163 | \end{equation} 164 | Where $e_{j, l}$ are entries from $E$. 165 | 166 | Let $T = (A + B) C$ and $F = A C + B C$, then each entry $t_{j, l}$ from $T$ is 167 | \begin{equation} 168 | t_{j, l} = \sum\limits^{m}_{s = 1} (a_{j, s} + b_{s, l}) c_{s, l}\equiv \sum\limits^{m}_{s = 1} a_{j, s} c_{s, l} + \sum\limits^{m}_{s = 1} b_{j, s} c_{s, l} = f_{j, l} 169 | \end{equation} 170 | Where $f_{j, l}$ are entries from $F$. 171 | \end{proof} 172 | 173 | \subsection{Determinant of a Square Matrix} 174 | 175 | \begin{definition}[Determinant of a $2 \times 2$ Matrix] 176 | Given a $2 \times 2$ \textit{square} matrix $A \in \MatrixClass{2}{2}$ 177 | \begin{equation} 178 | A = \begin{bmatrix} 179 | a & b \\ 180 | c & d 181 | \end{bmatrix} 182 | \end{equation} 183 | Then the determinant of $A$, denoted $\det(A)$ or $\VSBars{A}$ is calculated with 184 | \begin{equation} 185 | \det(A) = 186 | \begin{detmatrix}{2} 187 | a & b \\ 188 | c & d 189 | \end{detmatrix} 190 | = 191 | a d - b c 192 | \end{equation} 193 | \end{definition} 194 | 195 | \begin{definition}[Determinant of a $3 \times 3$ Matrix] 196 | Given a $3 \times 3$ \textit{square} matrix $A \in \MatrixClass{3}{3}$ 197 | \begin{equation} 198 | A = \begin{bmatrix} 199 | a & b & c \\ 200 | d & e & f \\ 201 | g & h & i 202 | \end{bmatrix} 203 | \end{equation} 204 | Then the determinant of $A$, denoted $\det(A)$ or $\VSBars{A}$ is calculated with 205 | \begin{align} 206 | \det(A) = 207 | \left\vert 208 | \begin{matrix} 209 | a & b & c \\ 210 | d & e & f \\ 211 | g & h & i 212 | \end{matrix} 213 | \right\vert 214 | &= 215 | a 216 | \left\vert 217 | \begin{matrix} 218 | \square & \square & \square \\ 219 | \square & e & f \\ 220 | \square & h & i 221 | \end{matrix} 222 | \right\vert 223 | - b 224 | \left\vert 225 | \begin{matrix} 226 | \square & \square & \square \\ 227 | d & \square & f \\ 228 | g & \square & i 229 | \end{matrix} 230 | \right\vert 231 | + c 232 | \left\vert 233 | \begin{matrix} 234 | \square & \square & \square \\ 235 | d & e & \square \\ 236 | g & h & \square 237 | \end{matrix} 238 | \right\vert \\ 239 | &= 240 | a 241 | \left\vert 242 | \begin{matrix} 243 | e & f \\ 244 | h & i 245 | \end{matrix} 246 | \right\vert 247 | - b 248 | \left\vert 249 | \begin{matrix} 250 | d & f \\ 251 | g & i 252 | \end{matrix} 253 | \right\vert 254 | + c 255 | \left\vert 256 | \begin{matrix} 257 | d & e \\ 258 | g & h 259 | \end{matrix} 260 | \right\vert \\ 261 | &= 262 | aei - afh + bfg - bdi + cdh - ceg 263 | \end{align} 264 | \end{definition} 265 | 266 | \begin{definition}[Upper Triangular Matrix] 267 | An $n \times n$ matrix $A \in \MatrixClass{n}{n}$ is called a \textit{upper triangular} (or \textit{right triangular}) matrix if it has the form 268 | \begin{equation} 269 | A = \begin{bmatrix} 270 | a_{1, 1} & a_{1, 2} & \cdots & a_{1, n} \\ 271 | & a_{2, 2} & \cdots & a_{2, n} \\ 272 | & & \ddots & \vdots \\ 273 | 0 & & & a_{n, n} \\ 274 | \end{bmatrix} 275 | \end{equation} 276 | Where all the lower triangular part are $0$s. 277 | \end{definition} 278 | 279 | \begin{lemma}[Determinant of an Upper Triangular Matrix] 280 | Given an $n \times n$ \textit{upper triangular} matrix $A$, then its \textit{determinant} $\det(A)$ can be calculated as 281 | \begin{equation} 282 | \det(A) = 283 | \left\vert 284 | \begin{matrix} 285 | \gamma_1 & \ast & \ast & \cdots & \ast \\ 286 | \vdots & \gamma_2 & \ast & \rddots & \vdots \\ 287 | \vdots & \cdots & \gamma_3 & \ast & \ast \\ 288 | \vdots & \rddots & \vdots & \ddots & \ast \\ 289 | 0 & \cdots & \cdots & \cdots & \gamma_n 290 | \end{matrix} 291 | \right\vert 292 | = 293 | \gamma_1 \gamma_2 \cdots \gamma_n 294 | \end{equation} 295 | 296 | Where $\ast$ represents arbitrary entries. 297 | \end{lemma} 298 | 299 | \begin{corollary} 300 | A specialization of this lemma is the case for $3 \times 3$ \textit{upper triangular} matrix $A$: 301 | \begin{equation} 302 | \det(A) = 303 | \left\vert 304 | \begin{matrix} 305 | \gamma_1 & \ast & \ast \\ 306 | 0 & a & b \\ 307 | 0 & c & d 308 | \end{matrix} 309 | \right\vert 310 | = 311 | \left\vert 312 | \begin{matrix} 313 | \gamma_1 & \ast & \ast \\ 314 | 0 & a & b \\ 315 | 0 & 0 & d - b \cdot \frac{c}{a} 316 | \end{matrix} 317 | \right\vert 318 | = 319 | \gamma_1 (a d - b c) 320 | \end{equation} 321 | \end{corollary} 322 | 323 | \section{Solving Linear System of Equations} 324 | 325 | \begin{definition} 326 | Matrices are useful for solving a \textit{linear system of equations} of the form 327 | \begin{equation} 328 | \left\{ 329 | \begin{array}{c c} 330 | a_{1, 1} x_1 + a{1, 2} x_2 + \cdots + a_{1, n} x_n &= b_1 \\ 331 | a_{2, 1} x_1 + a{2, 2} x_2 + \cdots + a_{2, n} x_n &= b_2 \\ 332 | \vdots &\phantom{} \\ 333 | a_{n, 1} x_1 + a{n, 2} x_2 + \cdots + a_{n, n} x_n &= b_n \\ 334 | \end{array} 335 | \right. 336 | \end{equation} 337 | 338 | Then, the matrix of the \textit{coefficients} is denoted as $A$ with dimension $n \times n$ where 339 | \begin{equation} 340 | A = \begin{bmatrix} 341 | a_{1, 1} & a_{1, 2} & \dots & a_{1, n} \\ 342 | a_{2, 1} & a_{2, 2} & \dots & a_{2, n} \\ 343 | \vdots & \vdots & \ddots & \vdots \\ 344 | a_{n, 1} & a_{n, 2} & \dots & a_{n, n} \\ 345 | \end{bmatrix} 346 | \end{equation} 347 | 348 | The \textit{unknowns} are denoted as $X$ with dimension $n \times 1$ where 349 | \begin{equation} 350 | X = \begin{bmatrix} 351 | x_1 \\ 352 | x_2 \\ 353 | \vdots \\ 354 | x_n 355 | \end{bmatrix} 356 | \end{equation} 357 | 358 | The \textit{constants} are denoted as $B$ with dimension $n \times 1$ where 359 | \begin{equation} 360 | B = \begin{bmatrix} 361 | b_1 \\ 362 | b_2 \\ 363 | \vdots \\ 364 | b_n 365 | \end{bmatrix} 366 | \end{equation} 367 | 368 | Together, they yield the matrix equation 369 | \begin{equation} 370 | A \cdot X = B 371 | \end{equation} 372 | To solve for $X$, one needs to find the \textit{inverse} matrix $\Inverse{A}$ of $A$ such that 373 | \begin{align} 374 | A \cdot X &= B \\ 375 | \Inverse{A} \cdot A \cdot X &= \Inverse{A} \cdot B \\ 376 | I \cdot X &= \Inverse{A} \cdot B \\ 377 | X &= \Inverse{A} \cdot B 378 | \end{align} 379 | Where $I$ is the \textit{identity} matrix. 380 | \end{definition} 381 | 382 | \section{Gaussian Elimination} 383 | 384 | \begin{definition}[Augmented Matrix] 385 | Given a system of linear equations 386 | \begin{equation} 387 | \left\{ 388 | \begin{array}{c c} 389 | a_{1, 1} x_1 + a_{1, 2} x_2 + \cdots + a_{1, n} x_n &= b_1 \\ 390 | a_{2, 1} x_1 + a_{2, 2} x_2 + \cdots + a_{2, n} x_n &= b_2 \\ 391 | \vdots &\phantom{} \\ 392 | a_{n, 1} x_1 + a_{n, 2} x_2 + \cdots + a_{n, n} x_n &= b_n \\ 393 | \end{array} 394 | \right. 395 | \end{equation} 396 | 397 | Then its \textit{augmented} matrix $A \vert B$ is 398 | \begin{equation} 399 | \begin{augmatrix}{4} 400 | a_{1, 1} & a_{1, 2} & \cdots & a_{1, n} & b_{1, n} \\ 401 | a_{2, 1} & a_{2, 2} & \cdots & a_{2, n} & b_{2, n} \\ 402 | \vdots & \vdots & \vdots & \ddots & \vdots \\ 403 | a_{n, 1} & a_{n, 2} & \cdots & a_{n, n} & b_{n, n} \\ 404 | \end{augmatrix} 405 | \end{equation} 406 | \end{definition} 407 | 408 | \begin{definition}[Row Operations]\ \\ 409 | \begin{enumerate} 410 | \item \textbf{Multiply and Add Row} 411 | \subitem Multiply row by scalar $\gamma$ then add the result to another row. 412 | \begin{equation} 413 | \det(A\prime) = \det(A) 414 | \end{equation} 415 | \item \textbf{Swap Rows} 416 | \begin{equation} 417 | \det(A\prime) = -\det(A) 418 | \end{equation} 419 | \item \textbf{Multiply Row} 420 | \subitem Multiply a row by scalar $\gamma$. 421 | \begin{equation} 422 | \det(A\prime) = \gamma \det(A) 423 | \end{equation} 424 | \end{enumerate} 425 | \end{definition} 426 | 427 | \begin{definition}[Gaussian Elimination] 428 | Using the \textit{row operations} applied to $A \vert B$ then one transforms $A X = B$ into an equivalent system 429 | \begin{equation} 430 | A\prime X = B\prime 431 | \end{equation} 432 | 433 | If it is the case that 434 | \begin{equation} 435 | A\prime = I 436 | \end{equation} 437 | 438 | Then there exists a \textit{solution} $X = B\prime$ to the system 439 | \begin{equation} 440 | B\prime = A\prime X = I X = X 441 | \end{equation} 442 | \end{definition} 443 | 444 | \begin{definition}[Inverse Matrix] 445 | The \textit{inverse} matrix $\Inverse{A}$ of $A$ is the matrix for which under multiplication yields the \textit{identity} matrix $I$ 446 | \begin{equation} 447 | A \Inverse{A} \equiv \Inverse{A} A \equiv I 448 | \end{equation} 449 | 450 | With \textit{Gaussian Elimination} applied to $A \vert I$ then one transforms 451 | \begin{equation} 452 | A \Inverse{A} = I \Rightarrow A\prime \Inverse{A} = B\prime 453 | \end{equation} 454 | 455 | If 456 | \begin{equation} 457 | A\prime = I 458 | \end{equation} 459 | 460 | Then there exists a solution to $\Inverse{A} = B\prime$ 461 | \begin{equation} 462 | B\prime = A\prime \Inverse{A} = I \Inverse{A} = \Inverse{A} 463 | \end{equation} 464 | \end{definition} 465 | 466 | \section{Linear Maps} 467 | 468 | \begin{definition}[$\Real^{n}$] 469 | \begin{equation} 470 | \Real^{n} \coloneqq \overbrace{\Real \times \Real \times \cdots \times \Real}^{n} 471 | \end{equation} 472 | \end{definition} 473 | 474 | \begin{definition}[$\Real^{m, n}$] 475 | Is the domain of a matrix with $m$ rows and $n$ columns. 476 | \end{definition} 477 | 478 | \begin{lemma}[Linear Mapping and Matrices] 479 | Any matrix defines a linear mapping. 480 | 481 | Given a matrix $A \in \Real^{m, n}$, then $A$ defines a \textit{linear mapping} $f \colon \Real^{n} \to \Real^{m}$ if entries of $\Real^{n}$ are treated as \textit{column vectors} then for $V \in \Real^{n, 1}$ 482 | \begin{equation} 483 | f(V) = A V 484 | \end{equation} 485 | \end{lemma} 486 | 487 | \begin{remark} 488 | For example, for the $\Real^{2, 3}$ matrix $A$ where 489 | \begin{equation} 490 | A = \begin{bmatrix} 491 | 1 & 2 & 3 \\ 492 | 4 & 5 & 6 493 | \end{bmatrix} \in \Real^{2, 3} 494 | \end{equation} 495 | 496 | $A$ defines a \textit{linear mapping} $f$ such that 497 | \begin{equation} 498 | f \colon \Real^{3} \to \Real^{2} 499 | \end{equation} 500 | 501 | Since column vectors are used, then an $m \times n$ matrix defines a mapping from $\Real^{n} \to \Real^{m}$ with $m, n$ reversed. 502 | 503 | Then the mapping $f$ is defined as 504 | \begin{equation} 505 | f \begin{pmatrix} 506 | 1 \\ 507 | 0 \\ 508 | 0 \\ 509 | \end{pmatrix} = \begin{pmatrix} 510 | 1 \\ 511 | 4 512 | \end{pmatrix} 513 | \quad 514 | f \begin{pmatrix} 515 | 0 \\ 516 | 1 \\ 517 | 0 \\ 518 | \end{pmatrix} = \begin{pmatrix} 519 | 2 \\ 520 | 5 521 | \end{pmatrix} 522 | \quad 523 | f \begin{pmatrix} 524 | 0 \\ 525 | 0 \\ 526 | 1 \\ 527 | \end{pmatrix} = \begin{pmatrix} 528 | 3 \\ 529 | 6 530 | \end{pmatrix} 531 | \end{equation} 532 | 533 | Then the $i$th column of $A$ represents the image of the $i$th element of $\Real^{n, 1}$ 534 | \end{remark} 535 | 536 | \begin{remark} 537 | Let there be an system of linear equations 538 | \begin{equation} 539 | \left\{ 540 | \begin{array}{c} 541 | x\prime_1 = a_{1, 1} x_1 + a_{1, 2} x_2 + \cdots + a_{1, n} x_n \\ 542 | x\prime_2 = a_{2, 1} x_1 + a_{2, 2} x_2 + \cdots + a_{2, n} x_n \\ 543 | \vdots \\ 544 | x\prime_n = a_{n, 1} x_1 + a_{n, 2} x_2 + \cdots + a_{n, n} x_n \\ 545 | \end{array} 546 | \right. 547 | \end{equation} 548 | 549 | With 550 | \begin{equation} 551 | A = \begin{bmatrix} 552 | a_{1, 1} & a_{1, 2} & \cdots & a_{1, n} \\ 553 | a_{2, 1} & a_{2, 2} & \cdots & a_{2, n} \\ 554 | \vdots & \vdots & \ddots & \vdots \\ 555 | a_{n, 1} & a_{n, 2} & \cdots & a_{n, n} \\ 556 | \end{bmatrix} 557 | \quad 558 | X = \begin{bmatrix} 559 | x_1 \\ 560 | x_2 \\ 561 | \vdots \\ 562 | x_n \\ 563 | \end{bmatrix} 564 | \quad 565 | X\prime = \begin{bmatrix} 566 | x\prime_1 \\ 567 | x\prime_2 \\ 568 | \vdots \\ 569 | x\prime_n \\ 570 | \end{bmatrix} 571 | \end{equation} 572 | 573 | Then there is a linear map 574 | \begin{equation} 575 | X\prime = A X 576 | \end{equation} 577 | \end{remark} 578 | 579 | \section{Eigenvalues and Eigenvectors} 580 | 581 | \begin{definition}[Eigenvalue and Eigenvector]\ \\ 582 | \begin{enumerate} 583 | \item A real number $\lambda \in \Real$ is an \textit{eigenvalue} of $A$ 584 | \item A non-zero vector $\overrightarrow{\upsilon}$ is an \textit{eigenvector} 585 | \end{enumerate} 586 | Then 587 | \begin{equation} 588 | A \overrightarrow{\upsilon} = \lambda \overrightarrow{\upsilon}, \quad \overrightarrow{\upsilon} \ne \overrightarrow{0} 589 | \end{equation} 590 | 591 | Since 592 | \begin{equation} 593 | A \overrightarrow{\upsilon} - \lambda \overrightarrow{\upsilon} = (A - \lambda I) \cdot \overrightarrow{\upsilon} = \overrightarrow{0} \implies \lvert A - \lambda I \rvert = 0 594 | \end{equation} 595 | 596 | Hence, to solve for $\lambda$, use 597 | \begin{equation} 598 | \lvert A - \lambda I \rvert = 0 599 | \end{equation} 600 | 601 | Then substitute the found \textit{eigvenvalue} $\lambda$ to find its corresponding \textit{eigvenvector} $\overrightarrow{v}$ with 602 | \begin{equation} 603 | (A - \lambda I) \cdot \overrightarrow{\upsilon} = \overrightarrow{0} 604 | \end{equation} 605 | \end{definition} 606 | 607 | \begin{remark} 608 | An example. 609 | 610 | For the system of linear equations 611 | \begin{equation} 612 | \left\{ 613 | \begin{array}{c} 614 | x\prime = 2 x + 2 y \\ 615 | y\prime = 2 x + 5 y \\ 616 | \end{array} 617 | \right. 618 | \end{equation} 619 | 620 | \begin{equation} 621 | A = \begin{bmatrix} 622 | 2 & 2 \\ 623 | 2 & 5 \\ 624 | \end{bmatrix} 625 | \end{equation} 626 | 627 | \begin{equation} 628 | \lvert A - \lambda I \rvert 629 | = 630 | \begin{detmatrix}{2} 631 | 2 - \lambda & 2 \\ 632 | 2 & 5 - \lambda \\ 633 | \end{detmatrix} 634 | = \lambda^2 - 7 \lambda + 6 635 | = 0 636 | \end{equation} 637 | 638 | Then there exist two \textit{eigenvalues} 639 | \begin{equation} 640 | \lambda^2 - 7 \lambda + 6 \implies \lambda_1 = 1, \lambda_2 = 6 641 | \end{equation} 642 | 643 | Then 644 | \begin{equation} 645 | A - \lambda_1 I = \begin{bmatrix} 646 | 1 & 2 \\ 647 | 2 & 4 \\ 648 | \end{bmatrix} 649 | \end{equation} 650 | 651 | And 652 | \begin{equation} 653 | A - \lambda_2 I = \begin{bmatrix} 654 | -4 & 2 \\ 655 | 2 & -1 \\ 656 | \end{bmatrix} 657 | \end{equation} 658 | 659 | To find the \textit{eigenvector} associated with each \textit{eigenvalue}: 660 | 661 | \begin{enumerate} 662 | \item Case $\lambda_1 = 1$ 663 | \subitem From the system, to find the \textit{eigenvector} ${\overrightarrow{\upsilon}}_{\lambda_1}$ 664 | \begin{equation} 665 | (A - \lambda_1 I) 666 | \begin{bmatrix} 667 | {\upsilon}_{1} \\ 668 | {\upsilon}_{2} 669 | \end{bmatrix} 670 | = 671 | \begin{bmatrix} 672 | 0 \\ 673 | 0 674 | \end{bmatrix} 675 | \Rightarrow 676 | \begin{bmatrix} 677 | 1 & 2 \\ 678 | 2 & 4 \\ 679 | \end{bmatrix} 680 | \begin{bmatrix} 681 | {\upsilon}_{1} \\ 682 | {\upsilon}_{2} 683 | \end{bmatrix} 684 | = 685 | \begin{bmatrix} 686 | 0 \\ 687 | 0 688 | \end{bmatrix} 689 | \end{equation} 690 | 691 | Via Gaussian elimination, 692 | \begin{equation} 693 | \Leftrightarrow 694 | \begin{bmatrix} 695 | 1 & 2 \\ 696 | 0 & 0 \\ 697 | \end{bmatrix} 698 | \begin{bmatrix} 699 | {\upsilon}_{1} \\ 700 | {\upsilon}_{2} \\ 701 | \end{bmatrix} 702 | = 703 | \begin{bmatrix} 704 | 0 \\ 705 | 0 706 | \end{bmatrix} 707 | \quad\quad \implies 708 | \left\{ 709 | \begin{array}{l} 710 | 1 \upsilon_1 + 2 \upsilon_2 = 0 \\ 711 | 0 + 0 = 0 \\ 712 | \end{array} 713 | \right. 714 | \end{equation} 715 | 716 | Then there exists an \textit{infinite} number of solutions where 717 | \begin{equation} 718 | \upsilon_1 = -2 \upsilon_2 719 | \end{equation} 720 | 721 | Taking one of them is sufficient, e.g. 722 | \begin{equation} 723 | {\overrightarrow{\upsilon}}_{\lambda_1} 724 | = 725 | \begin{bmatrix} 726 | -2 \\ 727 | 1 \\ 728 | \end{bmatrix} 729 | \end{equation} 730 | 731 | Check that for the \textit{eigenvalue}-\textit{eigenvector} pair that 732 | \begin{equation} 733 | A {\overrightarrow{\upsilon}}_{\lambda_1} = \lambda_1 {\overrightarrow{\upsilon}}_{\lambda_1} 734 | \end{equation} 735 | \begin{equation} 736 | \begin{bmatrix} 737 | 2 & 2 \\ 738 | 2 & 5 \\ 739 | \end{bmatrix} 740 | \begin{bmatrix} 741 | -2 \\ 742 | 1 \\ 743 | \end{bmatrix} 744 | = 745 | \begin{bmatrix} 746 | -2 \\ 747 | 1 \\ 748 | \end{bmatrix} 749 | = 750 | \lambda_1 751 | \begin{bmatrix} 752 | -2 \\ 753 | 1 \\ 754 | \end{bmatrix} 755 | \end{equation} 756 | \item Case $\lambda_2 = 6$ 757 | \subitem Repeat the same procedure, and the \textit{eigenvector} takes the value 758 | \begin{equation} 759 | {\overrightarrow{\upsilon}}_{\lambda_2} 760 | = 761 | \begin{bmatrix} 762 | 1 \\ 763 | 2 \\ 764 | \end{bmatrix} 765 | \end{equation} 766 | \end{enumerate} 767 | \end{remark} 768 | 769 | \begin{remark} 770 | With $A$ being symmetric, then \textit{eigenvectors} ${\overrightarrow{\upsilon}}_{\lambda_1}$ and ${\overrightarrow{\upsilon}}_{\lambda_2}$ are \textit{orthogonal} 771 | \begin{equation} 772 | \begin{bmatrix} 773 | {\overrightarrow{\upsilon}}_{\lambda_1} & {\overrightarrow{\upsilon}}_{\lambda_2} 774 | \end{bmatrix} 775 | \begin{bmatrix} 776 | {\overrightarrow{\upsilon}}_{\lambda_1} \\ 777 | {\overrightarrow{\upsilon}}_{\lambda_2} 778 | \end{bmatrix} 779 | \equiv 780 | \overrightarrow{0} 781 | \end{equation} 782 | \end{remark} 783 | 784 | \begin{remark} 785 | For the system of linear equations 786 | \begin{equation} 787 | \left\{ 788 | \begin{array}{l} 789 | x\prime = \frac{\sqrt{2}}{2} x + \frac{\sqrt{2}}{2} y \\ 790 | y\prime = -\frac{\sqrt{2}}{2} x + \frac{\sqrt{2}}{2} y \\ 791 | \end{array} 792 | \right. 793 | \end{equation} 794 | 795 | \begin{equation} 796 | A = 797 | \begin{bmatrix} 798 | \frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} \\ 799 | -\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} \\ 800 | \end{bmatrix} 801 | \end{equation} 802 | 803 | \begin{equation} 804 | \lvert A - \lambda I \rvert 805 | = 806 | \begin{detmatrix}{2} 807 | \frac{\sqrt{2}}{2} - \lambda & \frac{\sqrt{2}}{2} \\ 808 | -\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} - \lambda \\ 809 | \end{detmatrix} 810 | = \left( \frac{\sqrt{2}}{2} - \lambda \right)^2 + \frac{1}{2} 811 | = 0 812 | \end{equation} 813 | 814 | And thus there is no \textit{real} \textit{eigenvalues}; this $A$ is in fact a \textit{rotation}. 815 | \end{remark} 816 | -------------------------------------------------------------------------------- /latex/ch-permutations.tex: -------------------------------------------------------------------------------- 1 | \chapter{Permutations} 2 | 3 | \section{Permutation Basics} 4 | 5 | \begin{definition}[Permutation] 6 | The bijection -- \textit{permutation} -- of 7 | \begin{equation} 8 | \begin{matrix} 9 | 1 &2 &3 &\cdots &n \\ 10 | \downarrow &\downarrow &\downarrow &\cdots &\downarrow \\ 11 | \Permutate{1} &\Permutate{2} &\Permutate{3} &\cdots &\Permutate{n} 12 | \end{matrix} 13 | \end{equation} 14 | 15 | Is denoted as 16 | \begin{equation} 17 | \begin{pmatrix} 18 | 1 & 2 & 3 & \cdots & n \\ 19 | \Permutate{1} & \Permutate{2} & \Permutate{3} & \cdots & \Permutate{n} \\ 20 | \end{pmatrix} 21 | \end{equation} 22 | 23 | Where $\sigma \colon \set{1, \dots, n} \to \set{1, \dots, n}$ is the \textit{permutation} bijection. 24 | \end{definition} 25 | 26 | \begin{definition}[Counting Permutations] 27 | \begin{equation} 28 | \VSBars{S_n} \coloneqq n! 29 | \end{equation} 30 | Which is the number of different ways to permutate $n$ elements $\set{1, 2, \dots, n} \subset \Int$. Together, the different permutations for $n$ distinct elements is the \textit{symmetric group} $S_n$. 31 | \end{definition} 32 | 33 | \begin{remark} 34 | For example, with $S_3 = \set{1, 2, 3}$, there are $3! = 6$ different ways to arrange the three distinct elements 35 | \begin{equation} 36 | \begin{matrix} 37 | \begin{pmatrix} 38 | 1 & 2 & 3 \\ 39 | 1 & 2 & 3 40 | \end{pmatrix} \quad 41 | \begin{pmatrix} 42 | 1 & 2 & 3 \\ 43 | 1 & 3 & 2 44 | \end{pmatrix} \quad 45 | \begin{pmatrix} 46 | 1 & 2 & 3 \\ 47 | 2 & 1 & 3 48 | \end{pmatrix} \\[1em] 49 | \begin{pmatrix} 50 | 1 & 2 & 3 \\ 51 | 2 & 3 & 1 52 | \end{pmatrix} \quad 53 | \begin{pmatrix} 54 | 1 & 2 & 3 \\ 55 | 3 & 1 & 2 56 | \end{pmatrix} \quad 57 | \begin{pmatrix} 58 | 1 & 2 & 3 \\ 59 | 3 & 2 & 1 60 | \end{pmatrix}\\ 61 | \end{matrix} 62 | \end{equation} 63 | \end{remark} 64 | 65 | \begin{definition}[Order of Permutation] 66 | The \textit{order} of a permutation $\sigma$ is the smallest $k \in \PosInt$ such that 67 | \begin{equation} 68 | \sigma^{k} = \epsilon 69 | \end{equation} 70 | Where $\epsilon$ is the \textit{identity permutation} 71 | \begin{equation} 72 | \epsilon(x) = x 73 | \end{equation} 74 | \end{definition} 75 | 76 | \begin{definition}[Sign of Permutation] 77 | The \textit{sign} of a permutation $\Sign{\sigma} \colon \sigma \to \set{-1, +1}$ where $\sigma \in S_n$ is defined as 78 | \begin{equation} 79 | \Sign(\sigma) = (-1)^{k} 80 | \end{equation} 81 | Where $k$ is the number of \textit{disorders} within $\sigma$, the number of pairs $(x, y)$ such that $x > y \to \sigma(x) < \sigma(y)$ or the converse $x < y \to \sigma(x) > \sigma(y)$. Additionally, 82 | \begin{equation} 83 | \Sign(\sigma) = \begin{cases} 84 | +1 &\text{if k is even} \\ 85 | -1 &\text{if k is odd} 86 | \end{cases} 87 | \end{equation} 88 | \end{definition} 89 | 90 | \begin{remark} 91 | For example, in 92 | \begin{equation*} 93 | \begin{pmatrix} 94 | 1 & 2 & 3 \\ 95 | 2 & 1 & 3 96 | \end{pmatrix} 97 | \end{equation*} 98 | $1 < 2$ but $\sigma(1) = 2 > \sigma(2) = 1$, hence a disorder. 99 | 100 | For each $i \in \set{1, \dots, n}$, starting from $i = 1$, compare $\sigma(i)$ with $\sigma(i + 1), \dots, \sigma(n)$ and add the number of disordered pairs, then move on to $i + 1$ and compare $\sigma(i + 1)$ with $\sigma(i + 2), \dots, \sigma(n)$ and so on. 101 | \end{remark} 102 | 103 | \begin{definition}[Composition of Permutation] 104 | Given two permutations $\sigma$ and $\tau$, then their composition 105 | \begin{equation} 106 | (\sigma \tau) (x) \coloneqq \tau(\sigma(x)) 107 | \end{equation} 108 | 109 | With $\sigma$ applied first. 110 | \end{definition} 111 | 112 | \begin{theorem}[Sign of Composition of Permutation] 113 | \begin{equation} 114 | \Sign(\sigma_1 \sigma_2) \coloneqq \Sign(\sigma_1) \cdot \Sign(\sigma_2) 115 | \end{equation} 116 | \end{theorem} 117 | 118 | Where 119 | \begin{table}[H] 120 | \centering 121 | \begin{tabular}{c | c c} 122 | \toprule 123 | $\circ$ & even & odd \\ 124 | \midrule 125 | even & even & odd \\ 126 | odd & odd & even \\ 127 | \bottomrule 128 | \end{tabular} 129 | \caption{Sign Changes on Composition} 130 | \end{table} 131 | -------------------------------------------------------------------------------- /latex/ch-set-theory.tex: -------------------------------------------------------------------------------- 1 | \chapter{Set Theory} 2 | 3 | \section{Set Notations} 4 | \begin{itemize} 5 | \item Set definition: $A = \set{a, b, c}$ 6 | \item Set membership (element-of): $a \in A$ 7 | \item Set builder notation: $\set{x \given x \in \Real \land x^2 = x}$ 8 | \item Empty set: $\emptyset$ 9 | \end{itemize} 10 | 11 | \section{Properties} 12 | \begin{itemize} 13 | \item No structure 14 | \item No order 15 | \item No copies 16 | \end{itemize} 17 | 18 | For example, $a, b, c$ are references to actual objects in 19 | \begin{equation*} 20 | \set{a, b, c} \Leftrightarrow \set{c, a, b} \Leftrightarrow \set{a, b, c, b} 21 | \end{equation*} 22 | 23 | \section{Set Equality} 24 | \begin{definition}[Set Equality] 25 | Set $A = B$ iff: 26 | \begin{enumerate} 27 | \item $A \subseteq B$ $\implies$ $\Forall x (x \in A \to x \in B)$ 28 | \item $B \subseteq A$ $\implies$ $\Forall y (y \in B \to y \in A)$ 29 | \end{enumerate} 30 | \end{definition} 31 | 32 | \begin{remark} 33 | $A = B \Leftrightarrow A \subseteq B \land B \subseteq A$ 34 | \end{remark} 35 | 36 | \section{Set Operations} 37 | \begin{itemize} 38 | \item \textit{Union}: $A \cup B \coloneqq \set{x \given x \in A \lor x \in B}$ 39 | \item \textit{Intersection}: $A \cap B \coloneqq \set{x \given x \in A \land x \in B}$ 40 | \item \textit{Relative Complement}: $A \Diff B \coloneqq \set{x \given x \in A \land x \not\in B}$ 41 | \item \textit{Absolute Complement}: $\AbsComplement{A} \coloneqq U \Diff A \coloneqq \set{x \given x \in U \land x \not\in A}$ 42 | \item \textit{Symmetric Difference}: $A \Delta B \coloneqq (A \Diff B) \cup (B \Diff A) \coloneqq (A \cup B)\Diff(A \cap B)$ 43 | \item \textit{Cartesian Product}: $A \times B \coloneqq \set{(x, y) \given x \in A \land y \in B}$ 44 | \end{itemize} 45 | 46 | \section{Boolean Algebra} 47 | \begin{definition}[De Morgan's Laws] 48 | \begin{align} 49 | \neg (p \lor q ) &\equiv \neg p \land \neg q \\ 50 | \neg (p \land q) &\equiv \neg p \lor \neg q 51 | \end{align} 52 | \end{definition} 53 | 54 | \begin{definition}[Idempotent Laws] 55 | \begin{align} 56 | p \lor p &\equiv p \\ 57 | p \land p &\equiv p 58 | \end{align} 59 | 60 | \end{definition} 61 | 62 | \begin{definition}[Commutative Laws] 63 | \begin{align} 64 | p \lor q &\equiv q \lor p \\ 65 | p \land q &\equiv q \land p 66 | \end{align} 67 | \end{definition} 68 | 69 | \begin{definition}[Associative Laws] 70 | \begin{align} 71 | p \lor (q \lor r) &\equiv (p \lor q) \lor r \\ 72 | p \land (q \land r) &\equiv (p \land q) \land r 73 | \end{align} 74 | \end{definition} 75 | 76 | \begin{definition}[Distributive Laws] 77 | \begin{align} 78 | p \land (q \lor r) &\equiv (p \land q) \lor (p \land r) \\ 79 | p \lor (q \land r) &\equiv (p \lor q) \land (p \lor r) 80 | \end{align} 81 | \end{definition} 82 | 83 | \begin{definition}[Identity Laws] 84 | \begin{align} 85 | p \lor \False &\equiv p \\ 86 | p \lor \True &\equiv \True \\ 87 | p \land \True &\equiv p \\ 88 | p \land \False &\equiv \False 89 | \end{align} 90 | \end{definition} 91 | 92 | \begin{definition}[Absorption Laws] 93 | \begin{align} 94 | p \lor (p \land q) &\equiv p \\ 95 | p \land (p \lor q) &\equiv p 96 | \end{align} 97 | \end{definition} 98 | 99 | \begin{definition}[Implication and Negation Laws]\ \\ 100 | \begin{itemize} 101 | \item \textit{Identity}: $p \to q \equiv \neg p \lor q$ 102 | \item \textit{Counter-example}: $\neg(p \to q) \equiv p \land \neg q$ 103 | \item \textit{Equivalences}: $p \to q \to r \equiv (p \land q) \to r \equiv q \to (p \to r)$ 104 | \item \textit{Absorption}: 105 | \subitem $p \to \True \equiv T$ 106 | \subitem $p \to \False \equiv \neg p$ 107 | \subitem $\True \to p \equiv p$ 108 | \subitem $\False \to p \equiv T$ 109 | \item \textit{Contrapositive}: $p \to q \equiv \neg q \to \neg p$ 110 | \item \textit{Law of Excluded Middle}: 111 | \subitem $p \lor \neg p \equiv \True$ 112 | \subitem $p \land \neg p \equiv \False$ 113 | \item \textit{Double Negation}: $\neg \neg p \equiv p$ 114 | \item \textit{Reduction to Absurdity}: $\neg p \to \False \equiv p$ 115 | % TODO 116 | \end{itemize} 117 | \end{definition} 118 | 119 | \section{Set Algebra} 120 | \begin{definition}[De Morgan's Laws] 121 | \begin{align} 122 | \AbsComplement{(A \cup B)} &\equiv \AbsComplement{A} \cap \AbsComplement{B} \\ 123 | \AbsComplement{(A \cap B)} &\equiv \AbsComplement{A} \cup \AbsComplement{B} 124 | \end{align} 125 | \end{definition} 126 | 127 | \begin{definition}[Idempotent Laws] 128 | \begin{align} 129 | A \cup A &\equiv A \\ 130 | A \cap A &\equiv A 131 | \end{align} 132 | \end{definition} 133 | 134 | \begin{definition}[Commutative Laws] 135 | \begin{align} 136 | A \cup B &\equiv B \cup A \\ 137 | A \cap B &\equiv B \cap A 138 | \end{align} 139 | \end{definition} 140 | 141 | \begin{definition}[Associativity Laws] 142 | \begin{align} 143 | A \cup (B \cup C) &\equiv (A \cup B) \cup C \\ 144 | A \cap (B \cap C) &\equiv (A \cap B) \cap C 145 | \end{align} 146 | \end{definition} 147 | 148 | \begin{definition}[Distributive Laws] 149 | \begin{align} 150 | A \cap (B \cup C) &\equiv (A \cap B) \cup (B \cap C)\\ 151 | A \cup (B \cap C) &\equiv (A \cup B) \cap (B \cup C) 152 | \end{align} 153 | \end{definition} 154 | 155 | \begin{definition}[Identity Laws] 156 | \begin{align} 157 | A \cup \emptyset &\equiv A \\ 158 | A \cap \emptyset &\equiv \emptyset \\ 159 | A \cap U &\equiv A \\ 160 | A \cup U &\equiv U 161 | \end{align} 162 | \end{definition} 163 | 164 | \begin{definition}[Absorption Laws] 165 | \begin{align} 166 | A \cup (A \cap B) &\equiv A \\ 167 | A \cap (A \cup B) &\equiv A 168 | \end{align} 169 | \end{definition} 170 | 171 | \begin{definition}[Difference Identity Laws] 172 | \begin{align} 173 | C \Diff (A \cup B) &\equiv (C \Diff A) \cap (C \Diff B) \\ 174 | C \Diff (A \cap B) &\equiv (C \Diff A) \cup (C \Diff B) 175 | \end{align} 176 | \end{definition} 177 | 178 | \begin{definition}[Complement-Difference Identity Law] 179 | \begin{equation} 180 | C \Diff D \equiv C \cap \AbsComplement{D} 181 | \end{equation} 182 | \end{definition} 183 | 184 | \begin{definition}[Double Complement Law] 185 | \begin{equation} 186 | \AbsComplement{(\AbsComplement{D})} \equiv D 187 | \end{equation} 188 | \end{definition} 189 | 190 | \begin{definition}[Contraposition] 191 | \begin{align} 192 | C \subseteq D &\Leftrightarrow \AbsComplement{D} \subseteq \AbsComplement{C} \\ 193 | C = D &\Leftrightarrow \AbsComplement{C} = \AbsComplement{D} 194 | \end{align} 195 | \end{definition} 196 | 197 | \begin{definition}[Arbitrary Union]\ \\ 198 | Given sets $A_1, A_2, \dots, A_n$ where $I = \set{1, 2, \dots, n}$ 199 | \begin{equation} 200 | A_1 \cup A_2 \cup \dots \cup A_n \coloneqq \bigcup_{i \in I} A_i 201 | \end{equation} 202 | Then 203 | \begin{equation} 204 | x \in \bigcup_{i \in I} A_i \Leftrightarrow \Exists i \in I \colon x \in A_i 205 | \end{equation} 206 | \end{definition} 207 | 208 | \begin{definition}[Arbitrary Intersection]\ \\ 209 | Given sets $A_1, A_2, \dots, A_n$ where $I = \set{1, 2, \dots, n}$ 210 | \begin{equation} 211 | A_1 \cap A_2 \cap \dots \cap A_n \coloneqq \bigcap_{i \in I} A_i 212 | \end{equation} 213 | Then 214 | \begin{equation} 215 | x \in \bigcap_{i \in I} A_i \Leftrightarrow \Forall i \in I \colon x \in A_i 216 | \end{equation} 217 | \end{definition} 218 | -------------------------------------------------------------------------------- /latex/citations.bib: -------------------------------------------------------------------------------- 1 | @unpublished { kanovich-hirsch, 2 | author = {Max Kanovich and Robin Hirsch}, 3 | institution = {University College London}, 4 | title = {Lecture Notes on Discrete Mathematics for Computer Scientists}, 5 | url = {http://www.cs.ucl.ac.uk/1819/a4u/t2/comp0147_discrete_mathematics_for_computer_scientists/} 6 | } 7 | 8 | @book{rotman, 9 | author = {Joseph J. Rotman}, 10 | title = {A First Course in Abstract Algebra}, 11 | date = {October 8, 2005}, 12 | edition = {3}, 13 | publisher = {Pearson}, 14 | location = {University of Illinois at Urbana-Champaign}, 15 | isbn = {978-0131862678}, 16 | } 17 | -------------------------------------------------------------------------------- /latex/font-cfg.tex: -------------------------------------------------------------------------------- 1 | \usepackage{unicode-math} 2 | \setmainfont{Latin Modern Roman} 3 | \setmathfont{Latin Modern Math} 4 | \setsansfont{Ubuntu} 5 | 6 | \let\mathrm\relax 7 | \DeclareMathAlphabet{\mathrm}{TU}{lmodern}{m}{n} 8 | 9 | \DeclareMathAlphabet{\mathbf}{TU}{lmodern}{bx}{n} 10 | \DeclareMathAlphabet{\mathit}{TU}{lmodern}{m}{it} 11 | 12 | \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n} 13 | \let\mathbb\relax % remove the definition by unicode-math 14 | \DeclareMathAlphabet{\mathbb}{U}{msb}{m}{n} 15 | -------------------------------------------------------------------------------- /latex/math-ops.tex: -------------------------------------------------------------------------------- 1 | \DeclarePairedDelimiterX\set[1]\lbrace\rbrace{\def\given{\;\delimsize\vert\;}#1} 2 | 3 | \DeclarePairedDelimiterX\VSBars[1]\lvert\rvert{#1} 4 | \DeclarePairedDelimiterX\VDBars[1]{\lvert\lvert}{\rvert\rvert}{#1} 5 | 6 | \newcommand{\Real}{\mathbb{R}} 7 | \newcommand{\Rational}{\mathbb{Q}} 8 | \newcommand{\Complex}{\mathbb{C}} 9 | \newcommand{\Int}{\mathbb{Z}} 10 | \newcommand{\PosInt}{\mathbb{Z}^{+}} 11 | \newcommand{\NegInt}{\mathbb{Z}^{-}} 12 | \newcommand{\NatNum}{\mathbb{N}} 13 | \newcommand{\PosRat}{\mathbb{R}^{+}} 14 | \newcommand{\NegRat}{\mathbb{R}^{-}} 15 | 16 | \newcommand{\AlephZero}{\aleph_{0}} 17 | 18 | \DeclareMathOperator{\Exists}{\exists} 19 | \DeclareMathOperator{\Forall}{\forall} 20 | 21 | \DeclareMathOperator{\Diff}{\backslash} 22 | 23 | \newcommand{\AbsComplement}[1]{{#1}^{c}} 24 | 25 | \newcommand{\True}{\mathrm{T}} 26 | \newcommand{\False}{\mathrm{F}} 27 | 28 | \newcommand{\Domain}[1]{\operatorname{domain}({#1})} 29 | \newcommand{\Image}[1]{\operatorname{image}({#1})} 30 | 31 | \newcommand{\Inverse}[1]{{#1}^{-1}} 32 | 33 | \newcommand{\Permutate}[1]{\sigma({#1})} 34 | 35 | \DeclareMathOperator{\Sign}{sgn} 36 | 37 | \newcommand{\Mod}[1]{\ (\mathrm{mod}\ #1)} 38 | 39 | \newcommand{\Encrypt}[3]{\mathrm{encrypt}_{#1, #2}(#3)} 40 | \newcommand{\Decrypt}[3]{\mathrm{decrypt}_{#1, #2}(#3)} 41 | 42 | \newcommand{\MatrixClass}[2]{\mathcal{M}(#1, #2)} 43 | 44 | \newcommand{\rddots}{\reflectbox{$\ddots$}} 45 | 46 | \newenvironment{detmatrix}[1]{% 47 | \left\vert\begin{array}{@{}*{#1}{c}@{}} 48 | }{% 49 | \end{array}\right\vert 50 | } 51 | 52 | \newenvironment{augmatrix}[1]{% 53 | \left[\begin{array}{@{}*{#1}{c}|c@{}} 54 | }{% 55 | \end{array}\right] 56 | } 57 | 58 | \newcommand{\Prob}[1]{\mathrm{P}(#1)} 59 | -------------------------------------------------------------------------------- /latex/theorem-cfg.tex: -------------------------------------------------------------------------------- 1 | \theoremstyle{definition} 2 | \newtheorem{theorem}{Theorem}[section] 3 | \newtheorem{corollary}{Corollary}[theorem] 4 | \newtheorem{lemma}[theorem]{Lemma} 5 | \newtheorem*{remark}{Remark} 6 | 7 | \theoremstyle{definition} 8 | \newtheorem{proposition}{Proposition}[section] 9 | 10 | \theoremstyle{definition} 11 | \newtheorem{definition}{Definition}[section] 12 | 13 | \renewcommand\qedsymbol{$\blacksquare$} -------------------------------------------------------------------------------- /latex/utils.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\blankpage}{ 2 | \newpage 3 | \thispagestyle{empty} 4 | \mbox{} 5 | \newpage 6 | } 7 | --------------------------------------------------------------------------------