# Definition of gauge freedom in electromagnetism and general relativity

Gauge freedom is a freedom to redefine the fields of your theory in a way that doesn't change the physics. More specifically in a way that does not change the Lagrangian from which your fields were derived. It is not just any freedom that you have to choose something. Typically the gauge fields end up appearing as Lagrange multipliers in the Lagrangian that multiply constraints in the field theory.

General relativity is special (pardon the pun!) in the sense that (a) the metric is the primary field of the theory, and (b) the coordinate freedom is inherently wrapped as part that field itself. Not just the coordinates used to label values of the field, but actually the field. In particular, when you do a 3+1 decomposition, the $00$ and $0i$ components are specified by a lapse function and a shift vector. You can show that those, in turn, are in 1-to-1 correspondence with your freedom to choose coordinates.

More detail, for example, here: "Gauge Freedom" in GR

Since there is already another answer, this is just meant to provide a different perspective on the matter. For clarity, it might help to think about Kaluza-Klein theory, which brings the two kinds of gauge symmetry into the same picture, so that we can appreciate the difference. We start with an arbitrary five-dimensional metric $G_{MN}$, then postulate that one of the spatial dimensions is periodic, and the resultant circle has small enough radius that the world appears four dimensional. An observer in this apparently four-dimensional world (with metric $g_{\mu\nu}=G_{MN}, M,N=0,1,2,3$) will see the action of regular four dimensional gravity, and also U(1) electromagnetism. On the other hand, an observer who knows that the world is five dimensional will see no electromagnetism, just 5d general relativity. In other words, the 4d observer interprets the dynamics of the extra metric degrees of freedom ($G_{4M}, M=0,1,2,3$), in the language of a traditional gauge theory of electromagnetism. We now have a setting where we can ask the question, how do the 4d and the 5d observer see gauge freedom?

Well, as usual, we have the general coordinate invariance of general relativity, whether we are in four or five dimensions. However, this is not what gives rise to the U(1) gauge freedom that the 4d observer notices. This is a consequence of the 4d observer's inability to tell where he/she is on the circle of the hidden dimension. There is a U(1) freedom in choosing the location of the 4d observer on the compact dimension, and the physics observed is independent of this choice. Notice that this freedom is intimately related to the geometry of the compact dimension, and does not have the same origin as the gauge symmetry of general relativity. Of course, Kaluza Klein reduction (or some other compactification) has not been established to be the underlying reason behind the gauge symmetry we observe in our world, but in this case, it is a helpful mathematical tool to see the difference.

A final point: In classical field theories, since gauge symmetry is just a local symmetry, electromagnetism would have a "gauge symmetry" arising out of Lorentz transformations if the transformation parameter were allowed to vary locally. Of course, this would not be the U(1) symmetry of electromagnetism we know and love.