# Statistical mechanics and thermodynamics

(The original course was based on a course summarized by Lior Yosub and Liana Diesendruck. A rewrite is in progress that brings in more detail)

### Introduction

The properties of a macroscopic physical system ultimately derives from the properties of its fundamental constituents. Since an exact solution for many particle systems with non-trivial interactions is out of the question, one is forced to resort to statistical methods to make progress. Statistical methods can, of course, only be used when we know the probabilities for finding the system in a particular state. The fundamental postulate of statistical physics is that all accessible states of an isolated system are a priori equally likely. Here "state" means the exact quantum state of the system which thus provides for a full microscopic description of the system. This postulate can be motivated by Liouville's theorem and Boltzmann's H-theorem which we'll discuss later in this course.
A macroscopic property of a system is, in general, obtained from the exact state after a coarse graining. Properties such as the internal energy, temperature, pressure etc. are examples of such macroscopic properties and they all have to be understood as (derived from) coarse grained variables. In principle, however, one can make any arbitrary choice for the macroscopic properties. For any choice, one defines the so-called "macrostate" of the system to be the set of these variables. Thermodynamics is the study of the relations between the macroscopic properties of the system. In thermodynamics, the word "state" is often used for "macrostate". To avoid confusion, it is customary to call the exact physical state of the system the "microstate".
A system is said to be in thermal equilibrium if its macrostate is time independent. A major part of statistical mechanics is the study of systems in or very close to thermal equilibrium. It follows from the fundamental postulate that lacking any information about a system, the most likely macrostate is that state for which the number of microstates that corresponds to it, is maximal. Any initial macrostate should thus evolve to such a macrostate, which is thus the thermal equilibrium state. This conclusion is known as the Second Law of Thermodynamics.
In the next section we'll apply the methods of statistical mechanics to isolated systems characterised by their total energy.

### The Micro-Canonical Ensemble

Since the total energy of an isolated system is conserved, all accessible microstates have the same energy. The macroscopic variable corresponding to the total energy, $E,$ has to be understood as a coarse grained variable corresponding to the total energy of the system. We define this as follows: When $E$ is specified, the total energy of the system can be in the range between $E$ and $E+\delta E$, where $\delta E$ is assumed to be small on a macroscopic scale. We'll see later that the value of macroscopic quantities per unit mass or unit volume in the limit of infinite system size do not depend on the choice of $\delta E$.
We define the function $\Omega \left(E\right)$ to be the number of microstates with energies with an energy in the range between $E$ and $E+\delta E$. All these states are equally likely in thermal equilibrium. One can then compute macroscopic properties of systems by averaging over all the $\Omega \left(E\right)$ states. Put differently, one can imagine the so-called "micro-canonical ensemble " ensemble of of systems with microstates in each of the $\Omega \left(E\right)$ states. Averaging over this ensemble yields the macroscopic thermal variables.

#### Definition of temperature

Now consider two such isolated systems in internal equilibrium, but isolated from each other. They have internal energies of $E_{1}$ and $E_{2}$. The number of microstates the systems can be in are then $\Omega _{1}\left(E_{1}\right)$ and $\Omega _{2}\left(E_{2}\right)$, respectively. Suppose we bring the two systems into contact, such that energy can flow between the two systems. The total internal energy $E=E_{1}+E_{2}$ of the combined system will then be conserved. The total number of accessible states the combined system can be in, is clearly given by:
    $\Omega \left(E\right)=\sum _{E_{1}}\Omega _{1}\left(E_{1}\right)\Omega _{2}\left(E-E_{1}\right)$
Here the summation variable $E_{1}$ increases by a steps of $\delta E$. This then means that the coarse grained internal energy variable $E$ for the combined system determines its exact system's energy to be in the range between $E$ and $E+2\delta E$. Obviously, the most likely energy distribution over the two systems is such that the product $\Omega _{1}\left(E_{1}\right)\Omega _{2}\left(E-E_{1}\right)$ is maximal. When we start with any other energy distribution and bring the two systems into thermal contact, energy will flow until that particular equilibrium state is reached. While there is then still a small probability for the energy distribution to deviate from this equilibrium state, it turns out that this is exceedingly unlikely, because the product of the two omega functions has a very sharp maximum.
We can formally compute the condition for thermal equilibrium between the two subsystems by maximizing the function $\Omega _{1}\left(E_{1}\right)\Omega _{2}\left(E-E_{1}\right)$. It is convenient to take the logarithm of this function and equate the derivative of that w.r.t. $E_{1}$ to zero. This gives:
    ${\frac {\mathrm {d} \log \left[\Omega _{1}\left(E_{1}\right)\right]}{\mathrm {d} E_{1}}}+{\frac {\mathrm {d} \log \left[\Omega _{2}\left(E-E_{1}\right)\right]}{\mathrm {d} E_{1}}}=0$
In the derivative of $\log \left[\Omega _{2}\left(E-E_{1}\right)\right]$ we can change variables by putting $E_{2}=E-E_{1}$. By the chain rule, we then have:
    ${\frac {\mathrm {d} \log \left[\Omega _{1}\left(E_{1}\right)\right]}{\mathrm {d} E_{1}}}={\frac {\mathrm {d} \log \left[\Omega _{2}\left(E_{2}\right)\right]}{\mathrm {d} E_{2}}}$
Note that the l.h.s. of the equation only refers to the property of system 1 and the r.h.s only to the properties of system 2. For any arbitrary isolated system with internal energy $E,$ we define the so-called temperature parameter $\beta$ as:
$\beta \equiv {\frac {\mathrm {d} \log \left[\Omega \left(E\right)\right]}{\mathrm {d} E}}$
The condition that two isolated systems in internal thermal equilibrium are also in thermal equilibrium with each other (i.e. that when they are brought into thermal equilibrium no energy will flow between them), is thus that the two temperature parameters of both systems are equal. The thermodynamic temperature $T$ is defined by:
    ${\frac {1}{kT}}\equiv \beta$
where $k$ is a arbitrary constant that fixes the temperature scale. If we choose to measure the thermodynamic temperature in Kelvin, then this constant is fixed to be Boltzmann's constant. We'll see later that this definition of thermodynamic temperature implies that energy flow between two systems as a result of thermal contact is from the high temperature system to the low temperature system.
While the Omega function is not accessible at the macroscopic level, the entropy, defined as:
    $S=k\log \left[\Omega \left(E\right)\right]\,$
is a thermodynamic variable that can (indirectly) be determined from the macroscopic thermal properties of the system. From the above definitions, it follows that the temperature $T$ can be expressed as:
    ${\frac {1}{T}}={\frac {\mathrm {d} S}{\mathrm {d} E}}$
Now, this equation is only valid for isolated systems that don't perform any work. I.e. when the energy is added it goes into the internal thermal energy of the system. In general, we deal with systems that can perform work. In general this can be described by so-called external parameters, such as the volume of the system. The energy change due to the change in the external parameters is called work. Thermal energy that flows into a system that is not due to work is called heat.

#### The fundamental thermodynamic relation

We will now show that in general, when heat is added to a system so slowly that it remains in internal thermal equilibrium (such slow processes are called quasistatic processes), we have:
    $\mathrm {d} S={\frac {\delta Q}{T}}$
i.e. the change in entropy depends only on the added heat to the system and not on changes in internal energy due to work. Suppose that the system has some external parameter, $x,$ that can be changed. In general, the energy eigenstates of the system will depend on $x$. According to the adiabatic theorem of quantum mechanics, in the limit of an infinitely slow change of the system's Hamiltonian, the system will stay in the same energy eigenstate and thus change its energy according to the change in energy of the energy eigenstate it is in.
The generalized force, $X,$ corresponding to the external variable $x,$ is defined such that $X\,\mathrm {d} x$ is the work performed by the system if $x$ is increased by an amount $\mathrm {d} x\,;$ E.g., if $x$ is the volume, then $X$ is the pressure. The generalized force for a system known to be in energy eigenstate $E_{r}$ is given by:
    $X=-{\frac {\mathrm {d} E_{r}}{\mathrm {d} x}}$
Since the system can be in any energy eigenstate within an interval of $\delta E$, we define the generalized force for the system as the expectation value of the above expression:
    $X=-\left\langle {\frac {\mathrm {d} E_{r}}{\mathrm {d} x}}\right\rangle \,$
To evaluate the average, we partition the $\Omega \left(E\right)$ energy eigenstates by counting how many of them have a value for ${\frac {\mathrm {d} E_{r}}{\mathrm {d} x}}$ within a range between $Y$ and $Y+\delta Y$. Calling this number $\Omega _{Y}\left(E\right)$, we have:
    $\Omega \left(E\right)=\sum _{Y}\Omega _{Y}\left(E\right)\,$
The average defining the generalized force can now be written:
    $X=-{\frac {1}{\Omega \left(E\right)}}\sum _{Y}Y\Omega _{Y}\left(E\right)\,$
We can relate this to the derivative of the entropy w.r.t. $x$ at constant energy $E$ as follows. Suppose we change $x$ to $x+\mathrm {d} x$. Then $\Omega \left(E\right)$ will change because the energy eigenstates depend on $x\,,$ causing energy eigenstates to move into or out of the range between $E$ and $E+\delta E$. Let's focus again on the energy eigenstates for which ${\frac {\mathrm {d} E_{r}}{\mathrm {d} x}}$ lies within the range between $Y$ and $Y+\delta Y$. Since these energy eigenstates increase in energy by $Y\;\mathrm {d} x,$ all such energy eigenstates that are in the interval ranging from $E-Y\;\mathrm {d} x$ to $E$ move from below $E$ to above $E.$ There are
    $N_{Y}\left(E\right)={\frac {\Omega _{Y}\left(E\right)}{\delta E}}Y\mathrm {d} x\,$
such energy eigenstates. If $Ydx\leq \delta E$, all these energy eigenstates will move into the range between $E$ and $E+\delta E$ and contribute to an increase in $\Omega$. The number of energy eigenstates that move from below $E+\delta E$ to above $E+\delta E$ is, of course, given by $N_{Y}\left(E+\delta E\right)$. The difference
    $N_{Y}\left(E\right)-N_{Y}\left(E+\delta E\right)\,$
is thus the net contribution to the increase in $\Omega$. Note that if $Y\;\mathrm {d} x$ is larger than $\delta E$ there will be the energy eigenstates that move from below $E$ to above $E+\delta E$. They are counted in both $N_{Y}\left(E\right)$ and $N_{Y}\left(E+\delta E\right)$, therefore the above expression is also valid in that case.
Expressing the above expression as a derivative w.r.t. $E$ and summing over $Y$ yields the expression:
    $\left({\frac {\partial \Omega }{\partial x}}\right)_{E}=-\sum _{Y}Y\left({\frac {\partial \Omega _{Y}}{\partial E}}\right)_{x}=\left({\frac {\partial \left(\Omega X\right)}{\partial E}}\right)_{x}\,$
The logarithmic derivative of $\Omega$ w.r.t. $x$ is thus given by:
    $\left({\frac {\partial \log \left(\Omega \right)}{\partial x}}\right)_{E}=\beta X+\left({\frac {\partial X}{\partial E}}\right)_{x}\,$
The first term is intensive, i.e. it does not scale with system size. In contrast, the last term scales as the inverse system size and will thus vanishes in the thermodynamic limit. We have thus found that:
    $\left({\frac {\partial S}{\partial x}}\right)_{E}={\frac {X}{T}}\,$
Combining this with
    $\left({\frac {\partial S}{\partial E}}\right)_{x}={\frac {1}{T}}\,$
Gives:
    $\mathrm {d} S=\left({\frac {\partial S}{\partial E}}\right)_{x}\mathrm {d} E+\left({\frac {\partial S}{\partial x}}\right)_{E}\mathrm {d} x={\frac {\mathrm {d} E}{T}}+{\frac {X}{T}}\mathrm {d} x={\frac {\delta Q}{T}}\,$
The first part of this equation, which can be written as:
    $\mathrm {d} E=T\mathrm {d} S-X\mathrm {d} x\,$ (1)
is called the fundamental thermodynamic relation. It is more general than the equation $\mathrm {d} S=\delta Q/T$, as the former is also valid when the changes in the system are not quasistatic. This is because the internal energy in thermal equilibrium will be completely determined by when $S$ and $X$ are specified. So, we can consider $E$ to be a function of $S$ and $X$ (we say that $E$ is a thermodynamic state function) and we always have:
    $\mathrm {d} E=\left({\frac {\partial E}{\partial S}}\right)_{x}\mathrm {d} S+\left({\frac {\partial E}{\partial x}}\right)_{S}\mathrm {d} x$
The fact that (1) is valid for quasistatic changes then allows us to conclude that the partial derivatives in the above equation are given by:
    $\left({\frac {\partial E}{\partial S}}\right)_{x}=T$
    $\left({\frac {\partial E}{\partial x}}\right)_{S}=-X$
The equation (1) is thus always valid, albeit it that for non-quasistatic changes we cannot identify the two terms as heat added and work done by the system any more. Also we don't always have to interpret the infinitesimal changes as a change that actually happens in a system. E.g. one can consider two copies of the same system but with slightly different thermodynamic variables. Then $\mathrm {d} E,\,\mathrm {d} S\,{\textrm {and}}\,\mathrm {d} x$ can refer to the difference in internal energy, entropy, and external parameter between the two systems. These changes will satisfy (1).

### Canonical Ensemble

Often, the system we want to study is not isolated, but instead is in thermal contact with an environment at some fixed temperature. Now, for a large system a system kept at some temperature will fix its internal energy with negligible energy fluctuations relative to the total internal energy. So, we could just as well treat such systems using the micro-canonical ensemble. However, it turns out that doing computations in the micro-canonical ensemble is rather inconvenient.
Since a system kept at constant temperature is in thermal contact with an environment, usually called a heat bath, it is no longer true that all microstates of the system are equally likely. We can find the probability to find the system in some microstate as follows. We imagine that the system is kept at constant temperature by a heat bath such that the system plus heat bath is an isolated system. The accessible microstates for this combined system are then all equally likely. Suppose that the combined system has a total energy of E. If the system is in some microstate with energy $E_{r}$, then we can express the total number of states the combined system can be in, in terms of the omega function of the heat bath as $\Omega \left(E-E_{r}\right)$. Since all states are equally likely, this is proportional to the probability $P_{r}$ of finding the system in the microstate with an energy $E_{r}$:
    $P_{r}=C\Omega \left(E-E_{r}\right)\,$
for some constant C. Here one has to define the omega function by choosing the energy resolution $\delta E$ smaller than the spacing between the energy levels of the system. For the Omega function to be well defined we have to choose $\delta E$ to be much larger than the spacing between the energy levels in the heat bath. These conditions can be satisfied because the heat bath will have to consist of far more degrees of freedoms than the system in order to be able to be able to absorb heat from the system and yet stay at (almost) constant temperature. The more degrees of freedom a system has, the smaller the spacing between the energy levels will be.
The above expression for $P_{r}$ can be simplified as follows. We can write:
    $\log \left(P_{r}\right)=\log(C)+\log \left[\Omega \left(E-E_{r}\right)\right]=K-E_{r}{\frac {\mathrm {d} \log \left[\Omega \left(E\right)\right]}{\mathrm {d} E}}=K-\beta E_{r}\,$
for some constant $K$. Here we have used the definition of the temperature parameter given in the previous section and that in the limit of an ideal heat bath, the higher order terms in the Taylor expansion tend to zero as they involve the change in temperature due to change in the system's energy. It thus follows that:
    $P_{r}={\frac {\exp \left(-\beta E_{r}\right)}{Z}}$
where the normalization constant $Z$ is the so-called partition function which is given by:
    $Z=\sum _{r}\exp \left(-\beta E_{r}\right)$
The canonical ensemble is a hypothetical ensemble of copies of a system whose microstates are distributed according to $P_{r}$.

#### Computation of thermodynamic variables

The system's thermodynamic variables can be computed by averaging over the probability distribution $P_{r}$. It turns out that a knowledge of the partition function suffices to extract all of the system's thermodynamic variables. In this section, we'll derive the equations for the internal energy, generalized forces, and the entropy in terms of $Z$.
The internal energy is expectation value of the system's energy. This can be expressed in terms of the partition function in the following way:
    $E=\sum _{r}P_{r}E_{r}=\sum _{r}E_{r}{\frac {\exp \left(-\beta E_{r}\right)}{Z}}=-{\frac {1}{Z}}{\frac {\partial }{\partial \beta }}\sum _{r}\exp \left(-\beta E_{r}\right)=-{\frac {1}{Z}}{\frac {\partial Z}{\partial \beta }}=-{\frac {\partial \log \left(Z\right)}{\partial \beta }}\,$
If the system is in the state r, then the generalized force corresponding to an external variable x is given by
    $X_{r}=-{\frac {\partial E_{r}}{\partial x}}\,$
The expectation value of this is the thermodynamic generalized force of the system and this can be written as:
    $X=\sum _{r}P_{r}X_{r}={\frac {1}{\beta }}{\frac {\partial \log Z}{\partial x}}\,$
Suppose the system has one external variable x. Then changing the system's temperature parameter by $d\beta$ and the external variable by dx will lead to a change in $\log Z$:
    $\mathrm {d} \left(\log Z\right)={\frac {\partial \log Z}{\partial \beta }}\mathrm {d} \beta +{\frac {\partial \log Z}{\partial x}}\mathrm {d} x=-E\,\mathrm {d} \beta +\beta X\,\mathrm {d} x\,$
If we write $E\,\mathrm {d} \beta$ as:
    $E\,\mathrm {d} \beta =\mathrm {d} \left(\beta E\right)-\beta \,\mathrm {d} E\,$
we get:
    $\mathrm {d} \left(\log Z\right)=-\mathrm {d} \left(\beta E\right)+\beta \,\mathrm {d} E+\beta X\,\mathrm {d} x\,$
This means that the change in the internal energy is given by:
    $\mathrm {d} E={\frac {1}{\beta }}\mathrm {d} \left(\log Z+\beta E\right)-X\,\mathrm {d} x\,$
In the thermodynamic limit, the fundamental thermodynamic relation should hold:
    $\mathrm {d} E=T\,\mathrm {d} S-X\,\mathrm {d} x\,$
This then implies that the entropy of the system is given by:
    $S=k\log Z+{\frac {E}{T}}+c\,$
where c is some constant. The value of c can be determined by considering the limit T → 0. In this limit the entropy becomes $S=k\log \Omega _{0}$ where $\Omega _{0}$ is the ground state degeneracy. The partition function in this limit is $\Omega _{0}e^{-\beta E_{0}}$ where $E_{0}$ is the ground state energy. We thus see that $c=0$, therefore:
    $S=k\log Z+{\frac {E}{T}}\,$
The Helmholtz free energy $F$ can thus be expressed as:
    $F=E-TS=-kT\log \left(Z\right)\,$

### Grand Canonical Ensemble

In this ensemble we attach our system to a heat-particles reservoir in order to fix the temperature and the chemical potential of our system. The chemical potential is defined as $\mu =\left({\frac {\mathrm {d} F}{\mathrm {d} N}}\right)_{V,\tau }$. In previous ensembles we fixed number of particles $N$ in the system. Now we let it change, so now we should rectify the expression of the energy and all its derivatives.
${\begin{matrix}&\mathrm {d} U=\tau \mathrm {d} \sigma -p\mathrm {d} V+\mu \mathrm {d} N\\&\mathrm {d} F=-\sigma \mathrm {d} \tau -p\mathrm {d} V+\mu \mathrm {d} N\\&\mathrm {d} \sigma ={\frac {\mathrm {d} U}{\tau }}+{\frac {p}{\tau }}\mathrm {d} V-{\frac {\mu }{\tau }}\mathrm {d} N\end{matrix}}$
We start by defining the probability of a certain state as:
$P(N,\left\{s_{i}\right\})={\frac {1}{\zeta }}e^{\frac {\mu N-\epsilon _{s}}{\tau }}$
where
$\zeta =\sum _{N}\sum _{\left\{s\right\}}e^{\frac {\mu N-\epsilon _{s}}{\tau }}$
Directly from $\zeta$, the Grand Partition Function, we shall derive the definition of the Grand Thermodynamical Potential, $\Omega$.
$\Omega =-\tau ln\zeta$
Another form of $\Omega$ is: $\Omega =F-\mu N$. The differential form of $\Omega$ is:
$\Omega =-\sigma \mathrm {d} \tau -p\mathrm {d} V-N\mathrm {d} \mu$
There are other possible ensembles, some of them we shall see in this course.

### Gibbs Potential

We should now elaborate a specific characteristic of physical parameters of a thermodynamic system. An extensive parameter is a parameter whose value is proportional to the size of the system (number of particles), an intensive parameter is a parameter that is independent of the system size.
Let's summarize the thermodynamic potential we have seen:
* $U$ - Energy
* $F$ - Free Energy
* $H$ - Enthalpy
* $\Omega$ - Grand Potential
We have expressed all of these potentials in a differential form, where the number of elements depends on the number of ways to change the system's energy. Each term involves one extensive parameter and one intensive parameter. The pairs we have encountered so far are $(\tau ,\sigma )$, ($p,V$), ($\mu ,N$), ($B,M$), where the first element of each pair is the intensive parameter and the second is the extensive one. The parameters under differential sign have a special meaning: when they are fixed, this thermo potential tends to minimum/maximum. For example:
$d\sigma ={\frac {dU}{\tau }}+{\frac {p}{\tau }}dV-{\frac {\mu }{\tau }}dN\Rightarrow \sigma \uparrow \,{\textrm {max}}$
$U,V,N={\textrm {const}}$
or
$\mathrm {d} F=-\sigma \mathrm {d} \tau -p\mathrm {d} V+\mu \mathrm {d} N\Rightarrow F\downarrow \;{\textrm {min}}$ when $\tau ,V,N={\textrm {const}}.$
In order to get from one potential to another one we simply need to add the proper pair of parameters to the first potential. For example, let's construct an ensemble where we fix the temperature, the number of particles and the pressure of the system. Like in the previous ensembles we'll look for a matching potential for our new ensemble and we shall see that our matching potential tends to a minimum.
${\begin{matrix}&G(\tau ,p,N)=U(V,\sigma ,N)+pV-\tau \sigma =H(p,\sigma ,N)-\tau \sigma =F(V,\tau ,N)+pV\\&\mathrm {d} G=-\sigma \mathrm {d} \tau -Vdp+\mu \mathrm {d} N\end{matrix}}$
We attach to the system a heat-particle reservoir and will show that Gibbs potential is minimum at $\tau$, $p$ and $N$ - constant.
The total entropy $\sigma _{R+S}$ increase since $R+S$ is a closed system.
We use Taylor expansion:
${\begin{matrix}&\sigma _{R}(U_{0}-U,V_{0}-V)+\sigma _{S}(U,V)\ \uparrow \,{\textrm {max}}\\&\sigma _{R}(U_{0},V_{0})-{\frac {\partial \sigma _{R}}{\partial U}}|_{U_{0}}\ U-{\frac {\partial \sigma _{R}}{\partial V}}|_{V_{0}}\ V+\sigma _{S}\ \uparrow \,{\textrm {max}}\end{matrix}}$
Using Maxwell relations we get:
${\begin{matrix}&\left({\frac {\partial \sigma _{R}}{\partial U}}\right)_{N,V}={\frac {1}{\tau }}\\&\left({\frac {\partial \sigma _{R}}{\partial V}}\right)_{N,U}={\frac {p}{\tau }}\\&\underbrace {\sigma _{R}(U_{0},V_{0})} _{\textrm {constant}}-{\frac {U}{\tau }}-p{\frac {V}{\tau }}+\sigma _{S}\ \uparrow \,{\textrm {max}}\end{matrix}}$
Now we multiply by $-\tau$, so the expression should tend to minimum:
$G=U+pV-\tau \sigma \ \downarrow \,{\textrm {min}}$
We call this potential Gibbs Free Energy.

### Intensive Potentials

All of our potentials so far are extensive quantities. Sometimes we want to characterize the system by an intensive quantity with a meaning of thermodynamic potential. The easiest way define it is to divide the potential by an extensive parameter. If we divide the potential by, for example, N we'll get the potential per particle, which is an intensive size. We shall see now that in the special case of the potential G we'll get:
$\mu =\left({\frac {\partial G}{\partial N}}\right)_{p,\tau }={\frac {G}{N}}$
i.e. $\mu$ is Gibbs free energy per particle
We start with the Energy (U):
$U=(\sigma ,V,N)=NU\left({\frac {\sigma }{N}},{\frac {V}{N}},1\right)$
The above equation simply states that the energy of a system is equal to the number of particles times the energy of one particle.
The same can be done with the Free Energy (F):
$F(\tau ,V,N)=NF\left(\tau ,{\frac {V}{N}},1\right)=Nf_{1}\left(\tau ,{\frac {V}{N}}\right)$
(The temperature is an intensive quantity so it's the same for every particle) Now we do the same to Gibbs Free Energy:
$G(\tau ,p,N)=NG(\tau ,p,1)=Ng_{1}(\tau ,p)$
From the differential form of G we calculate the Chemical Potential:
$\mu =\left({\frac {\partial G}{\partial N}}\right)_{p,\tau }=g_{1}(\tau ,p)\ \Rightarrow \ \mu ={\frac {G}{N}}$
From here we receive:
${\begin{matrix}&G=F+pV=U+pV-\tau \sigma =\mu N\\&\Omega =F-\mu N=F-G=-pV\end{matrix}}$

### Phase transitions:

(example of liquid-vapor transition)
Consider vessel which contain water vapor with volume $V$ and at low pressure so that the gas is an ideal gas. We start decrease the volume so the pressure increases: $\left(p\approx {\frac {1}{V}}\right)$.
In a certain point a small layer of water will appear and from this point, the following decreasing of volume will not change the pressure, it will be constant. So what happens in the system? If we continue to reduce the volume, the water level will rise, but the pressure will remain constant. When all the vapor turn into water, reducing the volume will increase the pressure drastically and the proportion between the pressure and volume will change. In range of constant pressure we observe coexistence of two phases: liquid and gas.
The process we described above is done at a constant temperature. If we raise the temperature, the range of phase separation will shrink. But, if we raise the temperature high enough, we will have only a point of constant pressure. This temperature is called critical temperature, and for a phase transformation process at this temperature we don't have phase separation, we have everytime coexistence of gas and liquid, this named - fluid.

### Theory of phase transition

Despite the complicated mathematical description like for example the BCS theory all known phase transitions like superconductivity, superfluidity or ferromagnetism are the result of the competition between the ordering interaction and the thermal fluctuations and they are similar to frequent attempts of falling out of the ping-pong ball in the hemispherical bowl or the box excited for example by the stream of air with the cooling fan or the vacuum cleaner. After exceeding the certain excitation intensity i.e. for the true case the critical temperature with the sufficiently strong stream of air the ball will stop randomly bounce from the walls of the bowl and it will fall out i.e. its order parameter which is its localization in or outside the bowl will undergo the phase transition. It is therefore the result of strong non-linearity of motion which shows up when the system is randomly excited. The similar mechanism is responsible for "melting" of the ferromagnet i.e. for its total demagnetization with the thermal excitation above the Curie temperature when the interaction with the thermal reservoir is causing that the spin from small oscillations around the parallel direction of other spins starts randomly oscillate averaging to zero and ignoring the other spins around or when the thermal oscillations cause the ionization of Cooper pairs in the superconductor. For the Heisenberg model for example it is the pendular cosine scalar product interaction between the spins and the separatrix between two types of pendular spin motion in the external field which is responsible for the transition between the oscillatory (ordered) phase and the demagnetized or rotational phase with the critical temperature $kT_{c}\approx {\sup }_{\phi }J(\cos \phi +1)=2J$ or the energy between the pendulum up and down, close to its exact value from two dimensional Ising model given implicitly by $2\tanh ^{2}(2J/kT_{c})=1$ or $kT_{c}\approx 2.269J$. Considering the spin as pendulum with the potential of the interaction with two other spins (with one above in the third dimension) one gets $kT_{c}=4J$ close to its numerical value $kT_{c}=4.512J$ obtained from the numerical Monte Carlo calculations and generally as interacting with one more for extra dimension $kT_{c}=6J$ for four dimensions close to numerical $kT_{c}=6.666J$ and $kT_{c}=2(d-1)J$ close to Bethe-Peierls-Weiss theory in $d$ dimensions where it is $kT_{c}=2dJ$ for the very large $d$.