Example of a continuous function $f$ into the unit circle, such that there is no continuous $g$ with $f=e^{{\rm i}g}$ Let $E$ be a metric space, $$U:=\left\{z\in\mathbb C:\left|z\right|=1\right\}$$ and $f\in C^0(E,U)$. Say that $f$ is inessential if $$f=e^{{\rm i}g}\tag1$$ for some $g\in C^0(E,\mathbb R)$.

I was able to show that if $f(E)\ne U$, then $f$ is inessential. Now I wonder what can possibly go wrong if $f(E)=U$.

The most trivial example of $f(E)=U$ should be $$E=\{(x,y)\in\mathbb R^2:x^2+y^2=1\},$$ $g$ being the inverse of the polar coordinate map $$(-\pi,\pi]\to E\;,\;\;\;\phi\mapsto\left(\cos\phi,\sin\phi\right)\tag2$$ and $f:=e^{{\rm i}g}$. Now $(1)$ is trivially satisfied by the very definition of $f$.

Now, clearly, this is a very special construction. Does anyone know a counterexample of $(1)$ when $f(E)=U$?

 A: Let $E=U$ and let $f:E\to U$ be the identity map.

Suppose $f=\exp(ig)$ for some continuous function $g:E\to\mathbb{R}$.

Our goal is to derive a contradiction.

Since $f$ is injective, $g$ must be injective.

In particular, $g$ is not constant.

Since $E$ is compact and connected, we must have $g(E)=[a,b]$ for 
some $a,b\in\mathbb{R}$ with $a < b$.

But then since $g$ is a continuous bijection from the compact space $E$ to the Hausdorff space $[a,b]$, it would follow that the $g$, when regarded as a map from $E$ to $[a,b]$, is a homeomorphism.

But $E$ is not homeomorphic to $[a,b]$ since for example, removing any point from $E$ always yields a connected space, whereas removing any point from $[a,b]$ other than $a$ or $b$ always yields a space which is not connected.
A: If I understand correctly, you are looking for a continuous surjective map $f:E\longrightarrow U$ such that there exists no continuous map $g:E\to\mathbb R$ with $f=\mathrm e^{\mathrm ig}$. An example is the projection $f:\mathbb C\backslash\{0\}\longrightarrow U,~r\mathrm e^{\mathrm i\varphi}\mapsto\mathrm e^{\mathrm i\varphi}$. A fitting $g:\mathbb C\backslash\{0\}\longrightarrow \mathbb R$ would be a continuous branch of the argument function $\operatorname{arg}$ on the punctured plane. But it is known that such a branch does not exist. Otherwise $\mathrm i \operatorname{arg}(z)+\ln\vert z\vert$ would be locally an inverse of $\exp$, and thus locally an antiderivative of $\frac1z$, and since it's defined on the maximal domain of $\frac1z$, it would be a global antiderivative, but then all contour integrals over $\frac1z$ would vanish, which we know to be false.
