What is the Euler characteristic of a square? (Confusion with Gauss-Bonnet theorem)

The achievement of the GB theorem is to relate the total curvature of a surface $S$ that's bounded by some curve $c$ to (i) the topology of $S$, and (ii) the curvature "along $c$". For a closed surface, which has no boundary, the "curvature along $c$" term ends up being zero. So we get a relationship between the total curvature of $S$ and the topology of $S$ --- the thing you cite as the G-B theorem.

For surfaces with boundary, you have to include curvature along the boundary, and if the boundary has "corners", you have to include "curvature" there as well. You end up looking at three kinds of curvature:

  1. Curvature at "corners" of the boundary, i.e., 0-dimensional things

  2. Curvature along arcs of the boundary, i.e., 1-dimensional things

  3. Curvature over the interior of the surface, i.e., a 2-dimensional thing

And a kind of sum of these ends up being related to three kinds of topological objects:

  1. A count of 0-dimensional things (vertices)

  2. A count of 1-dimensional things (edges)

  3. A count of 2-dimensional things (faces)

providing an interesting symmetry between the two sums.

I'm not going to write out the formula, because getting it right requires getting orientations set up properly, and that's a task for which I personally need a blackboard rather than text. But the 0-dimensional contributions to curvature are "exterior angles" at the vertices. And my favorite "carry it in my pocket so I can remember" example consists of a triangle on the surface of the earth:

The north pole $N$ is one vertex. An edge extends from it through Greenwich, UK to a point $G$ on the equator. Another extends through Guatemala (longitude 90W) to a point $A$ on the equator. And the 90-degree arc of the equator from $A$ to $G$ completes the triangle. There are 3 vertices, 3 edges, one face, so $V-E+F = 1$. That's the topology side. On the "geometry side," the total curvature of a sphere is $4\pi$, so this triangle, which is $1/8$ of the sphere, has total curvature $\frac12 \pi$. Each edge of the triangle is a geodesic, so it has no curvature-along-the-surface. And at each vertex, the exterior angle is 90 degrees, i.e., $\pi/2$, for a total of $3\pi/2$ at the vertices. Adding in the surface curvature, and subtracting the (zero) edge-curvature, we get $2\pi$, which is indeed $2\pi (V - E + F)$, as expected.

If you shrink this triangle down until it's very small, say fitting on a piece of paper, then the surface-curvature term drops to essentially zero, and the three exterior angles are all $2\pi/3$, so again the sum is $2\pi$.

The first difficulty is that the version of the Gauss-Bonnet theorem you seem to be using is for compact 2-manifolds without boundary. A sphere is a compact 2-manifold without boundary. The boundary of a cube (six squares glued along their edges) is a compact 2-manifold without boundary. A square (taken to be closed since you say the vertices and edges are part of the manifold) is a compact 2-manifold with boundary.

In describing a manifold, one usually omits "without boundary". One usually includes "with boundary". The default state of a manifold is having no boundary.

There is a version of Gauss-Bonnett for compact 2-manifolds with boundary. $$ \int_M K \,\mathrm{d}A + \int_{\partial M} k_g \,\mathrm{d}s = 2 \pi \chi(M) \text{,} $$ where the first integral is of the Gaussian curvature over the surface and the second integral is the geodesic curvature on the boundary.

The closed square is homeomorphic to the closed disk. The boundary of the closed disk is a circle. The geodesic curvature of the circle boundary of a disk measures how much that curve closes up in like manner to a circle (much as the Gaussian curvature measures how much a surface closes up in like manner to the sphere). Of course, a circle closes up exactly the way one circle does, so this integral contributes $2\pi$ on the left-hand side when you study a closed disk or a closed square.

(There is a subtletly here. It is easy to conflate "extrinsic" curvature caused by a specific embedding with geodesic ("intrinsic") curvature. We can embed our circle along many revolutions of a helix, then outside the helix back to where we started. This embedding has a lot of curvature, but a circle is just a circle...)

A less critical difficulty is that a square only looks flat when you embed it a particular way. You can curl a square up into a tube -- which is not flat. You can even bend this tube around to make the ends meet -- which is again not flat.

If to a square we glue the upper and lower edges together [*] and then glue the two new circles together, we get a compact 2-manifold (without boundary). This object is a torus. Due to the gluings, all four vertices of the square have been glued into one vertex and both opposite pairs of edges of the square have been glued together. The result has one vertex, two edges, and one face, with Euler characteristic zero and total curvature zero.

This zero is what you were expecting for a flat square. It might be surprising that our embedding has to exhibit all the "curviness" of a torus to get zero Gaussian curvature -- but all that "curviness" is extrinsic curvature.

[*] We should be careful about how we do this gluing. For the first pair of edges we should glue so as to obtain an annulus not a Moebius strip. For the gluing of the circles, if we glue the same way as the first gluing, we obtain a torus. If we glue "the other way around", we get a Klein bottle. Of course, the Klein bottle with constant curvature is flat, so also has zero Gaussian curvature.