# Existence of an antiderivative in $U \cup V$ if it exists in both $U$ and $V$

I'm doing this exercise where I know that a function $f$ that is holomorphic in $U \cup V$, has a holomorphic antiderivative in $U$ and also another holomorphic antiderivative in $V$, where $U, V \subseteq \mathbb{C}$ are open sets such that $U \cap V \neq \emptyset$ and $U \cap V$ is connected.

Then the question is to prove that $f$ has a holomorphic antiderivative in the union $U \cup V$, and provide a counterexample to show that the hypothesis on the intersection $U \cap V$ are required for the result to be true.

My attempt

I thought that since there are holomorphic functions $F: U \rightarrow \mathbb{C}$ and $G: V \rightarrow \mathbb{C}$ such that $F' = f$ in $U$ and $G' = f$ in $V$, then in the intersection both derivatives coincide so in $U \cap V$ we have $F' = G'$ and so $F = G + C$ in $U \cap V$, where $C$ is a constant. But now my problem is that I don't see how to extend this to the whole union $U \cup V$, and I don't see where I'll use the connectedness assumption.

So if you could help me with my argument I would be most grateful. By the way, if you could also give me a hint to construct a counterexample that would be great. Thanks.

-
This is my first question but a friend who recommended the site to me gave me some suggestions on how to ask a question, I hope I did OK. –  Student Sep 15 '11 at 16:08
+1 In fact, you did A-OK. :-) –  Srivatsan Sep 15 '11 at 16:13
You already know that $F = G+C$ on the intersection. If $F$ is defined on $U$, and $G+C$ is defined on $V$,.. –  Soarer Sep 15 '11 at 16:34
Soarer, I thought about that, but I thought I was making a mistake because I'm not using anything about connectedness in that argument. –  Student Sep 15 '11 at 16:37
On where you used connectedness: If $U \cap V$ is not connected, how did you get $F = G+C$? (constant for each connected component could be different.) –  Soarer Sep 15 '11 at 16:43

Suppose $f(z)=1/z$. Let $U$ be the open upper half-plane plus a small area surrounding $1$ (say a small open disk of radius $1/10$) and another surrounding $-1$. Let $V$ be the open lower half-plane plus a small area surrounding $1$ and another surrounding $-1$.
Then $f$ has a holomorphic antiderivative on $U$ and another on $V$, but if I'm not mistaken, it has none on $U\cup V$.