Silence is a source of great strength, Lao Tzu

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}dt \text{ where } \gamma(t) = x(t) + iy(t)$.
Lemma. If γ is a piecewise differentiable closed curve that does not pass through a point a in the complex plane ($a \in \mathbb{C}$), then the value of the integral $\oint_{\gamma} \frac{dz}{z-a}$ is an integer multiple of 2πi.
This Lemma proves that the integral $\oint_{\gamma} \frac{dz}{z-a}$ can only take values in the discrete set $\{ \dots, -2\pi i, 0, 2\pi i, 4\pi i, \dots \}$. It is incredibly important because it mathematically formalizes the Winding Number (or index) of a curve — a way to count exactly how many times a curve wraps around a specific point.
Proof.
$h(t) = \int_{\alpha}^t f(u) du \quad \text{where } f(u) = \frac{\gamma'(u)}{\gamma(u)-a}$. A fundamental theorem of calculus states that if $f(u)$ is piecewise continuous on a closed interval $[\alpha, \beta]$, then the integral function $h(t)$ is continuous on that entire interval. Notice that h(t) represents the accumulated area as t increases. A piecewise continuous function f(u) can have a finite number of jumps. Integrating a finite jump results in a corner in the graph of the integral function h(t), but it does not result in a break or jump in h(t). For h(t) to be discontinuous, the integrand f(u) would have to contain an infinite singularity (which is ruled out because $\gamma(u) \neq a$).
We might look at $h'(t) = \frac{\gamma'(t)}{\gamma(t)-a}$ and think, “That looks like the derivative of a natural logarithm!” If $h(t) \approx \ln(\gamma(t)-a)$, then exponentiating both sides gives $e^{h(t)} \approx \gamma(t)-a$. If we rearrange this informal guess, we get $\frac{\gamma(t)-a}{e^{h(t)}} \approx \text{constant}$.
$$ \begin{aligned} \frac{d}{dt}(e^{-h(t)} (\gamma(t)-a)) = & [\text{ Product rule: } \frac{d}{dt}(uv) = u'v + uv'] \\[2pt] &=e^{-h(t)}(-h'(t))(\gamma(t)-a) + e^{-h(t)}(\gamma'(t)) \\[2pt] &= [\text{Now, we substitute our know expression for $h'(t)$ from } (\star)] \\[2pt] &=e^{-h(t)}(-\frac{\gamma'(t)}{\gamma(t)-a})(\gamma(t)-a) + e^{-h(t)}(\gamma'(t)) \\[2pt] &=e^{-h(t)}(-\gamma'(t))+ e^{-h(t)}(\gamma'(t))\\[2pt] &=0. \end{aligned} $$The solution to the equation $e^w = 1$ in the complex plane is $w = 2\pi i n$, where n is any integer ($\dots, -2, -1, 0, 1, 2, \dots$).
Definition. Let $\gamma : [\alpha, \beta] \to \mathbb{C}$ be a piecewise smooth closed curve, and let $z_0 \notin \gamma^*$ (a point not on the curve). The winding number of $\gamma$ about $z_0$, also known as the index of $z_0$ with respect to γ, is defined as $\boxed{n(\gamma, z_0) = \operatorname{Ind}_\gamma(z_0) = \frac{1}{2\pi i}\oint_\gamma \frac{dz}{z - z_0} = \frac{1}{2\pi i}\int_\alpha^\beta \frac{\gamma'(t)}{\gamma(t) - z_0}\,dt.}$
By the lemma, $n(\gamma, z_0)$ is always an integer. It counts the net number of times $\gamma$ winds around $z_0$ counterclockwise.
When counting the total number of turns, counterclockwise motion counts as positive (it contributes +1 per full loop), while clockwise motion counts as negative (it contributes −1 per full loo). The winding number is the algebraic (signed) total.
Figure 4 illustrates indices −2, −1, 0, 1, 2, 3 for concentric loops with various orientations; the multi-loop picture shows different points $z_0, z_1, z_2$ with different winding counts. 
To understand why this formula works, consider the polar representation. Write: $z-z_0 = re^{i\theta} \leadsto dz = e^{i\theta}dr + ire^{i\theta}d\theta \leadsto \frac{dz}{z-z_0} = \frac{e^{i\theta}dr + ire^{i\theta}d\theta}{re^{i\theta}} = \frac{dr}{r}+id\theta$
$\oint_{\gamma} \frac{dz}{z - z_0} = \int_a^b \frac{dr}{r}+id\theta = ln(r)\bigg|_{a}^{b} + i×\text{total change in θ}$
The term $\frac{dr}{r}$ integrates to zero because ln(r) returns to its initial value (closed curve), $\oint \frac{dr}{r} = \ln r\big|_{\text{start}}^{\text{end}} = 0$.
$\oint_{\gamma} \frac{dz}{z - z_0} = i×\text{total change in θ} = i(2\pi k)$ where k is the net number of revolutions. Dividing by 2πi gives k, the winding number.
$\oint_\gamma \frac{1}{z} = \begin{cases} 2\pi i, &\gamma: [0, 2\pi] → \mathbb{C}, t → e^{it} \text{ It rotates once} \\\\ 4\pi i, &\gamma: [0, 4\pi] → \mathbb{C}, t → e^{it} \text{ It rotates twice} \\\\ 0, &\gamma: [a, b] → \mathbb{C} \text{ Not at all} \end{cases}$
For a simple closed curve γ:
A continuous integer-valued function on a connected set is constant (since $\mathbb{Z}$ is discrete).
If a function takes values in a discrete space (like ℤ) and is continuous on a connected domain, it cannot “jump,” so it must stay fixed
In other words, the winding number is constant for all points within a connected region defined by the curve.
If $z_0$ is in the unbounded exterior of γ, the curve does not enclose it at all, $n(\gamma, z_0) = 0$.
This is intuitive: if you are standing far away from a loop, your total change of argument θ as someone walks around it is zero —they return to their starting position without ever circling you.
On each bounded interior region, the winding number is a fixed integer (often 1 if the curve is simple and positively oriented).
If $\gamma$ is counterclockwise (positive orientation), then $n(\gamma, z_0)>0$. If $\gamma$ is clockwise (negative orientation), then $n(\gamma ,z_0)<0$.
For a simple closed curve (Jordan curve), there are only two regions. If $z_0$ is in the bounded interior of $\gamma$, the curve wraps around it exactly once, $|n(\gamma ,z_0)|=1.$
The winding number provides a perfect mathematical test to determine if a point is inside or outside a simple closed curve. If $n(\gamma; z_0) \ne 0$, the point is inside; if $n(\gamma; z_0) = 0$, the point is outside.
Homotopy invariance in the complement: if $\gamma_1$ and $\gamma_2$ can be deformed into each other without ever crossing the point $z_0$, then their winding numbers around $z_0$ will be identical, $n(\gamma_1; z_0) = n(\gamma_2; z_0)$.
This means you can replace a complicated curve with a simpler one (like a circle) for calculation purposes, provided the deformation doesn’t cross $z_0$.
Vanishing at Infinity. For $|z_0|$ sufficiently large (i.e., $z_0$ far from $\gamma$), $n(\gamma, z_0) = 0$. In particular, $n(\gamma, z_0) = 0$ on the unbounded component of $\mathbb{C} \setminus \gamma^*$.
Additivity: If you have a path γ composed of two loops, $\gamma_1$ and $\gamma_2$, the total winding number is the sum of the individual winding numbers: $n(\gamma_1 + \gamma_2; z_0) = n(\gamma_1; z_0) + n(\gamma_2; z_0)$.
Reversal: Traversing a curve in the opposite direction negates the winding number: $n(-\gamma; z_0) = - n(\gamma; z_0)$.
For a simple closed curve (Jordan curve) $\gamma$, the Jordan curve theorem says $\mathbb{C} \setminus \gamma^*$ has exactly two connected components: a bounded interior and an unbounded exterior. The winding number provides a precise algebraic test.
Let $\gamma$ be any positively oriented Jordan curve. Then, for any $z_0 \notin \gamma, n(\gamma; z_0) = \begin{cases} 1, z_0 \in Int(\gamma) \\\\ 0, z_0 \in Ext(\gamma) \end{cases}$
For a negatively oriented Jordan curve, the interior value is $-1$.
Proof
Case 1. $z_0 \in Int(\gamma)$
Approximate the Curve with a Polygon P close enough that $z_0$ remains inside. A Jordan curve γ can be approximated arbitrarily well by a simple polygon P that lies entirely within its interior. We can construct P to be positively oriented and “close enough” to γ so that it also contains $z_0$. Because the winding number integral is continuous with respect to the path, this approximation doesn’t change the result: $n(\gamma, z_0) = n(P, z_0)$
Triangulate the Polygon. Any simple polygon can be divided into a finite number of triangles ($T_1, T_2, \cdots T_k$). The integral over the boundary of the polygon is the sum of the integrals over the boundaries of these triangles. This is because all the internal edges are traversed twice in opposite directions, and their integrals cancel each other out, leaving only the integral over the exterior boundary: $n(P, z_0) = \sum_{j=1}^k n(∂T_j,z_0)$.
Isolate the Key Triangle. The point $z_0$ must lie in the interior of exactly one of these triangles, let’s call it $T_1$. For any other triangle $T_j, j \ne 1$, the point $z_0$ is in its exterior. The function $\frac{1}{z-z_0}$ is analytic inside and on the boundary of $T_j$. By Cauchy’s Integral Theorem, the integral is zero. Thus, $n(∂T_j,z_0) = 0$ for j ≠ 1.
This means our sum collapses to a single term: $n(P, z_0) = \sum_{j=1}^k n(∂T_j,z_0) = n(∂T_1,z_0)$
Deform the Triangle to a Circle (Homotopy). Let C be a small, positively oriented circle centered at $z_0$ that lies completely inside the triangle $T_1$. The function $\frac{1}{z-z_0}$ is analytic in the region between the triangle’s boundary and the circle. By the Deformation Principle (homotopy invariance), we can continuously deform the triangular path $∂T_1$ into the circular path C without changing the value of the integral: $n(∂T_1,z_0) = n(C, z_0)$. The winding number of a positively oriented circle around its center is known to be 1, so $n(\gamma, z_0) = n(P, z_0) = \sum_{j=1}^k n(∂T_j,z_0) = n(∂T_1,z_0) = n(C, z_0) = 1.$
Case 2. $z_0 \in Ext(\gamma)$
If $z_0$ is in the unbounded exterior region, the function $f(z) = \frac{1}{z-z_0}$ is analytic at all points inside and on the contour γ. The singularity at $z_0$ is outside the domain enclosed by the curve. By Cauchy’s Integral Theorem, the integral of an analytic function over a simple closed contour is zero: $\oint_{\gamma} \frac{1}{z-z_0} = 0$. Therefore, the winding number is: $n(\gamma; z_0) = \frac{1}{2\pi i} \oint_{\gamma} \frac{1}{z-z_0} = \frac{1}{2\pi i} \cdot 0 = 0.$
$n(\gamma, 0) = \frac{1}{2\pi i} \int_{0}^{1} \frac{1}{e^{i2\pi t}} \cdot \frac{d}{dt}(e^{i2\pi t}) dt = \frac{1}{2\pi i} \int_{0}^{1} \frac{i2\pi e^{i2\pi t}}{e^{i2\pi t}} dt = \frac{1}{2\pi i} \cdot i2\pi = 1$
For any $z_0$ with $|z_0| \lt R, \mathbb{n}(\gamma; z_0) = 1.$ This can be quickly verified using Cauchy’s Integral Formula. Let f(z) = 1. The formula states: $\oint_\gamma \frac{f(z)}{z-z_0} dz = 2\pi i \cdot f(z_0)$. Substituting into the winding number definition: $\mathbb{n}(\gamma;z_0) = \frac{1}{2\pi i}\oint_\gamma \frac{f(z)}{z-z_0} dz = \frac{1}{2\pi i} (2\pi i \cdot f(z_0)) = f(z_0) = 1.$
For any $z_0$ with $|z_0| > R, \mathbb{n}(\gamma;z_0) = 0.$ This follows from Cauchy’s Theorem. If $z_0$ is outside the circle, the function f(z) = $\frac{1}{z-z_0}$ is analytic at all points inside and on the contour γ. Therefore, its integral over the closed contour is zero: $\mathbb{n}(\gamma;z_0) = \frac{1}{2\pi i}\oint_\gamma \frac{f(z)}{z-z_0} dz = \frac{1}{2\pi i} \cdot 0 = 0.$
Hence, $\mathbb{Int}(\gamma) = \{ z \in \mathbb{C} | \mathbb{n}(\gamma; z_0) = 1 \} = \{ z \in \mathbb{C} | |z| < R \} \text{ and } \mathbb{Ext}(\gamma) = = \{ z \in \mathbb{C} | \mathbb{n}(\gamma; z_0) = 0 \} = \{ z \in \mathbb{C} | |z| > R \}.$
Simple polygon (one that does not self-intersect). Let γ be its boundary traversed counterclockwise. This is a perfect example of a Jordan curve. As such, the Jordan Curve Theorem guarantees that it cleanly separates the complex plane into two distinct regions: A bounded interior, which is the area inside the polygon $Int(\gamma^∘)$; an unbounded exterior, which is the area outside. For any $z_0 \in Int(\gamma^∘), n(\gamma; z_0) = 1$ (γ will encircle the point exactly once because the curve is simple and positively oriented); for $z_0\notin \overline{\operatorname{Int} (\gamma ^{\circ })}, n(\gamma; z_0) = 0$ ($z_0$ lies in the unbounded region, then the curve does not wrap around it at all).
Double Winding. $\gamma(t) = e^{it}$, $t \in [0, 4\pi]$ (The curve winds around the origin twice counterclockwise): $n(\gamma, 0) = \frac{1}{2\pi i}\int_\gamma \frac{dz}{z} = \frac{1}{2\pi i}\int_0^{4\pi}\frac{\gamma'(t)}{\gamma(t)}dt = \frac{1}{2\pi i}\int_0^{4\pi}\frac{ie^{it}}{e^{it}}\,dt = \frac{1}{2\pi i}\cdot 4\pi i = 2.$
Figure-Eight Curve. Let $ \gamma(t) = e^{i\pi t} + e^{i2\pi t} $, $ t \in [0, 2] $. This traces a figure-eight. The winding number around $ z_0 = 0 $ is undefined because the winding number is only defined for points that are not on the contour.
Example of Cancellation. Consider a path made of two parts: γ₁, the unit circle traversed counter-clockwise, $e^{i2\pi t}$ for $ t \in [0, 1]$. The winding number around the origin is n(γ₁, 0) = 1, a full positive (counter-clockwise) loop around the origin; The unit circle traversed clockwise, $e^{-i2\pi t}$ for $ t \in [1, 2]$. The winding number around the origin is n(γ₂, 0) = -1, a full negative (clockwise) loop around the origin.
$n(\gamma_2, 0) = \frac{1}{2\pi i}\int_\gamma \frac{dz}{z} = \frac{1}{2\pi i}\int_1^2\frac{\gamma'(t)}{\gamma(t)}dt = \frac{1}{2\pi i}\int_1^2 \frac{-2\pi i e^{-i2\pi t}}{e^{-i2\pi t}}\,dt = \frac{1}{2\pi i}\cdot -2\pi i = -1.$
The total winding number of the combined path γ = γ₁+γ₂ is the sum of the individual winding numbers: n(γ, 0) = n(γ₁, 0) + n(γ₂, 0) = 1 + (-1) = 0.
The two loops cancel each other out. The combined path γ winds around the origin zero times