Solution (source code)

= Solution

A <Chern number> turns local curvature data into a global integer. Let $E\to M$ be a complex <vector bundle> over a compact oriented manifold without boundary, with a <unitary connection> represented locally by an anti-Hermitian matrix-valued one-form $A$. Its <curvature form of a connection> is $F=dA+A\wedge A$. The <Chern-Weil theory> representative of the total <Chern class> is
$$
c(E,A)=\det\left(I+\frac{iF}{2\pi}\right)=1+c_1(E,A)+c_2(E,A)+\cdots.
$$
The coefficients are <closed differential forms>. They represent the images of integral <Chern classes> in <de Rham cohomology>. On an oriented $2r$-manifold, a product $c_{i_1}\cdots c_{i_s}$ with $i_1+\cdots+i_s=r$ pairs with the <fundamental class> to give a <Chern number>, an integer independent of the <unitary connection>.

For example,
$$
c_1=\frac{i}{2\pi}\operatorname{Tr}F,\qquad
c_2=\frac1{8\pi^2}\left\{\operatorname{Tr}(F\wedge F)-\operatorname{Tr}F\wedge\operatorname{Tr}F\right\}.
$$
For an $SU(N)$ bundle with $N\geq2$, $\operatorname{Tr}F=0$. On an oriented four-manifold the <Second Chern number> is then
$$
\boxed{q=\int_M c_2=\frac1{8\pi^2}\int_M\operatorname{Tr}(F\wedge F)\in\mathbb Z,}
$$
using the fundamental <matrix trace> and the stated anti-Hermitian convention. The trace-product correction is required for a general $U(N)$ bundle; it cannot simply be omitted. The sign of a physical <instanton number> also depends on the trace and <orientation> convention, so these conventions must accompany the formula.

The local origin of closure is the <Bianchi identity> $D_AF=0$ and the cyclic <matrix trace>: $d\operatorname{Tr}(F\wedge F)=0$. Independence of the <connection one-form> follows more concretely by varying a family $A_t$. Since $\dot F_t=D_{A_t}\dot A_t$, the <Chern-Weil connection transgression> is
$$
\frac{d}{dt}\operatorname{Tr}(F_t\wedge F_t)=2\,d\operatorname{Tr}(\dot A_t\wedge F_t).
$$
Its integral on a closed four-manifold is zero by the <Generalized Stokes theorem>. This proves connection independence of $q$; the integrality is the global <Chern class> statement, not merely a consequence of the local formula.

The local primitive of the <Second Chern form> is the <Chern-Simons three-form>
$$
\boxed{Y(A)=\frac1{8\pi^2}\operatorname{Tr}\left(A\wedge dA+\frac23A\wedge A\wedge A\right),\qquad dY=c_2.}
$$
Here we continue to use $SU(N)$, so $c_2=\operatorname{Tr}(F\wedge F)/(8\pi^2)$. The cubic coefficient is forced by the <exterior derivative>. In the graded cyclic <matrix trace>, $d\operatorname{Tr}(A^3)=3\operatorname{Tr}(dA\wedge A^2)$ and $\operatorname{Tr}(A^4)=0$, the latter because cycling one degree-one factor past the other three changes its sign. Therefore
$$
d\operatorname{Tr}(A\wedge dA+\tfrac23A^3)
=\operatorname{Tr}(dA\wedge dA+2dA\wedge A^2)
=\operatorname{Tr}(F\wedge F).
$$
Matrix-valued <differential forms> require both matrix order and the graded signs; treating all factors as commuting scalars would lose this derivation.

The <Chern-Simons three-form> depends on a local trivialization and is not itself gauge-invariant. For the <Yang-Mills gauge transformation> convention $A^g=g^{-1}Ag+g^{-1}dg$, set $u=g^{-1}dg$. The <gauge change of the Chern-Simons three-form> is
$$
Y(A^g)=Y(A)-\frac1{8\pi^2}d\operatorname{Tr}(dg\,g^{-1}\wedge A)
-\frac1{24\pi^2}\operatorname{Tr}(u\wedge u\wedge u).
$$
The last term is closed by the <Maurer-Cartan equation>. On a closed three-manifold its integral is an integer with the fundamental $SU(N)$ normalization. Consequently \b[the Chern-Simons integral is naturally defined modulo integers], while its exponential $\exp(2\pi i\ell\int Y)$ is invariant under large <Yang-Mills gauge transformations> for integer level $\ell$.

This also explains why a nonzero <Chern number> is compatible with $dY=c_2$: $Y$ need not be a globally defined three-form. On $S^4$, trivialize over two hemispheres and let $A_N=A_S^g$ on their common equator $\Sigma=S^3$, oriented as the boundary of the northern hemisphere. The <Generalized Stokes theorem> and the gauge-change formula give
$$
q=\int_\Sigma(Y(A_N)-Y(A_S))
=-\frac1{24\pi^2}\int_\Sigma\operatorname{Tr}(g^{-1}dg)^3.
$$
For $SU(2)\cong S^3$, this is the degree of the transition map, with compatible group <orientation>; for $SU(N)$ it is the corresponding integer in $\pi_3(SU(N))$. Thus the <Second Chern number> measures the obstruction to choosing one trivialization over the whole four-sphere.

A simpler <First Chern class> example is a line bundle over $S^2$. Write $A=-ia$ and choose local real potentials
$$
a_N=\frac{k}{2}(1-\cos\theta)d\phi,\qquad
a_S=-\frac{k}{2}(1+\cos\theta)d\phi.
$$
They have common curvature $da=(k/2)\sin\theta\,d\theta\wedge d\phi$, so $\int_{S^2}c_1=(2\pi)^{-1}\int da=k$. Their difference $a_N-a_S=k\,d\phi$ corresponds to the transition function $e^{-ik\phi}$, which is single-valued exactly when $k\in\mathbb Z$. This illustrates how the global integer arises from patching, rather than from an arbitrary flux normalization.

In physics, these constructions distinguish topological sectors of <Yang-Mills instantons> and relate four-dimensional characteristic densities to three-dimensional boundary actions. The <Chern-Simons three-form> itself gives a metric-independent gauge action in three dimensions. On a closed manifold its first variation is
$$
\delta\int Y=\frac1{4\pi^2}\int\operatorname{Tr}(\delta A\wedge F),
$$
so its classical equation is \b[$F=0$]. The common thread is that a local expression in the <connection one-form> records global topology: curvature produces the invariant <Chern number>, while its local <Chern-Simons three-form> primitive retains gauge and boundary information.