Contour integration with pole on the contour itself

This post is in response to this thread on Reddit.

The original question was essentially to evaluate the integral:

Ce2z(z2)(z3)dz \oint_C \dfrac{e^{2z}}{(z-2)(z-3)} dz

on the circle defined by z=2|z| = 2. This presents an obvious challenge, as a pole exists on this curve, which means that Cauchy's integral formula and the residue theorem cannot be used to evaluate this integral as is. For brevity's sake, let's call our integrand f(z)f(z).

The way around this problem is to modify the curve so that the pole no longer occurs on it. Below is one such modified curve:

As no pole occurs within C' and f(z)f(z) is defined along and in C', we know by the Cauchy integral theorem that:

Ce2z(z2)(z3)dz=0 \oint_{C'} \dfrac{e^{2z}}{(z-2)(z-3)} dz = 0

and splitting Cf(z)dz\displaystyle \oint_{C'} f(z) dz into subintegrals from A to B and B to A, we get:

ABe2z(z2)(z3)dz+BAe2z(z2)(z3)dz=0. \int_{AB} \dfrac{e^{2z}}{(z-2)(z-3)} dz + \int_{BA} \dfrac{e^{2z}}{(z-2)(z-3)} dz = 0.

Along AB:

z=2eiθz = 2e^{i\theta}, dz=2ieiθdθdz = 2ie^{i\theta} d\theta and δθ2πδ\delta \leq \theta \leq 2\pi - \delta, where δ=sin1(ϵ2)\delta = \sin^{-1}\left(\dfrac{\epsilon}{2}\right).

Along BA:

z=2+ϵeiθz = 2 + \epsilon e^{i\theta}, dz=2iϵeiθdθdz = 2i\epsilon e^{i\theta} d\theta and θ\theta goes from 3π2\dfrac{3\pi}{2} to π2\dfrac{\pi}{2}.

Therefore our contour integral becomes:

δ2πδe22eiθ(2eiθ2)(2eiθ3)2ieiθdθ+3π2π2e2(2+ϵeiθ)(2+ϵeiθ2)(2+ϵeiθ3)iϵeiθdθ=0. \int_{\delta}^{2\pi - \delta} \dfrac{e^{2 \cdot 2 e^{i\theta}}}{(2e^{i\theta}-2)(2e^{i\theta}-3)} 2i e^{i\theta} d\theta + \int_{\dfrac{3\pi}{2}}^{\dfrac{\pi}{2}} \dfrac{e^{2 \cdot (2+\epsilon e^{i\theta})}}{(2 + \epsilon e^{i\theta}-2)(2 + \epsilon e^{i\theta}-3)} i \epsilon e^{i\theta} d\theta = 0.

As ϵ0\epsilon \rightarrow 0, the first of these integrals becomes the same as Cf(z)dz\displaystyle \oint_C f(z) dz and the second integral becomes:

limϵ03π2π2e2(2+ϵeiθ)(2+ϵeiθ2)(2+ϵeiθ3)iϵeiθdθ=limϵ0ie43π2π2e2ϵeiθ(ϵeiθ)(ϵeiθ1)ϵeiθdθ=limϵ0ie43π2π2e2ϵeiθϵeiθ1dθ=ie43π2π211dθ=ie43π2π2dθ=ie4π23π2dθ=ie4π. \begin{aligned} \lim_{\epsilon \rightarrow 0} \int_{\dfrac{3\pi}{2}}^{\dfrac{\pi}{2}} \dfrac{e^{2 \cdot (2+\epsilon e^{i\theta})}}{(2 + \epsilon e^{i\theta}-2)(2 + \epsilon e^{i\theta}-3)} i \epsilon e^{i\theta} d\theta &= \lim_{\epsilon \rightarrow 0} ie^4 \int_{\dfrac{3\pi}{2}}^{\dfrac{\pi}{2}} \dfrac{e^{2 \epsilon e^{i\theta}}}{(\epsilon e^{i\theta})(\epsilon e^{i\theta}-1)} \epsilon e^{i\theta} d\theta \\ &= \lim_{\epsilon \rightarrow 0} ie^4 \int_{\dfrac{3\pi}{2}}^{\dfrac{\pi}{2}} \dfrac{e^{2 \epsilon e^{i\theta}}}{\epsilon e^{i\theta}-1} d\theta \\ &= ie^4 \int_{\dfrac{3\pi}{2}}^{\dfrac{\pi}{2}} \dfrac{1}{-1} d\theta \\ &= -ie^4 \int_{\dfrac{3\pi}{2}}^{\dfrac{\pi}{2}} d\theta \\ &= ie^4 \int_{\dfrac{\pi}{2}}^{\dfrac{3\pi}{2}} d\theta \\ &= ie^4 \pi. \end{aligned}

Our contour integral therefore becomes:

Ce2z(z2)(z3)dz+ie4π=0. \begin{aligned} \oint_C \dfrac{e^{2z}}{(z-2)(z-3)} dz + ie^4 \pi &= 0. \end{aligned}

Hence our original integral is:

Ce2z(z2)(z3)dz=ie4π. \oint_C \dfrac{e^{2z}}{(z-2)(z-3)} dz = - ie^4 \pi.