# Complex Analysis/Residue Theory/A More "Complex" Solution

There is a much more general, more lovely, all-pole encompassing formula for determining residues. We start off by examining the Laurent series of a function:

$f(z) = \sum_{n=-\infin}^{\infin} a_n (z-z_0)^n$

And when examining the expansion we note that if we want the residue of the simple pole of a function, we want the coefficient $a_{-1}$. The second order pole, $a_{-2}$, and so on. In order to really see what's going on in the formula, it's best to look at the expansion:

$f(z) = ... + \frac{a_{-2}}{(z-z_0)^2} + \frac{a_{-1}}{(z-z_0)} + a_0 + a_1(z-z_0) + a_2(z-z_0)^2 + ...$

Say we want the residue of $z_0$ from a function with a 2nd-order pole about that point, we first multiply by $(z-z_0)^2$:

$f(z) = \frac{a_{-2}}{(z-z_0)^2} + \frac{a_{-1}}{(z-z_0)} + a_0 + a_1(z-z_0) + a_2(z-z_0)^2 + ...$

$(z-z_0)^2 f(z) = a_{-2} + a_{-1} (z-z_0) + ...\,$

We now want to isolate the $a_{-1}$ term, so we take a derivative:

$g(z) = \frac{d}{d z} ((z-z_0)^2 f(z)) = a_{-1} + ...$

Now if we evaluate $g$ at $z_0$, the remaining terms will be zero, thus:

$g(z_0) = \frac{d}{d z} ((z-z_0)^2 f(z)) = a_{-1}$

gets us the residue, from repeating this same procedure the general formula can be obtained quite easily.

## The Residue Formula

$\mathrm{Res}(f,z_0) = \lim_{z \rightarrow z_0} \frac{1}{(m-1)!} \frac{d^{m-1}}{dz^{m-1}} \Big((z-z_0)^m \cdot f(z)\Big)$

Where $z_0$ is the point about which the residue is to be found, $f$ is the function.

There are some extra terms placed into this formula that weren't discussed above. The factorial eliminates the extra multiplied terms from the derivatives, and the limit deals with issues caused by a removable singularity.