# Discrepancy in counting the number of poles in complex function when refactoring

If I have a function that looks like this: $$f(z) = \frac{(z-i)^2}{\sin^2z}$$ and I want to find its poles within the unit circle contour, $|z| = 1$, it seems from this equation that there is a pole of order 2 at $z=0$. However, if I rewrite the equation as: $$f(z) = \frac{(z-i)^2}{(1-\cos z)(1 + \cos z)}$$ then from this equation, it seems that there is a pole of order 1 at $z=0$ within the contour coming from the $(1-\cos z)$ factor. But these two answers do not agree. Calculating the residue limit for the first equation as a second-order pole results in $-2i$, but the residue limit for the 2nd function as a simple pole does not even converge. What am I doing wrong, and how can I resolve this discrepancy?

$$\text{cos}(z) = 1-\frac {z^2} 2 + \frac {z^4}{4!} - ...$$ $$1-\text{cos}(z) = \frac{z^2}2 - \frac{z^4}{4!} +...$$
This has a zero of order $2$ at zero, and thus $$\frac{1}{1-\text{cos}(z)}$$ has a pole of order 2 at zero.
• That's how the order of a zero is defined; and if $f$ has a zero of order $n$ at $z_0$, then $\frac 1{f(z)}$ has a pole of order $n$ at $z_0$. (See here.) – user98602 Dec 11 '13 at 19:05