Let $g_1 (x)=\frac{1}{e^{\frac{1}{x}}}, g_2 \equiv 0.$ Can someone please explain to me how to show, that the function $f:\mathbb{R} \rightarrow \mathbb{R},\ x \mapsto \begin{cases} g_1 (x) & x>0\\ g_2 (x) & \text{else}\\ \end{cases} $ is in $C^ \infty(\mathbb{R})$ ?
I wasn't even able to manage to prove that $f|_{(0,\infty)}$ is in $C^ \infty(0,\infty)$ (let alone to prove that all derivatives exist in $0$, which actually seems to me to be the key point), since I wasn't able to guess a general formula for calculating the derivatives (which I did for some values using a CAS), because it just gets horrible complicated after the fourth derivative; my idea was to succesively calculate the derivatives using the chain, sum and product rule and to prove that way, that the function ought to be in $C^ \infty(\mathbb{R})$. Is there maybe a sleeker way to achieve this ?
Afterswards I should use $f$ to prove that $F:\mathbb{R}^k\rightarrow \mathbb{R}, \ (x_1,\ldots,x_k) \mapsto \begin{cases} G_1 (x_1,\ldots,x_k) & |(x_1,\ldots,x_k)|<1\\ g_2 (x) & \text{else}\\ \end{cases} $
is also in $C^ \infty(\mathbb{R^k})$ , for $G_1 (x_1,\ldots,x_k)=e^{-\frac{1}{1-|(x_1,\ldots,x_k)|^2}}$. The only thing that came to my mind for this, was to maybe try prove that all partial derivatives of all orders of $F$ are continuously differentiable, since that would imply that $F$ would be smooth and that $F(x_1,\ldots,x_k)=f(1-|(x_1,\ldots,x_k)|^2),$ but I'm not sure about that.