So in a given problem, I am seeking to compute the residues of the function
$$f(z) = \frac{cos(z)}{z^2 (z-\pi)^3}$$
at its singularities. I feel pretty weak in this subject, so I want to just double-check my methodology and all that, and just make sure my understanding on the underlying ideas are all okay.
(Specifically I'm only asking for the evaluation of my solution for one of the residues. The process would be analogous for others, so not much point in posting both. If I'm wrong with the logic underlying one solution, they'd both be wrong, you know?)
So, first, we want to identify the two singularities. The singularities of $f$ are at $z=0$ and $z=\pi$. Visibly, both are poles, the former of order $2$ and the latter of order $3$.
This is actually one of my sticking points. In a function like this, is it sufficient to look at the exponent of the $z$ and $(z-\pi)$ terms and let them be the respective orders of the corresponding poles? It's a bit of an iffy point for me.
Generally speaking, if we are seeking the residue $a_{-1}^\ast$ at some pole $z=z_\ast$ of order $k$, we have the relation
$$a_{-1}^\ast = \left. \frac{1}{(k-1)!} \cdot \frac{d^{k-1}}{dz^{k-1}} (z-z_\ast)^k \cdot f(z) \right|_{z=z_\ast}$$
So we first consider the singularity $z=0$, which is of order $2$. Then:
$$a_{-1}^{(0)} = \left. \frac{1}{(2-1)!} \cdot \frac{d^{2-1}}{dz^{2-1}} (z-0)^2 \cdot \frac{cos(z)}{z^2 (z-\pi)^3} \right|_{z=0} = \left. \frac{d}{dz} \frac{cos(z)}{(z-\pi)^3} \right|_{z=0}$$
Since
$$\frac{cos(z)}{(z-\pi)^3} = cos(z) \cdot (z-\pi)^{-3}$$
the derivative is given by the product rule:
$$\frac{d}{dz} \frac{cos(z)}{(z-\pi)^3} = -sin(z) \cdot (z-\pi)^{-3} + cos(z)(-3)(z-\pi)^{-4} = -\frac{sin(z)}{(z-\pi)^{3}} - \frac{3 \cdot cos(z)}{(z-\pi)^4}$$
Evaluating this at $z=0$ thus finally yields
$$a_{-1}^{(0)} = -\frac{3}{\pi^4}$$
(And of course an analogous process follows for the $z=\pi$ singularity. As stated before, I'm not including it for brevity's sake since the underlying process would be the same.)
WolframAlpha confirmed this solution (as seen here) for this residue, but I just wanted to be sure my methodology was right (could be a coincidence), and perhaps receive clarification on the sticking point highlighted above.
If $D$ is an open non-empty subset of $\mathbb C$, $f,g\colon D\longrightarrow\mathbb C$ are analytic functions, $z_0\in D$ and $f(z_0)\neq0$, then $z_0$ is a pole of $\frac fg$ if and only if it is a zero of $g$ and furthermore, if these conditions are satisfied, then the order of the pole of $\frac fg$ at $z_0$ is equal to order of the zero $z_0$ of $g$. So, you are right about this: it is indeed easy to see that the orders of the poles of your function at $0$ and at $\pi$ are $2$ and $1$ respectively.
And, yes, your computations are fine.