# Let $f(x)=x^2+2x$ and $g(x)=x^3$, finding the roots of $f\circ g(x)=g\circ f(x)$

Let $f(x)=x^2+2x$ and $g(x)=x^3$, how many different roots does $f\circ g(x)=g\circ f(x)$ have?

I solved it and found $x=-1$ but it says it has two different roots, could someone clarify?

-
$g(f(x))-f(g(x))=6x^3(x+1)^2$. So there are two roots : 0 (a triple root) and -1 (a double root) – Ewan Delanoy Jan 23 '12 at 9:33

Other than the nice answer from Alex, you can also do it concretely: $$f\circ g(x)=f(x^3)=x^6+2x^3=x^3(x^3+2)$$ and $$g\circ f(x)=g(x^2+2x)=(x^2+2x)^3=x^3(x+2)^3.$$ Therefore, $f\circ g(x)=g\circ f(x)$ can be written as $x^3(x^3+2)-x^3(x+2)^3=0$, or equivalently, $$x^3\Big[(x+2)^3-(x^3+2)\Big]=x^3\Big[(x^3+6x^2+12x+8)-(x^3+2)\Big]$$ $$=x^3(6x^2+12x+6)=6x^3(x+1)^2=0,$$ which gives $x=0$ or $x=-1$.
Right, I missed $x^3=0$. Thanks. – Gigili Jan 23 '12 at 10:12
$f=g$ when $x=0,2,-1$ as $f=g\implies x(x^2-x-2)=0$.The x we found should also be true for both g and f.Since $f(0)=g(0)=0,f(-1)=g(-1)=-1$ while $g^{-1}(2)=2^{1\over 3}$ while $f(2^{1\over 3})$not equal to 2 which is not possible as an answer.