Showing Existence of Antiderivative for Complex-Valued Function I am asked to show that for $z\in \mathbb{C} \setminus \{0,1\}$, there exists an analytic (single-valued) function, $F(z)$ on $\mathbb{C} \setminus \{0,1\}$, such that $F'=f$, where $$f(z) = \frac{(1-2z)\cos(2\pi z)}{z^2 (1-z)^2}$$
I know that if $$\int_{\gamma} f(z) dz =0$$ for all closed contours, $\gamma$, then $f$ has an antiderivative. Furthermore, in the case of the given function above, $f(z)$, I know that Res$(f,0)=$ Res$(f,1)=0$, so using the Residue Theorem I know that for any simple closed contour, $\gamma$, we have $$\int_{\gamma} f(z) dz =0$$
However, to ensure that $f$ has an antiderivative, I need to show that this is true for all closed $\gamma$, not just simple closed $\gamma$. How can I go about finishing this last step of the proof?
 A: The Residue theorem states that for any (rectifiable) closed curve $\gamma$ in $\mathbb{C} \setminus \{0,1\}$:
$$
\int _{\gamma }f(z)\,dz=2\pi i \bigl( \operatorname {I} (\gamma ,0)\operatorname {Res} (f,0) + \operatorname {I} (\gamma ,1)\operatorname {Res} (f,1) \bigr) 
$$
and that is zero for the given function $f$ because both residues are zero (as you already calculated).
Alternatively you could use that
$$
 f(z) = \frac{\cos(2 \pi z)}{z^2} - \frac{\cos(2 \pi (z-1))}{(z-1)^2}
$$
and show that $\frac{\cos(2 \pi z)}{z^2}$ has an antiderivative in $\mathbb{C} \backslash \{0\}$.
A: Here is an alternative solution. Write
$$ g(z) = f(z) - \left( \frac{1}{z^2} - \frac{1}{(z-1)^2} \right). $$
Then $g$ has removable singularities at both $z=0$ and $z=1$, and so, $g$ extends to a holomorphic function on $\mathbb{C}$. In particular, $g$ has an antiderivative, say $G(z)$. Then
$$ f(z) = g(z) + \frac{1}{z^2} - \frac{1}{(z-1)^2} $$
has an antideriviative
$$ G(z) - \frac{1}{z} + \frac{1}{z-1}. $$
A: The function $f$ is holomorphic on $\mathbb{C} \backslash \{0,1\}$ because $f$ is the quotient of holomorphic functions.  Since $f$ is holomorphic in this set, it has a primitive $F$ there so that $F^\prime=f$.  Or is the question to find $F$?
UPDATE
This answer is not complete.  Leaving it here for a while because the comment from @Martin R was helpful.
