Muhammad Haris Rao
Theorem: Let $f : \left( a, b \right) \longrightarrow \mathbb{R}$ be an $n + 1$-times continuously differentiable functions, and let $c \in \left( a , b \right)$. Then for any $x_0 \in \left( a, b \right)$ with $x_0 \ne c$, there exists a real number $\xi$ in the closed interval between $x_0$ and $x$ such that \begin{align*} f\left( x_0 \right) &= \sum_{k = 0}^n \frac{f^{(k)}(c) \left( x_0 - c \right)^k}{k!} + \frac{f^{(n + 1)} (\xi) (x_0 - c)^{n + 1}}{(n + 1)!} \end{align*}
Proof. Define $M \in \mathbb{R}$ to be such that \begin{align*} f\left( x_0 \right) &= \sum_{k = 0}^n \frac{f^{(k)}(c) \left( x_0 - c \right)^k}{k!} + \frac{M (x_0 - c)^{n + 1}}{(n + 1)!} \end{align*} Set $g : \left( a, b \right) \longrightarrow \mathbb{R}$ as \begin{align*} g\left( x \right) &= f(x) - \sum_{k = 0}^n \frac{f^{(k)}(c) \left( x - c \right)^k}{k!} - \frac{M (x - c)^{n + 1}}{(n + 1)!} \end{align*} Observe that $g$ is $(n + 1)$ times differentiable with the $\ell$th derivative being \begin{align*} g^{(\ell)} (x) &= f^{(\ell)}(x) - \sum_{k = \ell}^n \frac{f^{(k)}(c) \left( x - c \right)^{k - \ell}}{(k - \ell)!} - \frac{M (x - c)^{n + 1 - \ell}}{(n + 1 - \ell)!} \end{align*} Evidently, we have $g^{(\ell)}(c) = 0$ for $\ell \in \{ 0, 1, \cdots, n \}$, and $g^{(n + 1)}(c) = f^{(n + 1)}(c) - M$. See also that $g(x_0) = 0$ by the choice of $M$. Hence, by mean value theorem, there is $\xi_1 \in \mathbb{R}$ between $c$ and $x_0$ such that the derivative of $g$ vanishes at that point. That is, $g^\prime(\xi_1) = 0$. Continuing recursively for $\ell \in \{ 1, 2, \cdots, n - 1 \}$, if we are given $\xi_\ell \in \mathbb{R}$ between $c$ and $x_0$ such that $g^{(\ell)}(\xi_\ell) = 0$, we have using the fact that also $g^{(\ell)}(0) = 0$ that there is $\xi_{\ell + 1}$ between $c$ and $\xi_\ell$, and hence also between $c$ and $x_0$ such that $g^{(\ell + 1)}(\xi_{\ell + 1}) = 0$. Thus, we have $\xi_n$ between $c$ and $x_0$ such that \begin{align*} 0 &= g^{(n)} \left( \xi_n \right) = f^{(n)}(\xi_n) - f^{(n)}(c) - M (\xi_n - c) \end{align*} A simple rearrangement gives \begin{align*} M &= \frac{f^{(n)}\left( \xi_n \right) - f^{(n)} \left( c \right)}{\xi_n - c} \end{align*} By the mean value theorem, there is $\xi \in \mathbb{R}$ between $c$ and $\xi_n$, and hence between $c$ and $x_n$ such that $M = f^{(n + 1)}\left( \xi \right)$. Thus, \begin{align*} f\left( x_0 \right) &= \sum_{k = 0}^n \frac{f^{(k)}(c) \left( x_0 - c \right)^k}{k!} + \frac{f^{(n + 1)} \left( \xi \right) (x_0 - c)^{n + 1}}{(n + 1)!} \end{align*}