Functions high school olympiad level. Show that there exist functions $f: \mathbb{R} \mapsto\mathbb{R}\;$ and $g:\mathbb{R}\mapsto\mathbb{R}\;$ such that $f(g)=g(f)\;$ and $f(f)=g(g)\;$ and $f(x) \neq g(x)\;$ for all real $x$$\\$
$\\$
$\\$b) Prove that if $f: \mathbb{R} \mapsto\mathbb{R}\;$ and $g: \mathbb{R} \mapsto\mathbb{R}\;$   are continuous and have the properties $f(g)=g(f)\;$ and $f(x) \neq g(x)\;$ for all real $x$ then $(f(f))(x) \neq(g(g))(x)\quad$ for all real $x$
Hi. Im a high schooler who trying this question. I havent the slightest idea how to proceed and would like if someone could help me through this.
 A: There's no general method, except imagination which comes with experience, I'm afraid.
Here is how I found an example: the relation $f(g)=g(f)$ reminded me of the characterisation  of odd/even functions: an $odd$ function satisfies the relation 
$$\forall x,\;f(-x)=-f(x)$$
which is the required relation for $g(x)=-x$. Now $g\bigl(g(x)\bigl)=x$, so we also must have  $f\bigl(f(x)\bigl)=x$, in other words $f$ must be its own inverse, and different  from $-x$. There aren't so many functions at an elementary level, but one obvious answer is 
$$f(x)=\frac1x.$$
Last requirement $\;f(x)\ne g(x)$ for all $x$. It's automatically satisfied since $\dfrac 1x=-x$ implies $x^2+1=0$, which have no real root.
Yet there's one flaw: $f(x)$ is not defined at $x=0$.Never mind: we'll slightly change the definition of $f$ and set
$$f(x)=\begin{cases}\dfrac1x&\text{ if } x\ne 0,\\[1ex]1&\text{ if } x=0.\end{cases}$$
A: For the first part $f(x) = \frac{1}{x}$, $g(x) = -f(x)$ almost work. Now define $f(0)=1$. 
Note: these functions are not continuous at $0$. But continuity was not a stated requirement for the first part of the exercise.
(This makes sense, as in the second part, it is a task to prove that continuous examples $f,g$ do not exist.) 
