Application of Cauchy theorem On Integral I'm taking my first course in complex analysis and I've come across a question I haven't encountered before.
$$\int_C \frac{z dz}{(z+2)(z-1)}$$
Such that C is a circle where $|Z| = 4$.
So my approach was,
seeing that this has singularities, $z = -2, 1$. I see that they lie within the circle. Therefore, I used partial fractions to break this up into two integrals.
$$\int_C \frac{z}{3(z-1)}dz - \int_C \frac{z}{3(z+2)}dz$$
Then applying cauchy's integral formula on these seperate integrals I get. Where $f(z) = z$ in both cases.
$$= \frac{2}{3} \pi i f(1) - \frac{2}{3}\pi if(-2)$$
$$ =\frac{2}{3} \pi i + \frac{4}{3} \pi i $$
$$= 2\pi i $$
Is this the correct way to approach this integral? Thank you for any guidance.
 A: Using partial fractions,
$$
\frac{z}{(z+2)(z-1)}=\frac{2}{3(z+2)}+\frac{1}{3(z-1)}
$$
Therefore, taking the contour integral over the curve (|z|=4),
$$
\oint_{|z|=4}\frac{z}{(z+2)(z-1)}\,dz=\oint_{|z|=4}\left(\frac{2}{3(z+2)}+\frac{1}{3(z-1)}\right)\,dz
$$
By linearity of integration, this becomes
$$
\oint_{|z|=4}\left(\frac{2}{3(z+2)}+\frac{1}{3(z-1)}\right)\,dz=\oint_{|z|=4}\left(\frac{2}{3(z+2)}\right)\,dz+\oint_{|z|=4}\left(\frac{1}{3(z-1)}\right)\,dz
$$
Cauchy's integral formula states that for a suitable function $f(z)$ and curve $\gamma$,
$$
f(a)=\frac{1}{2\pi i}\oint_\gamma\frac{f(z)}{z-a}\,dz
$$
where $a$ is any point within the interior of the curve $\gamma$. In this case, the function $f(z)$ is constant, and the singularities are $z=-2$ and $z=1$ are within the interior of the curve, so applying the formula gives
$$
\begin{align*}
\oint_{|z|=4}\left(\frac{2}{3(z+2)}\right)\,dz+\oint_{|z|=4}\left(\frac{1}{3(z-1)}\right)\,dz&=\frac{4\pi i}{3}+\frac{2\pi i}{3}\\
&=2\pi i.
\end{align*}
$$
