infinitely differentiable function $\exp(-1/(x^2(1-x)^2))$ Given the function :
$f:\mathbb{R}\rightarrow\mathbb{R}$ defined as
$f(x) = \begin{cases}\exp(-1/(x^2(1-x)^2)) &\text{for $x\in (0,1)$} \\0 &\text{otherwise} \end{cases}$
How can I formally show that this function is infinitely differentiable?
This function is clearly quite difficult only on $(0,1)$ and given that $\exp(x)' = \exp(x) \cdot x'$ we have that $(-\frac{1}{x^2(1-x)^2})' = \frac{2\left(2x-1\right)}{x^3\left(x-1\right)^3}$ and this tells me that the derivative will always be of the form "exponential times fraction of polynomials". Should I use induction? Are there any cases I should watch out for?
 A: Here's a solution to show that $f$ is infinitely differentiable at $x = 0$.

By definition
$$ f'(0) = \lim_{h \to 0} \frac{f(h)-0}{h}$$
the limit from the left is clearly $0$ so consider $h \in (0,1)$.
Notice that forall all $x \in (0,1)$ we have
$$ \frac{-1}{x^2(1-x)^2}<\frac{-1}{x^2} < \frac{-1}{x}.$$
Therefore $$0<  \frac{1}{x}\exp\frac{-1}{x^2(1-x)^2} < \frac{1}{x} e^{-1/x}$$
and we have that $f$ is differentiable at $0$ with $f'(0) = 0$  since $1/xe^{-1/x} \to 0.$

We now show that higher order derivatives at $0$ exists and are equal to $0$. That is  $f^{(k)}(0) = 0.$ We will rely on induction.
We've already shown the base case $f'(0) = 0.$
Assume that $f^{(k)}(0) = 0$ then
$$ f^{(k+1)}(0) = \lim_{h \to 0} \frac{f^{(k)}(h)- f^{(k)}(0)}{h} = \lim_{h \to 0} \frac{f^{(k)}(h)}{h}.$$
The limit from the left is clearly $0$ so consider what happens for  $h \in (0,1).$
I make the following claim which can easily be proven by induction

Claim: Let $g(h) = \frac{-1}{h^2(1-h)^2}.$ $$(e^{g})^{(k)} = Q_ke^{g}$$ for some rationnal function $Q_k$

It follows that
$$\frac{f^{(k)}(h)}{h} = \tilde Q_k(h) \exp {g(h)}$$
for some rationnal function $\tilde Q_k = Q_k/h$. By what was done previously we have
$$ \vert \tilde Q_k(h) \exp g(h) \vert \leq \vert \tilde Q_k (h)\exp \frac{-1}{x}\vert$$
by definition we can find $a_i, b_i$ such that
$$ \tilde Q_k(h ) = \frac{b_nh^n + ... + b_1h + b_0 }{a_mh^m +... + a_1h + a_0}$$
If $a_0  \neq 0$ then $\tilde Q_k \exp{-1/x}$ converges to $0$ and we are done.
If $a_0 = 0$ then we can factor out a power of $h$, $h^l$ in the denominator. By taking $l$ as large as possible for this property we have
$$ \lim_{h \to 0} h^{l+1} \tilde Q_k(h) = 0$$
Hence for $h$ small enough we have $\vert \tilde Q_k(h)\vert < \vert \frac{1}{h^{l+1}}\vert$
Therefore for small values of $h$ we have
$$ 0 \leq \left\vert \frac{f^{(k)}(h)}{h}\right \vert \leq \left\vert \frac{1}{h^{l+1}}e^{-1/h}\right\vert.$$
Since the RHS converges to $0$ as $h \to 0$ we deduce that
$$ f^{(k+1)}(0) = 0.$$

To show smoothness at $x = 1$ I suspect (haven't checked) you can use similar arguments but by using the inequality
$$ \exp \frac{-1}{x^2(1-x)^2} \leq \exp \frac{-1}{1-x}$$
and factoring out powers of $(1-h)$ instead of powers of $h$ in the latter part.
