In this case, both electrons and H ions are involved and the electrode potential is a function of pH. The reaction equation may be written:
Using the expressions for the free energy in terms of potentials, the energy balance is given by a Nernst equation:
For the iron and water example, considering the boundary line between the ferrous ion Fe and hematite FeO, the reaction equation is:
: with . 
The equation of the boundary line, expressed in base-10 logarithms is:
As, the activities, or the concentrations, of the solid phases and water are always taken equal to unity by convention in the definition of the equilibrium constant : [FeO] = [HO] = 1. 
The Nernst equation thus limited to the dissolved species  and  is written as: 
For, [Fe] = 10 M, this yields: 
Note the negative slope (-0.1775) of this line in a E–pH diagram.