In which contexts are gauge theories applied? According to the book Quantum Field Theory for the Gifted Amateur, on page 128 they say 

A theory which had a field $A^\mu(x)$ introduced to produce an invariance with respect to local transformations is known as a gauge theory. The field $A^\mu(x)$ is known as a gauge field.  

I have tried to learn more about gauge theory, but I am struggling to understand the context behind where the idea is coming from. 
My Question:
What kind of systems have these invariants? Is this something that is limited to particle physics or do we see this in macroscopic systems? If so, can you provide an example?
 A: The general idea is that you are able, starting from a Lagrangian $\mathscr L$ invariant under some global (i.e. not space-time dependent) transformation, to "derive" the interaction of the field described by that theory solely by requiring that the Lagrangian is still invariant when the transformation is allowed to be local (meaning that the parameter defining the transformation is space-time dependent).
A simple example is QED. Consider the Lagrangian density for a massive Dirac field $\psi$, which reads:
$$ \tag 1 \mathscr{L} = \bar \psi (i \gamma^\mu \partial_\mu - m) \psi.$$
Note that this Lagrangian is invariant under the global transformation
$$ \tag{2} \psi(x) \rightarrow e^{i\alpha} \psi(x),$$
$$ \tag{2'} \bar \psi(x) \rightarrow e^{-i\alpha} \bar \psi(x),$$
where $\alpha_0 \in \mathbb{R}$ is a number (as in not a function).
But if you now try to generalize the transformations (2) and (2'), allowing $\alpha$ to depend on the space-time point, you easily notice the Lagrangian (1) is no longer invariant.
It turns out that if you add to the Lagrangian density an additional term, writing it as
$$ \tag 3 \mathscr{L}
= \bar \psi (i \gamma^\mu \partial_\mu - m) \psi
- ieA_\mu \bar \psi \gamma^\mu \psi,$$
where $A^\mu(x)$ is a field with certain transformation properties under the phase transformation (2), then you obtain that (3) is invariant under the more general gauge transformations
$$ \tag{4} \psi(x) \rightarrow e^{i\alpha(x)}\psi(x),$$
$$ \tag{4'} \bar \psi(x) \rightarrow e^{-i\alpha(x)} \bar \psi(x),$$
$$ \tag{5} A_\mu(x) \rightarrow A_\mu(x) + \frac{1}{e} \partial_\mu \alpha(x).$$
$A^\mu$ is nothing else that the photon field, and you thus see that the requirement of gauge invariance under the local phase transformations (also called U(1) transformations) written above reproduces (as in: is equivalent to) the electromagnetic interaction between charged fermions/antifermions, like electrons and positrons.
In a similar fashion, the requirement of gauge symmetry is used to "derive" all of the fundamental forces:


*

*In QCD requiring invariance under the $SU(3)$ gauge group introduces the gluons as carriers of the strong force;

*Weak interactions are introduced requiring invariance under the $SU(2)_W$ gauge group, and this produced the coupling of left-handed leptons with the $W^\pm$ and $Z^0$ gauge fields;


And these are just a couple of examples taken from a really broad subject.

Other Phys.SE questions related to the subject are:


*

*About the application of gauge theories in gravity: To which extent is general relativity a gauge theory? and links therein

*About gauge theories: Why gauge theories have such a success?

*More generically about gauge freedom: What is a gauge in a gauge theory?
