---
title: "First law of thermodynamics, heat and work | Sandbox Physics"
description: "Follow heat and work across a boundary, and compare two gas paths with the same change in internal energy."
canonical_url: "https://sandboxphysics.com/learn/heat-and-statistics/first-law-of-thermodynamics/"
language: "en"
page_type: "story"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/learn/heat-and-statistics/first-law-of-thermodynamics/"
last_modified: "2026-11-25"
---

[Volume 5 · Heat, Probability and Matter](https://sandboxphysics.com/learn/heat-and-statistics/)

# How do heat and work change internal energy?

Follow heat and work across a boundary, and compare two gas paths with the same change in internal energy.

Before you start: [Chapter 1](https://sandboxphysics.com/learn/heat-and-statistics/temperature-and-thermal-equilibrium/) on heat capacity, [Chapter 2](https://sandboxphysics.com/learn/heat-and-statistics/molecular-motion-and-pressure/) on gases and [Volume 1 Chapter 9](https://sandboxphysics.com/learn/mechanics/work-and-kinetic-energy/) on work.

After this chapter you can: Choose a system boundary and calculate heat, work and internal energy for a gas process.

Incoming heat and work done on a system add to its internal energy. Outgoing heat and work done by the system subtract from it. The change between two equilibrium states is fixed by those states. Heat and work can differ along two paths between them.

Chapter 1 tracked heat transfer between a probe and a bath. Chapter 2 connected gas pressure and temperature to molecular motion. Here we draw the system boundary, decide what crosses it and calculate the difference between two ways to expand a gas.

## 3.1 The first law adds incoming heat and subtracts outgoing work

Choose a closed system so no matter crosses its boundary. Here the system has no appreciable change in its bulk kinetic or gravitational potential energy. Its internal energy $U$ includes microscopic motion and interactions within it. Define $Q$ as heat entering because of a temperature difference and $W_{\mathrm{by}}$ as work done by the system on its surroundings. Each can be negative.

$$
\Delta U=Q-W_{\mathrm{by}} .
$$

Work and heat are transfers across the boundary. Internal energy is a property of the state. When a gas receives $500\,\mathrm J$ of heat and does $200\,\mathrm J$ of work during expansion, its internal energy rises by $300\,\mathrm J$. When a gas is compressed, the surroundings do work on it and $W_{\mathrm{by}}$ is negative. [OpenStax, University Physics Volume 2, Section 3.3](https://openstax.org/books/university-physics-volume-2/pages/3-3-first-law-of-thermodynamics).

## 3.2 Work by a gas is the signed area under its pressure–volume path

Put the gas in a cylinder with a frictionless piston of cross-sectional area $A$. If a nearly uniform gas pressure $p$ moves the piston outward by $\mathrm dx$, the gas exerts a force $pA$. The volume change is $\mathrm dV=A\,\mathrm dx$, so the work is $p\,\mathrm dV$. For a slow process in which the gas stays close to internal equilibrium,

$$
W_{\mathrm{by}}=\int_{V_i}^{V_f}p\,\mathrm dV .
$$

On a pressure–volume graph, this is the area signed by the direction of travel. Expansion gives positive work and compression gives negative work. Pressure times volume has units of pascal cubic metres, or joules. When the volume stays fixed there is no piston work. At constant pressure the work is $p(V_f-V_i)$. [OpenStax, University Physics Volume 2, Section 3.2](https://openstax.org/books/university-physics-volume-2/pages/3-2-work-heat-and-internal-energy).

## 3.3 Temperature and heat have separate conditions

For a fixed amount $n$ of ideal gas, $pV=nRT$, where $T$ is absolute temperature in kelvins and $R$ is the gas constant. The monatomic ideal gas has internal energy $U=\tfrac32 nRT$. Its molar heat capacity at fixed volume is $C_{V,\mathrm m}=\tfrac32R$, in $\mathrm{J\,mol^{-1}\,K^{-1}}$. Here we assume the gas stays in the range where these relations apply. [OpenStax, University Physics Volume 2, Section 3.5](https://openstax.org/books/university-physics-volume-2/pages/3-5-heat-capacities-of-an-ideal-gas).

In an isothermal process, the temperature stays fixed. The ideal gas keeps the same internal energy. During expansion it must receive heat equal to the work it does. Substituting the pressure of the ideal gas in the work integral gives

$$
W_{\mathrm{by}}=nRT\ln\left(\frac{V_f}{V_i}\right).
$$

In an adiabatic process, there is no heat transfer. An insulated gas that expands against a piston does work at the expense of its internal energy and cools. If only piston work is present and the expansion is reversible, $nC_{V,\mathrm m}\,\mathrm dT=-p\,\mathrm dV$. With ideal gas pressure, integration at fixed heat capacities gives $pV^\gamma$ constant, where $\gamma=C_{P,\mathrm m}/C_{V,\mathrm m}$ and $C_{P,\mathrm m}=C_{V,\mathrm m}+R$ is the molar heat capacity at fixed pressure. The same volume increase therefore takes the gas to different pressures on isothermal and reversible adiabatic paths. [OpenStax, University Physics Volume 2, Section 3.4](https://openstax.org/books/university-physics-volume-2/pages/3-4-thermodynamic-processes), [Section 3.6](https://openstax.org/books/university-physics-volume-2/pages/3-6-adiabatic-processes-for-an-ideal-gas).

## 3.4 Two paths give the same internal-energy change

Take one mole of monatomic ideal gas at $300\,\mathrm K$ and $10.0\,\mathrm L$. Bring it to $450\,\mathrm K$ and $20.0\,\mathrm L$ along either of two paths. On path A, first heat it at fixed volume and then expand it at the final temperature. On path B, first expand it at the initial temperature and then heat it at fixed volume.

- Heat first, then expand
- Expand first, then heat

**Figure 3.1** Two calculated paths between the same initial and final states of an ideal gas. The vertical segments do no piston work. Path A expands at higher pressure than Path B.

The fixed-volume segments contribute zero work. Both isothermal segments double the volume, so they have the same logarithm in the work formula. Path A does more work because it expands at a higher temperature. Both paths raise the temperature by $150\,\mathrm K$, so $\Delta U=\tfrac32 nR(150\,\mathrm K)$ is about $1.87\,\mathrm{kJ}$ for either path.

**Table 3.1** Calculated energy transfers for the paths in Figure 3.1. Heat into the gas and work done by the gas are positive.

| Path | Change in internal energy (kJ) | Work by gas (kJ) | Heat into gas (kJ) |
| --- | --- | --- | --- |
| A, heat then expand | 1.871 | 2.593 | 4.464 |
| B, expand then heat | 1.871 | 1.729 | 3.600 |

The extra heat entering along Path A pays for its extra work. The shared endpoints determine the energy stored in the gas at the start and finish.

## 3.5 Use the same energy balance in the calorimeter

Open [Electrical Calorimeter](https://sandboxphysics.com/labs/calorimeter/) and choose **Reset**. Draw the system boundary around the water, sample, cup, immersed hardware and probe. Electrical work enters across the heater leads. Heat can leave the system for the room. The volume is fixed, so the work across this boundary is electrical, with $W_{\mathrm{by}}=-E_{\mathrm{in}}$, where $E_{\mathrm{in}}$ is the electrical input. If the heat leaving is $Q_{\mathrm{room}}>0$, then $Q=-Q_{\mathrm{room}}$ and

$$
\Delta U=E_{\mathrm{in}}-Q_{\mathrm{room}} .
$$

In the default sample record, the heater runs at $8.0\,\mathrm V$ and $1.0\,\mathrm A$ for $240\,\mathrm s$. Integrating power gives the **Recorded electrical energy** of $1920\,\mathrm J$. The bath and probe store some of that energy, and some has already left for the room when the heater switches off. Predict the result of setting the heat loss to zero and select **Ideal insulation** to acquire that record.

**Table 3.2** Energy at the end of the heater pulse for the two simulated sample runs. Stored energies and heat loss are from the separate ideal model states. The input energy follows from the saved voltage and current.

| Setting | Electrical input (J) | Bath energy increase (J) | Probe energy increase (J) | Heat to room (J) |
| --- | --- | --- | --- | --- |
| Default sleeve | 1920.00 | 1486.26 | 6.73 | 427.00 |
| Ideal insulation | 1920.00 | 1911.38 | 8.62 | 0.00 |

Add the two stored contributions to get the system's internal-energy increase. In this model the bath includes the water, container, immersed hardware and sample, while the probe has its own temperature. The **JSON** export labels both ideal temperatures and raw probe observations. Use the stored energies to check the first law, then compare the recorded probe curves to see the different warming.

## 3.6 Exercises

1. A closed gas absorbs $320\,\mathrm J$ of heat and does $120\,\mathrm J$ of work. Find the change in internal energy.
2. The surroundings do $70\,\mathrm J$ of work on a gas and the gas releases $50\,\mathrm J$ of heat. Find the signed work by the gas and its energy change.
3. A gas expands slowly from $2.0\,\mathrm L$ to $5.0\,\mathrm L$ at $200\,\mathrm{kPa}$. Find the work it does. How does the sign change on reversing the motion at the same pressure?
4. A fixed-volume gas absorbs $180\,\mathrm J$ of heat and exchanges no other work. Find the internal-energy change. What condition makes the piston work vanish?
5. One mole of ideal gas expands isothermally at $300\,\mathrm K$ from $10.0\,\mathrm L$ to $20.0\,\mathrm L$. Find the work and heat transferred. Explain why they have the same magnitude.
6. The same gas expands adiabatically and does positive work. What happens to its internal energy and temperature? Would the same conclusion hold for an ideal-gas expansion into a vacuum without heat transfer?
7. Use Table 3.1. Calculate the difference in heat input between paths A and B. What other difference has the same value?
8. Use Table 3.2. In the default sleeve setting, estimate the internal-energy increase and check it against the electrical input minus the heat loss. Why does the ideal insulation row give a larger increase?

## 3.7 Answers and explanations

Exercise 1

Use $\Delta U=320\,\mathrm J-120\,\mathrm J=200\,\mathrm J$. The heat entering supplies both the work and the increase in stored energy.

Exercise 2

The work by the gas is $-70\,\mathrm J$ and its heat input is $-50\,\mathrm J$. The change in internal energy is $-50\,\mathrm J-(-70\,\mathrm J)=+20\,\mathrm J$.

Exercise 3

The pressure–volume area is $(200000\,\mathrm{Pa})(0.0030\,\mathrm{m^3})=600\,\mathrm J$. The signed volume change reverses on compression, so the work by the gas becomes $-600\,\mathrm J$.

Exercise 4

The piston cannot move, so the volume change and piston work are zero. Heat is the only energy transfer and the internal energy rises by $180\,\mathrm J$.

Exercise 5

The logarithm of the volume ratio is $\ln 2$. The work is $nRT\ln2\approx1.73\,\mathrm{kJ}$. The ideal gas is isothermal, so its internal energy stays fixed and it must receive the same amount as heat.

Exercise 6

Positive work with zero heat input lowers the internal energy. The ideal gas then cools. A free expansion into vacuum with no heat transfer and zero work keeps the ideal gas's internal energy and equilibrium temperature fixed.

Exercise 7

Path A takes about $0.864\,\mathrm{kJ}$ more heat than path B. Since both paths have the same internal-energy change, this is also the extra work on path A.

Exercise 8

Bath and probe together gain about $1493\,\mathrm J$. Subtracting about $427\,\mathrm J$ from the electrical input gives the same value within rounding. With ideal insulation, the same input remains in the system because no heat leaves for the room.

## Test it in the Lab

Change one setting at a time, then compare what you see with the tables and answers in this chapter.

[Electrical Calorimeter → Heat a sample in a stirred water bath. Record electrical input and thermometer response, compare a separate water-only blank, and recover specific heat with heat-loss and probe-response corrections.](https://sandboxphysics.com/labs/calorimeter/)

## Sources and reading scope

1. [OpenStax, University Physics Volume 2, §3.2 Work, Heat, and Internal Energy](https://openstax.org/books/university-physics-volume-2/pages/3-2-work-heat-and-internal-energy)

   The section defines pressure-volume work, heat and internal energy and states their sign conventions.

2. [OpenStax, University Physics Volume 2, §3.3 First Law of Thermodynamics](https://openstax.org/books/university-physics-volume-2/pages/3-3-first-law-of-thermodynamics)

   The section balances energy transferred by heat and work against the change of a system’s internal energy.

3. [OpenStax, University Physics Volume 2, §3.4 Thermodynamic Processes](https://openstax.org/books/university-physics-volume-2/pages/3-4-thermodynamic-processes)

   The section compares constant-pressure, constant-volume, isothermal and adiabatic paths.

4. [OpenStax, University Physics Volume 2, §3.5 Heat Capacities of an Ideal Gas](https://openstax.org/books/university-physics-volume-2/pages/3-5-heat-capacities-of-an-ideal-gas)

   The section relates an ideal gas’s temperature change to internal energy and distinguishes the constant-volume and constant-pressure heat capacities.

5. [OpenStax, University Physics Volume 2, §3.6 Adiabatic Processes for an Ideal Gas](https://openstax.org/books/university-physics-volume-2/pages/3-6-adiabatic-processes-for-an-ideal-gas)

   The section derives the pressure-volume relation for a reversible adiabatic ideal-gas process.

[← Chapter 2 · How do molecular collisions create pressure?](https://sandboxphysics.com/learn/heat-and-statistics/molecular-motion-and-pressure/) [Chapter 4 · Why does heat flow spontaneously from hot to cold? →](https://sandboxphysics.com/learn/heat-and-statistics/entropy-and-irreversibility/)

Chapters in this volume

- [1. When does a thermometer represent the sample temperature?](https://sandboxphysics.com/learn/heat-and-statistics/temperature-and-thermal-equilibrium/)
- [2. How do molecular collisions create pressure?](https://sandboxphysics.com/learn/heat-and-statistics/molecular-motion-and-pressure/)
- [3. How do heat and work change internal energy?](https://sandboxphysics.com/learn/heat-and-statistics/first-law-of-thermodynamics/)
- [4. Why does heat flow spontaneously from hot to cold?](https://sandboxphysics.com/learn/heat-and-statistics/entropy-and-irreversibility/)
- [5. How much work can a heat engine deliver in one cycle?](https://sandboxphysics.com/learn/heat-and-statistics/heat-engines-and-cycles/)
- [6. How do probabilities determine a system's thermal averages?](https://sandboxphysics.com/learn/heat-and-statistics/boltzmann-weights-and-fluctuations/)

## Keep reading

Interactive Physics Textbook · Reading path

### Heat, Probability and Matter

1. [Article **When does a thermometer represent the sample temperature?**](https://sandboxphysics.com/learn/heat-and-statistics/temperature-and-thermal-equilibrium/)
2. [Article **How do molecular collisions create pressure?**](https://sandboxphysics.com/learn/heat-and-statistics/molecular-motion-and-pressure/)
3. [You are here **How do heat and work change internal energy?**](https://sandboxphysics.com/learn/heat-and-statistics/first-law-of-thermodynamics/)
4. [Article **Why does heat flow spontaneously from hot to cold?**](https://sandboxphysics.com/learn/heat-and-statistics/entropy-and-irreversibility/)
5. [Article **How much work can a heat engine deliver in one cycle?**](https://sandboxphysics.com/learn/heat-and-statistics/heat-engines-and-cycles/)
6. [Article **How do probabilities determine a system's thermal averages?**](https://sandboxphysics.com/learn/heat-and-statistics/boltzmann-weights-and-fluctuations/)

1 more group

### Other articles that use the same experiments

Each experiment from this article that another series also uses, followed by the articles there.

1. [Lab **Electrical Calorimeter**](https://sandboxphysics.com/labs/calorimeter/)
2. [Article **The cup absorbs heat too**](https://sandboxphysics.com/stories/instruments/calorimeter/)
