The theorem applies in particular to compact surfaces without boundary, in which case the integral :\int_{\partial M}k_g\,ds can be omitted. It states that the total Gaussian curvature of such a closed surface is equal to 2 times the Euler characteristic of the surface. Note that for
orientable compact surfaces without boundary, the Euler characteristic equals , where is the
genus of the surface: Any orientable compact surface without boundary is topologically equivalent to a sphere with some handles attached, and counts the number of handles. If one bends and deforms the surface , its Euler characteristic, being a topological invariant, will not change, while the curvatures at some points will. The theorem states, somewhat surprisingly, that the total integral of all curvatures will remain the same, no matter how the deforming is done. So for instance if you have a sphere with a "dent", then its
total curvature is 4 (the Euler characteristic of a sphere being 2), no matter how big or deep the dent. If the compact surface has a boundary, the theorem states, again somewhat surprisingly, that the total curvature of the surface can be calculated from the curvature of just the boundary along with the surface's Euler characteristic. Compactness of the surface is of crucial importance. Consider for instance the
open unit disc, a non-compact
Riemann surface without boundary, with curvature 0 and with Euler characteristic 1: the Gauss–Bonnet formula does not work. It holds true however for the compact closed unit disc, which also has Euler characteristic 1, because of the added boundary integral with value 2. As an application, a
torus has Euler characteristic 0, so its total curvature must also be zero. If the torus carries the ordinary Riemannian metric from its embedding in , then the inside has negative Gaussian curvature, the outside has positive Gaussian curvature, and the total curvature is indeed 0. It is also possible to construct a torus by identifying opposite sides of a square, in which case the Riemannian metric on the torus is flat and has constant curvature 0, again resulting in total curvature 0. It is not possible to specify a Riemannian metric on the torus with everywhere positive or everywhere negative Gaussian curvature. == For triangles ==