In a problem I was asked to calculate the complex integral $\int_C\frac{\cos(z)}{z}dz$ where $C$ is (1) the unit circle or (2) the circle $|z|=3$, both positively oriented.
I wanted to approach this problem in two ways; one by direct calculation using parametrization and one by the residue theorem.
First: we see that the function has a simple pole at $z=0$ which has residue $\lim_{z\to 0}(z-0)\frac{\cos(z)}{z}=\cos(0)=1$. Therefore, by the residue sum theorem, any positively oriented simple, closed, piecewise smooth curve $C$ will give $\int_Cf(z)dz=2\pi i * 1 = 2\pi i$, which seems to be independent of the choice of our circle $|z|=1$ or $|z|=3$.
This would lead me to think the answer for both circles is the same. However, when using parametrization I thought the answers would differ:
Take $\gamma=e^{it}$ for $t\in[0,2\pi]$, then
$$\int_Cf(z)dz = \int_0^{2\pi}\frac{\cos(e^{it})}{e^{it}}ie^{it}dt=i\int_0^{2pi}\cos(e^{it})dt.$$ We now turn to the power series for $\cos$ which is convergent and therefore:
$$\int_Cf(z)dz=i\sum_{n=0}^\infty\frac{(-1)^n}{(2n)!}\int_0^{2\pi}e^{2itn}dt.$$
The latter integral is $0$ for every $n>0$ as the function has a primitive and its endpoints give the same value. Therefore, the integral will only be affected by the term for $n=0$:
$$\int_Cf(z)dz=i*\frac{(-1)^0}{(2*0)!}\int_0^{2pi}dt=2\pi i.$$
This seems fine, however, when we turn to the circle $C:|z|=3$ I seem to get a different answer. We use the parametrization $\gamma=3e^{it}$ and calculate the integral similarly; only now the outcome will be $6\pi i$ as $\gamma'=3ie^{it}$ so the integral will have a constant $3i$ before it, and the rest will be the same as everything will be to the power $n=0$ and therefore become $1$ and $2\pi$ regardless of the extra $3$ ($3^0=1$) that appears.
Clearly something must be going wrong somewhere; I feel like I'm either not applying the Residue Sum Theorem correctly or the approach using parametrizations should give the same outcome for both circles.