Reversible Work Theorem¶
Consider two processes between the same initial and final states with a heat bath at temperature .
One process is irreversible The other is reversible. But Since both processes have the same energy change,
Since we can rewrite work in terms ofreversible work:
Using Clausius inequality we arrive at the relationship between irreversible and reversible work
figure-md - Unknown Directive
figure-md - Unknown Directive<img src="./figs/polymer.png" class="bg-primary" width="500px"> 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 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: we see that under work is equal to a full differential
We call the quantity of 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.
If instead it is the system that is doing the work on the environment 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.
Free Energy Minimization principle¶
When there is no work done which happens when fixing volume and temperature:
Thus, at fixed and , equilibrium is achieved when the Free Energy is at its minimum
Free Energy and the System-Centric Perspective
In thermodynamics, a system in contact with a thermal reservoir undergoes energy exchange, affecting both the system’s entropy and the reservoir’s entropy . Directly tracking these changes can be cumbersome. The adoption of free energy circumvents this issue by encapsulating the reservoir’s effects into a single function.
Consider the total entropy change in an isothermal process at temperature :
Since the heat exchanged with the reservoir is , where is internal energy and is work done on the system, the reservoir’s entropy change is:
Thus, the total entropy change can be rewritten as:
Rearranging, we obtain:
Defining the Helmholtz free energy , we arrive at:
We arrive at reversible work theorem stating that work we do on the system goes into free energy change and the rest dissipated
For spontaneous processes at constant and volume (), this simplifies to:
This result shows that minimizing governs equilibrium and spontaneous evolution. The key advantage is that we focus only on the system’s free energy , avoiding explicit tracking of the entropy changes in the reservoir. This simplification makes free energy a powerful tool in equilibrium thermodynamics and statistical mechanics.
Free Energies and Legendre Transforms¶
Energy is a natural function of extensive variables.
Equilibrium is found by minimizing with respect to its independent variables.
In experiments, it’s often more convenient to control intensive variables (e.g., , ) 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:
Legendre transform preserves convexity: equilibrium is still found by minimization.
Free energies contain the same information as since the transform is invertible.
Free energies use experimentally controllable variables (e.g., , ).
Helmholtz Free energy
Where energy and entropy are now expressed in terms of temperature
Gibbs Free energy
Where energy, entropy volume are now expressed in terms of temperature and pressure
Visualizing the Legendre Transform¶
Simply put, the Legendre transform replaces the variable in a function with its derivative:
This results in a new function , expressed in terms of the slope.
figure-md - Unknown Directive
figure-md - Unknown Directive<img src="./figs/Legendre.png" class="bg-primary" width="300px"> Visualizing a convex function and its legendre transform.
Geometric Intuition: A curve can be described either as a collection of points or as a collection of tangent slopes .
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 to another convex function .
Moreover, the transformation is involutive, meaning that applying it twice returns the original function.
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())
Mathematical Formulation of Legendre Transform¶
The Legendre transform of is given by:
Applying the transform again recovers the original function:
In thermodynamis we are looking at minimum of energies and free energies. Hence we write Helmholtz Free energy as:
figure-md - Unknown Directive
figure-md - Unknown Directive<img src="./figs/Leg1.png" class="bg-primary" width="300px"> 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
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.
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
What is meant by a constraint in thermodynamics, and why must its removal always lead to increased entropy?
What is a quasi-static process in thermodynamics, and how is this idealization used for computing changes in thermodynamic variables?
What is the difference between the fundamental equation in thermodynamics vs. state equation e.g., like for ideal gas?
Why during a spontaneous transformation of systems entropy tend to its maximum value?
Why do we introduce Free energies of various kinds? Explain why free energy minimization is equivalent of total entropy maximization.
Can part of the entropy of a part of a total system decrease? Give some examples.
Does the entropy change depend on the path between two equilibrium states?
How is the adiabatic process different from the quasistatic and reversible process?