How is the error term in the Taylor expansion of a function arrived at? $f(x)= \sum_\limits{k=0}^{n} \dfrac{f^k(a)}{k!}(x-a)^k + \dfrac{ f^{n+1}(c) }{ (n+1)! } (x-a)^{n+1} $
I have some trouble understanding this, as it seems to imply that
$ \dfrac{ f^{n+1}(c) }{ (n+1)! } (x-a)^{n+1} = \sum_\limits{k=n+1}^{\infty}  \dfrac{f^k(a)}{k!}(x-a)^k$
Because by the Taylor expansion of $f(x)$ at a:
$f(x)= \sum_\limits{k=0}^{ \infty} \dfrac{f^k(a)}{k!}(x-a)^k $
This seems to be very similar to the mean value theorem, but I'm not sure how to prove the equation using it as it includes x to powers other than 1, and I only know $\dfrac{f(b)-f(a)}{b-a}=f'(a \le k \le b) $. As it may be of help here for me to understand the answer: how can the mean value theorem be derived from the Taylor series (if it can at all), and can this be generalised to higher derivitaves (how?)? 
 A: First off, note that you can't say that $f(x)=\displaystyle \sum_{k=0}^\infty \frac{f^k(a)}{k!}(x-a)^k$ holds unless you assume $f$ is analytic; that is, that the Taylor series converges. This isn't really related to the heart of your question, so I'm just including it as a note.
The source of confusion is that when you write $f(x)=\displaystyle \sum_{k=0}^n \frac{f^k(a)}{k!}(x-a)^k + \frac{f^{n+1}(c)}{(n+1)!} (x-a)^{n+1}$, you are saying that this equation, for a particular value of $x$ holds for some $c$ in the interval $[a,x]$ (assuming $a<x$). However, the value of $c$ depends on $x$. It might make more sense to subscript $c$ as $c_x$ to indicate the dependence on $x$.
Now when you write $\displaystyle\frac{f^{n+1}(c_x)}{(n+1)!} (x-a)^{n+1}=\sum_{k=n+1}^\infty \frac{f^k(a)}{k!}(x-a)^k$, there's no problem. This equation holds for a particular value of $x$; it's an equation about two numbers, not two functions, again assuming the Taylor series for $f$ converges at $x$.
We can think of both sides as functions of $x$, but $c_x$ can have very complicated dependence on $x$ (all we know about $c_x$ is that $ a<c_x < x$ for $a<x$ and $ x<c_x < a$ for $x<a$).  If you do this, then assuming $f$ is analytic and the Taylor series converges everywhere, then the equation $\displaystyle\frac{f^{n+1}(c_x)}{(n+1)!} (x-a)^{n+1}=\sum_{k=n+1}^\infty \frac{f^k(a)}{k!}(x-a)^k$ holds as equality of functions.
