Do there exist functions $f:\Bbb {R} \to \Bbb {R} $ and $g:\Bbb {R} \to \Bbb {R} $ such that $f(g(x)) =x^2$ and $g(f(x)) =x^4$? Do there exist functions $f:\Bbb {R} \to \Bbb {R} $ and $g:\Bbb {R} \to \Bbb {R} $ such that $f(g(x)) =x^2$ and $g(f(x)) =x^4$?
Try
Let $f(x) =x^m$ and $g(x) =x^n$ where $m\neq n$. Then $f(g(x)) =x^{mn} $ and $g(f(x)) =x^{mn} $. This two implies that $mn=2$ and $mn=4$ simultaneously. Which is impossible.
Am I correct?  I want to know if there is any alternative way to argue this question?
 A: Define $$f(x)=
\begin{cases}
0& \text{if }x=0\\
e^{2\sqrt{-\log(|x|)}}& \text{if } 0 < |x| < 1\\
e^{2\sqrt{\log(|x|)}}& \text{if } |x| \geq 1
\end{cases} \quad \quad \text{and} \quad \quad g(x)=
\begin{cases}
0& \text{if }x=0\\
e^{-\log^2(|x|)}& \text{if } 0 < |x| < 1\\
e^{\log^2(|x|)}& \text{if } |x| \geq 1
\end{cases}$$
Then $f$ and $g$ meet the required conclusions : indeed,
$\bullet\ $ If $x=0$, one has $f(g(x))=f(0)=0=0^2$ and $g(f(x))=g(0)=0=0^4$.
$\bullet\ $ If $0 < |x| < 1$, one has
$$f(g(x)) = f(e^{-\log^2(|x|)}) = e^{2\sqrt{\log^2(|x|)}} = x^2$$
$$g(f(x))=g(e^{2\sqrt{-\log(|x|)}}) = e^{-\left(2\sqrt{-\log(|x|)}\right)^2} = x^4 $$
$\bullet\ $ If $|x| > 1$, then
$$f(g(x))=f(e^{\log^2(|x|)}) = e^{2\sqrt{\log^2(|x|)}} = x^2$$
$$g(f(x))=g(e^{2 \sqrt{\log(|x|)}}) = e^{(2 \sqrt{\log(|x|)})^2} = x^4$$

Explanation on how to find such functions :
By composing the equalities $f(g(x))=x^2$ and $g(f(x))=x^4$ by $g$ and $f$ respectively, you get that $f$ and $g$ must satisfy $f(x)^2=f(x^4)$ and $g(x)^4=g(x^2)$. In other words, $f_{|[0, +\infty)}$ must be a conjugacy between $x \mapsto x^4$ and $x \mapsto x^2$ on $[0,+\infty)$, and  $g_{|[0, +\infty)}$ must be a conjugacy between $x \mapsto x^2$ and $x \mapsto x^4$ on $[0,+\infty)$.
So I tried to construct such conjugacies, which is not so difficult : indeed, $x \mapsto x^2$ is conjugate to $x \mapsto 2x$ (thanks to the $\log$), which is conjugate to $x \mapsto 4x$ (quite easily), which is conjugate to $x \mapsto x^4$ (again thanks to the $\log$). Composing all these conjugacies leads to the given expressions for $f$ and $g$.
