Let $f(x)=x^2$ and $g(x)=\sin(x)\ \forall\ x\in \mathbb R$. Then find the value of all $x$ satisfying $(f\circ g\circ g\circ f)(x)=(g\circ g\circ f)(x)$, where $(f\circ g)(x)=f(g(x))$.
Solution. From the given data, we have $(f\circ g\circ g\circ f)(x)=(\sin(\sin(x^2)))^2$ and $(g\circ g\circ f)(x)=\sin(\sin(x^2))$.
Now we have to find the values of $x$ satisfying $$(\sin(\sin(x^2)))^2=\sin(\sin(x^2))\tag{1}$$
Let $\sin(\sin(x^2))=t$, then $(1)$ becomes $t^2=t\implies t=0 \text{ or }1$
Case 1: $\sin(\sin(x^2))=0\implies \sin(x^2)=n\pi, n\in \mathbb Z$. Need help in proceeding further
Case 2: $\sin(\sin(x^2))=1\implies \sin(x^2)=n\pi+(-1)^n \left (\frac{\pi}{2} \right)$. Need help in proceeding further
Recall that $\sin$ is a bounded function between $-1$ and $1$. So the only way that $\sin(x^2)$ is of the form $n\pi$ for some $n\in \mathbb{Z}$ is when $n=0$. You can then solve this easily for $x$.
Can you solve case $2$ in a similar manner?
EDIT: As for case $2$, as @CameronBuie remarked in the comment, the usual writing of the solutions of $\sin(z)=0$ is $z=\frac{\pi}{2}+2n\pi$. Note that no real number of this form lie between $1$ and $-1$ (the least such positive real number is $\frac{\pi}{2}=1.57\ldots$ and the greatest negative real number of this form is $\frac{\pi}{2}-2\pi=-4.71\ldots$). Hence, there is no solution in the case $2$ where $\sin(x^2)=\frac{\pi}{2}+2n\pi$.