All things are difficult before they are easy, Thomas Fuller.

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$. Examples of contours:
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.$
General Cauchy Integral Formula for Derivatives. If f is analytic (holomorphic) on and inside a positively orientated simple closed contour $\gamma$ and a is a point inside $\gamma$, then for any non-negative integer n, the n-th derivative of f at a exists and is given by $f^{(n)}(a) = \frac{n!}{2\pi i}\oint_\gamma \frac{f(w)}{(w-a)^{n+1}}dw, \forall a \in \mathcal{Int}(\gamma)$
Key Conditions:
This is a powerful result in complex analysis because it expresses the n-th derivative of an analytic function entirely in terms of a contour integral around the point.
Rearranging the formula gives: $\oint_\gamma \frac{f(w)}{(w-a)^{n+1}}dw = \frac{2\pi i}{n!}f^{(n)}(a)$. This is just solving the original formula for the integral itself, and it’s often quite useful when evaluating complex integrals involving analytic functions. This is called the General Cauchy Integral Formula because it generalizes the original Cauchy Integral Formula to compute higher-order derivatives of analytic functions using contour integrals.
This is a classic example of using proof by induction.
Case n = 0 is the base case. $f(a) = \frac{0!}{2\pi i}\oint_\gamma \frac{f(w)}{(w-a)^{1}}dw$. This is the original Cauchy’s Integral Formula, which we assume is already proven.
Inductive Hypothesis, We assume the formula holds for the k-th derivative: $f^{(k)}(a) = \frac{k!}{2\pi i}\oint_\gamma \frac{f(w)}{(w-a)^{k+1}}dw$. Inductive Step. We must use the hypothesis to prove that $f^{(k+1)}(a)$ exists and that the formula holds for k + 1: $f^{(k+1)}(a) = \frac{(k+1)!}{2\pi i}\oint_\gamma \frac{f(w)}{(w-a)^{k+2}}dw$
The basic tool we have to find $f^{(k+1)}(a)$ is the fundamental limit definition of the derivative, applied to $f^{(k)}(a)$ that is $f^{(k+1)}(a) = \lim_{h \to 0} \frac{f^{(k)}(a + h) - f^{(k)}(a)}{h}$
Just like in the proof for the first derivative, we deform our arbitrary contour $\gamma$ into a neat, predictable circle $\gamma(a; 2r)$ centered at $a$ with radius $2r$. By the Deformation Theorem, this doesn’t change the contour integral. We restrict our perturbation $h$ such that $|h| < r$, ensuring $a+h$ is safely trapped inside our “buffer zone”.
We need to evaluate the numerator of our difference quotient: $f^{(k)}(a+h) - f^{(k)}(a)$. Using our inductive hypothesis (n = k), we can write this as a single integral: $f^{(k)}(a + h)-f^{(k)}(a) = \frac{k!}{2\pi i}\oint_\gamma \frac{f(w)}{(w-(a+h))^{k+1}}dw - \frac{k!}{2\pi i}\oint_\gamma \frac{f(w)}{(w-a)^{k+1}}dw = \frac{k!}{2\pi i} \oint_{\gamma} f(w)[\frac{1}{(w -a - h)^{k+1}-(w -a)^{k+1}}]dw$
Consider the function F(ξ) = $\frac{1}{(w-ξ)^{k+1}}$. Its derivative with respect to $\xi$ is $F'(\xi) = (-k-1)(w-\xi)^{-k-2} \cdot (-1) = (k+1)(w-\xi)^{-k-2}$. By the Fundamental Theorem of Calculus, $\int_a^{a+h} F'(\xi)d\xi = F(a+h) - F(a)$.
In our particular case, $\int_a^{a+h} (k+1)(w-\xi)^{-k-2} d\xi = (w-(a+h))^{-k-1} - (w-a)^{-k-1} \leadsto \frac{1}{(w-a-h)^{k+1}} - \frac{1}{(w-a)^{k+1}} = (k+1) \int_{[a, a+h]} \frac{1}{(w-\xi)^{k+2}} d\xi$
$$ \begin{aligned} f^{(k)}(a + h)-f^{(k)}(a) &=\frac{k!}{2\pi i} \oint_{\gamma} f(w)[\frac{1}{(w -a - h)^{k+1}-(w -a)^{k+1}}]dw \\[2pt] &\text{Now we substitute this new integral back into our main expression:} \\[2pt] &=\frac{k!}{2\pi i} \oint_{\gamma} f(w)\biggr(\int_{[a, a+h]} \frac{k+1}{(w-ξ)^{k+2}}dξ\biggl)dw \\[2pt] &\text{We can bring the constant $(k+1)$ out to the front, which gives us (k + 1)!:} \\[2pt] &=\frac{(k+1)!}{2\pi i} \oint_{\gamma} \biggr(\int_{[a, a+h]} \frac{f(w)}{(w-ξ)^{k+2}}dξ\biggl)dw \\[2pt] &=\frac{(k+1)!}{2\pi i} \oint_{\gamma} f(w) \biggr(\int_{[a, a+h]} (w-ξ)^{-k-2}dξ\biggl)dw \end{aligned} $$We are trying to prove that $\lim_{h \to 0} \frac{f^{(k)}(a+h) - f^{(k)}(a)}{h}$ equals our target $\frac{(k+1)!}{2\pi i}\oint_{\gamma}\frac{f(w)}{(w-a)^{k+2}}$. Let’s look at the difference between the expression we have and the target we want:
$$ \begin{aligned} \text{Error Term} &=\frac{f^{(k)}(a + h)-f^{(k)}(a)}{h} - \frac{(k+1)!}{2\pi i}\oint_{\gamma}\frac{f(w)}{(w-a)^{k+2}} \\[2pt] &\text{Notice that} \int_{[a, a+h]} 1 \, d\xi = h\text{. We can use this to rewrite the second term so that it perfectly absorbs into the inner integral.} \\[2pt] &=\frac{(k+1)!}{2\pi i h} \oint_{\gamma} f(w) (\int_{[a, a+h]}(w-ξ)^{-k-2}dξ - h(w-a)^{-k-2})dw \\[2pt] &(w-a)^{-k-2} \text{ is constant with respect to ξ over the straight line [a, a+h]} \\[2pt] &=\frac{(k+1)!}{2\pi i h} \oint_{\gamma} f(w) (\int_{[a, a+h]}((w-ξ)^{-k-2} - (w-a)^{-k-2})dξ)dw \\[2pt] &\text{Let } H(\tau) = (w-\tau)^{-k-2}, H'(\tau) = (-k-2)(w-\tau)^{-k-3} \cdot (-1) = (k+2)(w-\tau)^{-k-3}. \\[2pt] &\text{By the Fundamental Theorem of Calculus } \int_a^\xi H'(\tau)d\tau = H(\xi) - H(a). \int_{[a, \xi]} (k+2)(w-\tau)^{-k-3} d\tau = (w-\xi)^{-k-2} - (w-a)^{-k-2}. \\[2pt] &\text{Substitute this in, and we arrive at our final, triple-nested Error integral:} \\[2pt] &=\frac{(k+1)!}{2\pi i h} \oint_{\gamma} f(w) (\int_{[a, a+h]}(\int_{[a, ξ]} (w-\tau)^{-k-3}(k + 2)d\tau)dξ)dw \end{aligned} $$Choose h to be small enough such that |h| < r. Bounding the Error with ML-Estimation: (Figure i)

We apply the bounds to the magnitude of the Error term:
$$ \begin{aligned} |Error| &=|\frac{f^{(k)}(a + h)-f^{(k)}(a)}{h} - \frac{(k+1)!}{2\pi i}\oint_{\gamma}\frac{f(w)}{(w-a)^{k+2}}| \\[2pt] &\le \frac{(k+1)!}{2\pi |h|} \oint_{\gamma} \int_{[a, a+h]} M \left( \int_{[a, \xi]} (k+2) \frac{1}{r^{k+3}} |d\tau| \right) |d\xi| |dw| \\[2pt] &\text{Inner τ-integral} \int_{[a, \xi]} (k+2) \frac{1}{r^{k+3}} |d\tau| = (k+2) \frac{1}{r^{k+3}} \cdot (\text{Length of } [a,\xi]) \le (k+2) \frac{1}{r^{k+3}} |h| \\[2pt] &\text{Inner ξ-integral} \int_{[a, a+h]} M \left( (k+2) \frac{1}{r^{k+3}} |h| \right) |d\xi| = M (k+2) \frac{|h|}{r^{k+3}} \cdot (\text{Length of } [a,a+h]) = M (k+2) \frac{|h|^2}{r^{k+3}}. \\[2pt] &\le \frac{(k+1)!}{2\pi |h|} \oint_{\gamma}\frac{M(k+2)}{r^{k+3}}|h|^2|dw| \\[2pt] &\text{Outer w-integral} \oint_{\gamma} \left( M (k+2) \frac{|h|^2}{r^{k+3}} \right) |dw| = M (k+2) \frac{|h|^2}{r^{k+3}} \cdot (\text{Length of } \gamma) = M (k+2) \frac{|h|^2}{r^{k+3}} (4\pi r). \\[2pt] &=\frac{(k+2)!}{2\pi |h|}\frac{M}{r^{k+3}}|h|^2 4\pi r \\[2pt] &=\frac{2(k+2)!}{r^{k+2}} M|h| \end{aligned} $$We have successfully shown that the magnitude of the Error term is bounded: $0 \le |\frac{f^{(k)}(a + h)-f^{(k)}(a)}{h} - \frac{(k+1)!}{2\pi i}\oint_{\gamma}\frac{f(w)}{(w-a)^{k+2}}| \le \frac{2(k+2)!}{r^{k+2}} M|h|$
$\lim_{h \to 0} 0 = \lim_{h \to 0} \frac{2(k+2)!}{r^{k+3}} M|h| = 0$. By the Squeeze Theorem, $\lim_{h \to 0} |\frac{f^{(k)}(a + h)-f^{(k)}(a)}{h} - \frac{(k+1)!}{2\pi i}\oint_{\gamma}\frac{f(w)}{(w-a)^{k+2}}dw| = 0.$ If the limit of the magnitude is 0, the limit of the term itself is 0. $\lim_{h \to 0} \frac{f^{(k)}(a + h)-f^{(k)}(a)}{h} - \frac{(k+1)!}{2\pi i}\oint_{\gamma}\frac{f(w)}{(w-a)^{k+2}} = 0 $
Since $\frac{(k+1)!}{2\pi i}\oint_{\gamma}\frac{f(w)}{(w-a)^{k+2}}$ is constant related to h and by the definition of the derivative, $f^{k+1}(a)$ exists, and is equal to the formula $f^{k+1}(a) = \lim_{h \to 0} \frac{f^{(k)}(a + h)-f^{(k)}(a)}{h} = \frac{(k+1)!}{2\pi i}\oint_{\gamma}\frac{f(w)}{(w-a)^{k+2}}dw$
The singularity is inside our contour, $z = 1 \in \mathcal{Int}(\gamma(0, 2))$ (pole of order 3).
$\oint_{\gamma(0, 2)} (z-1)^{-3}e^{z²} =[\text{Define } f(z) = e^{z²}]= \oint_{\gamma(0, 2)} \frac{f(z)}{(z-1)^3}$
$$ \begin{aligned} \oint_{\gamma(0, 2)} (z-1)^{-3}e^{z²} &[\text{ Define } f(z) = e^{z²} \text{ it is entire (analytic everywhere)}] \\[2pt] &=\oint_{\gamma(0, 2)} \frac{f(z)}{(z-1)^3} \\[2pt] &\text{Generalized Cauchy Integral Formula for Derivatives, n = 2, z =1 } \\[2pt] &=\frac{2\pi i}{2!} f''(1) = \frac{2\pi i}{2}(\frac{d}{dz}(2ze^{z²}))\Big|_{z=1} \\[2pt] &=\pi i(2e^{z²} + 4z²e^{z²})\Big|_{z=1} = \pi i(2e + 4\cdot 1e) = 6e\pi i. \end{aligned} $$Solution.
This is a classic example how calculating contour integrals could be simplified quite a lot by using the Cauchy Integral Formula for Derivatives.
Let’s consider our integrand’s numerator f(z) = $e^{z^2}$, our contour integral becomes
$$ \begin{aligned} \oint_{\gamma} \frac{e^{z^2}}{(z-i)^4}dz &=\oint_{\gamma} \frac{f(z)}{(z-i)^4}dz \\[2pt] &\text{By the Deformation Theorem}\\[2pt] &=\oint_{\gamma(i, 1)} \frac{f(z)}{(z-i)^4}dz \\[2pt] &\text{By the Cauchy Integral Formula for Derivatives: (the order is n = 3, the singularity inside the contour is a = i) } f^{(n)}(a) = \frac{n!}{2\pi i} \oint_{\gamma} \frac{f(z)}{(z-a)^{n+1}}dz \\[2pt] &=2\pi i \frac{f^{'''}(i)}{3!} \\[2pt] &[f'(z) = 2ze^{z^2}, f''(z) = 2e^{z^2} + 4z^2e^{z^2}, f'''(z) = 2e^{z^2}2z + 8ze^{z^2} + 8z^3e^{z^2} = 12ze^{z^2} + 8z^3e^{z^2}] \\[2pt] &\text{ We plug the value of f'''(i) back into our formula: } f'''(i) = 12ie^{-1} - 8ie^{-1}=\frac{4i}{e} \\[2pt] &=\frac{2\pi i}{6}\cdot \frac{4i}{e} = -\frac{4\pi}{3e} \end{aligned} $$