We define $\rho:\mathbb R^n \to \mathbb R$ by $$ \rho (x) := \begin{cases} e^{1/ (|x|^2-1)} &\text{if } |x| <1, \\ 0 &\text{otherwise} \end{cases} $$
It's is mentioned at page $108$ of Brezis's Functional Analysis that $\rho \in \mathcal C_c^\infty (\mathbb R^n)$. I would like to verify this claim. Could you have a check on my below attempt?
Proof Clearly, $\rho$ is compactly supported. It remains to prove that $\rho$ is smooth. We define $f:\mathbb R \to \mathbb R$ by $$ f (x) := \begin{cases} e^{-1/x} &\text{if } x>0, \\ 0 &\text{otherwise}. \end{cases} $$
Then $\rho (x) = f(1-|x|^2)$ . The map $x \mapsto 1-|x|^2$ is smooth. By chain rule, it suffices to prove that $f$ is smooth. If $x<0$ then $f'(x)=0$. If $x>0$ then $f'(x)=x^{-2} e^{-1/x} = x^{-2} f(x)$ and thus $$ \begin{align} f''(x) &= -2x^{-3}f(x)+x^{-2} f'(x) \\ &= (-2x^{-3} + x^{-4}) f(x). \end{align} $$
Recursively, $f^{(n)} (x)=0$ for $x <0$ and there is a polynomial $P_n$ of degree $2n$ such that $f^{(n)} (x) = P_n(x^{-1}) f(x)$ for $x>0$. We have $f'(0^-) = \lim_{x \to 0^-} \frac{0-0}{x}=0$ and $$ f'(0^+)=\lim_{x \to 0^+} \frac{e^{-1/x}}{x} = \lim_{x \to +\infty} xe^{-x}=0. $$
Recursively, $f^{(n+1)}(0^-) = \lim_{x \to 0^-} \frac{0-0}{x}=0$ and $$ f^{(n+1)}(0^+) = \lim_{x \to 0^+} \frac{P_n(x^{-1}) f(x)-0}{x} = \lim_{x \to +\infty} xP_n(x)e^{-x}=0. $$
So $f^{(n)}$ is differentiable at $0$ for all $n$. In particular, $f^{(n)}(0)=0$ for all $n$. This completes the proof.