I am trying to learn about basic characteristic classes and Generalized Gauss-Bonnet Theorem, and my main reference at the moment is [*From calculus to cohomology*](https://books.google.com/books?id=CwQ-L9MOGUwC&lpg=PP1&pg=PP9#v=onepage&q&f=false) by Madsen & Tornehave. I know the statement of the theorem is as follows:



> 
> Let $M$ be an even-dimensional compact, oriented smooth manifold, $F^{∇}$ be the curvature of the connection ∇ on a smooth vector bundle $E$.
> 
> 
> $$∫\_{M}\mathrm{Pf}\Big(\frac{−F^{∇}}{2\pi}\Big)=χ(M^{2n}).$$
> 
> 
> 


My questions are:


* How does this relate to counting (with multiplicities) the number of zeros of generic sections of the vector bundle?
* Also, are there other good references for learning this topic?



On the generalized Gauss-Bonnet theorem
When $E\to M$ is an oriented vector bundle of rank $2n$ over a 
compact manifold $M$, it has a well-defined *de Rham Euler class* $e(E)$ 
in $H^{2n}\_{dR}(M)$, and a representative $2n$-form for $e(E)$ 
can be computed as follows: 


Fix a positive definite inner product $\langle,\rangle$ on $E$. (Since any two such inner products are equivalent under automorphisms of $E$, it doesn't matter which one.) Let $\nabla$ be a $\langle,\rangle$-orthogonal connection on $E$, and let $K^\nabla$ denote the curvature of $\nabla$, regarded as a $2$-form with values in ${\frak{so}}(E)$. Let $e(\nabla) = \mathrm{Pf}(K^\nabla/2\pi)$, which is a well-defined $2n$-form on $M$. (N.B.: The definition of $\mathrm{Pf}$ requires both the inner product and the orientation of $E$.) Then $e(E)=\bigl[e(\nabla)\bigr]\in H^{2n}\_{dR}(M)$. (That $\bigl[e(\nabla)\bigr]$ is independent of the choice of $\nabla$ 
is one of the first results proved in Chern-Weil theory.)


If $M$ is a compact, oriented $2n$-manifold, then the value of $e(E)$ on $[M]$, the fundamental class of $M$, can be computed as follows: Let $Y$ be a section of $E$ that has only a finite number of zeroes. (By Whitney transversality, the generic section of $E$ satisfies this condition.) Using the orientations of $E$ and $M$, one defines the *index* 
of an isolated zero $z$ of $Y$, which is an integer $\iota\_Y(z)$. Then
$$
e(E)\bigl([M]\bigr) = \int\_M e(\nabla) = \sum\_{z\in Z}\ \iota\_Y(z).
$$
By the Poincaré-Hopf Theorem, when $E = TM$ (as oriented bundles), 
this sum is equal to the Euler characteristic of $M$, which explains
why $e(E)$ is called the Euler class of $E$.


To prove this result, one chooses an orthogonal connection $\nabla$ on $E$ that depends on $Y$ and whose Euler form $e(\nabla)$ is easy to evaluate explicitly. This can be done as follows: 


Let $Z\subset M$ be the (finite) zero set of $Y$ and let $U\subset M$ be an open neighborhood of $Z$ that consists of disjoint, smoothly embedded $2n$-balls, one around each element of $Z$. Let $\phi$ be a smooth function on $M$ that is identically equal to $1$ on an open neighborhood of $Z$ and whose support $K\subset U$ is a disjoint union of closed, smoothly embedded balls, 
one around each element of $Z$. 


Now, $E$ is trivial over $U$, 
so choose a positively oriented $\langle,\rangle$-orthonormal basis of sections 
$s\_1,\ldots, s\_{2n}$ of $E$ over $U$ and let $\nabla\_1$ be the (flat) connection on $E\_U$ for which these sections are parallel. Let $\bar Y = Y/|Y|$ be the normalized unit section defined on $M\setminus Z$, and define a second connection on $U$ by
$$
\nabla\_2 s = \nabla\_1 s 
+ (1{-}\phi)\bigl( \bar Y\otimes \langle s,\nabla\_1 \bar Y\ \rangle
- \langle s,\bar Y\ \rangle\ \nabla\_1\bar Y\ \bigr).
$$
It is easily verified that this formula does define a connection on $U$, 
that $\nabla\_2$ is $\langle,\rangle$-orthogonal, and that,
outside of $K$ (i.e., where $\phi\equiv0$), the vector field $\bar Y$ is 
$\nabla\_2$-parallel. (Note that, because $\phi\equiv1$ near $Z$, where $Y$ is
not defined, this formula does extend smoothly across $Z$, agreeing with $\nabla\_1$
on a neighborhood of $Z$.)


Meanwhile, on $M\setminus K$, write $E$ as a $\langle,\rangle$-orthogonal direct sum $E = \mathbb{R}\cdot Y \oplus E'$ and choose a $\langle,\rangle$-compatible connection $\nabla\_3$ on $E$ over $M\setminus K$ that preserves this splitting. Using a partition of unity subordinate to the open cover of $M$ defined by $U$ and $M\setminus K$, construct a $\langle,\rangle$-orthogonal connection $\nabla$ that agrees with $\nabla\_2$ on $K$ and with $\nabla\_3$ on $M\setminus U$, and for which the line bundle $\mathbb{R}\cdot Y\subset E$
is parallel on $M\setminus K$.


Now, on $M\setminus K$, the curvature of $\nabla$ takes values in ${\frak{so}}(E')\subset{\frak{so}}(E)$, so $e(\nabla) = \textrm{Pf}\bigl(K^{\nabla}/(2\pi)\bigr)$ vanishes identically outside of $K$. It suffices now to evaluate the
integral of $e(\nabla)$ over a single component $B$ of $K$, which may be 
assumed to be the unit ball in $\mathbb{R}^{2n}$, so restrict attention to
this case. Write $\bar Y = s\_1 u\_1 +\cdots + s\_{2n}\ u\_{2n}$, and note that,
on $B$, one has, by definition,
$$
\nabla s\_i = \nabla\_2 s\_i 
= \sum\_{j=1}^{2n} s\_j\otimes (1{-}\phi)(u\_j\ du\_i - u\_i\ du\_j),
$$
i.e., the connection $1$-forms of $\nabla$ in this basis are 
$\omega\_{ij} = (1{-}\phi)(u\_i\ du\_j - u\_j\ du\_i)$.  

Using the identity ${u\_1}^2 +\cdots + {u\_{2n}}^2 = 1$, 
the curvature forms are easily computed to satisfy
$$
\Omega\_{ij} = d\omega\_{ij} + \omega\_{ik}\wedge\omega\_{kj}
= (1{-}\phi^2)\ du\_i\wedge du\_j - d\phi\wedge(u\_i\ du\_j - u\_j\ du\_i).
$$
At this point, you have to know the definition of the Pfaffian. (I'll wait while you look it up.) Using the fact that the result has to be invariant under $SO(2n)$-rotations, it is easy to show that, on $B$, one has
$$
e(\nabla) = \textrm{Pf}\left(\frac{\Omega}{2\pi}\right)
= c\_n (1{-}\phi^2)^{n-1} d\phi\wedge u^\*(\Upsilon)
$$
for some universal constant $c\_n$ and where $\Upsilon$ is the $SO(2n)$-invariant $2n$-form 
of unit volume on $S^{2n-1}\subset\mathbb{R}^{2n}$ and $u: B\setminus z\to S^{2n-1}$
is $u = (u\_1,\ldots, u\_{2n})$. (I'll let you evaluate the constant $c\_n$. This can be done in a number of ways, but it's essentially a combinatorial exercise.) In particular, 
$$
e(\nabla) = d\bigl(P\_n(1{-}\phi)\ u^\*(\Upsilon)\bigr) 
$$
where $P\_n(t)$ is the polynomial in $t$ (of degree $2n{-}1)$) that vanishes at $t=0$ and 
satisfies $P'\_n(1{-}t) = -c\_n(1{-}t^2)^{n-1}$. By Stokes' Theorem, one has
$$
\int\_B e(\nabla) = P\_n(1) \int\_{\partial B}u^\*(\Upsilon) 
 = P\_n(1)\ \textrm{deg}(u:\partial B\to S^{2n-1}) = P\_n(1)\ \iota\_Y(z)
$$
Thus, it follows that there is a universal constant $C\_n = P\_n(1)$ such that
$$
e(E)\bigl([M]\bigr) = \int\_M e(\nabla) = C\_n \ \sum\_{z\in Z}\ \iota\_Y(z).
$$
Now, $C\_1 = 1$, as one can show by computing with the constant curvature metric on the $2$-sphere and noting that, for $Y$ the gradient of the height function on $S^2$, the sum of the indices is $2$. Finally, by properties of the Pfaffian and the index, one sees that,
if such a formula as above is to hold, then one must have $C\_{n+m}=C\_nC\_m$. Thus, $C\_n=1$ for all $n$, and the formula is proved.


(Of course, one can avoid these final tricks for evaluating the constants by carefully doing the combinatorial exercise, but I'll leave that to the curious.)


