# Proper application of Cauchy integral formula

I'm being asked to integrate $f(z) = \frac{e^z}{z^2 + 2z + 1}$ around a $5 \times 5$ square, centered at $i$, in the counter clockwise direction. It seems to me that applying Cauchy's integral formula for the first derivative directly yields an answer, but I am concerned the approach is incorrect due to a double pole at $z =-1$. Is there any special case that I am missing?

-
This is just a guess, but I think the exercise is supposed to let you calculate the integral in order to demonstrate to which Cauchy's integral formula applies. And yes, the pole at $-1$ should make you suspicious. – user20266 Dec 12 '11 at 18:12
This exercise was preceded with the same question for f(z) = z-1/z+1. That was a much easier case in which I could double-check Cauchy by integrating directly. Lectures haven't mentioned anything regarding two poles at a single location, hence my hesitation with calling my question done by applying Cauchy again. – Fred L. Dec 12 '11 at 18:20

Cauchy's differentiation formula states: $$f^{(n)}(a) = \frac{n!}{2 \pi i} \oint_\gamma \frac{f(z)}{(z-a)^{n+1}} \mathrm{d} z$$ In the case at hand, $a=-1$, $n=1$, $f(z) = \mathrm{e}^z$. Hence $$\oint_\gamma \frac{\mathrm{e}^z}{z^2 + 2 z + 1} \mathrm{d} z = 2 \pi i \mathrm{e}^{-1}$$
$$\oint f(z)dz=e^{-1}\oint \sum_{n=0}^{\infty}\frac{(z+1)^{n-2}}{n!}=2\pi ie^{-1}$$