When does a complex function have a square root?
Solution 1:
Since Malik already gave an answer concerning your specific question about $1-\cos z$, I will just talk about the existence of logarithms and $n$-th roots in general.
Given a holomorphic function $f:\Omega\to\mathbb{C}\setminus\{0\}$, we say that a holomorphic function $g:\Omega\to\mathbb{C}\setminus\{0\}$ is a logarithm of $f$ if $f(z)=e^{g(z)}$ for $z\in\Omega$. Similarly, we say that a holomorphic function $h_n:\Omega\to\mathbb{C}\setminus\{0\}$ is an $n$-th root of $f$ if $f(z)=h_n(z)^n$ for $z\in\Omega$. The question is, when do such functions exist?
The quick answer is that for an $n$-th root to exist, we must have, for any closed curve $\gamma$ in $\Omega$, $$ \frac{1}{2\pi i}\int_\gamma \frac{f'}{f}\ dz \in n\mathbb{Z}. $$ Furthermore, a branch of the logarithm of $f$ exists if and only if for every $n\in\mathbb{N}$, an $n$-th root of $f$ exists. The reason for this is that a logarithm of $f$ exists if and only if for every closed curve $\gamma$ in $\Omega$, $$ \frac{1}{2\pi i}\int_\gamma \frac{f'}{f}\ dz = 0. $$ Notice that if we have a logarithm of $f$, say $g$, then we can construct an $n$-th root of $f$ for any $n$ by letting $h_n(z):=e^{\frac{g(z)}{n}}$. For the other direction, notice that if the aforementioned integral is an element of $n\mathbb{Z}$ for every $n$, then it must be zero, and thus the logarithm of $f$ must exist.
Now, the above may seem very mysterious. Where did we get these conditions on the integral? The easiest explanation is via algebraic topology. Unfortunately, I can't draw commutative diagrams with MathJax, but the point is the existence of a logarithm of $f$ is equivalent to the existence of a lift with respect to the covering map $\exp:\mathbb{C}\to\mathbb{C}\setminus\{0\}$. Since $\mathbb{C}$ is simply connected, the induced homomorphism of fundamental groups, which we will denote $\exp_*$, is trivial. Thus, a lift (and hence a branch of the logarithm of $f$) exists if and only if $f_*(\pi_1(\Omega))<\exp_*(\pi_1(\mathbb{C}))$, which is if and only if $f_*(\pi_1(\Omega))$ is trivial, which is if and only if the winding number $n(f\circ\gamma,0)=0$ if and only if $\frac{1}{2\pi i}\int_\gamma \frac{f'}{f}\ dz=0$.
Similarly, the existence of an $n$-th root of $f$ is equivalent to the existence of a lift with respect to the covering map $(\cdot)^n:\mathbb{C}\to\mathbb{C}\setminus\{0\}$. Now the induced homomorphism of fundamental groups, which we will denote $(\cdot)^n_*$, has image $n\mathbb{Z}$. Thus, a lift (and hence an $n$-th root of $f$) exists if and only if $f_*(\pi_1(\Omega))<(\cdot)^n_*(\pi_1(\mathbb{C}))$, which is if and only if $f_*(\pi_1(\Omega))<n\mathbb{Z}$, which is if and only if the winding number $n(f\circ\gamma,0)\in n\mathbb{Z}$ if and only if $\frac{1}{2\pi i}\int_\gamma \frac{f'}{f}\ dz\in n\mathbb{Z}$.
Now, for the case when $f:\Omega\to\mathbb{C}$ (that is, $f$ might have zeros), then you simply restrict $f$ to the set where it is nonzero (this is still an open set) and follow the above procedure. If an $n$-th root of this restricted $f$ exists, then an $n$-th root of the original $f$ exists if and only if every zero of $f$ has order a multiple of $n$. This you can see because of the procedure laid out in the comments. Notice that this condition (along with the fact that a logarithm of $f$ exists if and only if for every $n\in\mathbb{N}$ an $n$-th root of $f$ exists) implies that a necessary condition for a logarithm of $f$ to exist is that it has no zeros in the domain in question.
I mentioned in the comments that it is possible for an $n$-th root of $f$ to exist for some $n\in\mathbb{N}$ and yet have it be the case that a logarithm for $f$ does not exist. As an example, consider the function $f(z)=z^2$ in the domain $\mathbb{C}\setminus\{0\}$. Clearly, the function $h_2(z)=z$ is a square root of $f$. However, $f$ does not have a logarithm in this domain because if $\gamma$ is some curve that winds around zero, then $$ \frac{1}{2\pi i}\int_\gamma \frac{f'}{f}\ dz = \frac{1}{2\pi i}\int_\gamma \frac{2}{z} \ dz = 2. $$ Since this is nonzero, $f$ cannot have a logarithm in the given domain.
Added: Let $f:\Omega\to\mathbb{C}\setminus\{0\}$ be a holomorphic function. Consider the following two statements.
- There exists a logarithm of $f$ in $\Omega$.
- There exists a branch of the logarithm in $f(\Omega)$.
We will show that 2 implies 1, but not conversely. To see that 2 implies 1, let $\log$ be a branch of the logarithm in $f(\Omega)$. Then define $g:=\log\circ f$. Then notice that for all $z\in\Omega$, $e^{g(z)}=e^{\log(f(z))}=f(z)$, since $f(z)\in f(\Omega)$. Thus $g$ is a logarithm of $f$. To see that the converse does not hold, simply consider the map $\exp:\mathbb{C}\to\mathbb{C}\setminus\{0\}$. This map is surjective, and it is a well-known fact (we could also use what I proved above) that there does not exist a branch of the logarithm in $\mathbb{C}\setminus\{0\}=\exp(\mathbb{C})$. However, there certainly exists a logarithm of $\exp$ in $\mathbb{C}$, namely, the identity map. Therefore 1 does not imply 2.
Solution 2:
If $g(z)=1-\cos{z}$, then $g$ can be written as $$g(z)=z^2 h(z)$$ where $h$ is entire and $h(0) \neq 0$ (why? Hint: Taylor).
Take a small disk $D$ around $0$ such that $h \neq 0$ on $D$. Then, on $D$, $h(z)=k(z)^2$ for some function $k$ analytic on $D$.
Finally, we get $$g(z)=z^2 h(z) = z^2 k(z)^2 = (z k(z))^2$$ for $ z \in D$.