Let's assume that $f,g:\mathbb{R} \rightarrow \mathbb{R}$ are smooth functions and
$\forall n\in \mathbb{N}, \forall x\in \mathbb{R}:\, |f^{(n)}(x)|, |g^{(n)}(x)| < 1 $
prove that if $\forall n \in \mathbb{N}\, f^{(n)}(0) = g^{(n)}(0)$, then f = g.
I presumed that if two smooth functions have a point $a$ in which $\forall n\in\mathbb{N\cup\{0\}} \,\,f^{(n)}(a) = g^{(n)}(a)$, then they are equal because their Taylor series are infinite and each term is equal. Later, I found a counter example: $\displaystyle f(x) = \begin{cases}e^{- \frac{1}{x^2}} &\text{for } x \neq 0 \\ 0 & \text{when } x=0 \end{cases}\,\,$ and $\,\,g(x) =0$
I understand it but I don't really see why my initial presumption is wrong. Can anyone explain it better or suggest some reading? As for the proof, my final idea is to inspect Taylor series of $h(x) = f(x)-g(x)$ and prove that Lagrange's form of the remainder converges to 0. Would that be a correct proof?
The problem is that a real function, even if smooth, may not agree with its Taylor series as you have seen in this famous example. Functions that agree with their Taylor series are called analytic. The situation is much better in complex analysis as complex differentiability already implies that a function is smooth and equal to its Taylor series.
As for your second question: Yes, you can prove this using the Lagrange form of the remainder.