Prove that $g$ has an antiderivative on $D$ iff $R=\mathrm{Res}(f,z_0)$. Let $f(z)$ be a holomorphic function on $D=\left\{z\mid 0<|z-z_0|<r\right\}$ where $r>0$ and $z_0\in\mathbb{C}$. Let $R\in\mathbb{C}$ such that $g(z):D\to\mathbb{C}$ is given by:
$$g(z)=f(z)-\frac{R}{z-z_0}$$
Prove that $g$ has an antiderivative on $D$ if and only if $R=\mathrm{Res}(f,z_0)$.

My Solution: first, assume $g$ has an antiderivative on $D$. Let $G(z):D\to\mathbb{C}$ such that $G'(z)=g(z)$. Let $C\subset D$ be a closed, smooth and simple curve. Then we know that:
$$I=\oint_Cg(z)\ dz=G(\text{endpoint})-G(\text{startpoint})=0 \tag{$\star$}$$
On the other hand, according to the Residue Theorem, $I=2\pi i\mathrm{Res}(g,z_0)$. Therefore, if $I$ must be zero, then the equality $R=\mathrm{Res}(f,z_0)$ must hold.
Now, assume $R=\mathrm{Res}(f,z_0)$. $g$ is holomorphic in $D$, thus it is analytic, and we can expand $g$ to its Laurent power series around $z=z_0$ in $D$:
$$g(z)=\sum_{n=-\infty}^{\infty}a_n(z-z_0)^n$$
It is clear that $a_{-1}=0$ since $R=\mathrm{Res}(f,z_0)$. Therefore, we can sum for every $n\in\mathbb{Z},n\neq -1$. Now observe:
$$G(z)\triangleq \sum_{n=-\infty \\ n\neq-1}^{\infty}a_n\frac{(z-z_0)^{n+1}}{n+1}+K$$
For every $K\in\mathbb{C}$, $G(z)$ is an antiderivative of $g(z)$ which is given by a power series. The series is uniformly convergent in $D$, since it is the term-by-term integration of $g(z)$, which is analytic in $D$. Notice that if $a_{-1}$ weren't to be zero, then the series wouldn't be power series (since a logarithm would pop up). Therefore, $G(z)$ is a legitimate antiderivative of $g(z)$ in $D$.

I have a few questions:


*

*Can I apply $(\star)$ given $z_0$ is a singularity point inside $C$?

*I know that the power series of $g$ uniformly converges in $D$. Is it true to say that the term-by-term integration of the series would also be uniformly convergent (as I suggested in my proof)?

*My initial thought was to use Morera's Theorem. Given $R=\mathrm{Res}(f,z_0)$, we know the integral of $g$ on every triangular curve s.t. $z_0$ is inside of it would be zero. The statement is true for every other curve in $D$ too (since $g$ is holomorphic). So I wanted to conclude that $g$ is actually holomorphic on $z_0$ too but it just didn't feel right. I know that $g$ must be continuous in order for Morera's Theorem to hold, but $g$ might not be continuous on $z_0$.


Yes I would like my solution to be verified (or perhaps not), but also I would love to hear your solutions too since I couldn't find any others.
Thanks!
 A: I will address each question in order. 


*

*In $(\star)$ you only need the Fundamental Theorem of Calculus for $G(\gamma(t))$ where $\gamma$ is a parameterization for $C$. It does not care about any point outside $C$.

*To define a primitive $G$ we have to give a value $G(p)= K$ at some point $p\in D$. Then
$$
G(z) = \int_p^z g(\zeta)d\zeta + K
$$
is well defined and holomorphic on $D$ because the integral is path independent. Indeed by path independence we have 
$$
\lim\limits_{h\to 0} \frac{G(z+h) - G(z)- g(z)h}{h} = \lim\limits_{h\to 0} \int\limits_z^{z+h}\frac{g(\zeta)-g(z)}{h}d\zeta = 0.
$$
The uniform convergence  (on compact subsets) implies that $G(z)$ is pointwise the series given by term by term integration. And the uniqueness of Laurent expansion says that 
$$
G(z) = \sum_{n=-\infty \\ n\neq-1}^{\infty}a_n\frac{(z-z_0)^{n+1}}{n+1}+K
$$ 
is indeed the Laurent expansion for $G$ and, as a consequence, it converges uniformly on compact subsets.

*Consider the function $g(z)  = \dfrac{1}{z^2}$ defined on $D = \mathbb{C}\setminus \{0\}$. It has a primitive $G(z) = \dfrac{-1}{z}$ on $D$ but $g$ cannot be holomorphicaly extended over the origin. 
