# How the lagrangian density is found?

In Classical Mechanics one usually considers the Lagrangian as $L = K - U$ where $K$ is the kinetic energy of the system and $U$ is the potential energy. One then gets the Euler-Lagrange equations and everything is fine: if we have a system we can plug in the kinetic energy and potential and find the Lagrangian for it.

The point is that I've already seen a different object: the Lagrangian density $\mathcal{L}$ which is on the other hand a $4$-form on space-time. The main difference being that the action is the integral of $L$ over time and the integral of $\mathcal{L}$ over all space-time.

The problem is that apart from that, no relation between $\mathcal{L}$ and other quantities is given at first. So for instance, in electrodynamics we have

$$\mathcal{L} = -\dfrac{1}{4\mu_0}F^{\alpha \beta}F_{\alpha\beta}-A_\alpha J^\alpha$$

Where $A$ is the $4$-potential and $F=dA$ is the electromagnetic tensor. It is not clear at first, why this is the right Lagrangian density in the sense that it becomes a little hard to see where it comes from.

So, the Lagrangian itself is just $K-U$, but what about the Lagrangian density? How does one find it?

The slightly more difficult answer is that the Lagrangian density has to be gauge invariant and a Lorentz scalar. The objects we have at hand are $F_{\alpha\beta}$, $A_\alpha$ and $J^\alpha$. Now, something like $A^\alpha A_\alpha$ is out, because it is not gauge invariant, $A^\alpha A^\beta F_{\alpha\beta}$ and $J^\alpha J^\beta F_{\alpha\beta}$ are 0 (symmetric tensor contracted with an antisymmetric), $J^\alpha A^\beta F_{\alpha\beta}$ is not gauge invariant. $F_{\alpha\beta}F^{\alpha\beta}$ on the other hand is gauge invariant (because $F_{\alpha\beta}$ is). $A_\alpha J^\alpha$ is not gauge invariant, but the extra term is a total divergence, so the action $S = \int d^4 \mathcal L$ will be gauge invariant.
So $$\mathcal L = aF^{\alpha\beta}F_{\alpha\beta} - bA_\alpha J^\alpha$$ for some constants $a, b$ is the simplest interacting Lagrangian density. You can fix the constants by matching them to the ones in Maxwell's equations.