Derivation and use of the residue theorem.