Is there a non-trivial solution to the functional equation $f(f(f(x)))=-x$ where $f$ is a continuous function defined on $\mathbb{R}$ ? Also, what about the general one $f^n(x)=-x$ where $f^n$ is $f$ composed with itself $n$ times and $n$ is odd.
In general, is there a theory about continuous solutions to $f^n(x)=g(x)$ where $g$ is a fixed continuous function. The only thing that I found was about the solutions of $f^2(x)=g(x)$, i.e, "square roots" in the sense of composition.
Thanks.
Edit : I forgot to mention that $n$ is supposed to be odd, sorry for the inconvenience.

The only solution is $f(x)=-x$ for all odd $n$.
We have $f(0)=0$ because if $f(0)=a$, then $f(f(a)))=0$ and $-a=f(f(f(a)))=f(0)=a$, so $a=0$.
Since $f^{2n}(x)=x$ for all $x$, the function $f$ cycles sets of at most $2n$ elements $\{\pm a_1,\pm a_2,\ldots,\pm a_n\}$. Fix one of these cycles, and assume without loss of generality that all the $a_i$ are nonzero, and denote by $a>0$ the least positive number in this cycle. Then $f((0,a))$ is an open interval with the endpoints $f(0)=0$ and $f(a)=b$. Assume that $b\neq \pm a$. Since $|b|>|a|$, the interval $f((0,a))$ must contain either $a$ or $-a$, which means there is an $x, |x|<a$ such that $f(x)=a$ or $f(x)=-a$, which is a contradiction, because $f$ is a bijection and $\pm a$ are the images of some $a_i, |a_i|\geq a$. Thus it must hold that $|f(a)|=a$ for all $a$, and consequently $f(a)=-a$ for all $a$.