# How can I get the minimum error term when manipulating Taylor series?

While working on this problem I decided to check some of my work with Mathematica:

ln[4]:= Series[u[x + h], {h, 0, 4}]


$u(x)+h u'(x)+\frac{1}{2} h^2 u''(x)+\frac{1}{6} h^3 u^{(3)}(x)+\frac{1}{24} h^4 u^{(4)}(x)+O\left(h^5\right)$

ln[5]:= Series[u[x - h], {h, 0, 4}]


$u(x)-h u'(x)+\frac{1}{2} h^2 u''(x)-\frac{1}{6} h^3 u^{(3)}(x)+\frac{1}{24} h^4 u^{(4)}(x)+O\left(h^5\right)$

(%4 + %5 - 2*u[x])/h^2


$u''(x)+\frac{1}{12} h^2 u^{(4)}(x)+O\left(h^3\right)$

As you can see, the error term in the result is $\operatorname{O}(h^3)$; however, all the odd terms should cancel and we could have $\operatorname{O}(h^4)$. How can I get Mathematica to recognize this cancellation and return the minimum error term? The order is correct if I add another term to each series, but I'd prefer a solution not requiring that.

• Please post code, not images. For notes on how to do this, if unclear, see mathematica.stackexchange.com/help/formatting – b3m2a1 Jan 7 '18 at 20:34
• Of course; done. – user50010 Jan 7 '18 at 20:43

Series[(u[x+h] + u[x-h] - 2 u[x])/h^2, {h, 0, 3}] //TeXForm

$u''(x)+\frac{1}{12} h^2 u^{(4)}(x)+O\left(h^4\right)$