The way to deal with singularities inside a contour is to wrap the contour around them so as not to include the singularities and then cancel parts of the contour which overlap and run in opposite directions. For example, consider a singularity at the origin and surround it with two circles, one large and the other small. By breaking the circles and connecting them by two close radii, an overall singularity-free contour can be created.

By taking very close radii, their integrals can be made to cancel, leaving he difference (because of running in opposite directions whilst counting counterclockwise contours as positive) of integrals over the circles. The outer circle can be almost anything else unless it is considered to surround infinity, whereas the circular form of the inner circle is important. Surrounding its singularfity symmetrically, it can be approximated by transferring to polar coordinates, whereupon it becomes

Here it is a question of what the singularity is like. If

= | (142) |

which is an integral of functions averaging to zero unless

The *residue*residue of a function *f*(*z*) at a point of singularity *z*_{0} is defined by

r |
= | (143) |

which looks very much like the definition of a derivative. However, since

If *f*(*z*) had a power series expansion beginning with negative powers (a Laurent series) the residue would be the coefficient *a*_{-1} in that series.
Therefore suppose

f(z) |
= | (144) |

which implies that an integral around a contour enclosing some or all of its singularities would be

= | (145) |

The use of the residues of a complex function gives a way to evaluate many definite integrals, including what seem to be real integrals. The way to get a real definite integral is to close the half-plane above the real axis with a huge semicircle, and hope that the function vanishes sufficently rapidly as one rises in the plane. The integral over the semicircle then approaches zero as a limit as its radius increases, leaving the poles in the upper half plane to contribute their residues. There exist extensive integral tables which have been constructed in this way.