Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

3.2. Applications of the First Law

Course-wide Conventions & Notation

Overview and Learning Objectives

If you heat a gas in a sealed rigid container versus a piston open to the atmosphere, the temperature changes will differ—even for the same amount of heat. Why? The answer lies in how constraints (constant VV vs. constant PP) redirect energy between heat and work. This section develops a systematic workflow for applying the First Law under different process constraints, then illustrates it with common ideal-gas cases and a microscopic interpretation.

We begin by clarifying the definitions of quasi-static, reversible, and irreversible processes. We then outline a step-by-step method for using the First Law under different constraints, derive results for isochoric, isothermal, and adiabatic ideal-gas processes, and end with a microscopic interpretation that connects probability distributions of microstates with heat and work.


Learning objectives:

Core Ideas and Derivations

Thermodynamic Processes

Quasi-static process
A process carried out infinitesimally slowly so that the system remains nearly in equilibrium at all times. Each intermediate state is well-defined thermodynamically.
Reversible process
An idealized process that is (1) quasi-static and (2) free of dissipative effects, meaning it can be reversed with no net change to the system or surroundings.
Irreversible process
Any process that violates one or more of the conditions for reversibility (e.g., too rapid, frictional, or dissipative).
Dissipative effects
Processes that convert ordered energy into disordered (thermal) energy in a way that cannot be undone spontaneously. Common examples include friction, viscous drag, turbulence, electrical resistance, and heat flow across a finite temperature difference.

How to Apply the First Law of Thermodynamics

The First Law states (Section 3.1, Eq. (5)):

dU=δq+δw,dU = \delta q + \delta w,

where dUdU is the change in internal energy, δq\delta q is the heat added to the system, and δw\delta w is the work done on the system. To make this law useful for specific processes, follow the five-step workflow below.

Workflow overview: (1) Choose independent variables → (2) Rewrite the First Law → (3) Apply constraints → (4) Define the system/EOS → (5) Integrate. Click each step for details.


Applying the Workflow: VV and TT as Independent Variables

For many systems—especially gases—choosing VV and TT as independent variables simplifies calculations. Let us walk through the five-step workflow for a monatomic ideal gas.

Step 1–2: First Law in Terms of VV and TT

Starting from

δq=dU+P dV,\delta q = dU + P\,dV,

we rewrite dUdU as a total differential in VV and TT:

dU=(∂U∂T)VdT  +  (∂U∂V)TdV.dU = \left(\frac{\partial U}{\partial T}\right)_V dT \;+\; \left(\frac{\partial U}{\partial V}\right)_T dV.

Substituting:

δq=(∂U∂T)V⏟CVdT  +  [(∂U∂V)T+P]dV.\delta q = \underbrace{\left(\frac{\partial U}{\partial T}\right)_V}_{C_V} dT \;+\; \left[\left(\frac{\partial U}{\partial V}\right)_T + P\right] dV.

Step 4: Ideal-Gas Simplification

For an ideal gas, UU depends only on TT (there are no intermolecular interactions to make UU depend on VV), so (∂U∂V)T=0\left(\frac{\partial U}{\partial V}\right)_T = 0. For a monatomic ideal gas specifically,

U=32NkBT,P=NkBTV,CV=(∂U∂T)V=32NkB.U = \frac{3}{2} N k_B T, \quad P = \frac{N k_B T}{V}, \quad C_V = \left(\frac{\partial U}{\partial T}\right)_V = \frac{3}{2} N k_B.

Equation (7) then simplifies to

δq=CV dT+P dV(ideal gas, PV-only work).\delta q = C_V \, dT + P \, dV \qquad\text{(ideal gas, $PV$-only work).}

Step 3: Process Constraints

Applying these constraints to Equation (9):

Table 1:Processes for an Ideal Gas (VV and TT as Independents)

Constraint

Condition

Resulting δq\delta q

Isochoric

dV=0dV = 0

δq=CV dT\delta q = C_V\, dT

Isothermal

dT=0dT = 0

δq=P dV\delta q = P\, dV

Adiabatic

δq=0\delta q = 0

CV dT=−P dVC_V\, dT = -P\, dV

Step 5: Integrations Under Specific Constraints

  1. Isochoric (dV=0dV = 0)

    With no volume change, there is no PVPV work (w=0w = 0). All energy enters as heat:

    δq=CV dT⟹q=∫T1T2CV dT=32NkB ΔT.\delta q = C_V\, dT \quad \Longrightarrow \quad q = \int_{T_1}^{T_2} C_V \, dT = \frac{3}{2} N k_B \,\Delta T.

    Since w=0w = 0, we also have ΔU=q=CVΔT\Delta U = q = C_V \Delta T.

  2. Isothermal (dT=0dT = 0)

    For an ideal gas, ΔU=0\Delta U = 0 (because UU depends only on TT). The system absorbs heat to offset the work it does:

    q=∫V1V2NkBTV dV=NkBTln⁡ ⁣(V2V1).q = \int_{V_1}^{V_2} \frac{N k_B T}{V} \, dV = N k_B T \ln\!\bigl(\tfrac{V_2}{V_1}\bigr).

    And w=−q=−NkBTln⁡(V2/V1)w = -q = -N k_B T \ln(V_2/V_1).

  3. Adiabatic (δq=0\delta q = 0)

    Setting δq=0\delta q = 0 in Equation (9):

    CV dT=−P dV=−NkBTV dV.C_V\, dT = -P\, dV = -\frac{N k_B T}{V}\, dV.

    Separating variables:

    CVT dT=−NkBV dV⟹∫T1T2CVT dT=−∫V1V2NkBV dV.\frac{C_V}{T}\, dT = -\frac{N k_B}{V}\, dV \quad \Longrightarrow \quad \int_{T_1}^{T_2} \frac{C_V}{T}\, dT = - \int_{V_1}^{V_2} \frac{N k_B}{V}\, dV.

    Integrating both sides:

    32NkBln⁡T2T1=−NkBln⁡V2V1.\frac{3}{2} N k_B \ln\frac{T_2}{T_1} = -N k_B \ln\frac{V_2}{V_1}.

    Dividing through by NkBN k_B:

    ln⁡T2T1=−23ln⁡V2V1=ln⁡ ⁣(V1V2)2/3.\ln\frac{T_2}{T_1} = -\frac{2}{3}\ln\frac{V_2}{V_1} = \ln\!\left(\frac{V_1}{V_2}\right)^{2/3}.

    Exponentiating:

    T1V12/3=T2V22/3(monatomic ideal gas).\boxed{T_1 V_1^{2/3} = T_2 V_2^{2/3}} \qquad\text{(monatomic ideal gas).}

    which, combined with PV=nRTPV = nRT, also gives PVγ=constPV^\gamma = \text{const}. We will use these relations when we compare isothermal and adiabatic processes below.


Comparing Isothermal and Adiabatic Expansions

How does the path affect the work? The PP–VV diagram below compares a reversible isothermal expansion with a reversible adiabatic expansion from the same initial state. The shaded areas represent ∣w∣|w| for each process.

Source
import numpy as np
import matplotlib.pyplot as plt

# Parameters
n = 1.0        # mol
R = 8.314      # J/(mol K)
T1 = 300       # K
V1 = 5.0e-3    # m^3 (5 L)
V2 = 20.0e-3   # m^3 (20 L)
gamma = 5/3    # monatomic ideal gas

P1 = n * R * T1 / V1  # initial pressure

# Volume array
V = np.linspace(V1, V2, 500)
V_L = V * 1e3  # convert to liters for plotting

# Isothermal: P = nRT/V
P_iso = n * R * T1 / V

# Adiabatic: P V^gamma = P1 V1^gamma  =>  P = P1 (V1/V)^gamma
P_adi = P1 * (V1 / V)**gamma

# Convert pressures to bar for plotting
P_iso_bar = P_iso / 1e5
P_adi_bar = P_adi / 1e5
P1_bar = P1 / 1e5

fig, ax = plt.subplots(figsize=(6, 4))

# Shaded areas
ax.fill_between(V_L, 0, P_iso_bar, alpha=0.15, color='C0', label=r'$|w_{\mathrm{iso}}|$')
ax.fill_between(V_L, 0, P_adi_bar, alpha=0.15, color='C3', label=r'$|w_{\mathrm{adi}}|$')

# Curves
ax.plot(V_L, P_iso_bar, 'C0-', lw=2.5, label=f'Isothermal ($T = {T1}$ K)')
ax.plot(V_L, P_adi_bar, 'C3-', lw=2.5, label=f'Adiabatic ($\\gamma = 5/3$)')

# Initial state marker
ax.plot(V1 * 1e3, P1_bar, 'ko', ms=7, zorder=5)
ax.annotate('  initial state', xy=(V1 * 1e3, P1_bar), fontsize=10, va='center')

# Compute numerical work values for annotation
w_iso = -n * R * T1 * np.log(V2 / V1)  # J
w_adi = (P1 * V1**gamma / (1 - gamma)) * (V2**(1 - gamma) - V1**(1 - gamma))  # J

ax.set_xlabel('Volume (L)', fontsize=11)
ax.set_ylabel('Pressure (bar)', fontsize=11)
ax.set_xlim(4, 22)
ax.set_ylim(0, P1_bar * 1.15)
ax.legend(loc='upper right', fontsize=10, framealpha=0.9)
ax.set_title('Isothermal vs. Adiabatic Expansion from the Same Initial State', fontsize=11)

# Add work annotations
ax.text(14, 1.8, f'$w_{{\\mathrm{{iso}}}} = {w_iso/1e3:.2f}$ kJ', fontsize=10, color='C0',
        bbox=dict(boxstyle='round,pad=0.3', fc='white', ec='C0', alpha=0.8))
ax.text(14, 0.8, f'$w_{{\\mathrm{{adi}}}} = {w_adi/1e3:.2f}$ kJ', fontsize=10, color='C3',
        bbox=dict(boxstyle='round,pad=0.3', fc='white', ec='C3', alpha=0.8))

plt.tight_layout()
plt.show()
plt.close(fig)
<Figure size 600x400 with 1 Axes>

Comparison of reversible isothermal and adiabatic expansions of one mole of a monatomic ideal gas from (V1,T1)=(5 L,300 K)(V_1, T_1) = (5\,\mathrm{L}, 300\,\mathrm{K}) to V2=20 LV_2 = 20\,\mathrm{L}. The isothermal curve lies above the adiabatic curve at every point, so the area under it is larger: isothermal expansion does more work on the surroundings.

Why the difference? During isothermal expansion, heat flows into the gas to maintain a constant temperature, keeping the pressure higher. During adiabatic expansion (q=0q = 0), the gas cools as it does work (Eq. (16)), so the pressure drops more steeply. The isothermal path therefore pushes against a higher pressure at every volume increment, producing more work.


Microscopic Interpretation of the First Law

As developed in Section 2.1, macroscopic thermodynamic properties are ensemble averages over microstates. This perspective gives a powerful physical picture of heat and work at the molecular level.

From a statistical mechanics perspective, the internal energy is

U=∑i=1MpiEi,U = \sum_{i=1}^M p_i E_i,

where pip_i is the probability of occupying the ii-th microstate with energy EiE_i, and MM is the total number of accessible microstates. The total differential can be written as

dU=∑i=1MEi dpi⏟changing which states are occupied+∑i=1Mpi dEi⏟changing the energies of the states.dU = \underbrace{\sum_{i=1}^M E_i\, dp_i}_{\text{changing which states are occupied}} + \underbrace{\sum_{i=1}^M p_i \, dE_i}_{\text{changing the energies of the states}}.

For a closed system (constant NN) with only PVPV work, the microstate energies depend on volume. Noting that

∑i=1Mpi(∂Ei∂V)N=⟨(∂E∂V)N⟩,\sum_{i=1}^M p_i \left(\frac{\partial E_i}{\partial V}\right)_N = \Bigl\langle \bigl(\tfrac{\partial E}{\partial V}\bigr)_N \Bigr\rangle,

we identify pressure as

P=−⟨(∂E∂V)N⟩.P = - \Bigl\langle \bigl(\tfrac{\partial E}{\partial V}\bigr)_N \Bigr\rangle.

Hence,

dU=∑i=1MEi dpi  −  P dV.dU = \sum_{i=1}^M E_i\, dp_i \;-\; P\, dV.

Comparing term by term with dU=δq+δw=δq−P dVdU = \delta q + \delta w = \delta q - P\,dV, we identify:

δq=∑i=1MEi dpiandδw=−P dV=∑i=1Mpi dEi.\delta q = \sum_{i=1}^M E_i\, dp_i \qquad\text{and}\qquad \delta w = -P\,dV = \sum_{i=1}^M p_i\, dE_i.

The figure below illustrates these two mechanisms. Reading left to right: the initial state, the result of adding heat (probabilities shift; energy levels unchanged), and the result of doing work via compression (energy levels shift; probabilities unchanged).

Source
import numpy as np
import matplotlib.pyplot as plt

N_microstates = 5
E_microstates = np.array([0, 1, 2, 3, 4])
P_microstates = np.array([0.5, 0.3, 0.1, 0.05, 0.05])
P_microstates /= P_microstates.sum()

fig, axs = plt.subplots(1, 3, figsize=(13, 4.5), constrained_layout=True, sharex=True)

# --- Panel 0 (left): Initial state ---
axs[0].set_title('Initial State', fontsize=11, fontweight='bold')

for i in range(N_microstates):
    axs[0].plot([0, 1], [E_microstates[i], E_microstates[i]], color='C0', alpha=0.5, lw=1.5)
    axs[0].fill_betweenx(
        [E_microstates[i], E_microstates[i] + 0.15], 0, P_microstates[i],
        color='C1', alpha=0.5
    )
    axs[0].text(
        P_microstates[i] + 0.02, E_microstates[i] + 0.07,
        f'$p_{i+1}={P_microstates[i]:.2f}$', fontsize=9, ha='left'
    )
axs[0].set_xlabel('Probability')
axs[0].set_ylabel('Energy')
axs[0].set_xlim(0, 0.75)
axs[0].set_ylim(-0.5, 9)

# --- Panel 1 (middle): After heating ---
axs[1].set_title('After Heating ($\\delta q > 0$)\n$\\{p_i\\}$ change; $\\{E_i\\}$ fixed',
                  fontsize=11, fontweight='bold')

P_heated = np.array([0.35, 0.25, 0.18, 0.12, 0.10])
P_heated /= P_heated.sum()

for i in range(N_microstates):
    axs[1].plot([0, 1], [E_microstates[i], E_microstates[i]], color='C0', alpha=0.5, lw=1.5)
    axs[1].fill_betweenx(
        [E_microstates[i], E_microstates[i] + 0.15], 0, P_heated[i],
        color='C3', alpha=0.5
    )
    axs[1].text(
        P_heated[i] + 0.02, E_microstates[i] + 0.07,
        f'$p_{i+1}={P_heated[i]:.2f}$', fontsize=9, ha='left'
    )
axs[1].set_xlabel('Probability')
axs[1].set_xlim(0, 0.75)
axs[1].set_ylim(-0.5, 9)

# --- Panel 2 (right): After compression ---
axs[2].set_title('After Compression ($\\delta w > 0$)\n$\\{E_i\\}$ change; $\\{p_i\\}$ fixed',
                  fontsize=11, fontweight='bold')

E_compressed = np.array([0, 2, 4, 6, 8])

for i in range(N_microstates):
    axs[2].plot([0, 1], [E_compressed[i], E_compressed[i]], color='C0', alpha=0.5, lw=1.5)
    axs[2].fill_betweenx(
        [E_compressed[i], E_compressed[i] + 0.15], 0, P_microstates[i],
        color='C4', alpha=0.5
    )
    axs[2].text(
        P_microstates[i] + 0.02, E_compressed[i] + 0.07,
        f'$p_{i+1}={P_microstates[i]:.2f}$', fontsize=9, ha='left'
    )
axs[2].set_xlabel('Probability')
axs[2].set_xlim(0, 0.75)
axs[2].set_ylim(-0.5, 9)

plt.show()
plt.close(fig)
<Figure size 1300x450 with 3 Axes>

Schematic of microstate energies (vertical axis) and occupation probabilities (horizontal bars). Left: initial state. Middle: after heating—the energy levels are unchanged, but the distribution shifts toward higher-energy states (∑Ei dpi>0\sum E_i\,dp_i > 0). Right: after compression—the probabilities are unchanged, but every energy level shifts upward (∑pi dEi>0\sum p_i\,dE_i > 0).

Worked Example

Isothermal reversible expansion of an ideal gas

One mole of an ideal gas expands reversibly and isothermally at T=300 KT=300\ \mathrm{K} from V1=5.0 LV_1=5.0\ \mathrm{L} to V2=20.0 LV_2=20.0\ \mathrm{L}. Compute ww, qq, and ΔU\Delta U.

Assumptions. Ideal gas, reversible process, isothermal; for an ideal gas U=U(T)U=U(T).

  1. Work

    For a reversible process, Pext=P=nRT/VP_{\mathrm{ext}} = P = nRT/V at every step:

    w=−∫V1V2P dV=−∫V1V2nRTV dV=−nRTln⁡(V2V1).w = -\int_{V_1}^{V_2} P\,dV = -\int_{V_1}^{V_2}\frac{nRT}{V}\,dV = -nRT\ln\left(\frac{V_2}{V_1}\right).

    With n=1 moln=1\,\mathrm{mol}, R=8.314 J mol−1 K−1R=8.314\ \mathrm{J\,mol^{-1}\,K^{-1}}, T=300 KT=300\ \mathrm{K}, and V2/V1=4V_2/V_1=4:

    w=−(1)(8.314)(300)ln⁡4=−3.46×103 J=−3.46 kJ.w = -(1)(8.314)(300)\ln 4 = -3.46\times10^{3}\ \mathrm{J}=-3.46\ \mathrm{kJ}.
  2. Internal energy

    ΔU=0(isothermal ideal gas: U=U(T) and ΔT=0).\Delta U = 0 \quad (\text{isothermal ideal gas: } U = U(T) \text{ and } \Delta T = 0).
  3. Heat from the First Law

    ΔU=q+w  ⇒  0=q+w  ⇒  q=−w=+3.46 kJ.\Delta U = q + w \;\Rightarrow\; 0 = q + w \;\Rightarrow\; q = -w = +3.46\ \mathrm{kJ}.

Result. w=−3.46 kJw=-3.46\ \mathrm{kJ}, q=+3.46 kJq=+3.46\ \mathrm{kJ}, and ΔU=0\Delta U=0. The gas does work on the surroundings, and an equal amount of heat flows in from the thermal reservoir to maintain the temperature.

Concept Checks

  1. Why is reversibility useful even when real processes are irreversible?

  2. What distinguishes an isothermal process from an adiabatic process in terms of energy transfer mechanisms?

  3. For an ideal gas, why does (∂U/∂V)T=0\left(\partial U/\partial V\right)_T=0?

  4. In the microscopic expression dU=∑iEi dpi+∑ipi dEidU=\sum_i E_i\,dp_i+\sum_i p_i\,dE_i, which term corresponds to heat and which to work (under the stated conditions)?

  5. An isothermal expansion and an adiabatic expansion start from the same initial state and end at the same final volume. Which produces more work? Which produces a larger temperature change?

Key Takeaways