# When does $f\left [g\left (x \right ) \right ]=g\left [ f\left ( x \right ) \right ]$ have roots.

I met a interesting equation: $$\sin\left [\cos\left (x \right ) \right ]=\cos\left [\sin\left (x \right ) \right ]$$

(And of course, the equation has no roots).

So, Let $f\left ( x \right )$ and $g\left ( x \right )$ be 2 continuous function with variable $x$.

I wonder whether the general equation $$\color{red}{f\left [g\left (x \right ) \right ]=g\left [ f\left ( x \right ) \right ]}$$ has roots, and when if it has.

You can solve it by the way you want.

The last, it's just a inquiry of mine. I'm only a high school student, please don't ask me anything too subliminal.

• Well one thing I see which doesn't give solutions is when $f(x)=C$ and $g(C)\neq C$. – Tucker Aug 10 '15 at 5:32
• @Tucker Thanks, but it's only true when $f\left ( x \right )$ and $g\left ( x \right )$ are 2 constants. – mja Aug 10 '15 at 5:36
• for my example $g(x)$ does not have to be a constant. For, instance $f(x) = 1$, $g(x)=cos(x)$ your equation then reads $1=cos(1)$, which is not true. I do see your point that this discussion is a bit degenerate. – Tucker Aug 10 '15 at 5:41
• This works when your functions are linear transformations ($f(x) = ax$ and $g(x) = bx$) since $1 \times 1$ matrices over $\mathbb{R}$ commute. In that case, every $x$ is a root :P – Mohamad Ali Baydoun Aug 10 '15 at 5:44
• I would be surprised if anything can be said in general. I'd be surprised to learn anything even if both functions are arbitrary polynomials, let alone for arbitrary continuous functions. – pjs36 Aug 10 '15 at 5:48

## 1 Answer

The equation $\sin(\cos(x)) = \cos(\sin(x))$ does have roots, just not real roots. For example, $\pm 0.7853981634 \pm 0.4663385348 i$ (approximately) are roots.

In some cases when $f$ and $g$ are polynomials with real coefficients, real roots exist. Suppose the leading terms of $f(x)$ and $g(x)$ are $\alpha x^m$ and $\beta x^n$. Then the leading terms of $f(g(x))$ and $g(f(x))$ are $\alpha \beta^m x^{mn}$ and $\beta \alpha^n x^{mn}$. If $m$ and $n$ are both odd and $\alpha \beta^m \ne \beta \alpha^n$, then $f(g(x)) - g(f(x))$ is a polynomial of odd degree, so it has at least one real root.

On the other hand, here are some polynomial examples where there are no real roots. Try $f(x) = x^2$, $g(x) = a x^2 + b$ with $a, b > 1$. Then $f(g(x)) - g(f(x)) = (a^2 - a) x^4 + 2 a b x^2 + b^2 - b > 0$ for all real $x$.