# Remainder of Taylor Expansion of a smooth function

I'm now stuck on a proof as follows

Suppose $$f$$ is a smooth function. We define another function $$g(h)=\sup_{x}|f(x+h)-f(x)-f'(x)h-\frac{1}{2}f''(x)h^{2}|$$

Then we have $$g(h)\leq K \min \{h^{2},|h|^{3}\}$$ Where $$K$$ is a constant depending on $$f$$ alone.

We have $$g(h)\leq Kh^{2}$$ for $$h$$ large and $$g(h)\leq K|h|^{3}$$ for $$h$$ near $$0$$.

The book said we get the conclusion above by using mean value theorems of second and third orders. I don't know how we get that. I think if we use Taylor expansion of $$f$$ at point $$x$$, then we get $$f(x+h)=f(x)+f'(x)h+\frac{1}{2}f''(x)h^{2}+o(h^{2})$$ Where $$o(h^{2})=\frac{f'''(z)}{6}h^{3}$$ for some $$z \in (x,x+h)$$.

I don't understand why $$g(h)\leq Kh^{2}$$ works well for $$h$$ large. I think if $$h$$ is large, then $$\frac{f'''(z)}{6}h^{3}>Kh^{2}$$ for a constant $$K$$.

Could someone help me with it? Thanks in advance!

Can you provide some more details (if any) about how and/or if $$f$$ and its derivatives are bounded?
The issue here, I believe, is that $$z$$ in the expression $$f'''(z)$$ may depend on $$h$$. An alternative, for large values of $$h$$, assuming that $$f''$$ is a bounded function, is to do the following.
$$|f(x+h) - f(x) - f'(x)h - \frac{1}{2}f''(x)h^2| = |f'(x_1)h - f'(x)h - \frac{1}{2}f''(x)h^2|=$$ $$= |hf''(x_2)(x_1-x) - \frac{1}{2}f''(x)h^2|\leq h^2(|f''(x_2)| + \frac{1}{2}|f''(x)|)\leq K_1h^2,$$ where the first two equalities follow from the Mean Value Theorem and the inequality follows from the triangle inequality and $$|x_1-x|\leq h$$.
On the other hand, for small values of $$h$$, you may use the Taylor estimate. This time, $$z$$ depending on $$h$$ will not cause problems, since to determine $$K_2$$ so that $$g(h)\leq K_2|h|^3$$, you may simply take the $$\sup$$ over some bounded interval of $$h$$ (again, assuming that $$\sup_{x, h} |f'''(z_{x, h})|$$ exists).
Finally, it suffices to take $$K=\max\{K_1, K_2\}$$.