Take a local gauge transformation acting on the adjoint field by . The connection convention is compatible with
Indeed, differentiating gives the extra commutator , exactly cancelled by the inhomogeneous term in the transformed gauge potential.
For a direct proof of the Yang-Mills gauge transformation of curvature, put and . Differentiation gives
Substituting into the Yang-Mills field strength cancels all terms involving and leaves
This direct calculation also applies when the adjoint action has a kernel.
Expand . The mixed second derivatives of cancel in pairs. The first-derivative terms from differentiating cancel the terms from . The remaining sum is
by the Jacobi identity. Thus the gauge-theory Bianchi identity is
For the variation of the Yang-Mills action, write . Differentiating the curvature gives . Invariance of the Killing form implies
This is invariant integration by parts for a gauge covariant derivative. Using symmetry of the Killing form, antisymmetry of , and compactly supported variations,
Since the Killing form of a semisimple Lie algebra is nondegenerate and the variations are arbitrary, the Yang-Mills equations are
For the constant Yang-Mills theta term, symmetry under exchanging the two antisymmetric index pairs gives
up to the boundary variation of the Yang-Mills theta term. Contracting the gauge-theory Bianchi identity with makes the last integrand vanish. Therefore a constant theta term does not alter the bulk Yang-Mills equations: . Its variation is a boundary term, so this conclusion uses compact support or boundary conditions that remove that term.
Finally apply to the gauge-theory Bianchi identity, obtaining
The adjoint covariant derivative obeys . Commute past the other derivative. The differentiated divergences vanish by the Yang-Mills equations, leaving
In the last line the second commutator needs its sign tracked carefully: directly,
Thus the simplified sum gives the covariant wave equation for the Yang-Mills field strength
All spacetime derivatives and index manipulations here use the fixed flat metric.
Absorb the gauge coupling into a matrix-valued connection 1-form, and use
for an adjoint-valued -form . The matrix trace supplies the usual invariant nondegenerate pairing of the Lie algebra, and the spacetime metric defining the Hodge star is fixed during the gauge-field variation. Since and the two-form Hodge pairing is symmetric,
For variations fixed at the boundary, the Yang-Mills equations are therefore
They accompany, rather than replace, the gauge-theory Bianchi identity , which follows directly by substituting and using .
Fix the Yang-Mills gauge transformation convention
Taking gives
The curvature variation also follows from . If the group parameter is defined with the opposite sign, both displayed infinitesimal variations change sign together.
The Hodge star acts only on spacetime indices, so . Consequently
This proves exact off-shell gauge invariance, with no surviving boundary term, even for a gauge parameter nonzero at the boundary. It does not require the Yang-Mills equations.
One can check the surface terms explicitly in the integrated variation. The Lie-algebra-valued four-form vanishes: writing , the coefficients are symmetric in , and multiply the antisymmetric commutator . Thus , and the gauge substitution in the variation gives
The last equality is Stokes theorem on the closed boundary; equivalently the cancellation is already pointwise in the preceding derivation. Keeping only the first surface term from an arbitrary variation would incorrectly produce a gauge boundary term.
For the additional Yang-Mills theta term, denote its coefficient-free integral by . Its gauge variation is again pointwise zero:
Under an arbitrary connection variation, its boundary variation of the Yang-Mills theta term is
The bulk term vanishes by the gauge-theory Bianchi identity. Therefore adding a constant multiple of does not change the bulk Yang-Mills equations. With fixed boundary potential, it also leaves the usual variational problem unchanged. If boundary variations are allowed, it changes the boundary term: has surface variation , so compatible boundary conditions or a boundary action must account for that change.
Locally , the unnormalized Chern-Simons 3-form identity. That three-form need not be globally defined on a nontrivial bundle, so absence of a bulk variation does not force itself to vanish. Its exact gauge invariance is the curvature-conjugation calculation above, independently of the choice of local gauge potential.