I know the fact that not every $C^{\infty}$ function is analytic, for which there is the famous example:
$$f(x):= \begin{cases} e^{-1/x} & x>0 \\ 0 & x\leq 0 \end{cases} $$
In that case, $f$ is $C^{\infty}$ but its Taylor series is identically zero, which is clearly different from $f$ itself.
But how can I prove a function is actually analytic? Take $\sin(x)$ or $\cos(x)$, for example. We can easily calculate each Taylor series $T_{\sin}(x):=\sum_{k=0}^{\infty}\frac{(-1)^{k}x^{2k+1}}{(2k+1)!}$ and $T_{\cos}(x):=\sum_{k=0}^{\infty}\frac{(-1)^{k}x^{2k}}{(2k)!}$ and check the convergence of both. But how do we prove that $T_{\sin}(x)=\sin(x)$ and $T_{\cos}(x)=\cos(x)$ for all $x\in\mathbb{R}$?
What about other examples ($\tan(x)$, $e^x$ etc)? Do we really have to treat each case separately? Is there any theorem that makes this task easier?
Thanks!
In the case of $\sin$, $\cos$, $\exp$, $\tan$ etc., there is nothing to prove because most mathematicians use those power series as their definitions, meaning that those functions are analytic by definition.
Composition of analytic functions is again analytic on the subsets where it may be performed.
In general, though, if one is given $f : D \subseteq \Bbb R \to \Bbb R$, one usually shows that for every compact $K \subseteq D$ there exist $C_K \ge 0$ such that for every $x \in K$ and every $n \in \Bbb N$ one has $| f^{(n)} (x) | \le C_K ^{n+1} n!$ and this is a necessary and sufficient condition to have $f$ analytic on $D$.