# Why does the Gibbs free energy need to be minimized for an equilibrium?

I've been trying to derive it myself but I can't seem to find something really decent. I'm looking for a simple, yet rigorous derivation. I'm specifically looking at phase transitions.

Okay, I've found a decent and simple derivation.

Suppose a system is in thermal contact with its environment which we suppose acts as a resevoir of energy - which means it can absorb or release energy without changing its temperature. We call $S_{tot}$ the total entropy of the system + environment, and any variables with subscript $R$ belong to the resevoir while varibles without subscript refer to those of the system.

The idea is that the total entropy $S_{tot}$ will always increase due to the second law of thermodynamics. Let us consider a small change in the entropy

$$dS_{tot} = dS + dS_R >0.$$

Suppose the system and its environment are at the same constant pressure $P$, but the volume of the system can change (and hence so can the volume of the resevoir). If this is the case than we can write the thermodynamic identity

\begin{align} dS_R &= \dfrac{dE_R}{T}+\dfrac{P}{T}dV_R\\ & = -\dfrac{dE}{T}-\dfrac{P}{T}dV, \end{align}

because a change in the energy of the environment will be negative the change of the energy of the system - same reasoning applies to the volume. Now we plug this into the equation above

\begin{align} dS_{tot} & =dS -\dfrac{dE}{T}-\dfrac{P}{T}dV\\ &= \dfrac{-1}{T}(dE +pdV-TdS)\\ &= \dfrac{-dG}{T} >0. \end{align}

It then follows that $dG<0$, and that the system will evolve to one where the Gibbs free energy is minimal, since this is where the total entropy is greatest.

Reference: "An introduction to Thermal Physics" by Daniel V. Schroeder.

$$G=H-T S$$ $$\Rightarrow \quad G=U+P V-T S$$

at constant $$P, T$$ we have then $$\Delta G=\Delta U+P \Delta V-T \Delta S$$ but $$\triangle U=\triangle Q-P \Delta V$$ $$\Rightarrow \Delta G=\Delta Q-T \Delta S$$

also we know $$\triangle Q \leq T \Delta S$$

Hence we deduce

$$\Delta G \leq 0$$.

So G will keep on falling until the equilibrium is established, so the Gibbs function will be minimum at equilibrium under constant $$T$$ and $$P$$