Thermodynamic Potentials#

What You Will Learn

  • The Reversible Work Theorem states that the minimum work required to take a system from an initial to a final state is given by a reversible process.

  • Thermodynamic potentials—such as internal energy, Helmholtz free energy, Gibbs free energy, enthalpy, and grand potential—are obtained via Legendre transformations of energy.

  • These potentials are crucial for analyzing thermodynamic systems under different constraints, such as:

    • Constant temperature and volume → Helmholtz Free Energy \(F\)

    • Constant temperature and pressure → Gibbs Free Energy \(G\)

  • The Second Law of Thermodynamics, when expressed in terms of free energy, states that spontaneous processes decrease the free energy of the system

Reversible Work Theorem#

  • Consider two processes between the same initial and final states with a heat bath at temperature \(T\).

  • One process is irreversible The other is reversible. But Since both processes have the same energy change,

\[ \Delta E = \delta W+ \delta Q = dW_{rev} + dQ_{rev} \]
  • Since \(\delta Q_{rev} = TdS\) we can rewrite work in terms ofreversible work:

\[ \delta W = dW_{rev} + TdS - dQ \]
  • Using Clausius inequality \(TdS-\delta Q\geq 0 \) we arrive at the relationship between irreversible and reversible work

\[ \delta W \geq dW_{\text{rev}} \]
../_images/polymer.png

Fig. 17 Comparison of a reversible and an irreversible pulling process of a chain molecule with a linear force-extension equation of state. the minimum work is achieved by reversible pulling and is equal to free energy difference.#

  • Thus, the minimum work required for a transformation at constant \(T\) is given by the reversible work.

  • For example, in a chain molecule with a linear force-extension equation of state, the work equal to the area under the force-extension curve is minimized when the force just suffices to induce the transition.

  • Writing reversible work in terms of a change of Energy and heat: \(\delta W_{rev} = dE-TdS \) we see that under \(T=const\) work is equal to a full differential

\[ \delta W \geq dE - TdS = d(E-TS) \]
  • We call the quantity of \(F=E-TS\) as Helmholtz free energy. Free energy differnece is the minimum amount of work that needs to be done on the syste to go from equilibrium state A to B.

\[ W \geq \Delta F \]
  • If instead it is the system that is doing the work on the environment \(W<0\) then the the Helmholtz free energy can bee seen as the maximum amount of energy available to do work to go from equilibrium state A to B.

\[|\Delta F| \geq |W|\]

Reversible Work Theorem

\[ W \geq W_{rev} = \Delta F \]

Free Energy Minimization principle#

  • When there is no work done \(W=0\) which happens when fixing volume and temperature:

\[ dF_{V,T} \leq 0 \]
  • Thus, at fixed \(T\) and \(V\), equilibrium is achieved when the Free Energy is at its minimum

Free Energy Minimization Principle

  • The state of equilibrium is found via Free Energy maximization over extensive variables \(X_1, X2\)

\[ min_X F(X_1, X_2) \rightarrow X^{eq}_1, X^{eq}_2,... \]

Free Energies and Legendre Transforms#

  • Energy \( E(S, V, N) \) is a natural function of extensive variables.

  • Equilibrium is found by minimizing \( E \) with respect to its independent variables.

  • In experiments, it’s often more convenient to control intensive variables (e.g., \( T \), \( P \)) instead of extensive ones.

  • Legendre transforms allow us to switch from energy to free energies, which have more practical independent variables.

  • The transformation replaces extensive variables with their conjugate intensive variables, giving new thermodynamic potentials:

\[ E(S, V, N) \rightarrow A(T, V, N) \quad \text{(Helmholtz Free Energy)} \]
\[ E(S, V, N) \rightarrow G(T, P, N) \quad \text{(Gibbs Free Energy)} \]
\[ E(S, V, N) \rightarrow \Omega(T, P, \mu) \quad \text{(Grand Potential)} \]
  • Legendre transform preserves convexity: equilibrium is still found by minimization.

  • Free energies contain the same information as \( E \) since the transform is invertible.

  • Free energies use experimentally controllable variables (e.g., \( T \), \( P \)).

General Procedure of Legendre Transform in Thermodynamics

  • Energy change is described by conjugate variable pairs \((X_i, f_i)\).

\[ dE = \sum_i f_i dX_i \]
  • We define a new thermodynamic potential by a Legendre transformation:

\[ A = E - \sum_i f_i X_i \]
  • The sum runs over those variables \( X_i \) we want to replace with \( f_i \). Differentiating:

\[ dA = dE - \sum_i f_i dX_i - \sum_i X_i df_i = - \sum_i X_i df_i \]
  • Thus, the new potential depends on the intensive variables \( f_i \), making it easier to describe equilibrium in controlled settings.

Helmholtz Free energy

\[E(N, V, S) \rightarrow E - T\cdot S = F(N, V, T)\]
  • Where energy and entropy are now expressed in terms of temperature \(T=\frac{\partial E}{\partial S}\)

\[dF = dE -d(TS) = dE - TdS - SdT\]
\[dF = -SdT - pdV + \mu dN\]

Gibbs Free energy

\[E(N, V, S) \rightarrow E - T\cdot S + p\cdot V = G(N, p, T)\]
  • Where energy, entropy volume are now expressed in terms of temperature \(T=\frac{\partial E}{\partial S}\) and pressure \(p=-\frac{\partial E}{\partial V}\)

\[dG = dE -d(TS) + d(pV) = dE - TdS - SdT + pdV + Vdp\]
\[dG = -SdT + Vdp + \mu dN\]

Visualizing the Legendre Transform#

  • Simply put, the Legendre transform replaces the variable \( x \) in a function \( f(x) \) with its derivative:

    \[ y = \frac{df}{dx}. \]

    This results in a new function \( g(y) \), expressed in terms of the slope.

../_images/Legendre.png

Fig. 18 Visualizing a convex function and its legendre transform.#

  • Geometric Intuition: A curve can be described either as a collection of points \( (x, f(x)) \) or as a collection of tangent slopes \( y = df/dx \).

    • For this correspondence to be one-to-one, the function must be convex and have a well-defined minimum.

  • Legendre transform in general:

    • It maps one convex function \( f(x) \) to another convex function \( f^*(\alpha) \).

    • Moreover, the transformation is involutive, meaning that applying it twice returns the original function.

Hide code cell source
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from IPython.display import HTML
# Define the convex function (example: quadratic function f(x) = x^2)
def f(x):
    return x**2

def df_dx(x):
    return 2*x  # Derivative of f(x)

def legendre_transform(x):
    p = df_dx(x)
    g_p = p*x - f(x)
    return p, g_p

# Generate x values
x_vals = np.linspace(-2, 2, 100)
f_vals = f(x_vals)

# Create the figure
fig, ax = plt.subplots(1, 2, figsize=(10, 5))
ax[0].set_xlim(-2, 2)
ax[0].set_ylim(-1, 5)
ax[0].set_title("Function and Tangents")
ax[0].set_xlabel("x")
ax[0].set_ylabel("f(x)")
ax[0].plot(x_vals, f_vals, label="$f(x)$", color="blue")

ax[1].set_xlim(-4, 4)
ax[1].set_ylim(-2, 4)
ax[1].set_title("Legendre Transform")
ax[1].set_xlabel("p")
ax[1].set_ylabel("g(p)")

# Initialize elements for animation
point, = ax[0].plot([], [], 'ro', markersize=6)  # Moving point on f(x)
tangent_line, = ax[0].plot([], [], 'r-', lw=1)  # Tangent line
legendre_point, = ax[1].plot([], [], 'go', markersize=6)  # Points on g(p)
g_p_vals, p_vals = [], []  # Store computed values for g(p)

# Animation update function
def update(frame):
    x = -2 + frame * 0.05  # Move x from -2 to 2
    p, g_p = legendre_transform(x)
    tangent_x = np.linspace(x-1, x+1, 10)
    tangent_y = f(x) + df_dx(x) * (tangent_x - x)
    
    # Update primary function plot
    point.set_data([x], [f(x)])
    tangent_line.set_data(tangent_x, tangent_y)
    
    # Update Legendre transform plot
    p_vals.append(p)
    g_p_vals.append(g_p)
    legendre_point.set_data(p_vals, g_p_vals)
    
    return point, tangent_line, legendre_point

# Create animation
plt.legend()
ani = animation.FuncAnimation(fig, update, frames=80, interval=100, blit=True)
plt.close()
HTML(ani.to_jshtml())
No artists with labels found to put in legend.  Note that artists whose label start with an underscore are ignored when legend() is called with no argument.

Mathematical Formulation of Legendre Transform#

The Legendre transform of \( f(x) \) is given by:

\[ f^*(\alpha) = \max_x \big[ \alpha x - f(x) \big]. \]

Applying the transform again recovers the original function:

\[ f(x) = \max_{\alpha} \big[ \alpha x - f^*(\alpha) \big]. \]
  • In thermodynamis we are looking at minimum of energies and free energies. Hence we write Helmholtz Free energy as:

\[A = min_S[ E(S) - T S]\]
../_images/Leg1.png

Fig. 19 Draw a line (red line) with the same slope passing through the origin, \(E=TS\). Then, \(A=E-TS\) is the \(E\)-coordinate value of the yellow dot subtracted that of the red dot. This implies that the minimum of the (signed) distance measured along the \(E\)-axis between the curve \(E(S)\) and the line \(E=TS\) is \(A\)#

Thermo quiz
  1. Give an example of a process in which a system is not heated, but its temperature increases. Also give an example of a process in which a system is heated, but its temperature is unchanged.

  2. Which states are in an equilibrium state, a time-dependent non-equilibrium state, or a time-independent but still non-equilibrium state (e.g., steady state)? Explain your reasoning. Sometimes, the state is not a true steady or equilibrium state but close to one. Discuss how it can be treated as a steady or equilibrium state.

    • a cup of hot tea, sitting on the table while cooling down

    • the wine in a bottle that is stored in a wine cellar

    • the sun

    • the atmosphere of the earth

    • electrons in the wiring of a flashlight switched off

    • electrons in the wiring of a flashlight switched on

  3. What is meant by a constraint in thermodynamics, and why must its removal always lead to increased entropy?

  4. What is a quasi-static process in thermodynamics, and how is this idealization used for computing changes in thermodynamic variables?

  5. What is the difference between the fundamental equation in thermodynamics \(S(E,V,N)=\) vs. state equation \(P(V,N,T)\) e.g., like \(PV=NRT\) for ideal gas?

  6. Why during a spontaneous transformation of systems entropy tend to its maximum value?

  7. Why do we introduce Free energies of various kinds? Explain why free energy minimization is equivalent of total entropy maximization.

  8. Can part of the entropy of a part of a total system decrease? Give some examples.

  9. Does the entropy change depend on the path between two equilibrium states?

  10. How is the adiabatic process different from the quasistatic and reversible process?

Problems#

Problem 1: Legendre transforms and free energy calculations#

  • Use Legendre transform to go from \(E(N, V, T)\) to \(F(S,p,N)\) and to \(G(T,p,N)\).

  • 1 mole of an ideal gas at 300 K is quasistatically and isothermally compressed from 5 to 25atm. Find \(\Delta F\) and \(\Delta G\)