# Note on generating a divergence identity

Special thanks to Ben Mares for coming up with this identity.

## Motivation

The motivation for this calculation comes from Bochner’s formula for harmonic functions. On a manifold with metric , a function is harmonic if , where is the Laplacian and is the Levi-Civita connection compatible with . Let’s define , which is divergence-free, . Then Bochner’s formula says

Why is this formula interesting? Well, the left hand side is a total divergence, so it will vanish if integrated over a manifold without boundary (or if the boundary term vanishes). Meanwhile, if the metric is Riemannian, then the first term on the right hand side is non-negative; and the sign of the final term is determined by the eigenvalues of the Ricci tensor. This formula is useful for estimating energy bounds.

Another viewpoint on this formula is to rearrange it as an identity
for , which looks like a kinetic term. Then Bochner’s
formula says: *is a total divergence, modulo
lower-derivative curvature terms*.

A natural question is: does this divergence identity generalize?

## Generating the divergence identity

From here forward let’s drop the divergence-free condition, so may be non-zero (though the identities hold just as well for vanishing ).

It turns out that we can generalize the above identity by constructing carefully anti-symmetrized tensor products of the tensor . These expressions arise in the expansion of the characteristic polynomial of (the characteristic polynomial made an appearance in an earlier note that I wrote). The characteristic polynomial of an matrix is given by , where is the identity matrix.

The term proportional to is homogeneous of degree in the coefficients of . Wikipedia writes this as , which is a bit abstruse. Let’s clarify by first forming the -th tensor product,

Now antisymmetrize on all the i and/or j indices, and completely contract the upper indices with all of the lower indices. Let’s call this ,

It is important to remember that the antisymmetrization happens first, before contraction.

This question is now: *is a total divergence, modulo
lower-derivative curvature terms*? The answer is yes (why else would
I have written these notes).

To see this, let’s define the vector

What happens when we take the divergence of this vector? Using the product rule, we will generate terms (each of which is actually antisymmetrized over the upper indices, so it’s really terms).

The first of these terms, when hits , is precisely . What about the remaining terms, when hits , ? That is, a term of the form

The crucial observation is that the two derivative indices
are contracted with the *completely anti-symmetric* block of indices
. This means that we are free to transfer
over the antisymmetry onto the double derivative indices
; and this makes it a commutator of derivatives and thus a
curvature term.

Thus we arrive at the following divergence identity,

where the vertical bars around mean that we do not antisymmetrize that index. Again it is important to antisymmetrize over the upper indices first, and trace second; so the Riemann does not automatically become a Ricci.

Thus we have established that is a total divergence, modulo lower-derivative curvature terms.

We can give a few examples, but the expressions get very large very quickly. For , we have

which is a way of re-writing Bochner’s formula Eq. \eqref{eq:bochner}. For , we have

For , we have the intimidating

Obviously I would recommend using xTensor to do these computations. My notebook to do these calculations is available upon request.