# Fundamental thermodynamic relation

Template:Laws of thermodynamics In thermodynamics, the fundamental thermodynamic relation is a mathematical summation of the first law of thermodynamics and the second law of thermodynamics subsumed into a single concise mathematical statement as shown below:

$dE= T dS - P dV\,$

Here, E is internal energy, T is temperature, S is entropy, P is pressure, and V is volume.

## Thermodynamic derivation

Starting from the first law:

$dE = dQ - dW\,$

From the second law we have for a reversible process:

$dS = dQ/T\,$

Hence:

$dQ = TdS\,$

By substituting this into the first law, we have:

$dE = TdS - dW\,$

Letting dW be reversible pressure-volume work, we have:

$dU = T dS - P dV\,$

This has been derived in the case of reversible changes. However, since U, S and V are thermodynamic functions of state, the above relation holds also for non-reversible changes. If the system has more external variables than just the volume that can change and if the numbers of particles in the system can also change, the fundamental thermodynamic relation generalizes to:

$dE = T dS - \sum_{i}X_{i}dx_{i} + \sum_{j}\mu_{j}dN_{j}\,$

Here the $X_{i}$ are the generalized forces corresponding to the external variables $x_{i}$. The $\mu_{j}$ are the chemical potentials corresponding to particles of type j.

## Derivation using the microcanonical ensemble

The above derivation can be criticized on the grounds that it merely defines a partitioning of the change in internal energy in heat and work in terms of the entropy. As long as we don't define the entropy in terms of the fundamental properties of the system, the fundamental law of thermodynamics is vacuous.

The entropy of an isolated system containing an amount of energy of is defined as:

$S = k \log\left[\Omega\left(E\right)\right]\,$

where $\Omega\left(E\right)$ is the number of quantum states in a small interval between $E$ and $E +\delta E$. Here $\delta E$ is a macroscopically small energy interval that is kept fixed. Strictly speaking this means that the entropy depends on the choice of $\delta E$. However, in the thermodynamic limit (i.e. in the limit of infinitely large system size), the specific entropy (entropy per unit volume or per unit mass) does not depend on $\delta E$. The entropy is thus a measure of the uncertainty about exactly which quantum state the system is in, given that we know its energy to be in some interval of size $\delta E$.

The fundamental assumption of statistical mechanics is that all the $\Omega\left(E\right)$ states are equally likely. This allows us to extract all the thermodynamical quantities of interest. The temperature is defined as:

$\frac{1}{k T}\equiv\beta\equiv\frac{d\log\left[\Omega\left(E\right)\right]}{dE}\,$

See here for the justification for this definition. 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 energy eigenstates, 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 dx$ is the work performed by the system if x is increased by an amount dx. 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{dE_{r}}{dx}$

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{dE_{r}}{dx}\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{dE_{r}}{dx}$ 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 + dx. 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{dE_{r}}{dx}$ lies within the range between $Y$ and $Y + \delta Y$. Since these energy eigenstates increase in energy by Y dx, all such energy eigenstates that are in the interval ranging from E - Y dx 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 dx\,$

such energy eigenstates. If $Y dx\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 dx 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:

$dS = \left(\frac{\partial S}{\partial E}\right)_{x}dE+\left(\frac{\partial S}{\partial x}\right)_{E}dx = \frac{dE}{T} + \frac{X}{T} dx\,$

which we can write as:

$dE = T dS - X dx\,$