Functions $f$ that $f(f(x))=x$, but $f:S^1\to S^1$

Background
Denote $$e_A$$ the identity map from $$A$$ to itself. Questions such like solving $$f$$ in the functional equation $$f\circ f=e_\mathbb{R}$$ or $$f\circ f=e_{\mathbb{R}\setminus\{a_1,\ldots,a_n\}}$$ with or without limitation of the continuousness of $$f$$ have already been discussed in this question. Given that there are some solutions like $$f:x\mapsto1/x$$ with domain $$\mathbb R\setminus\{0\}$$, it is natural to try to extend the domain to $$\mathbb{R}\cup \{\infty\}$$. To find the solutions with better properties, it is necessary to add a restriction of the solution. As it is hard to analysis of the nature of $$f$$ at infinity, the following question arises since $$\mathbb{R}\cup\{\infty\}$$ and $$S^1$$ are same to some extent.

Question
Let $$S^1\subset\mathbb R^2$$ be the unit circle centered at the origin, can we find all continuous solutions to the equation $$f\circ f=e_{S^1}$$ with the restriction that there exists a real-analytic function $$g$$ s.t. $$(\cos g(x),\sin g(x))=f((\cos x,\sin x))$$ for all $$x\in\mathbb R$$?

It is not hard to see that there exists a constant integer $$n$$ such that $$g(x)-2\pi nx$$ have a period $$2\pi$$. Plus, because $$f$$ is a continuous bijection, $$n$$ has to be $$\pm1$$. So the question boils down to finding a function with the following conditions: $$g\in C^\omega(\mathbb R)$$, $$g(x)=\pm x+\sum_{n=-\infty}^\infty c_ne^{inx}$$ and a functional equation with respect to $$g$$. I'm still struggling with the functional equation.

• It seems that in the end you view $S^1$ as subset of $\Bbb R^2$ and as $\Bbb R/(2\pi\Bbb Z)$ at the same time. Or do you want identify $\Bbb R^2$ with $\Bbb C$ and meant $f(e^{ix})$ instead of $f(x\bmod 2\pi)$? Or explicitly $f(\cos x,\sin x)$? Are you in fact rather looking for real-analytic $f$ that is $2\pi$-periodic and $f(f(x))=x+2k\pi$? – Hagen von Eitzen Jun 23 at 9:11
• This is only a partial answer: since $id=f^2: S^1 \to S^1$, then applying the homology functor $id_*=(f_*)^2 : H_*(S^1) \to H_*(S^1)$. This implies that $f$ has degree $1$. Since the degree of maps is a complete invariant on the circle, this implies that $f$ is homotopic to the identity map. The problem then reduces to finding functions homotopic to the identity that satisfy the desired condition. – Lance Jun 23 at 10:52
• @Hagen Sorry for the self-contradition and the unclear of my question. In fact I only want to find a "good" real-analytic function mapping $\Bbb R\cup\{\infty\}$ to itself and I tried to extend the definition of real-analytic to the infinity point. If it is still unclear, feel free to close this question as I have not yet find a good expression to it. – Kemono Chen Jun 23 at 10:57
• Your question makes sense. I think it would be more clear if you required $f$ to be a smooth map of smooth manifolds. Btw, in response to my earlier comment, $f$ could also be homotopic to the antipodal map. – Lance Jun 23 at 15:01