Sometimes people don’t want to hear the truth because they don’t want their illusions destroyed, Friedrich Nietzsche.

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 simply connected domains. If a function f is analytic (a function that is complex-differentiable at every point within a domain, i.e., well-behaved and smooth, with no sharp corners, breaks, or singularities like division by zero) throughout a simply simple connected domain D then $\oint_C f(z)dz = 0$ for every closed contour C lying in D.
General Cauchy Theorem for Multiply Connected Domains. Let $R$ be the multiply connected region (with n holes) inside $C$ but outside of every $C_k$ (each $C_k$ surrounds only one hole in the domain), $R = Int(C) \setminus \bigcup_{k=1}^n \overline{Int(C_k)}$, and let $f(z)$ be analytic on $R$. Now, let $\Gamma$ be any general closed contour (not necessarily simple) that lies entirely in R. This $\Gamma$ can wind around the “holes” (the regions inside each $C_k$) in any way it likes (this is the winding number or index of $\Gamma$ around each hole), the integral over $\Gamma$ is: $\oint_{\Gamma} f(z)dz = \sum_{k=1}^n m_k \oint_{C_k} f(z)dz$.
The Anti-Derivative Theorem. Let f be a continuous function on a region G (a region is an open, connected set). Then, the following statements are equivalent:
Cauchy’s Theorem for a disk. If a function f(z) is analytic in an open disk $D = B(z_0; \delta)$ (a disk centered at $z_0$ with radius $\delta$), then the contour integral for any closed contour γ lying entirely in $B(z_0; \delta)$ is zero, $\oint_{\gamma} f(z)dz = 0.$
We have established Cauchy’s Theorem for rectangles, triangles, and polygons. However, we want the integral of an analytic function over any closed loop inside a disk to vanish — circles, ellipses, figure-eights, or arbitrarily wiggly curves.
The contour $\gamma$ does not need to be simple — it may self-intersect. It does not need to be smooth either — it may have corners. The only requirements are that $\gamma$ is closed and lies entirely within the disk $D$.
Proof.
1. Defining the Candidate Antiderivative
Let z = (x, y) be an arbitrary point in the disk $B(z_0; \delta), z_0 = (x_0, y_0)$. We could construct a rectangle inside the disk. We denote $\gamma_1$ the L-shaped anti-clockwise “H–V” path from z to $z_0 = (x_0, y_0)$ consisting of a horizontal line segment ($\sigma_1$ go from $z_0 = (x_0, y_0) \text{ to } (x, y_0)$) followed by a vertical segment ($\sigma_2$ go from $(x, y_0) \text{ to } z = (x, y)$) and $\gamma_2$ the L-shaped clockwise “V–H” path from z to $z_0 = (x_0, y_0)$ consisting of a vertical line segment ($\sigma_3$ go from $z_0 = (x_0, y_0) \text{ to } (x_0, y)$) followed by a horizontal segment ($\sigma_4$ go from $(x_0, y) \text{ to } z = (x, y)$) (Figure i).

Why L-shaped paths? Both paths stay inside the disk $D$ (since disks are convex, the straight segments from $z_0$ to any point in $D$ remain in $D$, and both L-shaped paths lie within the rectangle with opposite corners $z_0$ and $z$, which is contained in $D$). Crucially, these two paths form the boundary of a rectangle — and we have already demonstrated Cauchy’s Theorem for rectangles.
We will define our potential antiderivative $F(z)$ as an integral from $z_0$ to $z, F(z) = \int_{z_0}^z f(\xi)d\xi$.
2. $F$ is Well-Defined.
The two L-shaped paths $\gamma_1$ and $\gamma_2$ together form the boundary of the rectangle $R$ with opposite corners $z_0$ and $z$. Therefore, $\gamma_1 - \gamma_2$ (i.e., $\gamma_1$ followed by $\gamma_2$ in reverse) traces $\partial R$. In other words, it is the boundary of a rectangular region.
$f$ is analytic on $D$ and $R \subset D$. Cauchy’s Theorem for a rectangle states that $\oint_R f(z)dz = 0$ for any closed rectangle $R$ whose interior is also in $D$, $\oint_{\gamma_1 - \gamma_2}f(z)dz = 0 \leadsto[\text{ Linearity of contour integrals}] \oint_{\gamma_1} f(z)dz = \oint_{\gamma_2} f(z)dz$.
Therefore, the value of the integral from $z_0$ to $z$ is the same along either L-shaped path. We define: $F(z) = \int_{z_0}^{z} f(\zeta)\,d\zeta := \int_{\gamma_1} f(\zeta)\,d\zeta = \int_{\gamma_2} f(\zeta)\,d\zeta$. At this stage, we have only shown that the H–V and V–H paths give the same integral. We have not yet shown full path independence (which would require the result for arbitrary closed contours).
3. Proving $F'(z) = f(z)$
We will show $F(z)$ is analytic by showing it satisfies the Cauchy-Riemann (C-R) equations and has continuous partials. The C-R equations for $F$ are $U_x = V_y$ and $U_y = -V_x$.
Calculating $\frac{\partial F}{\partial x}$. To find the partial derivative with respect to $x$, it’s easiest to use the V-H path ($\gamma_2$) expression, because the variable $x$ only appears in the second integral (x is the upper limit).
$$ \begin{aligned} F(z) = \oint_{\gamma_2} f(ξ)dξ &=\oint_{\sigma_3} f(ξ)dξ + \oint_{\sigma_4} f(ξ)dξ \\[2pt] &\text{Let's parameterize it:} \\[2pt] &[\sigma_3: \zeta(t) = x_0 + it, t \in [y_0, y], d\zeta = i\,dt; \sigma_4: \zeta(t) = t + iy, t \in [x_0, x], d\zeta = dt] \\[2pt] &=\int_{t=y_0}^y f(x_0 + it)\cdot i \cdot dt + \int_{t=x_0}^x f(t + iy) \cdot dt. \end{aligned} $$The first integral depends on $y$ only (not on $x$). Differentiating with respect to $x$: $\frac{\partial F}{\partial x} = 0 + \frac{\partial}{\partial x} \left[ \int_{x_0}^x f(t+iy) dt \right]$
By the Fundamental Theorem of Calculus (for real variables), the derivative of an integral with respect to its upper limit is just the integrand evaluated at that limit, $\frac{\partial F}{\partial x} = f(x+iy) = f(z)$
First Fundamental Theorem of Calculus. Let f be a real-valued function that is continuous on an interval [a, b]. Define a function F by $F(x) = \int_a^x f(t)dt$ for $x \in [a, b]$. Then, F is differentiable on (a, b), and F’(x) = f(x). In other words, the derivative of the integral from a to x of f(t) is just f(x).
Calculating, $\frac{\partial F}{\partial y}$. To find the partial derivative with respect to $y$, it’s easiest to use the H-V path ($\gamma_1$) expression.
$$ \begin{aligned} F(z) = \oint_{\gamma_1} f(ξ)dξ &=\oint_{\sigma_1} f(ξ)dξ + \oint_{\sigma_2} f(ξ)dξ \\[2pt] &\text{Let's parameterize it:} \\[2pt] &[\sigma_1: \zeta(t) = t + iy_0, t \in [x_0, x], d\zeta = dt; \sigma_2: \zeta(t) = x + it, t \in [y_0, y], d\zeta = idt] \\[2pt] &=\int_{t=x_0}^x f(t+iy_0)\cdot dt + \int_{t=y_0}^y f(x+it)\cdot i \cdot dt. \end{aligned} $$The first integral depends on $x$ only (not on $y$). Differentiating with respect to $y$: $\frac{\partial F}{\partial y} = 0 + \frac{\partial}{\partial y} \left[ \int_{y_0}^y f(x+it) i dt \right]$
By the Fundamental Theorem of Calculus again: $\frac{\partial F}{\partial y} = f(x+iy) \cdot i = i f(z)$
We have found the partial derivatives of $F(z), \frac{\partial F}{\partial x} = f(z), \frac{\partial F}{\partial y} = i f(z)$. From this, we can see that $\frac{\partial F}{\partial y} = i \frac{\partial F}{\partial x}$, which is a compact form of the C-R equations.
Let’s check this explicitly. Let’s write F = U + iV, f = u + iv, and we know $\frac{\partial F}{\partial x} = f(z), \frac{\partial F}{\partial x} = U_x + iV_x =[f(z)] u + iv \implies U_x = u, V_x = v$
$\frac{\partial F}{\partial y} = i f(z), \frac{\partial F}{\partial y} = U_y + iV_y =[if(z)] i(u+iv) = -v + iu \implies U_y = -v, V_y = u$
Check C-R: $U_x = u$ and $V_y = u \implies U_x = V_y, U_y = -v$ and $V_x = v \implies U_y = -V_x$.
The partials of $F$ (which are $u, v, -v, u$) are continuous because $f=u+iv$ is analytic, and analytic functions are continuous.
Conclusion: $F(z)$ satisfies the C-R equations and has continuous partials, so $F(z)$ is analytic in the disk $D$ and F’(z) = f(z).
For any analytic function $F(z)$, its complex derivative $F'(z)$ is always equal to its partial derivative with respect to $x, F'(z) = \frac{\partial F}{\partial x}$
The derivative $F'(z)$ is defined by the limit:$F'(z) = \lim_{\Delta z \to 0} \frac{F(z + \Delta z) - F(z)}{\Delta z}$.
For $F(z)$ to be analytic, this limit must be the same no matter which direction or path $\Delta z$ takes as it approaches 0.
Choosing a Convenient Path (The Horizontal Path). Let’s choose the simplest possible path for $\Delta z \to 0$: a horizontal one. This means $\Delta z$ is a purely real number, so we can write $\Delta z = \Delta x$. Plugging this into the limit definition: $F'(z) = \lim_{\Delta x \to 0} \frac{F(z + \Delta x) - F(z)}{\Delta x}$
This is exactly the definition of the partial derivative $\frac{\partial F}{\partial x}$ and we have successfully calculated this exact partial derivative: $\frac{\partial F}{\partial x} = f(z)$.
We have constructed an analytic function $F$ on $D$ with $F'(z) = f(z)$ — that is, $f$ has an antiderivative throughout the disk $B(z_0; \delta)$.
By the antiderivative theorem (1)⇒(2), the integral of $f$ over any closed contour $\gamma$ in $D$ must be zero, $\oint_{\gamma} f(z)dz = 0$.
Since f(z) is an entire function (analytic everywhere in $\mathbb{C}$), it is certainly analytic on and inside the circle $\gamma: |z-1|=5.$ By Cauchy’s theorem for a disk [$\oint_γ f(z) dz = 0$ provided f is analytic in the whole open disk that carries γ.], $\oint_{\gamma} e^{z^3}dz = 0$.
Any entire function will behave exactly like the previous example $f(z)=e^{z^3}$: the contour integral around any circle or closed contour vanishes by Cauchy’s theorem for a disk, since there are no singularities anywhere in $\mathbb{C}$, e.g., $e^z; e^{z^n}; \sin(z); \cos(z); \sin(z^2); \cos(e^z); e^{\sin(z)}; P(z)$ where P is any polynomial and $n \in \mathbb{N}$.
Polynomial, any disk. Polynomials are entire, so $f(z)=z^4-3z+7$ is analytic everywhere. Circle: $\gamma$: |z+2i|=0.3 is a closed curve contained in the domain of analyticity. By Cauchy’s theorem for a disk [$\oint_γ f(z) dz = 0$ provided f is analytic in the whole open disk that carries γ.], $\oint_{\gamma} z^4-3z+7 dz = 0$.
Alternative verification via antiderivative. The function $f$ has the explicit antiderivative $F(z) = \frac{z^5}{5} - \frac{3z^2}{2} + 7z$. By the Fundamental Theorem of Calculus for contour integrals: $\oint_\gamma f = F(\gamma_{\text{end}}) - F(\gamma_{\text{start}}) = 0$ (since $\gamma$ is closed).
Note: $|3i - 1| = \sqrt{1 + 9} = \sqrt{10} \approx 3.16 > 2$. So $3i \notin D$, $|-3i - 1| = \sqrt{1 + 9} = \sqrt{10} \approx 3.16 > 2$. So $-3i \notin D$.
Composition with entire function The function f(z) = cos(sin(z)) is an entire function (sin(z) and cos(w) are entire, and the composition of entire functions is entire; hence f(z) = cos(sin(z)) is entire, analytic everywhere in ℂ), it is certainly analytic on and inside the circle, γ: |z| = 12. By Cauchy’s theorem for a disk [$\oint_γ f(z) dz = 0$ provided f is analytic in the whole open disk that carries γ.], $\oint_{\gamma} cos(sin(z)) dz = 0$.
Log branch inside a disk avoiding the cut. The principal logarithm Log is analytic on $\mathbb{C}\setminus(-\infty,0]$. For $f(z)=\mathrm{Log}(z+4)$, the excluded set is shifted to the ray $(-\infty,-4]$. The unit disk does not intersect the ray $(-\infty,-4]$, since all points in $\mathbf{B}(0; 1)$ have real part greater than -1. Because z + 4 never falls on the principal cut $(-\infty,-4]$ for $z\in \mathbf{B}(0; 1)$, f is analytic on and inside $\gamma$. By Cauchy’s theorem for a disk [$\oint_γ f(z) dz = 0$ provided f is analytic in the whole open disk that carries γ.], $\oint_{\gamma} \mathrm{Log}(z+4) dz = 0$.
This example illustrates that Cauchy’s Theorem for a disk applies to functions that are not entire — as long as the disk avoids the branch cut or singularities. The logarithm is perfectly well-behaved inside this particular disk.

For a simple pole at a point $z_k$ (i.e., the denominator has a simple root) is calculated using the formula $Res(f, z_k) = \lim_{z \to z_k}(z-z_k)f(z)$.
$\text{Res}\left(\frac{1}{z^2+1}, i\right) = \lim_{z \to i}(z-i)\frac{1}{z^2+1} = \lim_{z \to i} \frac{1}{z+i} = \frac{1}{2i}$
$\text{Res}\left(\frac{1}{z^2+1}, -i\right) = \lim_{z \to -i}(z+i)\frac{1}{z^2+1} = \lim_{z \to -i} \frac{1}{z-i} = \frac{1}{-2i}.$
The Residue Theorem states that the integral of a function f(z) around a simple (doesn’t cross itself), and positively oriented (counter-clockwise) contour γ is equal to 2πi times the sum of the residues of all singularities inside the contour: $\oint_{|z|=2}\frac{dz}{z^2+1} = 2\pi i \sum Res(f, z_k) = 2\pi i\left(\frac{1}{2i}+\frac{1}{-2i}\right) = 0$. The integral vanishes not because of Cauchy's Theorem (which does not apply here), but because the two poles have equal and opposite residues that cancel. This is a coincidence of this particular function, not a general principle.
The curve C is the circle centered at i (0, 1) with radius 2 (Figure ii). We know that $a^2 - b^2 = (a + b)(a - b)$. Then, we have $\frac{1}{z^2 + 4} = \frac{1}{z^2 - (2i)^2} = \frac{1}{(z + 2i)(z - 2i)}$.

F(z) is not analytic at z = ±2i and 2i lies inside the circle, so we cannot apply the Cauchy’s Theorem for a disk.
Cauchy Integral Formula. If a function f is analytic in a simply connected domain D and γ is a simply closed contour (positive orientated) in D. Then, for any point $z_0$ inside γ we have $f(z_0) = \frac{1}{2\pi i}\cdot \int_{\gamma} \frac{f(z)}{z-z_0}dz$
Rewrite the integrand to isolate the pole at $z = 2i$. $F(z) = \frac{1}{(z + 2i)(z - 2i)} = \frac{\frac{1}{z+2i}}{z-2i} = \frac{f(z)}{z -2i} \text{ where we define } f(z) = \frac{1}{z+2i}$.
Clearly, f(z) is analytic inside and on the closed curve C (only z = 2i lies inside C). By Cauchy’s Integral Formula, $\oint_C \frac{1}{z^2 + 4} = 2\pi i f(2i) = 2\pi i \cdot \frac{1}{4i} = \frac{\pi}{2}$
The integral is nonzero because exactly one pole lies inside the contour, contributing a nonzero residue. The pole outside the contour ($z = -2i$) has no effect whatsoever — it is invisible to the integral.
C is a circle with center (1, 0) and radius 3. $\frac{e^{2z}}{(z+1)^4}$ is not analytic at z = -1 because this singularity lies inside the circle C (Figure iv).

Let f(z) = $e^{2z}$, f is analytic inside and on the circle C. Then, by the extension of Cauchy’s Integral Formula, $\int_{\gamma} \frac{f(z)}{z-z_0}dz = 2\pi i \cdot f(z_0), \int_{\gamma} \frac{f(z)}{(z-z_0)^{(n+1)}}dz = \frac{2\pi i}{n!} \cdot f^{(n)}(z_0)$ where f(z) = $e^{2z}, n = 3, z_0 = -1$.
$\oint_C \frac{e^{2z}}{(z+1)^4} = \oint_C \frac{f(z)}{(z+1)^4} = \frac{2\pi i}{3!}f^{(3)}(-1) = \frac{2\pi i}{3\cdot 2}\frac{8}{e^2} = \frac{8\pi i}{3e^2}$
$f'(z) = 2e^{2z}, f''(z) = 4e^{2z}, f'''(z) = 8e^{2z}, f'''(-2) = 8e^{-2}=\frac{8}{e^2}$