TITLE: Relationship between Stokes's theorem and the Gauss-Bonnet theorem
QUESTION [19 upvotes]: Stokes's theorem and the Gauss-Bonnet theorem are clearly very spiritually similar: they both relate the integral of a quantity $A$ over a region to the integral of some quantity $B$ over the boundary of the region, where $A$ can in some sense be thought of as a "curvature at one higher derivative" of $B$ or a closely related quantity.  Is either of these theorems a special case of the other?  If not, is there a more general theorem of which they are both special cases (which isn't too many levels higher up in abstraction)?
Edit: the answers to this follow-up question provide derivations of the Gauss-Bonnet theorem from Stokes's theorem in this paper, on pg. 105 of this textbook, and in Chapter 6 Section 1 of this textbook. Unfortunately, the derivations are too advanced for me to understand, as I haven't formally studied graduate-level differential geometry. I would appreciate any answer that summarizes the basic idea of the derivation.

REPLY [4 votes]: I thought it would be nice to have a complete proof of the Gauss Bonnet formula, which is a great achivment of mathematics. Starting from the begining, I introduce the Pfaff forms and show the way they work. Then I use them to get the structure equations of the surface, the moving frame of the surface and the general curve on a surface. Combining all results I arive to $(8)$ which is a classical formula of differential geometry. With the help of $(8)$ I prove Liouville's formula and then the Gauss Bonnet formula. I make no use, or explain, the Levi-Civita theory, since it may be skiped and demands a lot of material to be taken into acount. I have also add some notes of mine and prove the fundamental theorem of Gauss and the equations of Mainardi and Godazzi.
Assume a two-dimesional surface $\textbf{S}$ of the Eucledean space $E_3\cong \textbf{R}^3$ which is of class $C^3$. That is, the surface is given by 
$$
\overline{x}=\overline{x}(u,v)=\{x_1(u,v),x_2(u,v),x_3(u,v)\}\textrm{, }u,v\in D 
$$
and $x_{i}(u,v)\in C^3$,  $\overline{x}_u\times \overline{x}_v\neq \overline{0}$, $\overline{x}_u=\frac{\partial\overline{x}}{\partial u}$, $\overline{x}_v=\frac{\partial\overline{x}}{\partial v}$. 
In every point $P$ of the surface we attach a moving frame of three orthonormal vectors (that is $\{\overline{e}_1,\overline{e}_2,\overline{e}_3\}$ and  $\left\langle \overline{e}_i,\overline{e}_j\right\rangle=\delta_{ij}$), with the assumption that $\overline{n}=\overline{e}_3$ is orthonormal to the tangent plane of surface (in every $P$).Then there exist Pfaff (differentiatable) forms, $\omega_i$ and $\omega_{ij}$ such that
$$
d\overline{x}=\sum^{3}_{j=1}\omega_j\overline{e}_j\textrm{, }(\omega_3=0\Leftrightarrow \overline{n}=\overline{e}_3)
$$
$$
d\overline{e}_i=\sum^{3}_{j=1}\omega_{ij}\overline{e}_j\textrm{, }i=1,2,3
$$
This can be seen as:
$$
d\overline{x}=\{\partial_1 x_1du+\partial_2x_1dv,\partial_1 x_2du+\partial_2x_2dv,\partial_1 x_3du+\partial_2x_3dv\}
$$
and the Pfaff derivatives $\nabla_kf$ and $\nabla_k\overline{F}$ for any function $f$ or vector $\overline{F}$ (resp.) are defined as
$$
df=\sum^{3}_{k=1}(\nabla_kf)\omega_k=\sum^{3}_{k=1}\partial_kfdu_k.\tag 1
$$
Set now
$$
q_1=\frac{d\omega_1}{\omega_1\wedge\omega_2}\textrm{, }q_2=\frac{d\omega_2}{\omega_1\wedge\omega_2}.
$$
For to holds $(1)$ it must be
$$
\nabla_1\nabla_2f-\nabla_2\nabla_1f+q_1\nabla_1f+q_2\nabla_2f=0\textrm{, (condition)}.
$$
From the relations $d\left\langle\overline{e}_i,\overline{e}_j\right\rangle=0$, $d(d\overline{x})=\overline{0}$, $d(d\overline{n})=\overline{0}$, we get the structure equations of the surface:
$$
\omega_{ij}+\omega_{ji}=0\textrm{, }i,j=1,2,3,
$$
$$
d\omega_j=\sum^{3}_{i=1}\omega_i\wedge\omega_{ij}\textrm{, }j=1,2,3
$$
$$
d\omega_{ij}=\sum^{3}_{k=1}\omega_{ik}\wedge\omega_{kj}\textrm{, }i,j=1,2,3.
$$
Observe that $\omega_3=\omega_{11}=\omega_{22}=\omega_{33}=0$ and we can write
$$
d\overline{x}=\omega_1\overline{e}_1+\omega_2\overline{e}_2
$$
$$
d\overline{e}_1=\omega_{12}\overline{e}_2-\omega_{31}\overline{e}_3\tag 2
$$
$$
d\overline{e}_2=-\omega_{12}\overline{e}_1-\omega_{32}\overline{e}_3
$$
$$
d\overline{e}_3=\omega_{31}\overline{e}_1+\omega_{32}\overline{e}_2
$$
Moreover it is (structure equations):
$$
d\omega_1=\omega_{12}\wedge\omega_2
$$
$$
d\omega_2=-\omega_{12}\wedge\omega_1
$$
$$
\omega_1\wedge\omega_{31}+\omega_2\wedge\omega_{32}=0
$$
$$
d\omega_{12}=-\omega_{31}\wedge\omega_{32}\tag 3
$$
$$
d\omega_{31}=\omega_{12}\wedge\omega_{32}
$$
$$
d\omega_{32}=-\omega_{12}\wedge\omega_{31}
$$
If we write the connections (of $\omega_{ij}$ in terms of $\omega_i$):
$$
\omega_{12}=\xi\omega_1+\zeta \omega_2
$$
$$
\omega_{31}=-a\omega_1-b\omega_2
$$
$$
\omega_{32}=\eta\omega_1-c\omega_2
$$
We easily get (from the structure equations) $\xi=q_1$, $\zeta=q_2$, $\eta=-b$. Hence
$$
\omega_{12}=q_1\omega_1+q_2 \omega_2\tag 4
$$
$$
\omega_{31}=-a\omega_1-b\omega_2\tag 5
$$
$$
\omega_{32}=-b\omega_1-c\omega_2.\tag 6
$$
Assume now a ''strange'' operator $\theta$ such that
$$
\theta(A,B)=\left|
\begin{array}{cc}
 \nabla_1\textrm{  }\nabla_2\\
 A\textrm{  }B
\end{array}
\right|+q_1A+q_2B=\nabla_1B-\nabla_2A+q_1A+q_2B.
$$
This is not so ''strange'' since if $\omega=A\omega_1+B\omega_2$ and $f$ function of $u,v$, then 
$$
d(f\omega)=\theta(Af,Bf)\omega_1\wedge\omega_2=\left(\left|
\begin{array}{cc}
 \nabla_1f\textrm{  }\nabla_2f\\
 A\textrm{  }B
\end{array}
\right|+\theta(A,B)f\right)\omega_1\wedge\omega_2.
$$
By this way we have
$$
d\omega_{12}=\theta(q_1,q_2)\omega_1\wedge\omega_2=-K\omega_1\wedge\omega_2\textrm{, }K=ac-b^2\textrm{, (Gauss curvature)}
$$
$$
d\omega_{31}=\theta(-a,-b)\omega_1\wedge\omega_2=(q_2b-q_1c)\omega_1\wedge\omega_2=\frac{q_2b-q_1c}{K}\omega_{31}\wedge\omega_{32}
$$
and
$$
d\omega_{31}=q^{III}_1\omega_{31}\wedge\omega_{32}
$$
$$
d\omega_{32}=q^{III}_2\omega_{31}\wedge\omega_{32}
$$
Hence the theorem of Gauss is: 
$$
\theta(q_1,q_2)=-K=b^2-ac.
$$
The Mainardi and Godazzi equations are:
$$
\theta(a,b)=\left|
\begin{array}{cc}
 q_1\textrm{  }q_2\\
 a\textrm{  }b
\end{array}
\right|
$$
$$
\theta(b,c)=\left|
\begin{array}{cc}
 q_1\textrm{  }q_2\\
 b\textrm{  }c
\end{array}
\right|.
$$
The condition of Pfaff derivatrives becomes 
$$
\theta(\nabla_1f,\nabla_2f)=0
$$
and the Beltrami derivative is
$$
\Delta_2f=\theta(-\nabla_2f,\nabla_1f)
$$
$$
\theta(\overline{e}_1,\overline{e}_2)=0.
$$
... etc
Now assume a curve $\Gamma$ on the surface and its moving frame in $P\in\textbf{S}$ as follows: $\overline{t}$ is tangent of the curve in $P$, $\overline{n}$ is orthonormal of the surface in $P$ and $\overline{n}_g$ is orthonormal both in $\overline{t}$ and $\overline{n}$. Then we can easily see that exists $\frac{1}{\rho_g}$,$\frac{1}{R}$ and $\frac{1}{\tau_g}$ such that
$$
\frac{d\overline{t}}{ds}=\frac{\overline{n}_g}{\rho_g}+\frac{\overline{n}}{R}\tag 7
$$
$$
\frac{d\overline{n}_g}{ds}=-\frac{\overline{t}}{\rho_g}+\frac{\overline{n}}{\tau_g}
$$
$$
\frac{d\overline{n}}{ds}=-\frac{\overline{t}}{R}-\frac{\overline{n}_g}{\tau_g}.
$$
Where $s$ being the natural parameter of $\Gamma$. All $\frac{1}{\rho_g}$,$\frac{1}{R}$,$\frac{1}{\tau_g}$ are invariants. If we consider also the Frenet frame $\{\overline{t},\overline{h},\overline{b}\}$, which is such
$$
\frac{d\overline{t}}{ds}=\frac{h}{\rho}
$$
$$
\frac{d\overline{h}}{ds}=-\frac{\overline{t}}{\rho}+\frac{\overline{b}}{\tau}
$$
$$
\frac{d\overline{b}}{ds}=-\frac{\overline{h}}{\tau}
$$
and take the angle $\psi$ between $\overline{h}$ and $\overline{n}$, we get $(\psi\in[0,2\pi))$
$$
\frac{1}{\rho_g}=\frac{\sin(\psi)}{\rho}
$$
$$
\frac{1}{R}=\frac{\cos(\psi)}{\rho}
$$
$$
\frac{1}{\tau_g}=\frac{1}{\tau}+\frac{d\psi}{ds}.
$$
Gauss consider first the geodesic curvature $\frac{1}{\rho_g}$ of a curve in a surface. From (7) we have
$$
\frac{1}{\rho_g}=\left\langle\frac{d\overline{t}}{ds},\overline{n}_g\right\rangle.
$$ 
Also $
\overline{t}=\frac{d\overline{x}}{ds}\textrm{, }\frac{d\overline{t}}{ds}=\frac{d^2\overline{x}}{ds^2}\textrm{, }n_g=\overline{n}\times \overline{t}$
and 
$$
\frac{1}{\rho_g}=\left(\frac{d\overline{x}}{ds},\frac{d^2\overline{x}}{ds^2},\overline{n}\right)=\textrm{det}\left(\frac{d\overline{x}}{ds},\frac{d^2\overline{x}}{ds^2},\overline{n}\right)\tag 8
$$ 
Assuume now the surface curve coresponding to $\omega_2=0$ and we ask about its geodesic curvature. We have 
$$
d\overline{x}=\omega_1\overline{e}_1+\omega_2\overline{e}_2\Rightarrow \left(\frac{d\overline{x}}{ds}\right)_{\omega_2=0}=\frac{\omega_1}{ds}\overline{e}_1.
$$
From (2) we get
$$
\left(\frac{d^2\overline{x}}{ds^2}\right)_{\omega_2=0}=\frac{d}{ds}\left(\frac{\omega_1}{ds}\right)\overline{e}_1+\frac{\omega_1\omega_{12}}{ds^2}\overline{e}_2-\frac{\omega_1\omega_{31}}{ds^2}\overline{e}_3
$$
From (2) and (8) we find
$$
\left(\frac{1}{\rho_g}\right)_{\omega_2=0}=q_1.
$$
In the same manner for the curve $\omega_1=0$: 
$$
\left(\frac{1}{\rho_g}\right)_{\omega_1=0}=q_2
$$
Assume now a curve $\Gamma$ on a surface. Let $\overline{t}$ be its tangent vector and $\phi$ is the angle between $\overline{t}$ and $\overline{e}_1$ (the tangent $\overline{t}$ is on the $\{\overline{e}_1,\overline{e}_2\}$ plane). 
We have 
$$
\left(\frac{d\overline{x}}{ds}\right)_{\Gamma}=\overline{t}=\cos(\phi)\overline{e}_1+\sin(\phi)\overline{e}_2
$$
and
$$
\left(\frac{d^2\overline{x}}{ds^2}\right)_{\Gamma}=\frac{\omega_{12}+d\phi}{ds}(-\sin(\phi)\overline{e}_1+\cos(\phi)\overline{e}_2)-\frac{\omega_{31}\cos(\phi)+\omega_{32}\sin(\phi)}{ds}\overline{e}_3
$$
From relation (8) we get
$$
\frac{1}{\rho_g}=\frac{d\phi}{ds}+\frac{\omega_{12}}{ds}=\frac{d\phi}{ds}+q_1\frac{\omega_1}{ds}+q_2\frac{\omega_2}{ds}.
$$
But $\cos(\phi)=\frac{\omega_1}{ds}$, $\sin(\phi)=\frac{\omega_2}{ds}$. Hence we find
$$
\frac{1}{\rho_g}=\frac{d\phi}{ds}+q_1\cos(\phi)+q_2\sin(\phi)\textrm{, Liouville formula}.
$$
or in $\theta$ notation
$$
\frac{1}{\rho_g}=\theta(\cos(\phi),\sin(\phi)).
$$
Proof of the Gauss Bonnet Formula
From the formulas
$$
\frac{1}{\rho_g}=\frac{\omega_{12}}{ds}+\frac{d\phi}{ds},
$$
$$
d\omega_{12}=-\omega_{31}\wedge\omega_{32}=-K\omega_1\wedge\omega_2
$$
and Stokes theorem we get:
$$
\int_{\partial D}\frac{ds}{\rho_g}=\int_{\partial D}\omega_{12}+\int_{\partial D}\frac{d\phi}{ds}ds=\int\int_{D}d(\omega_{12})+\int_{\partial D}d\phi=
$$
$$
=-\int\int_{D}\frac{\omega_{31}\wedge\omega_{32}}{\omega_1\wedge\omega_2}\omega_1\wedge\omega_2+\int_{\partial D}d\phi=-\int\int_{D}K\omega_1\wedge\omega_2+2\pi,
$$
since 
$$
\int_{\partial_D}d\phi=2\pi.
$$
Hence we  get the Gauss Bonnet formula
$$
\int_{\partial D}\frac{ds}{\rho_g}+\int\int_{D}K\omega_1\wedge\omega_2=2\pi.
$$