I want to prove $g(x+h) = g(x) + hg'(x) + \frac{1}{2} h^2 g''(x) + o(h^2)$ from the definition of limit, where x is a 1D variable, $o(h)$ is a quantity that depends on scalar h negligible compared to h as h goes to zero i.e. a small quantity
Attempt:
Recall definition of limit
$$\lim_{h\to 0} |\frac{g(x+h) - g(x) - hg'(x)}{h}| = |\frac{o(h)}{h}|$$ which turns into a more familiar form $$\lim_{h\to 0} |\frac{g(x+h) - g(x)}{h}| = g'(x)$$
Conclusion $$g(x+h) - g(x) = hg'(x) + o(h)$$
Taking a derivative wrt $x$ in above expression ields
$$g'(x+h) - g'(x) = hg''(x)$$
Sub in definition of derivative for both LHS terms
$$g(x+h^2) - g(x+h) - g(x+h) + g(x) = h^2 g''(x) + ho(h)$$
Therefore
$$g(x+h^2) = g(x) + 2hg'(x) + h^2 g''(x) + o(h^2)$$
dividing a 2 across
$$\frac{g(x+h^2)}{2} = \frac{g(x)}{2} + hg'(x) + \frac{1}{2} h^2g''(x) + o(h^2)$$
which is not quite... $$g(x+h) = g(x) + hg'(x) + \frac{1}{2} h^2 g''(x) + o(h^2)$$
the desired result
Can someone show me how to prove this?