# If $f \circ g$ and $g \circ h$ are smooth, is $f \circ g \circ h$ smooth?

Given functions $$f, g,$$ and $$h$$ on some smooth manifold M such that $$f \circ g$$ and $$g \circ h$$ are $$C^\infty$$, must $$f\circ g\circ h$$ be $$C^\infty$$?

I can't imagine this is true, but I'm having trouble coming up with a counterexample. I've also had no luck in coming up with a proof, but I haven't been focusing on it for too long.

• Does "smooth" mean $C^\infty$? Commented Dec 18, 2019 at 3:44
• @LordSharktheUnknown Yes, $C^\infty$ and smooth are synonymous here. Commented Dec 18, 2019 at 3:45
• Aren't composites of $C^\infty$ functions always $C^\infty$? Commented Dec 18, 2019 at 3:46
• How about taking $f=g=h$ to be a non-smooth involution? Commented Dec 18, 2019 at 3:50
• @CharlesHudgins Yes, take $f:\mathbb{R}\to\mathbb{R}$ such that on the irrationals $f(x)=x$ and on the rationals $f(x)=-x$. Then $f$ isn't even continuous, but $f(f(x))=x$ Commented Dec 18, 2019 at 3:56

As @Lord Shark the Unknown suggested, pick $$f=g=h= \left\{ \begin{array}{lc} x & \mbox{ if } x \in \mathbb Q \\ -x & \mbox{ if } x \notin \mathbb Q \\ \end{array} \right.$$
More generally, pick any non-smooth bijection $$f$$ and set $$g=f^{-1}$$ and $$h=f$$.