I don't understand the first line of the solution
If $f:\mathbb{R} \to \mathbb{R}$ defined by $f(x)={e^{-1/x}}$ if $x>0$ and $f(x)=0$ if $x \leq 0$ then show it is $C^{\infty}$.
Well, it frst says
When $x \neq 0$ $f$ is locally the composition of $C^{\infty}$ functions so it is $C^{\infty}$
Okay, when $x>0$ then it indeed seems like a composition of $-\frac{1}{x}$ with $e^{x}$ which is infinitely differentiable. So I understand the claim here. Also, $x<0$ gives $f=0$ which is again infinitely differentiable so indeed, $C^{\infty}$.
However why exclude the case $x=0$? I know it's undefined if $f(x)=e^{-1/x}$ when $x\geq 0$ but in this case, isn't it well-defined? It's clearly stated that $f=0$ when $x \leq 0$ so it includes $0$ as its point that $f$ is defined clearly. It is $0$.
So, isn't considering $0$ just the same as considering $x<0$? That gives $0$ too and it's $C^{\infty}$. therefore, $f$ at $x=0$ is also infintiely differentiable and thus $C^{\infty}$. Done.
But instead, it keeps on going with some tedious calculations to solve this question. Why? Why did it exclude $x=0$ when $f$ is defined at that point?
The important word is "locally". If a function is the composition of $C^\infty$-functions in a neighbourhood of $x$, it is $C^\infty$ at $x$. Any neighbourhood of 0 contains elements $>0$ and elements $\leq 0$, so the function cannot by simply written as a composition in any neighbourhood of 0.
Often lectures tend to simplify by leaving out "locally", which is a source of confusions. Continuity, differentiability etc. are local properties, they always depend on the values in a neighbourhood.