Gibbs free energy
In thermodynamics the Gibbs free energy is a state function of any system defined as
 G = H  TS
where H is the
enthalpy, T is the
temperature, and S is the
entropy.
The Gibbs free energy is one of the most important thermodynamic functions for the characterisation of a system.
The Gibbs free energy determines outcomes such as the voltage of an electrochemical cell, and the equilibrium constant for a reversible reaction. Any natural process occurs if and only if the associated change in G for the system is negative, i.e. the energy of the system decreases.
See also free energy.
ΔG = ΔH  TΔS
ΔG = RTlnK
ΔG = nFΔE
and rearranging gives
nFΔE = RTlnK
which relates the electrical potential of a reaction to the equilibrium coefficient for that reaction.
where
ΔG = change in Gibbs free energy
ΔH = change in enthalpy
T = temperature
ΔS = change in entropy
R = gas constant
ln = natural logarithm
K = equilibrium constant
n = no. of electrons/mole product
F = Faraday constant (coulombs/mole)
ΔE = electrical potential of the reaction
Let S_{tot} be the total entropy of a thermally closed system. A closed system cannot exchange heat with its surroundings. Total entropy is only defined for a closed system, an open system has internal entropy instead.
The second law of thermodynamics states that if a process is possible, then

and if
ΔS_{tot} = 0 then the process is reversible.
Since Q = 0 for a closed system, then any reversible process will be adiabatic, and an adiabatic process is also isentropic .
Now consider an open system. It has an internal entropy S_{int}, and the system is thermally connected to its surroundings, which have entropy S_{ext}.
The entropy form of the second law does not apply directly to the open system, it only applies to the closed system formed by both the system and its surroundings. Therefore a process is possible iff
 .
We will try to express the left side of this inequation entirely in terms of internal state functions.
ΔS_{ext} is defined as:
Temperature
T is the same both internally and externally, since the system is thermally connected to its surroundings. Also,
Q is heat transferred
to the system, so
Q is heat transferred to the surroundings, and
Q/T is entropy gained by the surroundings. We now have:

Multiply both sides by
T:

+Q is heat transferred
to the system; if the process is now assumed to be
isobaric, then
Q = ΔH:

ΔH is the enthalpy change of reaction (for a chemical reaction at constant pressure and temperature). Then

for a possible process. Let change
ΔG in Gibbs free energy be defined as

Notice that it is not defined in terms of any external state functions, such as
ΔS_{ext} or
ΔS_{tot}. Then the second law becomes:


Gibbs free energy
G itself is defined as

but notice that to obtain eq. (2) from eq. (1) we must assume that
T is constant.
Thus, Gibbs free energy is most useful for thermochemical processes at constant temperature and pressure: both isothermal and isobaric. Such processes do not seem to move on a PV diagram; they do not seem to be dynamic at all. However, chemical reactions do undergo changes in chemical potential, which is a state function. Thus, thermodynamic processes are not confined to the two dimensional PV diagram. There is at least a third dimension for n, the quantity of gas.
If a closed system (Q = 0) is at constant pressure (Q = ΔH ), then

therefore the Gibbs free energy of a closed system is:

and if ΔG≤0 then this implies that ΔS≥0, back to where we started the derivation of ΔG.