Are $\pm f\sqrt{1+g^2}$ and $\pm fg\sqrt{1+g^2}$ smooth if $f,fg,fg^2$ are smooth? This is a follow-up on the previous question. 
Suppose that $f$ and $g$ are functions from $\mathbb R$ to $\mathbb R$ such that the functions $f,fg,fg^2$ are smooth, that is, are in $C^\infty(\mathbb R)$. Does it then necessarily follow that, for some function $h\colon\mathbb R\to\{-1,1\}$, the 
functions $hf\sqrt{1+g^2}$ and $hfg\sqrt{1+g^2}$ are smooth? 
Of course, the problem here is that the function $g$ does not have to be smooth, or even continuous, at zeroes of the function $f$; if $f$ has no zeroes, then one can obviously take $h=1$. 
One may also note that the continuity of the 
functions $hf\sqrt{1+g^2}$ and $hfg\sqrt{1+g^2}$ (at the zeroes of $f$ and hence everywhere) follows easily from the inequalities $|hf\sqrt{1+g^2}|\le|f|+|fg|$ and $|hfg\sqrt{1+g^2}|\le|fg|+|fg^2|$. 
 A: $\newcommand{\de}{\delta}$This is to provide a detalization/formalization of fedja's answer. 
For $r\in(0,1]$ and real $x$, let 
\begin{equation*}
 f_{0,r}(x):=(x^2+r^2)^2,\quad g_{0,r}(x):=\frac x{x^2+r^2}, 
\end{equation*}
\begin{equation*}
 H_{0,r}:=f_{0,r}\sqrt{1+g_{0,r}^2},\quad F_{0,m,r}:=f_{0,r}g_{0,r}^m,
\end{equation*}
\begin{equation*}
 f_r:=f_{0,r}\psi,\quad g_r:=g_{0,r}\psi,
\end{equation*}
\begin{equation*}
 H_r:=f_r\sqrt{1+g_r^2},\quad F_{m,r}:=f_r g_r^m,
\end{equation*}
where $m\in\{0,1,2\}$ and $\psi$ is any function in $C^\infty(\mathbb R)$ such that $\psi=1$ on the interval $[-1/2,1/2]$ and $0$ outside the interval $[-1,1]$. 
Then for each $k\in\{0,1,\dots\}$ we have $\max_{m=0}^2\sup_{0<r\le1}\|F_{0,m,r}^{(k)}\|_\infty<\infty$ and hence 
\begin{equation*}
 C_k:=\max_{m=0}^2\sup_{0<r\le1}\|F_{m,r}^{(k)}\|_\infty<\infty. \tag{1}
\end{equation*}
However, 
\begin{equation*}
 H_r^{(4)}(0)=H_{0,r}^{(4)}(0)=24-3/r^4\sim-3/r^4\to-\infty
\end{equation*}
as $r\downarrow0$; this crucial fact can be verified either by a direct calculation or by using (with $r$ fixed) the Maclaurin expansions $\sqrt{1+v}=1+v/2-v^2/8+o(v^2)$ (with $v=\dfrac u{(r^2+u)^2}$) and then $\dfrac1{(r^2+u)^2}=\dfrac1{r^4}\,\Big(1-\dfrac{2u}{r^2}\Big)+o(u^2)$ (with $u=x^2$). 
For real $x$ and $m\in\{0,1,2\}$, let now 
\begin{equation*}
 f(x):=\sum_{j=1}^\infty a_j f_{r_j}\Big(\frac{x-c_j}{\de_j}\Big), \quad 
 g(x):=\sum_{j=1}^\infty a_j g_{r_j}\Big(\frac{x-c_j}{\de_j}\Big), 
\end{equation*}
\begin{equation*}
 F_m(x):=f(x)g(x)^m=\sum_{j=1}^\infty a_j F_{m,r_j}\Big(\frac{x-c_j}{\de_j}\Big)
\end{equation*}
\begin{equation*}
 H(x):=f(x)\sqrt{1+g(x)^2}=\sum_{j=1}^\infty a_j H_{r_j}\Big(\frac{x-c_j}{\de_j}\Big),  
\end{equation*}
where 
\begin{equation*}
 r_j:=a_j:=e^{-j}, \quad c_j:=\tfrac12\,(x_j+x_{j+1}), \quad x_j:=1/j,\quad  \de_j:=\tfrac12\,(x_j-x_{j+1})\sim1/(2j^2)
\end{equation*}
as $j\to\infty$. 
Then, by (1) and dominated convergence, the functions $f=F_0$, $fg=F_1$, $fg^2=F_2$ are in $C^\infty(\mathbb R)$, with 
\begin{equation}
 \|F_m^{(k)}\|_\infty\le\sum_{j=1}^\infty a_j C_k/\de_j^k<\infty
\end{equation}
for all $k\in\{0,1,\dots\}$. 
However, $hH\notin C^\infty(\mathbb R)$, and even $hH\notin C^4(\mathbb R)$, for any function $h\colon\mathbb R\to\{-1,1\}$. Indeed, assume the contrary. Then, for each natural $j$ and all $x\in[c_j-\de_j/2,c_j+\de_j/2]$, we have 
$h(x)H(x)=a_j h(x)H_{r_j}\big(\frac{x-c_j}{\de_j}\big)$, which will be continuous in $x$ at $x=c_j$ only if $h$ is the constant $1$ or the constant $-1$ in some neighborhood of $c_j$. Hence, 
\begin{equation}
 |(hH)^{(4)}(c_j)|=a_j|H^{(4)}(0)|/\de_j^4\sim 3a_j/(r_j^4\de_j^4)\to\infty
\end{equation}
as $j\to\infty$. Since $c_j\to0$ as $j\to\infty$, we see that $(hH)^{(4)}$ is unbounded in any neighborhood of $0$. So, $hH\notin C^4(\mathbb R)$, as claimed. 
A: Still no. Consider the function $f(x)=(x^2+r^2)^2$, $g(x)=\frac x{x^2+r^2}$ with small $r>0$. Then $f$, $fg$, $fg^2$ are polynomials of degree $\le 4$ with bounded coefficients but $f\sqrt{1+g^2}$ is very close to $x^2|x|\sqrt{1+x^2}$ as close to $0$ as you wish when $r$ is small enough, so the maximum of the fourth derivative in an arbitrarily small neighborhood of the origin can be forced to be very large by choosing $r$ small enough. Now just take your favorite $C^\infty$ function $\psi$ that is $1$ on $[-1,1]$ and is supported on $[-2,2]$ and use $\psi f$ and $\psi g$ instead of $f$ and $g$. You'll get a compactly supported building block that you can scale and translate with the possibility to blow up the fourth derivative by choosing $r$ last. So just scale to some disjoint intervals $I_j$ accumulating to $0$ with sufficiently fast decaying heights to make individual multiplications by controlled polynomials irrelevant after which choose $r_j$. Near the center of each interval $I_j$ the function $f$ is strictly positive, so $h$ is of no use there. What may really help (no guarantee though) is to assume that $g$ is continuous, but that is, probably, too much for your purposes.
A: This time the answer is yes. Edited: the answer is no, as shown by fedja in his excellent answer. However, the following proves that with an appropriate choice of $h$, the functions $h f \sqrt{1 + g^2}$ and $h f g \sqrt{1 + g^2}$ have Taylor expansion (of an arbitrary order) at every real point. This is weaker than smoothness, but at least some positive result.
It is sufficient to consider a fixed zero of $f$. When trying to define the square-root of $h_1 = f^2 + f^2 g^2$ and $h_2 = f^2 g^2 + f^2 g^4$ in a neighbourhood of $a$, we need to choose among two options:
$$ f(x) \sqrt{1 + (g(x))^2} \qquad \text{or} \qquad f(x) \sqrt{1 + (g(x))^2} \operatorname{sign} (x - a) $$
for $h_1$, and similarly
$$ f(x) g(x) \sqrt{1 + (g(x))^2} \qquad \text{or} \qquad f(x) g(x) \sqrt{1 + (g(x))^2} \operatorname{sign} (x - a) $$
for $h_2$.

Suppose first that $a$ is a zero of $f$ of finite multiplicity $a$, say, $$ f(x) \sim C (x - a)^n $$ as $x \to a$ for some $C \ne 0$. Since $f g$ and $f g^2$ are smooth at $a$, and $g = (f g) / f$, $g^2 = (f g^2) / f$, we have the following possibilities:


*

*$g$ has a pole at $a$ of degree $-m < \tfrac{1}{2} n$;

*$g$ is smooth and non-zero at $a$ (and we set $m = 0$);

*$g$ has a zero at $a$ of multiplicity $m > 0$ (possibly infinite).


It is thus easy to see that $a$ is a zero of $h_1 = f^2 + f^2 g^2$ and $h_2 = f^2 g^2 + f^2 g^4$ of multiplicity $2 \min\{n, n + m\}$ and $2 \min\{n + m, n + 2 m\}$, respectively (watch out when $m = 0$!). Consequently, one can define smooth square-roots of $h_1$ and $h_2$ by an appropriate choice of sign — and it is easy to see that $f \sqrt{1 + g^2}$ and $f g \sqrt{1 + g^2}$ is the right choice if and only if $m$ is even or $m \geqslant 0$; otherwise, choose $f g \sqrt{1 + g^{-2}}$ and $f g^2 \sqrt{1 + g^{-2}}$ instead. (Note that in the latter case we have $|g^{-2}| < 1$ in a neigbourhood of $a$.)

Now consider a zero $a$ of $f$ of infinite multiplicity: suppose that $$f(x) = o(|x - a|^n)$$ as $x \to a$ for every $n$. If $f g^2$ also has a zero at $a$ of infinite multiplicity, then $h_1 = f^2 + f^2 g^2$ and $h_2 = f^2 g^2 + f^2 g^4$ have a zero at $a$ of infinite multiplicity, too, and so any choice of signs near $a$ leads to square-roots of $h_1$ and $h_2$ with a zero at $a$ of infinite multiplicity.
However, it is possible that $f g^2$ has a zero at $a$ of finite multiplicity $k$. In this case $a$ is still a zero of $h_1 = f^2 + f^2 g^2$ of infinite multiplicity, and hence both choices of sign of the square-root of $h_1$ are smooth at $a$. On the other hand, $f^2 g^2 + f^2 g^4$ has a zero at $a$ of finite multiplicity $2 k$. As in the first part of the proof, it is again possible to choose a square-root of $f^2 g^2 + f^2 g^4$ which is smooth at $a$; namely, $f g^2 \sqrt{1 + g^{-2}}$ is smooth at $a$. (As before: note that we necessarily have $|g^{-2}| < 1$ in a neigbourhood of $a$.)

One has to deal with some technicalities when $a$ is not an isolated zero of $h_1$ or $h_2$. Fortunately in this case it is necessarily a zero of infinite multiplicity, and hence the choice of sign of the square root does not matter at all.
