One of the most foundational concepts in physics is Noether's theorem, which states that symmetries of the laws of nature mathematically imply conserved quantities. Thus conservation of energy is revealed as a logical consequence of the fact that the laws of physics are timeshift-invariant; conservation of momentum is similarly understood to be a consequence of the spatial-translation invariance of the laws of physics. More abstract symmetries (gauge symmetries) imply such things as the conservation of electrical charge.
John Baez in 2002 gave the 'simplest possible proof' of Noether's theorem which I reproduce below. It repays attention as the concepts are quite subtle even though the maths is sixth-form level.
Note that some of the derivatives below are partial but for simplicity they are all shown with 'd'.
Suppose we have a particle able to move on a line with position x and velocity v = dx/dt under the influence of a potential V(x). Note that both x(t) and v(t) are functions of time t.
The Lagrangian is L = KE - PE = (1/2) mv2 - V(x).
The momentum of the particle is p = mv = dL/dv.
The force (caused by the potential) on the particle is F = -dV/dx = dL/dx.
The Euler-Lagrange equation (derived from the principle of least action) says that dL/dx = d/dt(dL/dv), so working it out:
F = dL/dx = d/dt(dL/dv) = d(mv)/dt = dp/dt = mf which is Newton's second law. Note in particular that dp/dt = dL/dx.
So far this is just how Lagrangians work.
A symmetry transformation
Now we suppose that the Lagrangian has a symmetry defined by a parameter s, so that if there is a transformation which sends x (at some t) to some new position x(s) (at time t) then the Lagrangian is unchanged. Note that this makes both x and v now functions of t and s: x(t, s) and v(t, s). I will often suppress one or both of these arguments for notational declutter.
As the Lagrangian is unchanged by the application of s, this means:
dL(x(t, s), v(t, s))/ds = 0.
With less clutter we can write dL(x, v)/ds = 0.
The symmetry might, for example, be: xt(s) -> xt + s which simply shifts the particle at xt spatially by amount s (at every time point). This corresponds to doing the experiment again in a different part of the lab.
Or xt(s) -> xt+s which shifts the particle at (x, t) through time by time-increment s. This corresponds to doing the experiment in the afternoon rather than the morning.
So here is the proposed conserved quantity: pdx(s)/ds.
We assume that the potential V(x) = 0 so there are no applied forces (which makes the conservation law simpler). In the first example, dx(s)/ds = d(xt + s)/ds = 1 (as t is held constant). So pdx(s)/ds = p. This says that momentum is the conserved quantity in space translation.
In the second example, we hold t constant and let s do the job of incrementing time. Define a new t-coordinate t' = t + s, noting that dt'/ds = 1.
Then dx(s)/ds = (dx/dt')(dt'/ds) = dx/dt' = v so
pdx(s)/ds = pv = 2 * (1/2)mv2 which shows that the particle's energy is what will be conserved in time translation.
Differentiate the allegedly conserved quantity pdx(s)/ds with respect to t. [Conservation of anything means conservation as time passes].
(dp/dt)(dx(s)/ds) + pd[dx(s)/ds]/dt =
(dp/dt)(dx(s)/ds) + pdv(s)/ds ... assuming s is time-independent.
Now we replace p and its derivatives by their Lagrangian equivalents.
(dL/dx)(dx/ds) + (dL/dv)(dv/ds) = dL(x, v)/ds by the chain rule.
But dL/ds = 0 as transformations via s are a symmetry of L, so the conserved quantity pdx(s)/ds is indeed conserved, as Emmy Noether indicated.