Find holomorphic function given square of that function 
Let $G=\mathbb C-\{x\in \mathbb R: |x|\ge 1\}$
Find a function $f$ that is holomorphic in G such that $f^2(z)=z^2-1$ in $G$ and $f(0)=i$

The only thing I can think of is that we can write $f$ as $e^g$ with $g$ being some holomorphic function and $g(0)=e^{i\pi+2i\pi k}, k\in \mathbb Z$
because $f^2$ is not equal to $0$ in $G$ and the condition $f(0)=i $but I can't see how to go on from there.
 A: Write $(-\infty,0]=\{x \in \mathbf{R}:x \leq 0 \}.$
Let $h: \mathbf{C} - (-\infty,0]\to \mathbf{C}$ be given by
$$ h(z)= \ln|z|+i(\varphi+\pi),$$
where $-\pi<\varphi<\pi$ is the argument of $z$: for example $i$ has argument $\pi/2.$ Now let $g:G \to \mathbf{C}$ be defined by 
$$g(z)=\frac{1}{2}h(1-z^2).$$
(Note that $g$ is well defined by the definition of $G.$) Finally,  define $f:G \to \mathbf{C}$ by
$$ f(z)=e^{g(z)}.$$
Since $h$ is homolorphic in $\mathbf{C}-(-\infty,0],$ $f$ is holomorphic in $G.$
Let $z \in G,$ and let $-\pi<\varphi<\pi$ be the argument of $z^2-1.$ Then $\varphi+\pi$ is the argument of $1-z^2,$ so that
$$ f(z)^2=e^{2g(z)}=e^{h(1-z^2)}=e^{\ln|1-z^2|}e^{i(\varphi+\pi)}=|z^2-1|e^{i(\varphi+\pi)}=z^2-1.$$
Moreover, since $h(1)=i\pi,$ then
$$ f(0)=e^{g(0)}=e^{\frac{1}{2}h(1)}=e^{\frac{i\pi}{2}}=i.$$
A: Define $g(z)$ on $\Omega=\mathbb{C}\setminus((-\infty,-1]\cup[1,+\infty))$ by
$$g(z)=\int_0^z\frac{\xi}{\xi^2-1}d\xi$$
Where the integral is taken on any curve joining $0$ to $z$.
Finally, define $f(z)$ on $\Omega$ by
$$f(z)=i\, e^{g(z)}$$
Clearly $f$ is holomorphic on $\Omega$ by definition. And it satisfies $f(0)=i$. More over for $0<x<1$ we have
$$ 2g(x)=\int_0^x\frac{2t}{t^2-1}dt=\log (1-x^2)
$$
And consequently $f^2(x)=x^2-1$ for $x\in(0,1)$. But analyitic continuation then proves that $f^2(z)=z^2-1$ for $z\in\Omega$.
