Calculate the residue of $f(z) = \frac {e^{-z}} {(z+2)^3} $ I'm currently studying integral solving methods using the Residue Theorem. However, I sometimes have problems finding a way to calculate the residue(s). For example, what do I do when a function includes the exponential function (or any other function whose Taylor series is commonly known)?
After a while, I found a solution that I added below this question. In general, I thought that it might be helpful to others when they are dealing with solving integrals using the residue theorem for functions that involve the exponential function (or any variants of it).
My initial problem was:
How do I calculate the residue of $f(z) = \frac {e^{-z}} {(z+2)^3} $ at $z = -2 ?$
With the solution to this problem, I was then able to calculate the integral using the residue theorem:
$$
\int_{|z|=3} f(z) dz =  ?
$$
 A: Since I'm fairly new to residue calculation, I had a lot of trouble with this one. After a while, I found a neat solution  that I'd like to share.
We have
$$\begin{align}
f(z) &= \frac {e^{-z}} {(z+2)^3} = \frac{1}{(z+2)^3} \sum_{k=0}^\infty \frac{(-z)^k}{k!} \\
&= \frac{1}{(z+2)^3} \sum_{k=0}^\infty \frac{(-1)^k}{k!}(z+2)^k e^2,
\end{align}$$
since
$
\sum_{k=0}^\infty \frac{(-1)^k}{k!}(z+2)^k = e^{-z-2}.
$
Thus we get
$$
f(z) = \frac{1}{(z+2)^3} \sum_{k=0}^\infty \frac{(-1)^k}{k!}(z+2)^k e^2 = e^2 \sum_{k=0}^\infty \frac{(-1)^k}{k!}(z+2)^{k-3}
$$
and the residue would be $\frac{e^2}{2}.$
A: That's a fair solution. Other than that you could also calculate the residue as follows:
We have
\begin{align}
\operatorname{Res}_{-2}f = \frac{1}{(3-1)!}\frac{\mathrm{d}^2}{\mathrm{d}z^2}\left((z+2)^3\cdot f(z)\right)\bigg|_{z = -2},
\end{align}
since we have a pole of order $3$ at $z = -2$. Due to
\begin{align}
\frac{1}{(3-1)!}\cdot\frac{\mathrm{d}^2}{\mathrm{d}z^2}\left((z+2)^3\cdot f(z)\right) = \frac{1}{2!}\cdot\frac{\mathrm{d}^2}{\mathrm{d}z^2} e^{-z} = \frac{e^{-z}}{2},
\end{align}
we find
\begin{align}
\boxed{\operatorname{Res}_{-2}f = \frac{e^{2}}{2}.}
\end{align}
Edit:
Here I used the general formula
\begin{align}
c_{-1} = \operatorname{Res}_af = \frac{1}{(k-1)!}\cdot \frac{\mathrm{d}^{k-1}}{\mathrm{d}z^{k-1}}\left((z-a)^k\cdot f(z) \right) \bigg|_{z=a},
\end{align}
if $a$ is a pole of order $k$ of $f$.
What this formula does is basically extracting the coefficient $c_{-1}$ of the Laurent series which by definition is your residue.
