How is this integral form for the remainder for Taylor formula proved? Let $\varphi \colon \mathbb R^n \to \mathbb R, \varphi \in \mathcal C^2(\mathbb R^n)$. How is this formula proved?
$$
\varphi(x)-\varphi(x_0)=\langle D \varphi\left(x_0\right), x-x_0\rangle + \int_0^1\langle D^2 \varphi\left(x_0+(1-t)\left(x-x_0\right)\right)\left(x-x_0\right), x-x_0\rangle d t
$$
Note that in the first order case by the fundamental theorem we have:
$$
\varphi(x)-\varphi(x_0)=\int_0^1 \frac{ d\varphi(x_0+t(x-x_0))}{dt} d t= \int_0^1\langle D \varphi\left(x_0+t\left(x-x_0\right)\right), x-x_0\rangle d t
$$
How is the other case proved?
 A: I'll write $\varphi_i$ for the $i$-th partial derivative, and $\varphi_{ij}$ for the $j$-th partial derivative of the $i$-th partial derivative.
I will also write $v=x-x_0$, $g(t)=\varphi(x_0+tv)$, $g'(t)=\frac{\mathrm dg(t)}{\mathrm dt}$, $g_i(t)=\varphi_i(x_0+tv)$, $g'_i(t)=\frac{\mathrm dg(t)}{\mathrm dt}$, and $g_{ij}(t)=\varphi_{ij}(x_0+tv)$. As you have written above, we have $g'(t)=\sum_{i=1}^n\varphi_i(x_0+tv)v_i=\sum_ig_i(t)v_i$, where I substituted the definition of the inner product. Exactly the same argument gives $g_i'(t)=\sum_{j=1}^n\varphi_{ij}(x_0+tv)v_j=\sum_jg_{ij}(t)v_j$, meaning that in order to take the derivative we take the inner product of the gradient, this time of $\varphi_i$, and $v$. Now, we use integration by parts and apply the fundamental theorem to obtain
\begin{aligned}
\varphi(x)-\varphi(x_0)&=\int_{0}^1g'(t)\mathrm dt
=\int_0^1\sum_{i=1}^ng_i(t)v_i\mathrm dt
=\sum_{i=1}^nv_i\int_0^1g_i(t)\mathrm dt\\
&=\sum_{i=1}^nv_i\left(\int_0^1g_i(t)+g'_i(t)(t-1)\mathrm dt+\int_0^1g'_i(t)(1-t)\mathrm dt\right)\\
&=\sum_{i=1}^nv_i\left(\left[g_i(t)(t-1)\right]_{t=0}^1+\int_0^1\left[\sum_jg_{ij}(t)v_j\right](1-t)\mathrm dt\right)\\
&=\sum_{i=1}^nv_i\left(g_i(0)+\sum_jv_j\int_0^1g_{ij}(t)(1-t)\mathrm dt\right)\\
&=\sum_{i=1}^nv_ig_i(0)+\int_0^1(1-t)\sum_{i,j}v_iv_jg_{ij}(t)\mathrm dt.
\end{aligned}
Substituting the definitions recovers the inner product and the bilinear form in the integral (the matrix product with the inner product). However, we are missing the $1/2$ and have the $1-t$ instead. To my defense, this is exactly the integral form of the remainder, and I think that this is the intended question.
