I am so surprised that no one has mentioned entropy. The derivation of all equilibrium conditions require the second law of thermodynamics. Ok, so here is a "proof" of the zeroth law:
Second Law: The universe acts spontaneously so as to maximize its entropy.
First Law: The amount of energy in the universe is conserved (that is, constant).
Ok, here we go. Suppose you have a composite system made of two subsystems A & B in thermal contact. Also suppose that this composite system is isolated from the rest of the universe (subsystems can only interact with each other) and that the subsystems can only exchange units of energy q (no particle exchange, volume exchange...). In such a composite system changes in total entropy can only come about via exchanges in energy units. Agree?
Since the composite system is isolated from the rest of the universe, energy is conserved. Thus, the total number of energy units is conserved.
N = NA + NB ----> total energy in the composite system is then U = N*q = (NA + NB) *q
NA = number of energy units belonging to A ---> not constant due to energy exchange
NB =number of energy units belonging to B ---> not constant due to energy exchange
N = total number of energy units of composite system ---> constant
The energy of each subsystem is then ---
UA = NA*q UB = NB*q so that NA = UA/q
NB = UB/q
where U = conserved = UA + UB, but UA and UB individually can change due to energy exchanges between subsystems as long as U is conserved, right?
So! We are allowing these subsystems to spontaneously exchange energy. Will the spontaneous transfer of energy between these subsystems every cease? Yes! The second law tells us that once the total entropy is maximized, spontaneous changes in the total entropy of the universe (in our case, the isolated composite system) will cease and we know that for this composite system changes in entropy are governed by energy exchanges. Thus, energy exchanges will cease once the total entropy is maximized. What we need to look at are changes in the total entropy of the composite system due to the changes in energy of either one of the systems. The reason is as follows: The maximum total entropy of the composite system describes a unique microstate of the composite system (this microstate corresponds to one of the configurations of the macrostate with the largest multiplicity) in which each subsystem contains a particular number of energy units such that spontaneous energy exchanges no longer occur. In other words, there is a unique NA and NB for which the total entropy will be maximum. We need to look for the maximum of the entropy vs. NA curve (or NB curve). We are looking at Stot = f(NA) and we want to find the condition for which Stot = Stotmax:
From elementary calculus we know that extremal points will occur when dStot/dNA = 0, but we also know that an extremal point can be a stationary point, minimum or maximum. But the second law tells us that the total entropy will spontaneously increase so that we need not to worry about minima or stationary points on the Stot vs NA curve (there is a particular NA for which Stot is a maximum, right?) . Lets look for the maximum.
the total entropy of the composite system is Stot = SA + SB, we need to find the condition for which dStot/dNA = 0:
dStot/dNA = d(SA + SB)/dNA = 0 ----> dSA/dNA + dSB/dNA = 0 -----> dSA/dNA = - dSB/dNA, but any loss of energy units by A is
the gain in energy units in B
dNA = -dNB
----> dSA/dNA = dSB/dNB , but NA = UA/q and NB = UB/q
----> dSA/d(UA/q) = dSB/d(UB/q) , but q is a quantum of energy and is therefore constant so that it cancels from both sides and we are left with the thermal equilibrium (no more spontaneous energy exchanges between A and B) condition:
** dSA/dUA = dSB/dUB**
So what if we have a third subsystem, C, and it is in thermal equilibrium with A. That is, it satisfies the condition dSC/dUC = dSA/dUA . Ok then, if we were to assume that A was also in thermal equilibrium with B, we have dSA/dUA = dSB/dUB.
So we have dSA/dUA = dSC/dUC and dSA/dUA = dSB/dUB, so this implies that dSC/dUC = dSB/dUB MUST be true. In words, if system A is in thermal equilibrium with system C and system B is also in thermal equilibrium with system A, then, by way of the thermal equilibrium conditions, system C must also be in thermal equilibrium with system B. This is the zeroth law of thermodynamics. Therefore the zeroth law is a result of the second law. One more thing:
dS/dU is the definition of the inverse temperature in thermodynamics so that we have the equilibrium condition for two systems:
dSA/dUA = dSB/dUB ----> 1/TA = 1/TB ----> TA = TB in thermal equilibrium
If there is a third system such that TC =TA and TB = TA, then it follows that TB = TC, again the zeroth law!
If I screwed up anywhere, you think my logic is flawed, or you have a question, please feel free to send me a message.
Hope it helps! ....and it's not too late