Now comes the tricky part. The following is very important to understand, because it is a common feature to nearly all differential formulations of any sort of potential-based field theory, quantum or classical.
We know from our extensive study of elementary physics that there must be some freedom in the choice of and . The fields are physical and can be ``directly'' measured, we know that they are unique and cannot change. However, they are both defined in terms of derivatives of the potentials, so there is an infinite family of possible potentials that will all lead to the same fields. The trivial example of this, familiar from kiddie physics, is that the electrostatic potential is only defined with an arbitrary additive constant. No physics can depend on the choice of this constant, but some choices make problems more easily solvable than others. If you like, experimental physics depends on potential differences, not the absolute magnitude of the potential.
So it is now in grown-up electrodynamics, but we have to learn a new term. This freedom to add a constant potential is called gauge freedom and the different potentials one can obtain that lead to the same physical field are generated by means of a gauge transformation. A gauge transformation can be broadly defined as any formal, systematic transformation of the potentials that leaves the fields invariant (although in quantum theory it can be perhaps a bit more subtle than that because of the additional degree of freedom represented by the quantum phase).
As was often the case in elementary physics were we freely moved around the origin of our coordinate system (a gauge transformation, we now recognize) or decided to evaluate our potential (differences) from the inner shell of a spherical capacitor (another choice of gauge) we will choose a gauge in electrodynamics to make the solution to a problem as easy as possible or to build a solution with some desired characteristics that can be enforced by a ``gauge condition'' - a constraint on the final potentials obtained that one can show is within the range of possibilities permitted by gauge transformations.
However, there's a price to pay. Gauge freedom in non-elementary physics is a wee bit broader than ``just'' adding a constant, because gradients, divergences and curls in multivariate calculus are not simple derivatives.
must be unique, but many
that correspond to any given
. Suppose we have one such
can obviously make a new
that has the same curl by adding
the gradient of any scalar function . That is:
We see that:
Note that it probably isn't true that can be any scalar function - if this were a math class I'd add caveats about it being nonsingular, smoothly differentiable at least one time, and so on. Even if a physics class I might say a word or two about it, so I just did. The point being that before you propose a that isn't, you at least need to think about this sort of thing. However, great physicists (like Dirac) have subtracted out irrelevant infinities from potentials in the past and gotten away with it (he invented ``mass renormalization'' - basically a gauge transformation - when trying to derive a radiation reaction theory), so don't be too closed minded about this either.
It is also worth noting that this only shows that this is a possible gauge transformation of , not that it is sufficiently general to encompass all possible gauge transformations of . There may well be tensor differential forms of higher rank that cannot be reduced to being a ``gradient of a scalar function'' that still preserve . However, we won't have the algebraic tools to think about this at least until we reformulate MEs in relativity theory and learn that and are not, in fact, vectors! They are components of a second rank tensor, where both and combine to form a first rank tensor (vector) in four dimensions.
This is quite startling for students to learn, as it means that there are many quantities that they might have thought are vectors that are not, in fact, vectors. And it matters - the tensor character of a physical quantity is closely related to the way it transforms when we e.g. change the underlying coordinate system. Don't worry about this quite yet, but it is something for us to think deeply about later.
Of course, if we change
in arbitrary ways,
will change as
well! Suppose we have an
and that leads to some particular
To accomplish this, as we shift
we must also
shift to . If we substitute an unknown into the
We see that in order to make
(so it doesn't vary with the
gauge transformation) we have to subtract a compensating piece to
to form :
In summary, we see that a fairly general gauge transformation that
is the following pair of simultaneous transformations of and
. Given an arbitrary
(but well-behaved) scalar function :
As noted at the beginning, we'd like to be able to use this gauge freedom in the potentials to choose potentials that are easy to evaluate or that have some desired formal property. There are two choices for gauge that are very common in electrodynamics, and you should be familiar with both of them.