# Principle of minimum energy

The principle of minimum energy is essentially a restatement of the second law of thermodynamics. It states that for a closed system, with constant external parameters and entropy, the internal energy will decrease and approach a minimum value at equilibrium. External parameters generally means the volume, but may include other parameters which are specified externally, such as a constant magnetic field.
In contrast, for isolated systems (and fixed external parameters), the second law states that the entropy will increase to a maximum value at equilibrium. An isolated system has a fixed total energy and mass. A closed system, on the other hand, is a system which is connected to another, and cannot exchange matter (i.e. particles), but can transfer other forms of energy (e.g. heat), to or from the other system. If, rather than an isolated system, we have a closed system, in which the entropy rather than the energy remains constant, then it follows from the first and second laws of thermodynamics that the energy of that system will drop to a minimum value at equilibrium, transferring its energy to the other system. To restate:
* The maximum entropy principle: For a closed system with fixed internal energy (i.e. an isolated system), the entropy is maximized at equilibrium.
* The minimum energy principle: For a closed system with fixed entropy, the total energy is minimized at equilibrium.

## Mathematical explanation

The total energy of the system is $U(S,X_{1},X_{2},\dots )$ where S is entropy, and the $X_{i}$ are the other extensive parameters of the system (e.g. volume, particle number, etc.). The entropy of the system may likewise be written as a function of the other extensive parameters as $S(U,X_{1},X_{2},\dots )$. Suppose that X is one of the $X_{i}$ which varies as a system approaches equilibrium, and that it is the only such parameter which is varying. The principle of maximum entropy may then be stated as:
    $\left({\frac {\partial S}{\partial X}}\right)_{U}=0$ and $\left({\frac {\partial ^{2}S}{\partial X^{2}}}\right)_{U}<0$ at equilibrium.
The first condition states that entropy is at an extremum, and the second condition states that entropy is at a maximum. Note that for the partial derivatives, all extensive parameters are assumed constant except for the variables contained in the partial derivative, but only U, S, or X are shown. It follows from the properties of an exact differential (see equation 8 in the exact differential article) and from the energy/entropy equation of state that, for a closed system:
    $\left({\frac {\partial U}{\partial X}}\right)_{S}=-\,{\frac {\left({\frac {\partial S}{\partial X}}\right)_{U}}{\left({\frac {\partial S}{\partial U}}\right)_{X}}}=-T\left({\frac {\partial S}{\partial X}}\right)_{U}=0$
It is seen that the energy is at an extremum at equilibrium. By similar but somewhat more lengthy argument it can be shown that
    $\left({\frac {\partial ^{2}U}{\partial X^{2}}}\right)_{S}=-T\left({\frac {\partial ^{2}S}{\partial X^{2}}}\right)_{U}$
which is greater than zero, showing that the energy is, in fact, at a minimum.

## Examples

Consider, for one, the familiar example of a marble on the edge of a bowl. If we consider the marble and bowl to be an isolated system, then when the marble drops, the potential energy will be converted to the kinetic energy of motion of the marble. Frictional forces will convert this kinetic energy to heat, and at equilibrium, the marble will be at rest at the bottom of the bowl, and the marble and the bowl will be at a slightly higher temperature. The total energy of the marble-bowl system will be unchanged. What was previously the potential energy of the marble, will now reside in the increased heat energy of the marble-bowl system. This will be an application of the maximum entropy principle as set forth in the principle of minimum potential energy, since due to the heating effects, the entropy has increased to the maximum value possible given the fixed energy of the system.
If, on the other hand, the marble is lowered very slowly to the bottom of the bowl, so slowly that no heating effects occur (i.e. reversibly), then the entropy of the marble and bowl will remain constant, and the potential energy of the marble will be transferred as energy to the surroundings. The surroundings will maximize its entropy given its newly acquired energy, which is equivalent to the energy having been transferred as heat. Since the potential energy of the system is now at a minimum with no increase in the energy due to heat of either the marble or the bowl, the total energy of the system is at a minimum. This is an application of the minimum energy principle.
Alternatively, suppose we have a cylinder containing an ideal gas, with cross sectional area A and a variable height x. Suppose that a weight of mass m has been placed on top of the cylinder. It presses down on the top of the cylinder with a force of mg where g is the acceleration due to gravity.
Suppose that x is smaller than its equilibrium value. The upward force of the gas is greater than the downward force of the weight, and if allowed to freely move, the gas in the cylinder would push the weight upward rapidly, and there would be frictional forces that would convert the energy to heat. If we specify that an external agent presses down on the weight so as to very slowly (reversibly) allow the weight to move upward to its equilibrium position, then there will be no heat generated and the entropy of the system will remain constant while energy is transferred as work to the external agent. The total energy of the system at any value of x is given by the internal energy of the gas plus the potential energy of the weight:
    $U=TS-PAx+\mu N+mgx\,$
where T is temperature, S is entropy, P is pressure, μ is the chemical potential, N is the number of particles in the gas, and the volume has been written as V=Ax. Since the system is closed, the particle number N is constant and a small change in the energy of the system would be given by:
    $dU=T\,dS-PA\,dx+mg\,dx$
Since the entropy is constant, we may say that dS=0 at equilibrium and by the principle of minimum energy, we may say that dU=0 at equilibrium, yielding the equilibrium condition:
    $0=-PA+mg\,$
which simply states that the upward gas pressure force (PA) on the upper face of the cylinder is equal to the downward force of the mass due to gravitation (mg).

## Thermodynamic potentials

The principle of minimum energy can be generalized to apply to constraints other than fixed entropy. For other constraints, other state functions with dimensions of energy will be minimized. These state functions are known as thermodynamic potentials. Thermodynamic potentials are at first glance just simple algebraic combinations of the energy terms in the expression for the internal energy. For a simple, multicomponent system, the internal energy may be written:
    $U(S,V,\{N_{j}\})=TS-PV+\sum _{j}\mu _{j}N_{j}\,$
where the intensive parameters (T, P, μ$_j$) are functions of the internal energy's natural variables $(S,V,\{N_{j}\})$ via the equations of state. As an example of another thermodynamic potential, the Helmholtz free energy is written:
    $A(T,V,\{N_{j}\})=U-TS\,$
where temperature has replaced entropy as a natural variable. In order to understand the value of the thermodynamic potentials, it is necessary to view them in a different light. They may in fact be seen as (negative) Legendre transforms of the internal energy, in which certain of the extensive parameters are replaced by the derivative of internal energy with respect to that variable (i.e. the conjugate to that variable). For example, the Helmholtz free energy may be written:
    $A(T,V,\{N_{j}\})={\underset {S}{\mathrm {min} }}(U(S,V,\{N_{j}\})-TS)\,$
and the minimum will occur when the variable T becomes equal to the temperature since
    $T=\left({\frac {\partial U}{\partial S}}\right)_{V,\{N_{j}\}}$
The Helmholtz free energy is a useful quantity when studying thermodynamic transformations in which the temperature is held constant. Although the reduction in the number of variables is a useful simplification, the main advantage comes from the fact that the Helmholtz free energy is minimized at equilibrium with respect to any unconstrained internal variables for a closed system at constant temperature and volume. This follows directly from the principle of minimum energy which states that at constant entropy, the internal energy is minimized. This can be stated as:
    $U_{0}(S_{0})={\underset {x}{\mathrm {min} }}(U(S_{0},x))\,$
where $U_{0}$ and $S_{0}$ are the value of the internal energy and the (fixed) entropy at equilibrium. The volume and particle number variables have been replaced by x which stands for any internal unconstrained variables.
As a concrete example of unconstrained internal variables, we might have a chemical reaction in which there are two types of particle, an A atom and an A$_2$ molecule. If $N_{1}$ and $N_{2}$ are the respective particle numbers for these particles, then the internal constraint is that the total number of A atoms $N_{A}$ is conserved:
    $N_{A}=N_{1}+2N_{2}\,$
we may then replace the $N_{1}$ and $N_{2}$ variables with a single variable $x=N_{1}/N_{2}$ and minimize with respect to this unconstrained variable. There may be any number of unconstrained variables depending on the number of atoms in the mixture. For systems with multiple sub-volumes, there may be additional volume constraints as well.
The minimization is with respect to the unconstrained variables. In the case of chemical reactions this is usually the number of particles or mole fractions, subject to the conservation of elements. At equilibrium, these will take on their equilibrium values, and the internal energy $U_{0}$ will be a function only of the chosen value of entropy $S_{0}$. By the definition of the Legendre transform, the Helmholtz free energy will be:
    $A(T,x)={\underset {S}{\mathrm {min} }}(U(S,x)-TS)\,$
The Helmholtz free energy at equilibrium will be:
    $A_{0}(T_{0})={\underset {S_{0}}{\mathrm {min} }}(U_{0}(S_{0})-T_{0}S_{0})$
where $T_{0}$ is the (unknown) temperature at equilibrium. Substituting the expression for $U_{0}$:
    $A_{0}={\underset {S_{0}}{\mathrm {min} }}({\underset {x}{\mathrm {min} }}(U(S_{0},x))-T_{0}S_{0})$
By exchanging the order of the extrema:
    $A_{0}={\underset {x}{\mathrm {min} }}({\underset {S_{0}}{\mathrm {min} }}(U(S_{0},x)-T_{0}S_{0}))={\underset {x}{\mathrm {min} }}(A_{0}(T_{0},x))$
showing that the Helmholtz free energy is minimized at equilibrium.
The Enthalpy and Gibbs free energy, are similarly derived.