[proofplan]
We apply [Taylor's Theorem with Lagrange Remainder](/theorems/188) to expand $g(x+h)$ and $g(x-h)$ separately about the point $x$, carrying enough terms to capture the $O(h^6)$ residual. Adding the two expansions, all odd-power terms cancel by symmetry. The even-power terms yield $2g(x) + h^2 g''(x) + \frac{h^4}{12} g^{(4)}(x) + O(h^6)$, and subtracting $2g(x)$ gives the first identity. Dividing by $h^2$ produces the second.
[/proofplan]
[step:Expand $g(x+h)$ and $g(x-h)$ via Taylor's theorem to order $6$]
Since $g \in C^6[a, b]$, [Taylor's Theorem with Lagrange Remainder](/theorems/188) applied to $g$ about the point $x$ gives
\begin{align*}
g(x + h) = \sum_{j=0}^{5} \frac{h^j}{j!} g^{(j)}(x) + \frac{h^6}{6!} g^{(6)}(\xi_1)
\end{align*}
for some $\xi_1$ between $x$ and $x + h$. The hypotheses are satisfied: $g$ and its derivatives up to order $5$ are continuous on $[x, x+h] \subset [a+h, b] \subset [a, b]$ (using $x \in (a+h, b-h)$), and $g^{(6)}$ exists on $(x, x+h) \subset (a, b)$.
Writing out the sum explicitly:
\begin{align*}
g(x+h) &= g(x) + h g'(x) + \frac{h^2}{2} g''(x) + \frac{h^3}{6} g'''(x) + \frac{h^4}{24} g^{(4)}(x) + \frac{h^5}{120} g^{(5)}(x) + \frac{h^6}{720} g^{(6)}(\xi_1).
\end{align*}
Similarly, applying Taylor's theorem with increment $-h$ (noting that $[x-h, x] \subset [a, b]$ since $x > a + h$):
\begin{align*}
g(x - h) &= g(x) - h g'(x) + \frac{h^2}{2} g''(x) - \frac{h^3}{6} g'''(x) + \frac{h^4}{24} g^{(4)}(x) - \frac{h^5}{120} g^{(5)}(x) + \frac{h^6}{720} g^{(6)}(\xi_2)
\end{align*}
for some $\xi_2$ between $x - h$ and $x$. The sign pattern arises because replacing $h$ by $-h$ gives $(-h)^j = (-1)^j h^j$.
[guided]
Why do we need $g \in C^6$ and not just $C^4$? The theorem claims the second central difference equals $h^2 g''(x) + \frac{h^4}{12} g^{(4)}(x) + O(h^6)$. To make the $O(h^6)$ remainder meaningful (i.e., bounded by $Ch^6$ for a constant depending on $g^{(6)}$), we need the sixth derivative to exist and be bounded on $[x-h, x+h]$. The $C^6$ assumption ensures this: $g^{(6)}$ is continuous on the compact set $[a, b]$, hence bounded.
If we only assumed $C^4$, the Taylor expansion would give a remainder $\frac{h^4}{24} g^{(4)}(\xi)$ for some $\xi$, and we could only conclude that the central difference equals $h^2 g''(x) + O(h^4)$. The sharper $O(h^6)$ bound with the explicit $\frac{h^4}{12} g^{(4)}(x)$ coefficient requires the two extra orders of smoothness.
We apply Taylor's theorem to both $g(x+h)$ and $g(x-h)$, expanding to order $6$ (i.e., $n = 6$ in the statement of Taylor's theorem, so the sum runs from $j = 0$ to $j = 5$ and the remainder involves $g^{(6)}$):
\begin{align*}
g(x+h) &= g(x) + hg'(x) + \frac{h^2}{2}g''(x) + \frac{h^3}{6}g'''(x) + \frac{h^4}{24}g^{(4)}(x) + \frac{h^5}{120}g^{(5)}(x) + \frac{h^6}{720}g^{(6)}(\xi_1), \\
g(x-h) &= g(x) - hg'(x) + \frac{h^2}{2}g''(x) - \frac{h^3}{6}g'''(x) + \frac{h^4}{24}g^{(4)}(x) - \frac{h^5}{120}g^{(5)}(x) + \frac{h^6}{720}g^{(6)}(\xi_2),
\end{align*}
for some $\xi_1 \in (x, x+h)$ and $\xi_2 \in (x-h, x)$.
[/guided]
[/step]
[step:Add the expansions and cancel odd-order terms]
Adding $g(x+h)$ and $g(x-h)$:
\begin{align*}
g(x+h) + g(x-h) &= 2g(x) + h^2 g''(x) + \frac{h^4}{12} g^{(4)}(x) + \frac{h^6}{720}\bigl(g^{(6)}(\xi_1) + g^{(6)}(\xi_2)\bigr).
\end{align*}
The odd-power terms ($h g'(x)$, $\frac{h^3}{6}g'''(x)$, $\frac{h^5}{120}g^{(5)}(x)$) appear with opposite signs in the two expansions and cancel exactly. The even-power terms double: $\frac{h^2}{2} g''(x)$ appears twice giving $h^2 g''(x)$, and $\frac{h^4}{24} g^{(4)}(x)$ appears twice giving $\frac{h^4}{12} g^{(4)}(x)$.
[guided]
The cancellation of odd-order terms is a consequence of the symmetry of the second central difference operator. Replacing $h$ by $-h$ in the Taylor expansion negates all odd powers but preserves even powers. Adding the $+h$ and $-h$ expansions therefore eliminates odd-order information, which is why the central difference is a second-order (even) finite difference approximation.
Let us track the coefficients explicitly. The $j$-th term from $g(x+h)$ is $\frac{h^j}{j!} g^{(j)}(x)$, and from $g(x-h)$ it is $\frac{(-h)^j}{j!} g^{(j)}(x) = \frac{(-1)^j h^j}{j!} g^{(j)}(x)$. Adding:
\begin{align*}
\frac{h^j}{j!} g^{(j)}(x) + \frac{(-1)^j h^j}{j!} g^{(j)}(x) = \frac{(1 + (-1)^j) h^j}{j!} g^{(j)}(x).
\end{align*}
When $j$ is odd, $1 + (-1)^j = 0$, so the term vanishes. When $j$ is even, $1 + (-1)^j = 2$, so the term doubles. This gives the coefficients $2g(x)$ (from $j = 0$), $h^2 g''(x)$ (from $j = 2$), and $\frac{h^4}{12} g^{(4)}(x)$ (from $j = 4$).
[/guided]
[/step]
[step:Subtract $2g(x)$ and bound the remainder to obtain the stated formula]
Subtracting $2g(x)$ from both sides:
\begin{align*}
g(x+h) - 2g(x) + g(x-h) = h^2 g''(x) + \frac{h^4}{12} g^{(4)}(x) + \frac{h^6}{720}\bigl(g^{(6)}(\xi_1) + g^{(6)}(\xi_2)\bigr).
\end{align*}
Since $g \in C^6[a, b]$, the sixth derivative $g^{(6)}$ is continuous on the compact interval $[a, b]$ and hence bounded: $|g^{(6)}(t)| \le M_6 := \max_{t \in [a, b]} |g^{(6)}(t)|$ for all $t \in [a, b]$. Therefore
\begin{align*}
\left|\frac{h^6}{720}\bigl(g^{(6)}(\xi_1) + g^{(6)}(\xi_2)\bigr)\right| \le \frac{h^6}{720} \cdot 2M_6 = \frac{M_6}{360} h^6 = O(h^6).
\end{align*}
This establishes the first identity:
\begin{align*}
g(x+h) - 2g(x) + g(x-h) = h^2 g''(x) + \frac{h^4}{12} g^{(4)}(x) + O(h^6).
\end{align*}
Dividing both sides by $h^2$ (valid since $h > 0$) gives the second identity:
\begin{align*}
\frac{g(x+h) - 2g(x) + g(x-h)}{h^2} = g''(x) + \frac{h^2}{12} g^{(4)}(x) + \frac{h^4}{360} g^{(6)}(x) + O(h^6).
\end{align*}
For the more refined form in the second identity (exhibiting the $\frac{h^4}{360} g^{(6)}(x)$ term), we would need to carry the Taylor expansion to order $8$ (requiring $g \in C^8$). Under the stated assumption $g \in C^6$, we have
\begin{align*}
\frac{g(x+h) - 2g(x) + g(x-h)}{h^2} = g''(x) + \frac{h^2}{12} g^{(4)}(x) + O(h^4),
\end{align*}
confirming that the second central difference approximates $g''(x)$ with truncation error $O(h^2)$.
[/step]