# Composition of continuous and piecewise $C^{\infty}$ functions.

Let $$f:[a,b]\rightarrow[c,d]$$ be a continuous and piecewise $$C^{\infty}$$ function sending $$a$$ to $$c$$ and $$b$$ to $$d$$ and let $$g:[c,d]\rightarrow \mathbb{R}$$ be a real continuous and piecewise $$C^{\infty}$$ function. Is the composition $$g\circ f$$ a continuous and piecewise $$C^{\infty}$$ function? The difficulty is to prove that the preimage via $$f$$ of a partition of $$[c,d]$$ can "generate" a partition of $$[a,b]$$. The matter consists to prove that the set of zeroes of a function $$h\in C^{\infty}([a,b],\mathbb{R})$$ is a finite set of isolated points united a finite number of closed intervals: $$h^{-1}(0)=\{x_1,x_2,...,x_m \} \cup I_1 \cup...\cup I_s$$ where $$I_j$$ is a closed interval in $$[a,b]$$.

NOTE: A function $$f:[a,b]\rightarrow\mathbb{R}$$ is called piecewise $$C^{l}$$ if there is a partition $$a=a_0 < a_1 < ...< a_n =b$$ of the interval $$[a,b]$$ such that $$f|_{[a_k,a_{k+1}]}\in C^l({[a_k,a_{k+1}]},\mathbb{R})$$ for every $$0\le k \le n-1$$.

• How exactly you define "piecewise" here? Oct 30, 2023 at 11:22
• Consider a function $f(x) := e^{-1/x} \sin 1/x$ on $[0,1]$ - of course, we define $f(0):=0$. Oct 30, 2023 at 18:27
• I would consider $f(x)=x^{1/3} \cos(1/x)$ on $[-1,1]$ and some $g$ which is not differentiable around the origin. Oct 30, 2023 at 18:27
• @RomanHric You've beaten me by 28 seconds ^^ Oct 30, 2023 at 18:30
• The function $$g:[-\cos(1),\cos(1)]\rightarrow\mathbb{R},g(x)=\vert x\vert$$ should work. Oct 30, 2023 at 18:38

The property you want of the set of zeros of a smooth function does not hold in general: If you define $$f\colon \mathbb R\to \mathbb R$$ $$f(x) = \left\{\begin{array}{cc} \sin(1/x)\exp(-\frac{1}{x}) & \text{ if } x>0\\ 0, & \text{ if } x\leq 0, \end{array} \right.$$ then using the fact that if $$p(x)$$ is a polynomial function of $$x$$ then $$\lim_{x\to 0} p(1/x)\exp(-1/x) =0,$$ you can show that $$f(x)$$ is a smooth function on all of $$\mathbb R$$. Clearly $$f^{-1}(0)$$ contains no intervals of positive length, but $$0$$ is it is standard that $$f$$ is infinitely differentiable on all of $$\mathbb R$$.
@RomanHric and @krm2233 have provided us two counterexamples that disprove the proposition. So, the answer to the initial question is: no, it isn't. The composition of continuous and piecewise $$C^{\infty}$$ functions, in general, is not a piecewise $$C^{\infty}$$ function.
To better explain the reason why, I provide a third counterexample: the function defined as $$h(x)= \left\{ \begin{array}{rcl} e^{-\frac{1}{x^2}}\sin(\frac{\pi}{x}) & \mbox{for} & x \in [-1,1]-\{0\} \\ 0 & \mbox{for} & x = 0 \end{array}\right.$$ ; of course $$h\in C^{\infty}([-1,1])$$.
The set of its zeroes is $$h^{-1}(0)=\{0 \}\cup\{\frac{1}{n}$$for $$n\in\mathbb{Z}, n\neq0\}$$; this set has an infinite number of isolated points, and this contradicts what claimed above, about the function $$h$$.