How to prove an analytic function is analytic 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!
 A: 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$.
A: For the functions you mention you can estimate the error in the Taylor polynomial. For cases like $\sin x$ and $\cos x$, it is easy to show that the error term goes to zero for each fixed $x\in\mathbb R$. This makes the function equal to its Taylor series everywhere, and thus analytic. 
If you can bound the error term within an interval, then you would have proven that the function is analytic on an interval. 
A: To expand on Martin's answer, consider $\exp(x)$. This is $C^{\infty}$, obviously. From Taylor's theorem,
$$\left|\exp x - \sum_{0 \leq k \leq n} \frac{x^k}{k!}\right| = \left|\frac{e^c \cdot x^{n+1}}{(n+1)!}\right| = \frac{e^c \cdot x^{n+1}}{(n+1)!} \le \exp(x) \frac{x^{n+1}}{(n+1)!} $$
for some $c \in [0,x]$. The right side $\to 0$ as $n \to \infty$; this can be seen from the ratio test. This implies $\exp$ is equal to its Maclaurin series everywhere.
