How to apply cauchy's residue theorem to rational function? I have the following function:
$$f(z)=\frac{(z-1)^2}{z*(z+1)^3)}$$
And I need to find its residue.  
The formula that I know for this is the following:
The residue $a_{-1}$ for a pole of order "n" is:
$$a_{-1} =\frac{1}{(n-1)!} \lim_{z \rightarrow z_0} \frac{\partial^{n-1}(z-z_0)^{n}(f(z))}{\partial z^{n-1}}$$
Now, when I apply this to the function $f(z)$ above, I'm getting the following:
$$a_{-1} =\frac{1}{(3-1)!} \lim_{z \rightarrow -1} \frac{\partial^{3-1}(z-z_0)^{3}(f(z))}{\partial z^{3-1}}$$
$$a_{-1} =\frac{1}{2} \lim_{z \rightarrow -1} 2z - 2 = -2$$ 
However, I'm told that the answer is $-4$.  Where did I go wrong in my solution?
Thanks.
 A: I get $-1$ for the residue.  $$(z+1)^3f(z)= \frac{(z-1)^2}{z}=z-2+\frac1z$$  The second derivative is $2z^{-3}$ and $\lim_{z\to-1}\frac12\cdot2z^{-3}=-1$.
Alternatively, we want the coefficient of the $\frac{1}{z+1}$ term in the Laurent series fo $f(z)$.  We have $$\frac{(z-1)^2}{z} = z-2+\frac1z = (z+1)-3-\frac{1}{1-(z+1)}$$  Dividing by $(z+1)^3$, we see that we want the coefficient of $(z+1)^2$ in the Taylor series for $-\frac{1}{1-(z+1)}$, which is $-1$.
A: I'm gonna rewrite the limit and work through it. So we can get the residue of a pole of order m with the following:
$$Resf(z)=\frac{1}{(m-1)!}\lim_{z\to z_0}\frac{d^{m-1}}{dz^{m-1}}[(z-z_0)^mf(z)]$$
Given the following $f(z)$:
$$f(z)=\frac{(z-1)^2}{z(z+1)^3}$$
Thus calculating the residue at $z=-1$ for the given $f(z)$ is as follows:
$$Resf(z)=\frac{1}{(3-1)!}\lim_{z\to -1}\frac{d^{3-1}}{dz^{3-1}}[(z-(-1))^{3}f(z)]$$
Which when simplified is:
$$Resf(z)=\frac{1}{2}\lim_{z\to -1}\frac{d^2}{dz^2}\left[(z+1)^3\frac{(z-1)^2}{z(z+1)^3}\right]=\frac{1}{2}\lim_{z\to -1}\frac{d^2}{dz^2}\left[\frac{(z-1)^2}{z}\right]$$
Thus taking the second derivative of the function within the limit will result in the following:
$$Resf(z)=\frac{1}{2}\lim_{z\to -1} 2z^{-3}=\lim_{z\to -1} z^{-3}=-1$$
I had originally gotten -4 as my answer, but upon further inspection realized I made a mistake and so this is my revised answer. I know @saulspatz already gave this solution but in case you wanted a second opinion here it is lol.
