In complex analysis, contour integration is a way to calculate an integral around a contour on the complex plane. In other words, it is a way of integrating along the complex plane.

More specifically, given a complex-valued function f and a contour {\displaystyle C}, the contour integral of f along {\displaystyle C} is written as {\displaystyle \textstyle \int \_{C}f(z)\,dz} or {\displaystyle \textstyle \oint \_{C}f(z)\,dz}.

Calculating contour integrals with the residue theorem
------------------------------------------------------

For a standard contour integral, we can evaluate it by using the residue theorem. This theorem states that 

{\displaystyle \oint \_{C}f(z)\,dz=2\pi i\cdot {\text{Res}}f(z)}

where {\displaystyle {\text{Res}}} is the residue of the function {\displaystyle f(z)}, {\displaystyle C} is the contour located on the complex plane. Here, {\displaystyle f(z)} is the integrand of the function, or part of the integral to be integrated.

The following examples illustrate how contour integrals can be calculated using the residue theorem.

### Example 1

{\displaystyle {\begin{aligned}&\oint \_{C}{\frac {e^{z}}{z^{3}}}\,dz\\&=2\pi i\cdot {\text{Res}}\left({\frac {e^{z}}{z^{3}}}\right)\\&=2\pi i\cdot {\frac {1}{2}}\\&=\pi i\end{aligned}}}
### Example 2

{\displaystyle {\begin{aligned}&\oint \_{C}{\frac {1}{z^{3}}}\,dz\\&=2\pi i\,{\text{Res}}f(z)\\&=2\pi i\,{\text{Res}}{\frac {1}{z^{3}}}\\&=2\pi i\cdot 0\\&=0\end{aligned}}}

Multivariable contour integrals
-------------------------------

To solve multivariable contour integrals (contour integrals on functions of several variables), such as surface integrals, complex volume integrals and higher order integrals, we must use the divergence theorem. For right now, let {\displaystyle \nabla } be interchangeable with {\displaystyle {\text{Div}}}. These will both serve as the divergence of the vector field written as {\displaystyle \mathbf {F} }. This theorem states that:

{\displaystyle \underbrace {\int \cdots \int \_{U}} \_{n}{\text{Div}}(\mathbf {F} )\,dV=\underbrace {\oint \cdots \oint \_{\partial U}} \_{n-1}\mathbf {F} \cdot \mathbf {n} \,dS}

In addition, we also need to evaluate {\displaystyle \nabla \cdot \mathbf {F} }, where {\displaystyle \nabla \cdot \mathbf {F} } is an alternate notation of {\displaystyle {\text{div}}\,\mathbf {F} }. The divergence of any dimension can be described as

{\displaystyle {\begin{aligned}&\operatorname {Div} {\mathbf {F} }\\\\&=\nabla \cdot {\textbf {F}}\\\\&=\left({\frac {\partial }{\partial u}},{\frac {\partial }{\partial x}},{\frac {\partial }{\partial y}},{\frac {\partial }{\partial z}},\cdots \right)\cdot (F\_{u},F\_{x},F\_{y},F\_{z}\cdots )\\\\&=\left({\frac {\partial F\_{u}}{\partial u}}+{\frac {\partial F\_{x}}{\partial x}}+{\frac {\partial F\_{y}}{\partial y}}+{\frac {\partial F\_{z}}{\partial z}}\cdots \right)\end{aligned}}}
The following examples illustrate the use of divergence theorem in the calculation of multivariate contour integrals.

### Example 1

Let the vector field {\displaystyle \mathbf {F} =\sin(2x)+\sin(2y)+\sin(2z)} be bounded by the following conditions

{\displaystyle {0\leq x\leq 1}\quad {0\leq y\leq 3\pi }\quad {-1\leq z\leq 4}}
The corresponding double contour integral would be set up as such:

{\displaystyle } \oiiint{\displaystyle {\scriptstyle S}} {\displaystyle {\mathbf {F} \cdot n}\,{\rm {d}}\,S}
We now evaluate {\displaystyle \nabla \cdot \mathbf {F} } by setting up the corresponding triple integral:

{\displaystyle {\begin{aligned}&=\iiint \_{V}\left({\frac {\partial F\_{x}}{\partial x}}+{\frac {\partial F\_{y}}{\partial y}}+{\frac {\partial F\_{z}}{\partial z}}\right)\,dV\\\\&=\iiint \_{V}\left({\frac {\partial \sin(2x)}{\partial x}}+{\frac {\partial \sin(2y)}{\partial y}}+{\frac {\partial \sin(2z)}{\partial z}}\right)\,dV\\\\&=\iiint \_{V}{=2(\cos(2x)+\cos(2y)+\cos(2z))}\,dV\end{aligned}}}
From this, we can now evaluate the integral as follows:

{\displaystyle {\begin{aligned}&\int \_{0}^{1}\int \_{0}^{3}\int \_{-1}^{4}2(\cos(2x)+\cos(2y)+\cos(2z))\,dx\,dy\,dz\\\\&=\int \_{0}^{1}\int \_{0}^{3}(10\cos(2y)+\sin(8)+\sin(2)+10\cos(z))\,dy\,dz\\\\&=\int \_{0}^{1}(30\cos(2z)+3\sin(2)+3\sin(8)+5\sin(6))\,dz\\\\&=18\sin(2)+3\sin(8)+5\sin(6)\end{aligned}}}

### Example 2

Given the vector field {\displaystyle \mathbf {F} =u^{4}+x^{5}+y^{6}+z^{-3}} and n being the fourth dimension. Let this vector field be bounded by the following:

{\displaystyle {0\leq x\leq 1}\quad {-10\leq y\leq 2\pi }\quad {4\leq z\leq 5}\quad {-1\leq u\leq 3}}
To evaluate this, we use the divergence theorem as stated before, and evaluate {\displaystyle \nabla \cdot \mathbf {F} } afterwards. Let {\displaystyle \,dV=\,dx\,dy\,dz\,du}, then:

 \oiint{\displaystyle {\scriptstyle S}} {\displaystyle \mathbf {F} \cdot n\,{\rm {d}}{\mathbf {S}}}
{\displaystyle {\begin{aligned}&=\iiiint \_{V}\left({\frac {\partial F\_{u}}{\partial u}}+{\frac {\partial F\_{x}}{\partial x}}+{\frac {\partial F\_{y}}{\partial y}}+{\frac {\partial F\_{z}}{\partial z}}\right)\,dV\\\\&=\iiiint \_{V}\left({\frac {\partial u^{4}}{\partial u}}+{\frac {\partial x^{5}}{\partial x}}+{\frac {\partial y^{6}}{\partial y}}+{\frac {\partial z^{-3}}{\partial z}}\right)\,dV\\\\&=\iiiint \_{V}{\frac {4u^{3}z^{4}+5x^{4}z^{4}+5y^{4}z^{4}-3}{z^{4}}}\,dV\end{aligned}}}
From this, we now can evaluate the integral:

{\displaystyle {\begin{aligned}&\iiiint \_{V}{\frac {4u^{3}z^{4}+5x^{4}z^{4}+5y^{4}z^{4}-3}{z^{4}}}\,dV\\\\&=\int \_{0}^{1}\int \_{-10}^{2\pi }\int \_{4}^{5}\int \_{-1}^{3}{\frac {4u^{3}z^{4}+5x^{4}z^{4}+5y^{4}z^{4}-3}{z^{4}}}\,dV\\\\&=\int \_{0}^{1}\int \_{-10}^{2\pi }\int \_{4}^{5}\left({\frac {4(3u^{4}z^{3}+3y^{6}+91z^{3}+3)}{3z^{3}}}\right)\,dy\,dz\,du\\\\&=\int \_{0}^{1}\int \_{-10}^{2\pi }\left(4u^{4}+{\frac {743440}{21}}+{\frac {4}{z^{3}}}\right)\,dz\,du\\\\&=\int \_{0}^{1}\left(-{\frac {1}{2\pi ^{2}}}+{\frac {1486880\pi }{21}}+8\pi u^{4}+40u^{4}+{\frac {371720021}{1050}}\right)\,du\\\\&={\frac {371728421}{1050}}+{\frac {14869136\pi ^{3}-105}{210\pi ^{2}}}\\\\&\,\approx {576468.77}\end{aligned}}}
Thus, we can evaluate a contour integral of the fourth dimension.

Related pages
-------------

* Cauchy's integral formula
* Line integral