%!TEX program = xelatex
% miko:title: Mathematics
% miko:summary: A concise guide to mathematics.
% miko:category: math
% miko:type: complete
% miko:origin: ai
% miko:tags: math
% miko:difficulty: undergrad
% miko:keywords: mathematics

\documentclass[a4paper,11pt]{article}
\usepackage{amsmath,amssymb,mathtools,bm}
\usepackage[margin=25mm]{geometry}
\usepackage{hyperref}

\title{Complete Mathematics}
\author{Miko-pedia AI}
\date{\today}

\begin{document}
\maketitle
\tableofcontents

\textbf{Overview.} This complete note provides a unified undergraduate review of core mathematical topics, from logic and discrete structures through calculus, linear algebra, probability, and modern analysis. Each section is designed to stand alone for exam review: definitions, key theorems, representative examples, and concise summaries are included throughout. The sections follow a natural progression from foundational reasoning to advanced topics such as topology and numerical methods. Use this overview to locate weak areas and target your study efficiently.

\section{The Language of Mathematics: Propositions, Sets, Functions, and Proofs}
\subsection{Core ideas}

Mathematics rests on a rigorous foundation of logic and set theory. A \textbf{proposition} is a declarative statement that is unambiguously either true or false. Propositions are combined using logical connectives: $\neg$ (negation), $\land$ (conjunction), $\lor$ (disjunction), $\implies$ (implication), and $\iff$ (biconditional). An implication $P \implies Q$ is vacuously true if $P$ is false. A \textbf{predicate} $P(x)$ is a statement whose truth depends on a variable $x$, quantified by $\forall$ (``for all'') or $\exists$ (``there exists''). De Morgan's laws for quantifiers state $\neg(\forall x\,P(x)) \iff \exists x\,\neg P(x)$ and $\neg(\exists x\,P(x)) \iff \forall x\,\neg P(x)$.

A \textbf{set} is a collection of distinct objects. Basic operations include union $A \cup B$, intersection $A \cap B$, set difference $A \setminus B$, and the power set $\mathcal{P}(A)$ (the set of all subsets of $A$). The Cartesian product $A \times B = \{(a,b) \mid a \in A,\; b \in B\}$ produces ordered pairs. 
A \textbf{relation} on $A$ and $B$ is a subset $R \subseteq A \times B$. An \textbf{equivalence relation} $\sim$ on $A$ is a relation that is reflexive ($a \sim a$), symmetric ($a \sim b \implies b \sim a$), and transitive ($a \sim b \land b \sim c \implies a \sim c$). It partitions $A$ into disjoint \textbf{equivalence classes} $[a] = \{x \in A \mid x \sim a\}$.

A \textbf{function} $f : A \to B$ is a relation where each $a \in A$ is paired with exactly one $b \in B$. A function is \textbf{injective} (one-to-one) if $f(a_1) = f(a_2) \implies a_1 = a_2$; \textbf{surjective} (onto) if $\forall b \in B, \exists a \in A$ with $f(a)=b$; and \textbf{bijective} if both hold. 
Bijections establish that two sets have the same \textbf{cardinality} $|A| = |B|$. A set is \textbf{countable} if it is in bijection with a subset of $\mathbb{N}$. Cantor's Theorem states that $|A| < |\mathcal{P}(A)|$, proving the existence of uncountably infinite sets (e.g., $\mathbb{R}$).

Proof techniques are the tools of mathematical reasoning:
\textbf{Direct proof}: assume hypotheses, deduce conclusion via logical steps. 
\textbf{Proof by contrapositive}: prove $P \implies Q$ by showing $\neg Q \implies \neg P$. 
\textbf{Proof by contradiction}: assume the negation of the desired statement and derive a logical impossibility. 
\textbf{Mathematical induction}: prove $P(1)$ (base case) and $P(k) \implies P(k+1)$ (inductive step) for all $k \in \mathbb{N}$.

\begin{enumerate}
  \item \textbf{Logic}: connectives, quantifiers, De Morgan's laws.
  \item \textbf{Set Theory}: operations, relations, equivalence classes, power sets, cardinality.
  \item \textbf{Functions}: injectivity, surjectivity, bijections, and inverse functions.
  \item \textbf{Proof methods}: direct, contrapositive, contradiction, induction.
\end{enumerate}

\subsection{Mathematical spine}
\[
\text{Truth table for Implication: } 
\begin{array}{c|c|c}
P & Q & P\implies Q \\ \hline
T & T & T \\
T & F & F \\
F & T & T \\
F & F & T
\end{array}
\]
\[
\text{De Morgan: } \neg(P\land Q) \iff \neg P \lor \neg Q,\qquad \neg(P\lor Q) \iff \neg P \land \neg Q
\]
\[
\text{Equivalence relation: } a \sim a,\quad a \sim b \implies b \sim a,\quad a \sim b \land b \sim c \implies a \sim c
\]

\paragraph{Section summary}
The language of mathematics is built upon formal logic and set theory. Propositions, predicates, and quantifiers provide the syntax for rigorous statements. Sets, relations, and functions offer the foundational structures for modeling mathematical objects. Mastery of proof techniques---including induction, contrapositive, and contradiction---is required to rigorously verify properties of these structures.

\section{Discrete Structures: Induction, Combinatorics, Graphs, and Algorithms}
\subsection{Core ideas}

Discrete mathematics studies countable, distinct structures. \textbf{Mathematical induction} (weak and strong) is the standard proof technique for statements concerning natural numbers. \textbf{Recursion} defines sequences or sets in terms of previous elements, often solvable via \textbf{generating functions} (e.g., representing sequence $\{a_n\}$ as a formal power series $\sum a_n x^n$) or characteristic equations.

\textbf{Combinatorics} counts finite arrangements. The \textbf{multiplication principle}: if task $A$ has $m$ ways and task $B$ has $n$ ways, the pair $(A,B)$ has $m \cdot n$ ways. A \textbf{permutation} is an ordered arrangement: $P(n,k) = n!/(n-k)!$. A \textbf{combination} is an unordered selection: $\binom{n}{k} = n!/(k!(n-k)!)$. The \textbf{Binomial Theorem} states $(x+y)^n = \sum_{k=0}^n \binom{n}{k} x^{n-k} y^k$. The \textbf{Pigeonhole Principle} guarantees that placing $n > m$ items into $m$ boxes results in at least one box with $\ge 2$ items. The \textbf{Principle of Inclusion-Exclusion} (PIE) computes the union of overlapping sets: $|A \cup B| = |A| + |B| - |A \cap B|$, expanding to alternating sums for more sets.

A \textbf{graph} $G = (V,E)$ consists of vertices $V$ and edges $E$. The Handshaking Lemma states $\sum_{v \in V} \deg(v) = 2|E|$. A \textbf{tree} is a connected acyclic graph on $n$ vertices, having exactly $n-1$ edges. A graph is \textbf{bipartite} if its vertices can be partitioned into two sets where all edges connect the two sets; equivalently, it contains no odd cycles. An \textbf{Eulerian circuit} traverses every edge exactly once (exists iff all vertices have even degrees and $G$ is connected). A \textbf{Hamiltonian cycle} visits every vertex exactly once. For connected planar graphs (drawable without edge crossings), \textbf{Euler's Formula} states $V - E + F = 2$, where $F$ is the number of faces. Graph coloring assigns colors to vertices so adjacent vertices differ; the \textbf{chromatic number} $\chi(G)$ is the minimum colors needed. By the Four Color Theorem, $\chi(G) \le 4$ for planar graphs.

\textbf{Algorithms} provide step-by-step procedures to solve discrete problems. Big-O notation, $f(n) = O(g(n))$, describes worst-case asymptotic upper bounds: $|f(n)| \le c|g(n)|$ for sufficiently large $n$. The \textbf{Euclidean algorithm} computes $\gcd(a,b)$ in $O(\log(\min(a,b)))$ steps. 
Graph algorithms include \textbf{Breadth-first search} (BFS) for shortest paths in unweighted graphs, \textbf{Depth-first search} (DFS) for topological sorting and cycle detection, and \textbf{Dijkstra's algorithm} for shortest paths with non-negative weights.

\begin{enumerate}
  \item \textbf{Counting}: permutations, combinations, Pigeonhole Principle, PIE, generating functions.
  \item \textbf{Graphs}: trees, bipartite graphs, Eulerian/Hamiltonian paths, planar graphs (Euler's formula).
  \item \textbf{Algorithms}: BFS, DFS, Dijkstra, Euclidean algorithm, Big-O complexity.
  \item \textbf{Induction}: strong induction, structural induction.
\end{enumerate}

\subsection{Mathematical spine}
\[
\binom{n}{k} = \frac{n!}{k!(n-k)!},\qquad
(x+y)^n = \sum_{k=0}^n \binom{n}{k} x^{n-k} y^k
\]
\[
|A \cup B \cup C| = |A|+|B|+|C| - |A\cap B| - |A\cap C| - |B\cap C| + |A\cap B\cap C|
\]
\[
\sum_{v\in V}\deg(v) = 2|E|,\qquad V - E + F = 2 \text{ (planar graphs)}
\]

\paragraph{Section summary}
Discrete structures encompass combinatorial counting (permutations, combinations, inclusion-exclusion), graph theory (trees, planarity, colorings), and algorithmic analysis (Big-O notation, graph traversal). Mastery of these principles is critical for analyzing finite structures, solving recurrence relations, and establishing computational complexity.

\section{Single Variable Calculus: Change, Approximation, and Integration}
\subsection{Core ideas}

Calculus studies continuous change and accumulation. The \textbf{limit} $\lim_{x\to a} f(x) = L$ means $f(x)$ approaches $L$ as $x$ approaches $a$. A function is \textbf{continuous} at $a$ if $\lim_{x\to a} f(x) = f(a)$. For sequences, $\lim_{n \to \infty} a_n = L$ means terms become arbitrarily close to $L$ as $n$ grows. The \textbf{Intermediate Value Theorem} states: if $f$ is continuous on $[a,b]$, it takes on every value between $f(a)$ and $f(b)$.

The \textbf{derivative} measures the instantaneous rate of change:
\[
f'(a) = \lim_{h\to 0} \frac{f(a+h) - f(a)}{h}.
\]
Differentiability implies continuity. Key differentiation rules: \textbf{product rule} $(fg)' = f'g + fg'$; \textbf{quotient rule} $(f/g)' = (f'g - fg')/g^2$; \textbf{chain rule} $(f\circ g)'(x) = f'(g(x))\,g'(x)$. The \textbf{Mean Value Theorem} (MVT): if $f$ is continuous on $[a,b]$ and differentiable on $(a,b)$, then $f'(c) = (f(b)-f(a))/(b-a)$ for some $c\in(a,b)$. Applications include optimization (critical points where $f'(x)=0$), and \textbf{L'H\^opital's rule} for limits of indeterminate forms like $0/0$.
Functions can be locally approximated by polynomials. \textbf{Taylor's Theorem} states $f(x) = \sum_{k=0}^n \frac{f^{(k)}(a)}{k!}(x-a)^k + R_n(x)$, where the remainder $R_n(x) = \frac{f^{(n+1)}(c)}{(n+1)!}(x-a)^{n+1}$ for some $c$ between $a$ and $x$ (Lagrange form).

\textbf{Integration} calculates accumulation. The \textbf{definite integral} $\int_a^b f(x)\,dx$ is rigorously defined as the limit of \textbf{Riemann sums} $\lim_{n \to \infty} \sum_{i=1}^n f(x_i^*)\Delta x$ as the partition width $\Delta x \to 0$. It represents the signed area under the curve. The \textbf{Fundamental Theorem of Calculus} (FTC) bridges derivatives and integrals. Part 1: if $f$ is continuous, $\frac{d}{dx}\int_a^x f(t)\,dt = f(x)$. Part 2: $\int_a^b f(x)\,dx = F(b) - F(a)$ where $F'(x) = f(x)$. Integration techniques include \textbf{substitution} ($u = g(x)$), \textbf{integration by parts} ($\int u\,dv = uv - \int v\,du$), and \textbf{partial fractions}.

\begin{enumerate}
  \item \textbf{Limits \& Continuity}: one-sided limits, sequence limits, IVT.
  \item \textbf{Derivatives}: rules, MVT, Taylor series with remainder, optimization.
  \item \textbf{Integrals}: Riemann sums, definite/indefinite integrals, FTC.
  \item \textbf{Techniques}: substitution, integration by parts, L'H\^opital's rule.
\end{enumerate}

\subsection{Mathematical spine}
\[
\boxed{f'(a) = \lim_{h\to 0}\frac{f(a+h)-f(a)}{h}},\qquad
\boxed{\int_a^b f(x)\,dx = \lim_{n \to \infty} \sum_{i=1}^n f(x_i^*)\Delta x}
\]
\[
\int_a^b f(x)\,dx = F(b)-F(a),\qquad \frac{d}{dx}\int_a^x f(t)\,dt = f(x)
\]
\[
f(x) = f(a) + f'(a)(x-a) + \frac{f''(a)}{2}(x-a)^2 + \dots + \frac{f^{(n)}(a)}{n!}(x-a)^n + R_n(x)
\]

\paragraph{Section summary}
Single-variable calculus formalizes continuous change and area. Limits define both the derivative (instantaneous rate of change) and the integral (accumulation via Riemann sums). Taylor series extend linear approximation to polynomial approximation. The Fundamental Theorem of Calculus profoundly unites these two branches, enabling analytical evaluation of integrals and solving differential equations.

\section{Linear Algebra: Spaces, Maps, Eigenvalues, and Projections}
\subsection{Core ideas}

Linear algebra studies vector spaces and linear transformations. A \textbf{vector space} $V$ over a field $\mathbb{F}$ is a set closed under vector addition and scalar multiplication. A \textbf{subspace} $U \subseteq V$ is a nonempty subset closed under these operations. The \textbf{span} of vectors $\{v_1,\dots,v_k\}$ is the set of all linear combinations. A set is \textbf{linearly independent} if $\sum c_i v_i = \mathbf{0}$ implies all $c_i = 0$. A \textbf{basis} is a linearly independent spanning set; its size is the \textbf{dimension} $\dim V$. The \textbf{dual space} $V^*$ is the vector space of all linear maps (functionals) from $V$ to $\mathbb{F}$.

A \textbf{linear transformation} $T: V \to W$ preserves operations. The \textbf{kernel} (null space) $\ker T$ and \textbf{image} (range) $\operatorname{im} T$ are subspaces. The \textbf{rank-nullity theorem} states $\dim\ker T + \dim\operatorname{im}T = \dim V$. Every linear map between finite-dimensional spaces can be represented by a matrix. The \textbf{determinant} $\det A$ of a square matrix measures the volume scaling factor; $A$ is invertible iff $\det A \neq 0$.

An \textbf{eigenvector} $v \neq \mathbf{0}$ of $A$ satisfies $Av = \lambda v$, where $\lambda$ is the \textbf{eigenvalue}. Eigenvalues are roots of the \textbf{characteristic polynomial} $p_A(\lambda) = \det(A - \lambda I)$. The \textbf{Cayley-Hamilton Theorem} states that every square matrix satisfies its own characteristic equation: $p_A(A) = 0$. A matrix is diagonalizable if it has a basis of eigenvectors. The \textbf{Spectral Theorem} guarantees every real symmetric matrix is orthogonally diagonalizable with real eigenvalues. If a matrix is not diagonalizable, it can be put into \textbf{Jordan canonical form}.
The \textbf{Singular Value Decomposition} (SVD) factorizes any $A \in \mathbb{R}^{m\times n}$ as $A = U\Sigma V^T$, with $U, V$ orthogonal and $\Sigma$ diagonal.

An \textbf{inner product space} is a vector space with an inner product $\langle x,y \rangle$ (generalizing the dot product). It induces a norm $\|x\| = \sqrt{\langle x,x \rangle}$ and a notion of orthogonality ($\langle x,y \rangle = 0$). Orthogonal projection onto a subspace $U$ minimizes the distance to $U$. The \textbf{Gram-Schmidt process} converts any basis into an orthonormal basis. In systems $Ax = b$ with no exact solution, the \textbf{least squares} solution minimizes $\|Ax-b\|^2$ via the normal equations $A^T A x = A^T b$.

\begin{enumerate}
  \item \textbf{Vector space}: basis, dimension, dual space, linear independence.
  \item \textbf{Linear maps}: rank-nullity theorem, matrix representation, determinants.
  \item \textbf{Eigen-theory}: characteristic polynomial, Cayley-Hamilton, Spectral Theorem, SVD.
  \item \textbf{Inner products}: Gram-Schmidt, orthogonal projections, least squares.
\end{enumerate}

\subsection{Mathematical spine}
\[
\det(A-\lambda I)=0,\qquad p_A(A) = 0 \text{ (Cayley-Hamilton)}
\]
\[
A = U\Sigma V^T,\qquad A^TA\hat{x} = A^T b \text{ (Least Squares)}
\]
\[
\operatorname{proj}_U(v) = \sum_{i=1}^k \langle v,u_i\rangle u_i \text{ (for orthonormal } \{u_i\})
\]

\paragraph{Section summary}
Linear algebra provides the framework for analyzing flat spaces and linear mappings. Core topics include dimension and basis (coordinates), the rank-nullity theorem, and determinants. Eigenvalues, diagonalization, and the Cayley-Hamilton theorem analyze matrix powers and structure, while inner products formalize geometry (orthogonality and projection), forming the bedrock for fields ranging from quantum mechanics to machine learning.

\section{Multivariable Analysis: Gradients, Multiple Integrals, and Vector Fields}
\subsection{Core ideas}

Multivariable calculus extends the concepts of limits, derivatives, and integrals to functions of several variables. For a scalar function $f: \mathbb{R}^n \to \mathbb{R}$, the \textbf{partial derivative} $\partial f/\partial x_i$ represents the rate of change of $f$ in the direction of the $x_i$-axis, holding all other variables constant. \textbf{Clairaut's Theorem} ensures that if the mixed second-order partial derivatives are continuous, they are equal: $\partial^2 f/\partial x_i \partial x_j = \partial^2 f/\partial x_j \partial x_i$. 

The \textbf{gradient} vector, denoted $\nabla f = \left( \frac{\partial f}{\partial x_1}, \dots, \frac{\partial f}{\partial x_n} \right)$, is central to optimization because it points in the direction of steepest ascent. Furthermore, the gradient is everywhere orthogonal to the level sets of $f$. The \textbf{directional derivative} $D_{\mathbf{u}} f = \nabla f \cdot \mathbf{u}$ computes the rate of change of $f$ in the direction of an arbitrary unit vector $\mathbf{u}$.

For a vector-valued function $f: \mathbb{R}^n \to \mathbb{R}^m$, the \textbf{Jacobian matrix} $J_f$ linearly approximates $f$. Its entries are $(J_f)_{ij} = \partial f_i/\partial x_j$. The multivariable \textbf{chain rule} is concisely expressed as matrix multiplication: $J_{f\circ g}(x) = J_f(g(x)) J_g(x)$. The \textbf{Inverse Function Theorem} states that if $J_f(a)$ is a square matrix and invertible (i.e., $\det J_f(a) \neq 0$), then $f$ is locally a bijection near $a$. Similarly, the \textbf{Implicit Function Theorem} guarantees that an equation $F(x,y)=0$ locally defines $y$ as a differentiable function of $x$ provided the partial derivative with respect to $y$ is non-zero. 

For optimization, critical points occur where $\nabla f = \mathbf{0}$. We classify these points using the symmetric \textbf{Hessian matrix} $H_f$ of second partial derivatives. If $H_f$ is positive definite, the point is a local minimum; if negative definite, a local maximum; if indefinite, a saddle point. \textbf{Lagrange multipliers} provide a method for finding extrema of $f(x)$ subject to constraints $g(x)=0$ by solving the system $\nabla f = \lambda \nabla g$ and $g(x)=0$.

\textbf{Multiple integrals} generalize the definite integral to compute areas, volumes, and hypervolumes. When changing variables from $(x,y)$ to $(u,v)$, the area element is scaled by the absolute value of the determinant of the Jacobian: $\iint_R f(x,y)\,dx\,dy = \iint_S f(u,v)\,|\det J|\,du\,dv$. Canonical coordinate systems simplify integration over symmetric domains:
\begin{itemize}
    \item \textbf{Polar coordinates (2D):} $x = r\cos\theta, y = r\sin\theta \implies dA = r\,dr\,d\theta$.
    \item \textbf{Cylindrical coordinates (3D):} $x = r\cos\theta, y = r\sin\theta, z = z \implies dV = r\,dr\,d\theta\,dz$.
    \item \textbf{Spherical coordinates (3D):} $x = \rho\sin\phi\cos\theta, y = \rho\sin\phi\sin\theta, z = \rho\cos\phi \implies dV = \rho^2\sin\phi\,d\rho\,d\phi\,d\theta$.
\end{itemize}

A \textbf{vector field} $\mathbf{F}: \mathbb{R}^n \to \mathbb{R}^n$ assigns a vector to every point in space. Two fundamental differential operators act on 3D vector fields:
\begin{itemize}
    \item \textbf{Divergence} ($\nabla\cdot\mathbf{F}$): A scalar measuring the local outward flux or "source/sink" nature of the field.
    \item \textbf{Curl} ($\nabla\times\mathbf{F}$): A vector measuring the local rotation or "swirl" of the field.
\end{itemize}
A \textbf{line integral} $\int_C \mathbf{F}\cdot d\mathbf{r}$ accumulates the tangential component of $\mathbf{F}$ along a curve $C$, computing the total work done by a force field. A vector field is \textbf{conservative} if it is the gradient of a scalar potential ($\mathbf{F} = \nabla\phi$). For conservative fields, $\nabla \times \mathbf{F} = \mathbf{0}$ (on simply connected domains), and the line integral is path-independent: $\int_C \mathbf{F}\cdot d\mathbf{r} = \phi(B) - \phi(A)$.

The core of vector calculus is a trio of theorems that are special cases of the generalized Stokes' Theorem on manifolds (which links the integral of a differential form over a boundary to the integral of its exterior derivative over the interior):
\begin{itemize}
    \item \textbf{Green's Theorem} (2D): Relates a line integral around a simple closed curve to a double integral over the enclosed plane region: $\oint_C \mathbf{F}\cdot d\mathbf{r} = \iint_D (\nabla\times\mathbf{F})\cdot\mathbf{k}\,dA$.
    \item \textbf{Stokes' Theorem} (3D): Relates the surface integral of the curl of a field to the line integral around the surface's boundary: $\oint_{\partial S} \mathbf{F}\cdot d\mathbf{r} = \iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{S}$.
    \item \textbf{Divergence Theorem} (Gauss's Theorem, 3D): Relates the flux of a field through a closed surface to the integral of its divergence over the enclosed volume: $\iint_{\partial V} \mathbf{F}\cdot d\mathbf{S} = \iiint_V (\nabla\cdot\mathbf{F})\,dV$.
\end{itemize}

\begin{enumerate}
  \item \textbf{Derivatives}: Gradient, Jacobian, Hessian, Inverse/Implicit Function Theorems, Clairaut's Theorem.
  \item \textbf{Optimization}: Critical points, second derivative test (Hessian), Lagrange multipliers.
  \item \textbf{Integration}: Multiple integrals, change of variables (Jacobian determinant), coordinate systems.
  \item \textbf{Vector Calculus}: Divergence, curl, conservative fields, Green's, Stokes', and Divergence theorems.
\end{enumerate}

\textbf{Example (Green's Theorem for Area)}. We can use Green's theorem to compute the area of a region $D$. Let $C = \partial D$ be traversed counterclockwise. If we choose a field $\mathbf{F}=(-y, x)/2$, its 2D curl is $\frac{1}{2}(\partial_x(x) - \partial_y(-y)) = 1$. By Green's theorem, $\text{Area}(D) = \iint_D 1 \, dA = \frac{1}{2} \oint_C (x\,dy - y\,dx)$.

\subsection{Mathematical spine}
\[
J_{f\circ g}(x) = J_f(g(x)) J_g(x),\qquad
dx\,dy = \left| \det \frac{\partial(x,y)}{\partial(u,v)} \right| du\,dv
\]
\[
\nabla f = \lambda \nabla g \text{ (Lagrange)}
\]
\[
\oint_{\partial S} \mathbf{F}\cdot d\mathbf{r} = \iint_S (\nabla\times\mathbf{F})\cdot d\mathbf{S},\qquad \iint_{\partial V} \mathbf{F}\cdot d\mathbf{S} = \iiint_V (\nabla\cdot\mathbf{F})\,dV
\]

\paragraph{Section summary}
Multivariable analysis translates single-variable calculus to higher dimensions. The Jacobian and Hessian matrices capture linear and quadratic approximations, enabling optimization and the Implicit/Inverse Function Theorems. Multiple integration relies on the Jacobian determinant for coordinate transformations. The crowning achievements are the integral theorems of Green, Stokes, and Gauss, which unify geometry and calculus by proving that the aggregate behavior of a field within a domain is determined entirely by its behavior on the domain's boundary.

\section{Probability: Conditional Probability, Random Variables, and Distributions}
\subsection{Core ideas}

Probability mathematically quantifies uncertainty. A \textbf{sample space} $\Omega$ is the set of all outcomes. An \textbf{event} $A \subseteq \Omega$ is a subset. A \textbf{probability measure} $\Pr$ satisfies Kolmogorov's axioms: $\Pr(\Omega)=1$, $0 \le \Pr(A) \le 1$, and $\Pr(\bigcup_i A_i) = \sum_i \Pr(A_i)$ for mutually exclusive events. 

\textbf{Conditional probability} $\Pr(A \mid B) = \Pr(A\cap B)/\Pr(B)$ updates belief given $B$. Events $A$ and $B$ are \textbf{independent} if $\Pr(A\cap B) = \Pr(A)\Pr(B)$. \textbf{Bayes' theorem}, $\Pr(A\mid B) = \Pr(B\mid A)\Pr(A)/\Pr(B)$, reverses the conditioning. The \textbf{law of total probability} states $\Pr(B) = \sum_i \Pr(B\mid A_i)\Pr(A_i)$ for a partition $\{A_i\}$.

\textbf{Example (Bayes' Theorem)}: Consider a disease affecting $1\%$ of a population. A test is $99\%$ accurate. If a person tests positive, the probability they actually have the disease is $\frac{0.99 \times 0.01}{0.99 \times 0.01 + 0.01 \times 0.99} = 0.5$. This demonstrates the base rate fallacy, highlighting the importance of the prior probability.

A \textbf{random variable} $X: \Omega \to \mathbb{R}$ assigns numbers to outcomes. Its \textbf{cumulative distribution function} (CDF) is $F_X(x) = \Pr(X \le x)$. Discrete $X$ has a probability mass function (PMF) $p_X(x)$; continuous $X$ has a probability density function (PDF) $f_X(x)$ such that $\int f_X(x)dx = 1$. \textbf{Expected value} $E[X] = \sum x p(x)$ or $\int x f(x)\,dx$. The \textbf{variance} $\operatorname{Var}(X) = E[(X-\mu)^2] = E[X^2] - \mu^2$, with standard deviation $\sigma_X = \sqrt{\operatorname{Var}(X)}$.

For multiple random variables, the \textbf{joint distribution} captures their simultaneous behavior. \textbf{Marginal distributions} are obtained by summing or integrating out other variables (e.g., $f_X(x) = \int f_{X,Y}(x,y)\,dy$). \textbf{Covariance} measures joint linear variation: $\operatorname{Cov}(X,Y) = E[XY]-E[X]E[Y]$.

Key distributions: \textbf{Binomial}$(n,p)$ models successes in $n$ independent trials. \textbf{Poisson}$(\lambda)$ models rare events in time/space. \textbf{Normal}$(\mu,\sigma^2)$ is the symmetric bell curve $f(x) \propto \exp(-(x-\mu)^2/(2\sigma^2))$. \textbf{Exponential}$(\lambda)$ models memoryless waiting times.

Limit theorems describe large-scale behavior. \textbf{Markov's} and \textbf{Chebyshev's inequalities} bound tail probabilities: $\Pr(|X-\mu| \ge k\sigma) \le 1/k^2$. The \textbf{Law of Large Numbers} (Weak and Strong versions) guarantees that the sample mean $\bar{X}_n \to \mu$ as $n \to \infty$. The \textbf{Central Limit Theorem} (CLT) states that the sum of $n$ i.i.d.\ variables with mean $\mu$ and variance $\sigma^2$ converges in distribution to Normal$(n\mu, n\sigma^2)$.

\textbf{Proof Sketch (Chebyshev's Inequality)}: By definition, $\operatorname{Var}(X) = \int (x-\mu)^2 f(x) dx \ge \int_{|x-\mu| \ge k\sigma} (x-\mu)^2 f(x) dx \ge (k\sigma)^2 \int_{|x-\mu| \ge k\sigma} f(x) dx = k^2\sigma^2 \Pr(|X-\mu| \ge k\sigma)$. Dividing by $k^2\sigma^2$ yields the result.

\begin{enumerate}
  \item \textbf{Axioms \& Bayes}: Conditional probability, independence, Bayes' rule.
  \item \textbf{Random variables}: PMF/PDF, joint/marginal distributions, expectation, variance.
  \item \textbf{Distributions}: Binomial, Poisson, Normal, Exponential.
  \item \textbf{Limit theorems}: Chebyshev's inequality, Law of Large Numbers, CLT.
\end{enumerate}

\subsection{Mathematical spine}
\[
\Pr(A\mid B) = \frac{\Pr(B\mid A)\Pr(A)}{\Pr(B)},\qquad
\operatorname{Var}(X) = E[X^2] - (E[X])^2
\]
\[
\Pr(|X-\mu| \ge \varepsilon) \le \frac{\sigma^2}{\varepsilon^2} \text{ (Chebyshev)}
\]
\[
\sqrt{n}\left(\frac{\bar{X}_n - \mu}{\sigma}\right) \xrightarrow{d} N(0,1) \text{ (Central Limit Theorem)}
\]

\paragraph{Section summary}
Probability grounds uncertainty in rigorous measure theory. Core concepts include conditional updates (Bayes' rule) and distributions of random variables (joint and marginal). The field culminates in the Law of Large Numbers, which justifies expected values as long-run averages, and the Central Limit Theorem, which explains the universality of the Normal distribution.

\section{Statistics: Estimation, Testing, Regression, and Inference}
\subsection{Core ideas}

Statistics uses data to make inferences about populations. A \textbf{parameter} is a numerical characteristic of a population; a \textbf{statistic} is a numerical characteristic of a sample. \textbf{Point estimation} produces a single best guess; \textbf{interval estimation} gives a plausible range. \textbf{Maximum likelihood estimation} (MLE) chooses $\theta$ maximizing the likelihood $L(\theta) = \prod_{i=1}^n f(x_i \mid \theta)$. For example, the MLE of the mean $\mu$ for Normal data is $\hat\mu = \bar{x} = \frac1n\sum x_i$.

\textbf{Example (MLE for Poisson)}: Let $X_1, \dots, X_n \sim \operatorname{Poisson}(\lambda)$. The likelihood is $L(\lambda) = \prod \frac{e^{-\lambda}\lambda^{x_i}}{x_i!}$. The log-likelihood is $\ell(\lambda) = -n\lambda + (\sum x_i)\ln\lambda - \sum \ln(x_i!)$. Setting $\frac{d\ell}{d\lambda} = -n + \frac{\sum x_i}{\lambda} = 0$ yields the MLE $\hat\lambda = \bar{x}$.

The \textbf{sampling distribution} of a statistic is its probability distribution over repeated samples. The \textbf{standard error} is the standard deviation of the sampling distribution. For i.i.d.\ data with variance $\sigma^2$, $\operatorname{SE}(\bar{X}) = \sigma/\sqrt{n}$. A \textbf{confidence interval} for the mean when $\sigma$ is known: $\bar{x} \pm z_{\alpha/2}\cdot\sigma/\sqrt{n}$, where $z_{\alpha/2}$ is the $1-\alpha/2$ quantile of the standard normal. When $\sigma$ is unknown, use the $t$-distribution: $\bar{x} \pm t_{\alpha/2,\,n-1}\cdot s/\sqrt{n}$ where $s$ is the sample standard deviation.

\textbf{Hypothesis testing} assesses evidence against a null hypothesis $H_0$. The $p$-value is $\Pr(\text{observed or more extreme data} \mid H_0)$. If $p < \alpha$ (significance level), reject $H_0$. A \textbf{Type I error} rejects a true $H_0$; \textbf{Type II error} fails to reject a false $H_0$. The $z$-test for a mean: $z = (\bar{x} - \mu_0)/(\sigma/\sqrt{n})$. The $t$-test uses $t = (\bar{x} - \mu_0)/(s/\sqrt{n})$.

\textbf{Linear regression} models $Y = \beta_0 + \beta_1 X + \varepsilon$, with $\varepsilon \sim N(0,\sigma^2)$ i.i.d. The least squares estimates minimize $\sum (y_i - \beta_0 - \beta_1 x_i)^2$: $\hat\beta_1 = \frac{\sum (x_i-\bar{x})(y_i-\bar{y})}{\sum (x_i-\bar{x})^2}$, $\hat\beta_0 = \bar{y} - \hat\beta_1\bar{x}$. The $R^2$ statistic measures the proportion of variance explained. Multiple regression extends to $p$ predictors: $\mathbf{Y} = \mathbf{X}\boldsymbol{\beta} + \boldsymbol{\varepsilon}$, with $\hat{\boldsymbol{\beta}} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{Y}$.

\textbf{Proof Sketch (OLS Estimator)}: The objective function is $S(\boldsymbol{\beta}) = (\mathbf{Y}-\mathbf{X}\boldsymbol{\beta})^T(\mathbf{Y}-\mathbf{X}\boldsymbol{\beta}) = \mathbf{Y}^T\mathbf{Y} - 2\boldsymbol{\beta}^T\mathbf{X}^T\mathbf{Y} + \boldsymbol{\beta}^T\mathbf{X}^T\mathbf{X}\boldsymbol{\beta}$. Taking the gradient with respect to $\boldsymbol{\beta}$ and setting it to zero gives $-2\mathbf{X}^T\mathbf{Y} + 2\mathbf{X}^T\mathbf{X}\boldsymbol{\beta} = 0$, leading to the normal equations $\mathbf{X}^T\mathbf{X}\boldsymbol{\beta} = \mathbf{X}^T\mathbf{Y}$. Assuming $\mathbf{X}^T\mathbf{X}$ is invertible, we obtain $\hat{\boldsymbol{\beta}} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{Y}$.

\textbf{Bayesian inference} treats parameters as random variables with prior $\pi(\theta)$ and posterior $\pi(\theta \mid \mathbf{x}) \propto f(\mathbf{x} \mid \theta)\,\pi(\theta)$. The posterior mean serves as a Bayesian estimator, and credible intervals are the Bayesian analog of confidence intervals.

\begin{enumerate}
  \item \textbf{Estimation}: MLE, confidence intervals for mean ($z$ and $t$).
  \item \textbf{Testing}: null/alternative, $p$-value, $z$-test, $t$-test, Type I/II errors.
  \item \textbf{Regression}: least squares; $\hat{\beta} = (X^TX)^{-1}X^Ty$; $R^2$.
  \item \textbf{Bayesian}: posterior $\propto$ likelihood $\times$ prior.
\end{enumerate}

For review, be able to: compute MLEs for common distributions; construct and interpret confidence intervals; perform $z$- and $t$-tests; interpret $p$-values; fit and interpret linear regression; derive posterior distributions for simple conjugate priors. Identify the estimator, the test statistic null distribution, the regression assumptions, and the prior-posterior relationship.

\subsection{Mathematical spine}
\[
\bar{x} \pm z_{\alpha/2}\frac{\sigma}{\sqrt{n}},\qquad
t = \frac{\bar{x}-\mu_0}{s/\sqrt{n}},\qquad
\hat{\boldsymbol{\beta}} = (\mathbf{X}^T\mathbf{X})^{-1}\mathbf{X}^T\mathbf{y}
\]

\paragraph{Section summary}
Statistics bridges data and decisions through estimation, testing, and modeling. Point estimates (MLE), interval estimates (confidence intervals), and hypothesis tests ($z$, $t$) form classical inference. Linear regression models relationships. Bayesian methods incorporate prior knowledge via Bayes' theorem. These tools are the foundation of data analysis and scientific discovery.

\section{Real Analysis: Limits, Continuity, Convergence, and Rigorous Integration}
\subsection{Core ideas}

Real analysis provides rigorous foundations for calculus. The real numbers $\mathbb{R}$ form a \textbf{complete ordered field}: they are ordered (totally), form a field under $+$ and $\times$, and satisfy the \textbf{completeness axiom} (every nonempty set bounded above has a supremum). A sequence $\{a_n\}$ \textbf{converges} to $L$ if $\forall\varepsilon>0,\;\exists N\in\mathbb{N}$ such that $n\ge N \implies |a_n - L| < \varepsilon$. A sequence is \textbf{Cauchy} if $\forall\varepsilon>0,\;\exists N$ such that $m,n\ge N \implies |a_m - a_n| < \varepsilon$. In $\mathbb{R}$, a sequence converges iff it is Cauchy. The \textbf{Bolzano-Weierstrass theorem}: every bounded sequence in $\mathbb{R}$ has a convergent subsequence.

For a function $f: \mathbb{R} \to \mathbb{R}$, $\lim_{x\to a} f(x) = L$ means $\forall\varepsilon>0,\;\exists\delta>0$ such that $0<|x-a|<\delta \implies |f(x)-L|<\varepsilon$. $f$ is \textbf{continuous} at $a$ if $\lim_{x\to a}f(x) = f(a)$. Equivalent: preimages of open sets are open. The \textbf{Intermediate Value Theorem}: a continuous function on $[a,b]$ attains every value between $f(a)$ and $f(b)$. The \textbf{Extreme Value Theorem}: a continuous function on a closed bounded interval attains its maximum and minimum.

\textbf{Uniform continuity} strengthens continuity: $\forall\varepsilon>0$, $\exists\delta>0$ that works for all $x$ simultaneously (independent of the point). On closed bounded intervals, continuity implies uniform continuity (Heine-Cantor theorem). A sequence of functions $\{f_n\}$ \textbf{converges pointwise} to $f$ if $f_n(x) \to f(x)$ for each $x$, and \textbf{uniformly} if $\sup_x |f_n(x)-f(x)| \to 0$. Uniform convergence preserves continuity and commutes with integration.

\textbf{Proof Sketch (Uniform Limit of Continuous Functions is Continuous)}: Let $f_n \to f$ uniformly, with $f_n$ continuous. To show $f$ is continuous at $c$, we use an $\varepsilon/3$ argument. $|f(x)-f(c)| \le |f(x)-f_n(x)| + |f_n(x)-f_n(c)| + |f_n(c)-f(c)|$. Choose $N$ such that $|f_N(y)-f(y)| < \varepsilon/3$ for all $y$ (by uniform convergence). Then, choose $\delta$ such that $|x-c|<\delta \implies |f_N(x)-f_N(c)| < \varepsilon/3$ (by continuity of $f_N$). Thus, $|x-c|<\delta \implies |f(x)-f(c)| < \varepsilon/3 + \varepsilon/3 + \varepsilon/3 = \varepsilon$.

\textbf{Riemann integration}: the integral $\int_a^b f(x)\,dx$ is the limit of Riemann sums $\sum f(x_i^*)\Delta x_i$ as the partition mesh goes to zero. A function is Riemann integrable if the upper and lower sums converge (which happens if the set of discontinuities has measure zero). The \textbf{Fundamental Theorem of Calculus} (rigorous version): if $f$ is integrable on $[a,b]$ and $F'(x)=f(x)$ uniformly, then $\int_a^b f = F(b)-F(a)$. The \textbf{Lebesgue integral} generalizes Riemann integration by partitioning the range rather than the domain, allowing integration of more functions and better convergence theorems (dominated convergence, monotone convergence).

\textbf{Series} $\sum_{n=1}^\infty a_n$ converge if the partial sums converge. Tests: ratio test, root test, integral test, comparison test. Power series $\sum c_n (x-a)^n$ have a radius of convergence $R = 1/\limsup \sqrt[n]{|c_n|}$. Within the radius, they can be differentiated and integrated termwise.

\begin{enumerate}
  \item \textbf{Sequences}: $\varepsilon$-$N$ definition; Cauchy criterion; Bolzano-Weierstrass.
  \item \textbf{Functions}: $\varepsilon$-$\delta$ continuity; uniform continuity; IVT, EVT.
  \item \textbf{Integration}: Riemann sums; FTC; Lebesgue generalization.
  \item \textbf{Series}: convergence tests; power series; radius of convergence.
\end{enumerate}

\textbf{Example ($\varepsilon$-$\delta$ proof)}. Prove $\lim_{x\to 2}x^2=4$. Let $\varepsilon>0$ be given. We need $\delta>0$ such that $0<|x-2|<\delta\implies|x^2-4|<\varepsilon$. Factor: $|x^2-4|=|x-2|\,|x+2|$. If we first require $\delta\le 1$, then $|x-2|<1$ implies $1<x<3$, so $|x+2|<5$. Choose $\delta=\min\{1,\varepsilon/5\}$. Then $|x-2|<\delta$ gives $|x^2-4|<5\cdot(\varepsilon/5)=\varepsilon$. This is the standard pattern: bound $|x-a|$ to control $|f(x)-L|$.

For review, be able to: write $\varepsilon$-$N$ and $\varepsilon$-$\delta$ proofs; prove convergence/divergence of sequences and series; determine uniform versus pointwise convergence; apply IVT and EVT; define and work with Riemann integrals; prove properties of continuous functions on compact sets. Identify the $\varepsilon$ bound, the uniform modulus of continuity, the dominating function for convergence theorems, and the partition refinement for integration.

\subsection{Mathematical spine}
\[
\lim_{n\to\infty} a_n = L \iff \forall\varepsilon>0\;\exists N\; \forall n\ge N:\; |a_n-L|<\varepsilon
\]
\[
\lim_{x\to a}f(x)=L \iff \forall\varepsilon>0\;\exists\delta>0\; \forall x:\; 0<|x-a|<\delta \implies |f(x)-L|<\varepsilon
\]
\[
\int_a^b f(x)\,dx = \lim_{\|\Delta\|\to 0}\sum_{i=1}^n f(x_i^*)\,\Delta x_i
\]

\paragraph{Section summary}
Real analysis places calculus on rigorous foundations using $\varepsilon$-$\delta$ arguments. Key concepts: convergence of sequences and series (Cauchy criterion, Bolzano-Weierstrass), continuity (IVT, EVT, uniform continuity), Riemann integration (FTC, integrability conditions), and function space convergence (pointwise vs.\ uniform). This material develops the logical infrastructure underpinning all of calculus.

\section{Algebra: Groups, Rings, Fields, and Symmetry}
\subsection{Core ideas}

Abstract algebra studies algebraic structures. A \textbf{group} $(G,\ast)$ is a set with a binary operation satisfying: closure, associativity $(a\ast b)\ast c = a\ast(b\ast c)$, identity $e\ast a = a\ast e = a$, and inverses $a\ast a^{-1} = a^{-1}\ast a = e$. A group is \textbf{abelian} if it is commutative ($a\ast b = b\ast a$). Examples: $(\mathbb{Z},+)$, $(\mathbb{R}\setminus\{0\},\times)$, the symmetric group $S_n$ (permutations of $n$ elements), $GL_n(\mathbb{R})$ (invertible $n\times n$ matrices). A \textbf{subgroup} $H \le G$ is a subset closed under the operation and inverses. The \textbf{order} of a group is its cardinality; the order of element $a$ is the smallest $n$ with $a^n = e$.

\textbf{Example (Symmetric Group)}: $S_3$ is the group of permutations of $\{1,2,3\}$. It has order $3! = 6$. It is the smallest non-abelian group.

A \textbf{homomorphism} $\phi: G \to H$ preserves the operation: $\phi(a\ast b) = \phi(a)\ast\phi(b)$. The \textbf{kernel} $\ker\phi = \{g \mid \phi(g) = e_H\}$ is a normal subgroup; the image $\operatorname{im}\phi$ is a subgroup of $H$. An \textbf{isomorphism} is a bijective homomorphism; isomorphic groups are structurally identical. \textbf{Cosets} of subgroup $H$ are $gH = \{gh \mid h\in H\}$; they partition $G$. Lagrange's theorem: $|H|$ divides $|G|$. A \textbf{normal subgroup} $N \trianglelefteq G$ satisfies $gNg^{-1} = N$ for all $g$, allowing the \textbf{quotient group} $G/N$ to be formed. The \textbf{First Isomorphism Theorem}: $G/\ker\phi \cong \operatorname{im}\phi$.

A \textbf{ring} $(R,+,\cdot)$ has two operations: $(R,+)$ is an abelian group, multiplication is associative and distributes over addition. Examples: $(\mathbb{Z},+,\cdot)$, polynomial ring $\mathbb{R}[x]$, matrix ring $M_n(\mathbb{R})$. A \textbf{field} is a commutative ring where nonzero elements have multiplicative inverses. Examples: $\mathbb{Q},\mathbb{R},\mathbb{C},\mathbb{Z}_p$ for prime $p$. Polynomials over a field form a Euclidean domain with division algorithm and unique factorization. The \textbf{Fundamental Theorem of Algebra}: every nonconstant polynomial in $\mathbb{C}[x]$ has a root in $\mathbb{C}$.

\textbf{Proof Sketch (Lagrange's Theorem)}: Let $H$ be a subgroup of a finite group $G$. The left cosets $gH$ partition $G$ into disjoint equivalence classes. For any $g$, the map $h \mapsto gh$ is a bijection from $H$ to $gH$, so all cosets have size $|H|$. Since $G$ is partitioned into $[G:H]$ cosets of size $|H|$, we have $|G| = [G:H]|H|$, proving $|H|$ divides $|G|$.

Group actions formalize symmetry. A \textbf{group action} $G \times X \to X$ satisfies $e\cdot x = x$ and $(gh)\cdot x = g\cdot(h\cdot x)$. The orbit $Gx = \{gx \mid g\in G\}$ and stabilizer $G_x = \{g \mid gx = x\}$; the orbit-stabilizer theorem: $|G| = |Gx|\cdot|G_x|$. Applications include counting (Burnside's lemma) and classifying symmetries of geometric objects.

\begin{enumerate}
  \item \textbf{Group}: closure, associativity, identity, inverses; subgroup, cosets, Lagrange.
  \item \textbf{Homomorphism}: kernel, image, isomorphism theorems; quotient groups.
  \item \textbf{Rings and fields}: polynomial rings, Euclidean domain, $\mathbb{Z}_p$.
  \item \textbf{Group actions}: orbit, stabilizer, Burnside's lemma.
\end{enumerate}

For review, be able to: verify group axioms; find subgroups and cosets; compute in $S_n$; construct quotient groups; apply isomorphism theorems; factor polynomials over fields; use group actions to count configurations. Identify the group operation and identity, the kernel of a homomorphism, the field characteristic, and the orbit decomposition.

\subsection{Mathematical spine}
\[
\phi(ab) = \phi(a)\phi(b),\qquad
|G| = |Gx|\cdot|G_x|,\qquad
G/\ker\phi \cong \operatorname{im}\phi
\]

\paragraph{Section summary}
Algebra abstracts arithmetic to structures: groups (symmetry via invertible operations), rings (arithmetic-like structures with addition and multiplication), and fields (where division works). Key results include Lagrange's theorem (divisibility of group orders), isomorphism theorems (structural relationships), and unique factorization in polynomial rings. Group actions connect algebra to geometry and combinatorics.

\section{Topology: Connectedness, Compactness, and Invariants of Shape}
\subsection{Core ideas}

Topology studies properties preserved under continuous deformations (stretching, bending, but not tearing or gluing). A \textbf{topological space} $(X,\mathcal{T})$ consists of a set $X$ and a collection $\mathcal{T}$ of open subsets satisfying: (i) $\varnothing, X \in \mathcal{T}$; (ii) arbitrary unions of open sets are open; (iii) finite intersections of open sets are open. The complement of an open set is \textbf{closed}. The \textbf{metric topology} is induced by a metric $d$: open balls $B_r(x) = \{y \mid d(x,y) < r\}$ form a basis. $\mathbb{R}^n$ with the Euclidean metric is the motivating example.

A function $f: X \to Y$ between topological spaces is \textbf{continuous} if preimages of open sets are open (the topological definition). Equivalently for metric spaces, $x_n \to x \implies f(x_n) \to f(x)$. A \textbf{homeomorphism} is a bijective continuous function with continuous inverse; homeomorphic spaces are topologically equivalent (they have the same ``shape''). For example, a coffee mug and a donut (torus) are homeomorphic.

\textbf{Connectedness}: $X$ is \textbf{connected} if it cannot be written as a disjoint union of two nonempty open subsets. Equivalently, the only clopen (both open and closed) subsets are $\varnothing$ and $X$. A subset of $\mathbb{R}$ is connected iff it is an interval. The continuous image of a connected set is connected (generalizing IVT). \textbf{Path-connectedness} (every pair of points joined by a continuous path) implies connectedness; the converse is false in general. A space is \textbf{totally disconnected} if its only connected subsets are singletons (e.g., $\mathbb{Q}$).

\textbf{Compactness}: $X$ is \textbf{compact} if every open cover has a finite subcover. In $\mathbb{R}^n$, the Heine-Borel theorem says $K$ is compact iff it is closed and bounded. The continuous image of a compact set is compact. A continuous function on a compact set attains its maximum and minimum (Extreme Value Theorem). Compactness also implies uniform continuity on metric spaces. Sequential compactness (every sequence has a convergent subsequence) is equivalent to compactness in metric spaces.

\textbf{Proof Sketch (Continuous image of compact set is compact)}: Let $f: X \to Y$ be continuous and $X$ compact. Consider an open cover $\{V_\alpha\}$ of $f(X)$ in $Y$. Since $f$ is continuous, the preimages $\{f^{-1}(V_\alpha)\}$ form an open cover of $X$. Because $X$ is compact, this has a finite subcover $f^{-1}(V_{\alpha_1}), \dots, f^{-1}(V_{\alpha_n})$. The corresponding $\{V_{\alpha_1}, \dots, V_{\alpha_n}\}$ covers $f(X)$. Thus, $f(X)$ is compact.

\textbf{Homotopy} and the \textbf{fundamental group} $\pi_1(X, x_0)$ classify spaces up to homotopy equivalence. A \textbf{homotopy} between maps $f,g: X\to Y$ is a continuous $H: X\times[0,1] \to Y$ with $H(x,0)=f(x)$, $H(x,1)=g(x)$. Two spaces are \textbf{homotopy equivalent} if there exist maps $f: X\to Y$, $g: Y\to X$ with $g\circ f \simeq \operatorname{id}_X$ and $f\circ g \simeq \operatorname{id}_Y$. The fundamental group consists of homotopy classes of loops based at $x_0$. For the circle $S^1$, $\pi_1(S^1) \cong \mathbb{Z}$; for $S^n$ ($n\ge 2$), $\pi_1(S^n)$ is trivial. Simply connected spaces have trivial fundamental group. The \textbf{Euler characteristic} $\chi = V - E + F$ for polyhedra is a topological invariant; for a sphere $\chi=2$, for a torus $\chi=0$.

\begin{enumerate}
  \item \textbf{Topological space}: open sets, continuity, homeomorphism.
  \item \textbf{Connectedness}: connected $\iff$ no nontrivial clopen sets; path-connectedness.
  \item \textbf{Compactness}: Heine-Borel in $\mathbb{R}^n$; extreme value theorem; uniform continuity.
  \item \textbf{Algebraic topology}: fundamental group $\pi_1$, homotopy, Euler characteristic.
\end{enumerate}

For review, be able to: determine if a set is open in a given topology; prove continuity via inverse images of open sets; check connectedness and path-connectedness; apply Heine-Borel for compactness arguments; compute fundamental groups of simple spaces; understand homotopy equivalence. Identify the open cover, the connected component, the compact subset, and the loop homotopy class.

\subsection{Mathematical spine}
\[
f \text{ continuous } \iff f^{-1}(U) \text{ open for all open } U
\]
\[
\text{Compact: } \forall\text{ open cover } \{U_\alpha\},\; \exists\text{ finite subcover}
\]
\[
\pi_1(S^1) \cong \mathbb{Z},\qquad \chi = V - E + F
\]

\paragraph{Section summary}
Topology abstracts notions of proximity and shape. A topological space defines continuity via open sets. Connectedness captures ``being all in one piece''; compactness generalizes finiteness and guarantees extreme values and uniform continuity. Algebraic topology uses the fundamental group and Euler characteristic to classify spaces up to deformation, providing invariants that distinguish spheres, tori, and other manifolds.

\section{Numerical Mathematics: Stability, Matrix Decompositions, and Optimization}
\subsection{Core ideas}

Numerical mathematics develops algorithms for continuous mathematical problems with guaranteed accuracy. \textbf{Conditioning} measures how much a problem's output changes relative to input perturbations. The \textbf{condition number} $\kappa = \sup_{\delta x} (\|\delta f\|/\|f\|) / (\|\delta x\|/\|x\|)$; problems with large $\kappa$ are ill-conditioned. \textbf{Numerical stability} means the algorithm produces nearly the exact output for nearly correct input (i.e., backward stable). \textbf{Forward error} = $\|\tilde{x} - x\|$; \textbf{backward error} = smallest $\Delta x$ such that $f(x+\Delta x) = \tilde{x}$.

\textbf{Example (Catastrophic Cancellation)}: Consider $f(x) = \sqrt{x+1} - \sqrt{x}$ for large $x$. If $x=10^8$, $\sqrt{x+1} \approx 10000.00005$ and $\sqrt{x} = 10000$. Subtracting them loses significant digits. Rewriting as $f(x) = \frac{1}{\sqrt{x+1} + \sqrt{x}}$ completely avoids cancellation, demonstrating how algebraic manipulation improves numerical stability.

\textbf{Floating-point arithmetic} approximates real numbers with finite precision machine epsilon $\epsilon_{\text{mach}} \approx 2^{-52} \approx 2.22\times10^{-16}$ in double precision. Rounding produces relative error $\approx \epsilon_{\text{mach}}$. Catastrophic cancellation occurs when subtracting nearly equal numbers. Algorithms should avoid such cancellation and use numerically stable formulas.

Matrix decompositions are the workhorses of numerical linear algebra. \textbf{LU decomposition} $PA = LU$ (permutation, lower triangular, upper triangular) solves linear systems $Ax = b$ in $O(n^3)$ time via forward/backward substitution. \textbf{Cholesky decomposition} $A = LL^T$ applies to symmetric positive definite matrices (twice as fast). \textbf{QR decomposition} $A = QR$ (orthogonal $Q$, upper triangular $R$) provides stable least-squares solutions. \textbf{Singular value decomposition} $A = U\Sigma V^T$ gives the optimal low-rank approximation (Eckart-Young theorem): truncating to rank $k$ minimizes $\|A - A_k\|_F$ over rank-$k$ matrices. \textbf{Eigenvalue computation} uses the QR algorithm (iterative $QR$ on shifted $A$).

\textbf{Iterative methods} solve large sparse systems: \textbf{Jacobi iteration} $x^{(k+1)} = D^{-1}(b - (L+U)x^{(k)})$; \textbf{Gauss-Seidel} uses latest components; \textbf{conjugate gradient} for SPD matrices minimizes error in the energy norm. The \textbf{condition number} of $A$ affects convergence rate.

\textbf{Numerical optimization} finds minima of functions. \textbf{Gradient descent} $x_{k+1} = x_k - \alpha \nabla f(x_k)$ converges linearly for well-conditioned problems. \textbf{Newton's method} $x_{k+1} = x_k - H_f^{-1}(x_k)\nabla f(x_k)$ converges quadratically near the solution but requires Hessian inversion. \textbf{Quasi-Newton methods} (BFGS) approximate the Hessian. For constrained optimization, \textbf{Lagrange multipliers} and \textbf{KKT conditions} characterize optimality. \textbf{Linear programming} minimizes $c^Tx$ subject to $Ax \le b$, $x \ge 0$ via the simplex method or interior-point methods.

\textbf{Numerical integration} (quadrature) approximates $\int_a^b f(x)\,dx$: trapezoidal rule has error $O(h^2)$, Simpson's rule $O(h^4)$, Gaussian quadrature $O(h^{2n})$. \textbf{Adaptive quadrature} refines subintervals where the function varies rapidly. \textbf{Differential equation solvers}: Euler's method (first-order), Runge-Kutta methods (classical RK4 is fourth-order). Stiff equations require implicit methods (backward Euler, BDF) for stability.

\begin{enumerate}
  \item \textbf{Stability}: condition number, forward/backward error, machine epsilon.
  \item \textbf{Decompositions}: LU, Cholesky, QR, SVD; QR algorithm for eigenvalues.
  \item \textbf{Iterative methods}: Jacobi, Gauss-Seidel, conjugate gradient.
  \item \textbf{Optimization}: gradient descent, Newton, BFGS, KKT, linear programming.
  \item \textbf{Quadrature \& ODEs}: trapezoidal, Simpson, RK4, adaptive methods.
\end{enumerate}

For review, be able to: compute condition number and interpret it; perform and apply LU, QR, and SVD factorizations; derive convergence criteria for iterative solvers; set up gradient descent and Newton iterations; understand error bounds for quadrature rules; identify stiffness in ODEs. Identify the source of ill-conditioning, the best matrix factorization for the problem, the convergence rate of iterative methods, and the dominant error term in approximation.

\subsection{Mathematical spine}
\[
A = LU,\qquad A = QR,\qquad A = U\Sigma V^T
\]
\[
x_{k+1} = x_k - \alpha \nabla f(x_k),\qquad
x_{k+1} = x_k - H_f^{-1}(x_k)\nabla f(x_k)
\]

\paragraph{Section summary}
Numerical mathematics bridges continuous mathematics and computational implementation. Key themes: conditioning and stability ensure reliable computation; matrix decompositions (LU, QR, SVD) provide the algorithmic backbone for linear algebra; iterative methods and optimization algorithms solve large-scale problems; quadrature and ODE solvers approximate continuous processes. The interplay of mathematical insight and algorithmic design produces efficient, accurate, and stable numerical methods.

\end{document}
