Without pain, without sacrifice, we would have nothing, Fight Club.

A complex function $f(z)$ maps $z = x + iy \in \mathbb{C}$ to another complex number. For example: $f(z) = z^2 = (x + iy)^2 = x^2 - y^2 + 2ixy, f(z) = \frac{1}{z}, f(z) = \sqrt{z^2 + 7}$.
A contour is a continuous, piecewise-smooth curve defined parametrically as: $z(t) = x(t) + iy(t), \quad a \leq t \leq b$.
Definition (Smooth Contour Integral). Let ᵞ be a smooth contour (a continuously differentiable path in the complex plane), $\gamma: [a, b] \to \mathbb{C}$. Let $f: \gamma^* \to \mathbb{C}$ be a continuous complex-valued function defined on the trace $\gamma^*$ of the contour (i.e. along the image of $\gamma$). Then, the contour integral of f along $\gamma$ is defined as $\int_{\gamma} f(z)dz := \int_{a}^{b} f(\gamma(t)) \gamma^{'}(t)dt$.

Deformation of Contours. If two contours $\gamma_1$ and $\gamma_2 $ are homotopic (i.e., one can be continuously deformed into the other without crossing any singularities of f) in a domain where f(z) is analytic, then: $\int_{\gamma_1} f(z)dz = \int_{\gamma_2} f(z)dz.$
Fundamental Theorem of Calculus for Contours. Suppose $\gamma$ is a contour (piecewise smooth path) from a to b, f is defined on a domain D containing $\gamma^*$ (the image of $\gamma$) and admits a primitive (antiderivative) F on D (i.e., $F'(z) = f(z)$), then $\int_{\gamma} f(z)dz = F(\gamma(b)) - F(\gamma(a))$. In particular, if $\gamma$ is a closed contour (i.e., $\gamma(a)=\gamma(b)$), this integral evaluates to zero, $\int_{\gamma} f(z)dz = 0.$
Estimation Theorem or the Triangle Inequality for Integrals. The triangle inequality for integrals in complex analysis states thatfor any continuous complex function $f:[a,b] \to \mathbb{C}$ on a closed real interval [a,b] (f(t) = u(t) + iv(t), t a real parameter), the following holds: $∣\int_a^b f(t)dt| \leq \int_a^b |f(t)|dt$.
Estimation Lemma (ML Inequality) for contour integrals. For any continuous complex function $f:[a,b] \to \mathbb{C}$ on a closed real interval [a,b] (f(z) = u(x, y) + iv(x, y)) with f bounded by some constant M along the entire contour, |f(z)| ≤ M for all $z \in \gamma^*$ (the image/trace of the contour in the complex plane), the following holds: $∣\int_\gamma f(z)dz| \leq M \cdot l(\gamma)$ where l(γ) is the arc length of the contour γ given by $\int_a^b |\gamma^{'}(t)|dt = \int_a^b \sqrt{x'(t)^2 + y'(t)^2} \text{ where } \gamma(t) = x(t) + iy(t)$.
Jordan’s curve theorem. Any simple closed curve (a continuous loop in the plane that does not intersect itself) separates the plane into two disjoint connected regions: one interior (bounded) and one exterior (unbounded). The curve itself is the boundary of both regions. In other words, it partitions the plane into exactly three disjoint sets:
Cauchy’s theorem (Classical “Green’s theorem” version). Let $\Omega \subset \mathbb{C}$ be an open domain. Suppose f = u + iv is analytic in $\Omega$ and its partial derivatives ( $u_x,u_y,v_x,v_y$) are continuous in $\Omega$. If $\gamma$ is a positively oriented, piecewise-smooth $C^1$, simple closed contour with $\gamma^* \cup \operatorname{Int}(\gamma) \subset \Omega$ (its path and interior both lie inside Ω), then $\oint_{\gamma} f(z)dz = 0.$
Cauchy’s Theorem (Cauchy–Goursat). This is the more powerful version, as it removes the need for continuous partial derivatives. If f is analytic in an open set containing a simple closed contour γ and its interior $\gamma^*\cup\operatorname{Int}(\gamma)$, then $\oint_{\gamma} f(z)dz = 0$.
Cauchy’s Theorem for a Rectangle. Let R be a rectangle region R = {x + iy: a ≤ x ≤ b, c ≤ y ≤ d}. Let f be analytic on an open set that contains R (so f is analytic on and in a neighborhood of R). Then, the positively oriented boundary (∂R) contour integral of f vanishes, $\int_{\partial R}f(z)dz = 0$.
Similarly, Let T be a triangular region. Let f be analytic on an open set that contains T (so f is analytic on and in a neighborhood of T). Then, the positively oriented boundary (∂T) contour integral of f vanishes, $\int_{\partial T}f(z)dz = 0$.
Proof.
We are going to subdivide R into four equally sized rectangles (Figure 1). We observe that the contour integrals along the inner boundaries cancel each other out due to opposite orientations (every interior edge is traversed twice in opposite directions). Consequently, the integral over the entire boundary of ∂R can be expressed as the sum of integrals over these smaller rectangles, $\int_{\partial R}f(z)dz = \int_{\partial R_1}f(z)dz + \int_{\partial R_2}f(z)dz + \int_{\partial R_3}f(z)dz + \int_{\partial R_4}f(z)dz$. Let’s name the perimeter and diagonal of R, l and d respectively.
Similarly, we can divide the triangular contour shown in Figure 4, then: $\int_{\partial T}f(z)dz = \int_{\partial T_1}f(z)dz + \int_{\partial T_2}f(z)dz + \int_{\partial T_3}f(z)dz + \int_{\partial T_4}f(z)dz$

By the triangle inequality, at least one of these subrectangle (or subtriangle), say $R_i$ or call it S(1), must contribute at least one-fourth of $\int_{\partial R}f(z)dz$ in absolute value, we can apply this reasoning recursively.
$|\int_{\partial R}f(z)dz| \le |\int_{\partial R_1}f(z)dz| + |\int_{\partial R_2}f(z)dz| + |\int_{\partial R_3}f(z)dz| + |\int_{\partial R_4}f(z)dz|$
The proof is essentially the same in both cases. For the sake of simplicity, we will prove it for rectangle regions.
The process involves continually subdividing the rectangle R into smaller rectangles, each time ensuring that the modulus of the integral remains bounded by a diminishing quantity.
Note. If every $|\int_{\partial R_k}f(z)dz|$ were $\le \frac{1}{4}|\int_{\partial R}f(z)dz|$, their sum could not reach $|\int_{\partial R_k}f(z)dz|$.
$|\int_{\partial R_i}f(z)dz| \ge \frac{1}{4}|\int_{\partial R}f(z)dz|$. Let’s call it $S(1)$. If there is more than one of such rectangles for which this inequality holds, then choose one of them arbitrarily. Divide $S(1)$ into four equal rectangles, $R_1^1, R_1^2, R_1^3, R_1^4$, there exists an i, $1 \le i \le 4, \text{ s.t. } |\int_{\partial R_1^i}f(z)dz| \ge \frac{1}{4}|\int_{\partial R_1}f(z)dz| \ge \frac{1}{4}\cdot \frac{1}{4}|\int_{\partial R}f(z)dz|$. Let’s call this rectangle $R_1^i$ as S(2).
Continuing by induction, we obtain a sequence of rectangles with
Cantor’s Intersection Theorem (Metric Space Version). Let (X, d) be a complete metric space (like $\mathbb{R}^n$). Suppose $\{S(n)\}_{n=1}^\infty$ is a sequence of non-empty, closed, and bounded subsets of X such that:
Then, their intersection is a single point $\bigcap_{n=1}^\infty S(n)$ contains exactly one point, $z^*$.
Given any $\delta > 0$, we can find a corresponding natural number N such that $S(N) \subseteq \{ z : |z - z^*| \le \delta \}$, i.e., $\forall n \ge N, S(n) \subseteq \{ z : |z - z^*| \le \delta \}, | f(z) - f(z^*) | \le \delta$
Utilizing the definition of analyticity, we can explore the behavior of f(z) near the point $z^*$. Analyticity implies complex differentiability at $z^*$. Given any $\epsilon > 0$, we can find a corresponding $\delta > 0$ such that the modulus of the difference between f(z) and its Taylor expansion around $z^*$ is less than $\epsilon|z-z^*|, \text{ i.e. } |f(z) - f(z^*) - f'(z^*)(z-z^*)| \le \epsilon|z-z^*|$ when z is within $\delta$ of $z^*, |z-z^*| \le \delta$. This is because $\lim_{z \to z^*} \frac{f(z) - f(z^*)}{z-z^*} = f'(z^*) ⇔ \lim_{z \to z^*} \frac{f(z) - f(z^*) - f(z^*) (z-z^*)}{z-z^*} = 0$.
Therefore, given any $\epsilon > 0$, choose the corresponding $\delta > 0$ such that $|f(z) - f(z^*) - f'(z^*)(z-z^*)| \le \epsilon|z-z^*|$. Using this very $\delta$, obtain an N such that $S(N) \subseteq \{ z : |z - z^*| \le \delta \}$. For n ≥ N, on ∂S(n) we have $|f(z) - f(z^*) - f'(z^*)(z-z^*)| \le \epsilon|z-z^*|$
By the Fundamental Theorem of Calculus, we know that $\int_{\partial S(n)} 1dz = 0, \int_{\partial S(n)} zdz = 0$ (*)
Constant and linear terms vanish. $\int_{\partial S} 1dz = 0, \int_{\partial S} zdz = 0$ for any closed contour S because the antiderivatives are z and $\frac{z²}{2}$.
$|f(z) - f(z^*) - f'(z^*)(z-z^*)| \le \epsilon|z-z^*| \leadsto |\int_{\partial S(n)}f(z) - f(z^*) - f'(z^*)(z-z^*)dz| \le |\int_{\partial S(n)}\epsilon(z-z^*)dz|$
Hence, $|\int_{\partial S(n)}f(z)dz - \int_{\partial S(n)}f(z^*)dz - f'(z^*)\int_{\partial S(n)}zdz + f'(z^*)z^*\int_{\partial S(n)}dz| \le \epsilon\int_{\partial S(n)} |z-z^*||dz|$
Many terms are zeros (*), so we get: $|\int_{\partial S(n)}f(z)dz| \le \epsilon\int_{\partial S(n)} |z-z^*||dz|$
Using the estimation lemma, $|\int_{\partial S(n)}f(z)dz| \le \epsilon d_n l_n$ because the distance $|z-z^*|$ is less than the diagonal of $S(n), |z-z^*| \le d_n$. As we previously stated $d_n = \frac{d}{2^n}, l_n = \frac{l}{2^n} \leadsto |\int_{\partial S(n)}f(z)dz| \le \epsilon 4^{-n}d\cdot l$.
Therefore, $4^{-n}|\int_{\partial R}f(z)dz| \le |\int_{\partial S(n)}f(z)dz| \le \epsilon 4^{-n}d\cdot l$
Ignoring the intermediate term $4^{-n}|\int_{\partial R}f(z)dz| \le \epsilon 4^{-n}d\cdot l \leadsto [\text{Multiply by } 4^n] |\int_{\partial R}f(z)dz| \le \epsilon d\cdot l$.
Since $\epsilon$ is arbitrary, $|\int_{\partial R}f(z)dz| = 0 \leadsto \int_{\partial R}f(z)dz = 0.$
There are several forms of Cauchy’s theorem. If C is a closed polygonal contour lying entirely within a simply connected domain D, f is a complex function analytic in D, then $\int_{\partial C}f(z)dz = 0$.
