We start with the definition of the Gibbs energy, G = H – TS . When the system undergoes a change of state, we may write, for **any** general change:

Since H = U + pV (by definition) we can write dH = dU + pdV + Vdp.

Now, the First Law of Thermodynamics states that dU = dw + d*q *, which, if the change occurs reversibly, may be substituted by the following relations: dw_{rev} = -pdV and d*q*_{rev} = TdS (by definition). This gives:

Crucially, since U is a state function, dU is an exact differential and thus independent of path.

This means that the above equation may be applied in **ANY** situation. The derivation was conducted for a reversible reaction as this is the simplest case to consider.

It remains valid because for a non-reversible change, TdS > d*q* (the Clausius inequality) and -pdV < dw . (Note that numerically, -pdV is larger (more positive) than dw, but since dw is considered as a negative quantity (the internal energy __lost__ by the system when it does work), it makes more sense to say that -pdV < dw.) The two quantities adjust so that their sum remains the same for a given process, regardless of whether or not that process occurs reversibly.

We can substitute the expressions for dU and dH into the expression for dG, to give:

This expression suggests that G may be correctly regarded as a function of p and T. (Note that these are usually the variables under experimental control in chemistry, confirming the use and importance of G.)

The ability to regard G as a function of p and T means that the following expression can be immediately be written down, simply from the fundamental properties of a function of two variables:

which in turn implies the relations:

From the first relation, we can tell that, since everything has a positive volume, G always increases when the pressure of the system is increased (at constant temperature and composition). Recall that the partial derivative gives us the slope of a graph of the top variable in the derivative against the bottom variable. Since the molar volumes of gases are much greater than those of solids or liquids, the Gibbs energies of gases are much more sensitive to pressure than those of solids or liquids. Liquids usually have slightly larger molar volumes than solids, so their Gibbs energies are usually slightly more pressure sensitive than those of solids:

To find the Gibbs energy at one pressure, f, in terms of its value at another pressure, i, at a constant temperature, we integrate the above expression relating Gibbs energy and pressure, to give:

For liquids and solids, their volume changes only slightly with changing pressure (consider the difficulty in compressing a liquid or particularly a solid by applying pressure to it). This means V may be treated as a constant and taken outside the integral, allowing us to write, in terms of molar quantities:

Under the conditions typically encountered in a lab, V_{m}Δp is very small, and may be neglected. Thus we can often make the assumption that Gibbs energies of solids and liquids are pressure-independent. However, if the pressures involved in the situation under consideration are large, their effect on the Gibbs energy may be important, and the complete expression involving the integral of Vdp must be used.

The molar volumes of gases vary greatly with pressure, meaning we cannot treat V as a constant and take it outside the integral. We must instead substitute for V with an expression which shows the pressure dependence of the volume. For a perfect gas, we make the substitution V = nRT / p , which gives: