First Law of Thermodynamics and Internal Energy

Rub your hands together and they warm up; there is no "cold" you can rub them to get them colder. A weight winds a clock, and somewhere along the way the ordered energy of the falling mass becomes the random jiggling we call heat. For most of the nineteenth century heat and mechanical work were thought to be different substances — "caloric" was a fluid you poured from a hot body into a cold one. The experiments of Mayer, Joule, and Helmholtz in the 1840s demolished that picture: a fixed amount of mechanical work always produces a definite amount of heat, the mechanical equivalent of heat. Heat and work are two currencies for the same thing — energy. The first law is the bookkeeping rule for that energy. It makes a claim that is easy to state and enormously consequential: there exists a state function UU, the internal energy, whose change in any process equals the heat added to the system plus the work done on it, ΔU=Q+W\Delta U = Q + W. The subtle part is not conservation — it is that UU is a state function. Heat QQ and work WW separately depend on the whole path a system takes; only their sum forgets the path and depends on the endpoints alone. That is why you can compute ΔU\Delta U along the easiest imaginable route and trust the answer for the messiest real one. Combined with the zeroth law (which gives temperature) and anticipating the second law (which gives entropy through δQrev=T dS\delta Q_{\mathrm{rev}} = T\,\mathrm{d}S), the first law supplies the energy axis of thermodynamics. For a simple system it becomes the fundamental relation dU=T dS−p dV+μ dN\mathrm{d}U = T\,\mathrm{d}S - p\,\mathrm{d}V + \mu\,\mathrm{d}N, from which every thermodynamic potential follows by a Legendre transform and every Maxwell relation follows from the exactness of dU\mathrm{d}U. Microscopically the law acquires a face: U=⟨E⟩=∑ipiEiU = \langle E\rangle = \sum_i p_i E_i. Heating redistributes the occupation probabilities among fixed energy levels; working slides the levels themselves. The macroscopic first law is the shadow of microscopic energy conservation.

Key takeaways
  • The first law asserts energy conservation with heat included: there is a state function UU (internal energy) whose change equals the heat QQ added plus the work WW done on the system, ΔU=Q+W\Delta U = Q + W.
  • Although QQ and WW are individually path-dependent (inexact differentials δQ,δW\delta Q,\delta W), their sum depends only on the endpoints — this is the physical content of the law.
  • In differential form dU=δQ+δW\mathrm{d}U = \delta Q + \delta W; for a simple compressible fluid changing reversibly, δW=−p dV\delta W = -p\,\mathrm{d}V and δQ=T dS\delta Q = T\,\mathrm{d}S, giving dU=T dS−p dV\mathrm{d}U = T\,\mathrm{d}S - p\,\mathrm{d}V.
  • Around any cycle ∮dU=0\oint\mathrm{d}U = 0, so net work out equals net heat in — a perpetual-motion machine of the first kind (work from nothing) is impossible.
  • Heat capacities are the measurable responses CV=(∂U/∂T)VC_V = (\partial U/\partial T)_V and Cp=(∂H/∂T)pC_p = (\partial H/\partial T)_p; for an ideal monatomic gas CV=32nRC_V = \tfrac32 nR, Cp=52nRC_p = \tfrac52 nR.
  • Statistically U=⟨E⟩=∑ipiEiU = \langle E\rangle = \sum_i p_i E_i: heating changes the probabilities dpi\mathrm{d}p_i at fixed levels (δQ\delta Q), working changes the levels dEi\mathrm{d}E_i at fixed occupation (δW\delta W).
  • Key idea: The combination heat-plus-work is path-independent. Define UU by ΔU=Q+W\Delta U = Q + W; then UU is a state function and dU\mathrm{d}U is an exact differential even though δQ\delta Q and δW\delta W separately are not.

Where this lives today

The first law is the silent backbone of every energy technology. A car engine, a jet turbine, and a power-station steam cycle are all closed loops in a thermodynamic diagram whose net work is an enclosed area and whose fuel bill is the net heat in. Battery modelling, building HVAC design, and rocket-nozzle analysis all begin by writing ΔU=Q+W\Delta U = Q + W (or its open-system cousin, the steady-flow energy equation) for a control volume. At the frontier the same bookkeeping runs at the scale of single molecules. In stochastic thermodynamics one tracks heat and work along an individual fluctuating trajectory of a colloidal bead in an optical trap, where δQ\delta Q and δW\delta W are random but their sum obeys the first law exactly, trajectory by trajectory. Landauer's principle — that erasing one bit of information costs at least kBTln⁡2k_{\mathrm B}T\ln 2 of dissipated heat — is a first-law-plus-second-law statement now verified in the lab, and it is why the thermodynamics of computation has become a live research field.

The physical picture

Think of internal energy as the water level in a tank fed by two taps — one labelled heat, one labelled work. Once water is in the tank you cannot tell which tap it came from; the level records only the total added. Likewise ΔU\Delta U records total energy transferred, never how much arrived as heat versus work. This is the whole content of "UU is a state function": the level depends on the state, the taps describe the process. The payoff of path-independence is a computational superpower. To find ΔU\Delta U between two equilibrium states you may replace the actual, complicated process with the simplest one you can imagine — adiabatic, isochoric, reversible — because the answer is guaranteed identical. The theorist's most-used trick and the engineer's too. Microscopically there are two distinct knobs. Heating jiggles the populations of the energy levels while leaving the levels fixed; working (compressing, magnetizing) slides the levels up or down while the populations momentarily ride along. Two physical operations, one conserved total: U=∑ipiEiU = \sum_i p_i E_i. The figure below shows the sharp difference.

Figure
Two ways to change internal energy: heating shifts level populations, working shifts the levels
Start Heat δQ: same levels, new populations Work δW: levels move E₀ E₁ E₂ population climbs levels rise U = Σ pᵢ Eᵢ — δQ = Σ Eᵢ dpᵢ (populations) · δW = Σ pᵢ dEᵢ (levels)

A perpetual-motion machine of the first kind would deliver work over a cycle with no energy input. But UU returns to its starting value after any cycle, ∮dU=0\oint\mathrm{d}U = 0, so the net work out must exactly equal the net heat in. You cannot get something for nothing — and the geometry of a closed loop in the pressure–volume plane makes this vivid.

Figure
Around any cycle the state function U closes to zero while heat and work do not
A closed cycle in the p–V plane: ∮dU = 0, but ∮δQ = ∮δW = enclosed area V p enclosed area = net work by gas = net heat in 1 2 3 4 ∮dU = 0 ✓ ∮δQ ≠ 0 ∮δW ≠ 0 The state function forgets the loop; the process quantities remember it — that is a heat engine.

The core equations

The law is easiest to read in two forms — a finite statement about two states and an infinitesimal statement about one step. We adopt the physics sign convention: QQ is heat added to the system, WW is work done on the system. (Chemistry and IUPAC often write ΔU=Q−W\Delta U = Q - W with WW the work done by the system — same physics, opposite sign on WW. Watch which convention a text uses.)

ΔU=Q+W(1)\Delta U = Q + W \qquad (1)

where: ΔU=Ufinal−Uinitial\Delta U = U_{\mathrm{final}} - U_{\mathrm{initial}} — change in the state function; QQ — heat absorbed by the system (a process quantity); WW — work done on the system (a process quantity). The equation is a definition of UU and a claim that this UU is path-independent — the second part is the physics. Passing to infinitesimals exposes the exactness structure. We write dU\mathrm{d}U for the exact differential and δ\delta for the inexact ones, a warning that no function QQ or WW of the state exists.

dU=δQ+δW(2)\mathrm{d}U = \delta Q + \delta W \qquad (2)

where: dU\mathrm{d}U — exact differential of UU; δQ,δW\delta Q,\delta W — inexact differentials, path-dependent. Read physically: a tiny energy change can be split into "heat added" and "work done on," but only their sum is a property of the state. For a fluid, the work done on the system by a quasi-static pressure is negative of p dVp\,\mathrm{d}V, because pushing the piston in (compression, dV<0\mathrm{d}V<0) does positive work on the gas.

δW=−p dV(3)\delta W = -p\,\mathrm{d}V \qquad (3)

where: pp — system pressure; dV\mathrm{d}V — volume change. Compression (dV<0\mathrm{d}V<0) gives δW>0\delta W>0 (energy in); expansion (dV>0\mathrm{d}V>0) gives δW<0\delta W<0 (the gas spends energy pushing out). Substituting the reversible heat δQrev=T dS\delta Q_{\mathrm{rev}} = T\,\mathrm{d}S (anticipating the second law) turns the first law into the master equation of equilibrium thermodynamics.

dU=T dS−p dV(4)\mathrm{d}U = T\,\mathrm{d}S - p\,\mathrm{d}V \qquad (4)

where: TT — absolute temperature; dS\mathrm{d}S — entropy change; the two terms are reversible heat and reversible work. Every thermodynamic potential and Maxwell relation descends from the exactness of this single line. Opening the system to particle exchange adds one conjugate pair.

dU=T dS−p dV+μ dN(5)\mathrm{d}U = T\,\mathrm{d}S - p\,\mathrm{d}V + \mu\,\mathrm{d}N \qquad (5)

where: μ\mu — chemical potential, the energy cost of adding one particle at fixed S,VS,V; dN\mathrm{d}N — change in particle number. The heat capacities are the directly measurable slopes of UU (and its Legendre cousin HH).

CV=(∂U∂T)V,Cp=(∂H∂T)p(6)C_V = \left(\frac{\partial U}{\partial T}\right)_V, \qquad C_p = \left(\frac{\partial H}{\partial T}\right)_p \qquad (6)

where: CV,CpC_V,C_p — heat capacities at constant volume and pressure; H≡U+pVH \equiv U + pV — enthalpy. For an ideal monatomic gas these are 32nR\tfrac32 nR and 52nR\tfrac52 nR, differing by exactly nRnR because at constant pressure the gas also does expansion work. Microscopically UU is nothing but the ensemble average of the energy levels, and the split into heat and work is a split into "change the probabilities" versus "change the levels."

U=⟨E⟩=∑ipiEi(7)U = \langle E\rangle = \sum_i p_i E_i \qquad (7)

where: pip_i — occupation probability of level ii; EiE_i — its energy. Then δQ=∑iEi dpi\delta Q = \sum_i E_i\,\mathrm{d}p_i (heating shuffles populations) and δW=∑ipi dEi\delta W = \sum_i p_i\,\mathrm{d}E_i (working moves levels) — the microscopic origin of equation (2).

Derivation AInternal energy is a state function if and only if heat-plus-work is exact

We want to prove the logical spine of the first law: the empirical fact that ∮(δQ+δW)=0\oint(\delta Q + \delta W) = 0 around every cycle is exactly equivalent to the existence of a state function UU with dU=δQ+δW\mathrm{d}U = \delta Q + \delta W, and equivalent again to path-independence of ∫(δQ+δW)\int(\delta Q+\delta W). None of these three statements is obvious a priori — heat and work each fail it — so the content of the law is that their sum does not. The strategy is to run the standard "closed-loop integral vanishes ⇒\Rightarrow potential exists" argument on the combined one-form and then confirm it on an explicit ideal-gas cycle so the abstract claim carries a number.

Step 1. Suppose experiment establishes ∮(δQ+δW)=0\oint(\delta Q + \delta W) = 0 for every closed path in state space. Define U(A)−U(ref)≡∫refA(δQ+δW)U(A) - U(\text{ref}) \equiv \int_{\text{ref}}^{A}(\delta Q + \delta W) along any path. Why this is well-defined: if two paths from ref to AA gave different integrals, running out along one and back along the other would be a closed loop with nonzero integral — contradicting the hypothesis. So U(A)U(A) depends on AA alone.

Step 2. By construction dU=δQ+δW\mathrm{d}U = \delta Q + \delta W, and UU is a function of state — the internal energy. Conversely, if such a UU exists then ∮dU=0\oint\mathrm{d}U = 0 trivially, closing the equivalence.

Step 3. Now confirm the loop actually closes on a concrete example: a rectangular ideal-gas cycle with corners 1(P1,V1)→2(P1,V2)→3(P2,V2)→4(P2,V1)→11(P_1,V_1)\to 2(P_1,V_2)\to 3(P_2,V_2)\to 4(P_2,V_1)\to 1, taken clockwise with P1>P2P_1>P_2, V2>V1V_2>V_1. Using U∝pVU\propto pV for an ideal gas, sum ΔU\Delta U over the four legs.

∮dU=(U2−U1)+(U3−U2)+(U4−U3)+(U1−U4)=0\oint\mathrm{d}U = (U_2-U_1)+(U_3-U_2)+(U_4-U_3)+(U_1-U_4) = 0

Why it must vanish: the sum telescopes — every corner value appears once with each sign — regardless of the values, which is precisely what "state function" means.

Step 4. Meanwhile the net work on the gas is ∮δW=−(P1−P2)(V2−V1)=−area≠0\oint\delta W = -(P_1-P_2)(V_2-V_1) = -\text{area}\neq 0, so by the first law ∮δQ=−∮δW=+area≠0\oint\delta Q = -\oint\delta W = +\text{area}\neq 0. The state function closes; the process quantities do not. Verified: telescoping of ∮dU\oint\mathrm{d}U, the clockwise-loop work −area-\text{area}, and ∮δQ=+area\oint\delta Q = +\text{area} reproduced symbolically and numerically in verify_aq-sm-first-law-internal-energy.py. Cf. Fermi Ch. 3, Reif §5.11.

Go deeper · Derivation B · 1 minThe microscopic first law: heat moves populations, work moves levels
Derivation BThe microscopic first law: heat moves populations, work moves levels

Starting from the statistical definition U=∑ipiEiU = \sum_i p_i E_i, we derive the clean split dU=δQ+δW\mathrm{d}U = \delta Q + \delta W with δQ=∑iEi dpi\delta Q = \sum_i E_i\,\mathrm{d}p_i and δW=∑ipi dEi\delta W = \sum_i p_i\,\mathrm{d}E_i, showing that the two macroscopic modes of energy transfer correspond to two mathematically distinct ways of changing the ensemble average. This is the payoff that makes "heat" and "work" precise rather than merely intuitive: the derivative of the energy average splits, by the product rule, into a term that varies the probabilities at fixed levels and a term that varies the levels at fixed probabilities.

Step 1. Differentiate the average energy treating both the probabilities pip_i and the level energies EiE_i as variables (levels move when you change volume, magnetic field, etc.).

dU=d ⁣(∑ipiEi)=∑iEi dpi+∑ipi dEi\mathrm{d}U = \mathrm{d}\!\left(\sum_i p_i E_i\right) = \sum_i E_i\,\mathrm{d}p_i + \sum_i p_i\,\mathrm{d}E_i

Why two terms: the product rule; there is no third term because UU is bilinear in {pi}\{p_i\} and {Ei}\{E_i\}.

Step 2. Identify the first sum with heat. Heating a system at fixed external parameters (fixed levels) redistributes probability toward higher-energy states without moving them: δQ=∑iEi dpi\delta Q = \sum_i E_i\,\mathrm{d}p_i.

Step 3. Identify the second sum with work. Doing work — compressing the box, ramping a field — shifts the level energies while, in a slow (reversible) change, the occupations ride along: δW=∑ipi dEi\delta W = \sum_i p_i\,\mathrm{d}E_i. For a gas, ∑ipi(∂Ei/∂V)=−p\sum_i p_i(\partial E_i/\partial V) = -p, recovering δW=−p dV\delta W = -p\,\mathrm{d}V.

Step 4. Their sum is the exact dU\mathrm{d}U, so the abstract "dU=δQ+δW\mathrm{d}U = \delta Q + \delta W" is literally the product rule applied to ⟨E⟩\langle E\rangle. Verified: the identity d⟨E⟩=∑E dp+∑p dE\mathrm{d}\langle E\rangle = \sum E\,\mathrm{d}p + \sum p\,\mathrm{d}E checked symbolically in the verify script; the mechanical ∑pi ∂VEi=−p\sum p_i\,\partial_V E_i = -p is standard (Kardar Ch. 4). Cf. Sethna Ch. 6.

Limiting cases

How the first law specializes on the standard reversible processes of an ideal gas:

CaseResultMeaning
Isochoric (dV=0\mathrm{d}V=0)δW=0,  ΔU=Q=CV ΔT\delta W = 0,\ \ \Delta U = Q = C_V\,\Delta TNo work; all heat becomes internal energy. Defines CVC_V.
Isobaric (pp const)Q=Cp ΔT,  W=−p ΔV,  ΔU=CV ΔTQ = C_p\,\Delta T,\ \ W = -p\,\Delta V,\ \ \Delta U = C_V\,\Delta TExtra heat Cp−CV=nRC_p-C_V = nR pays for the expansion work.
Isothermal (TT const)ΔU=0,  Q=−W=nRTln⁡(Vf/Vi)\Delta U = 0,\ \ Q = -W = nRT\ln(V_f/V_i)Ideal-gas UU depends on TT only; all heat in leaves as work out.
Adiabatic (δQ=0\delta Q=0)ΔU=W=− ⁣∫p dV,  pVγ=const\Delta U = W = -\!\int p\,\mathrm{d}V,\ \ pV^\gamma=\text{const}No heat; work done on/by the gas changes TT directly.
Closed cycle∮dU=0,  ∮δQ=−∮δW≠0\oint\mathrm{d}U = 0,\ \ \oint\delta Q = -\oint\delta W \neq 0State function returns; net heat in = net work out — an engine.

Worked examples

Example 1 — Heating a mole of helium at constant volume (a real number from first principles).

Step 1. Take n=1n = 1 mol of helium (monatomic, ideal) in a rigid sealed vessel, heated from Ti=300 KT_i = 300\ \mathrm{K} to Tf=400 KT_f = 400\ \mathrm{K}. Rigid means dV=0\mathrm{d}V = 0, so W=0W = 0.

Step 2. For a monatomic ideal gas U=32nRTU = \tfrac32 nRT, so ΔU=32nR ΔT\Delta U = \tfrac32 nR\,\Delta T. Insert R=8.314 J mol−1K−1R = 8.314\ \mathrm{J\,mol^{-1}K^{-1}} and ΔT=100 K\Delta T = 100\ \mathrm{K}:

ΔU=32(1)(8.314)(100)=1247 J.\Delta U = \tfrac32 (1)(8.314)(100) = 1247\ \mathrm{J}.

Step 3. By the first law with W=0W=0, all of this came in as heat: Q=ΔU=1247 JQ = \Delta U = \mathbf{1247\ J}. Equivalently Q=CV ΔTQ = C_V\,\Delta T with CV=32nR=12.47 J/KC_V = \tfrac32 nR = 12.47\ \mathrm{J/K}.

Step 4. If instead the same 100 K100\ \mathrm{K} rise happened at constant pressure, the gas would expand and do work, so we would need Q=Cp ΔT=52nR ΔT=2079 JQ = C_p\,\Delta T = \tfrac52 nR\,\Delta T = \mathbf{2079\ J} — the extra nR ΔT=831 JnR\,\Delta T = 831\ \mathrm{J} is the expansion work. Same ΔU=1247 J\Delta U = 1247\ \mathrm{J}, different QQ: heat is path-dependent, internal energy is not.

Example 2 — A rectangular engine cycle: net work equals enclosed area.

Step 1. Run 1 mol of ideal gas clockwise around a rectangle in the pp–VV plane between p=1.0→3.0×105 Pap = 1.0\to 3.0\times10^{5}\ \mathrm{Pa} and V=1.0→2.0×10−3 m3V = 1.0\to 2.0\times10^{-3}\ \mathrm{m^3}. Only the two isobaric legs do work.

Step 2. Expansion leg at high pressure p=3.0×105 Pap = 3.0\times10^{5}\ \mathrm{Pa}, ΔV=+1.0×10−3 m3\Delta V = +1.0\times10^{-3}\ \mathrm{m^3}: work by gas =p ΔV=+300 J= p\,\Delta V = +300\ \mathrm{J}. Compression leg at low pressure p=1.0×105 Pap = 1.0\times10^{5}\ \mathrm{Pa}, ΔV=−1.0×10−3 m3\Delta V = -1.0\times10^{-3}\ \mathrm{m^3}: work by gas =−100 J= -100\ \mathrm{J}. The two isochoric legs do zero work.

Step 3. Net work done by the gas over the cycle: 300−100=200 J300 - 100 = \mathbf{200\ J}, exactly the enclosed area (Δp)(ΔV)=(2.0×105)(1.0×10−3)=200 J(\Delta p)(\Delta V) = (2.0\times10^{5})(1.0\times10^{-3}) = 200\ \mathrm{J}.

Step 4. Since ∮dU=0\oint\mathrm{d}U = 0, the first law forces the net heat absorbed to equal the net work out: Qnet=200 JQ_{\text{net}} = \mathbf{200\ J}. No energy appeared from nowhere; the engine simply routed 200 J of heat into 200 J of work over each loop.

Going further

References. Fermi, Thermodynamics, Ch. 1–3 · Pathria & Beale, Statistical Mechanics, 3rd ed., Ch. 1 · Kardar, Statistical Physics of Particles, Ch. 1, 4 · Reif, Fundamentals of Statistical and Thermal Physics, Ch. 4–5 · Callen, Thermodynamics and an Introduction to Thermostatistics, Ch. 1–3 · Sethna, Statistical Mechanics, Ch. 6

Provenance. All equations are standard textbook results. A verifier should: (1) confirm ΔU=32nR ΔT=1247 J\Delta U = \tfrac32 nR\,\Delta T = 1247\ \mathrm{J} for 1 mol He, ΔT=100 K\Delta T = 100\ \mathrm{K}, and Cp−CV=nRC_p - C_V = nR; (2) reproduce the rectangular-cycle net work =200 J= 200\ \mathrm{J} = enclosed area and ∮dU=0\oint\mathrm{d}U = 0; (3) verify the microscopic identity d⟨E⟩=∑Ei dpi+∑pi dEi\mathrm{d}\langle E\rangle = \sum E_i\,\mathrm{d}p_i + \sum p_i\,\mathrm{d}E_i; (4) check the exactness of dU\mathrm{d}U for the ideal gas. The sign convention ΔU=Q+W\Delta U = Q + W with WW = work on the system is stated explicitly; the IUPAC ΔU=Q−W\Delta U = Q - W alternative is noted. Constants: R=8.314 J mol−1K−1R = 8.314\ \mathrm{J\,mol^{-1}K^{-1}}.

Builds on: Zeroth Law of Thermodynamics and Empirical Temperature · Work, Heat, and Inexact Differentials Leads to: Second Law of Thermodynamics and Entropy · Thermodynamic Potentials and the Fundamental Relation · Helmholtz Free Energy, Enthalpy, and Gibbs Free Energy · Maxwell Relations

Origins · 1 minJames Prescott Joule and how this was discovered
JP
James Prescott Joule
1818–1889 · Salford, England

A brewer's son who ran precise experiments in his family's brewery, Joule measured the mechanical equivalent of heat with a paddle-wheel churning insulated water, establishing that a fixed amount of work always produces the same quantity of heat. His obsessive accuracy — he is said to have measured temperature on his honeymoon — converted the vague idea that heat is motion into a quantitative law, and the SI unit of energy bears his name.

History
1798
— Rumford's cannon-boring experiments suggest heat is motion, not a fluid
1842
— Mayer states the equivalence of heat and mechanical work
1843
— Joule begins his paddle-wheel measurements of the mechanical equivalent of heat
1847
— Helmholtz formulates the general conservation of energy ("On the Conservation of Force")
1850
— Clausius gives the first law its modern form alongside the second
1865
— Clausius names the state function structure that makes internal energy exact
If Q and W both depend on the path, how can their sum not?

Because nature guarantees it — that is the empirical content of the first law, confirmed for every process ever measured. Mathematically, δQ\delta Q and δW\delta W each fail the exactness test (their loop integrals are nonzero), but the specific combination δQ+δW\delta Q + \delta W passes: ∮(δQ+δW)=0\oint(\delta Q + \delta W) = 0 around any cycle. The path-dependent pieces of heat and work are equal and opposite, so they cancel in the sum, leaving a quantity that depends only on the endpoints. We name that quantity the internal energy UU.

What is the difference between the physics and chemistry sign conventions?

Both write energy conservation; they differ only in what "WW" means. The physics convention is ΔU=Q+W\Delta U = Q + W with WW = work done on the system, so compressing a gas gives W>0W>0. The chemistry/IUPAC convention is ΔU=Q−W\Delta U = Q - W with WW = work done by the system, so the same compression gives W<0W<0. The two are identical physics — just track which one a book uses, because a sign error here propagates into every subsequent formula. This article uses the physics convention throughout.

Is internal energy the same as heat?

No, and conflating them is the most common beginner error. Heat is one mode of transferring energy (via a temperature difference); internal energy is the energy a system has (the sum of microscopic kinetic and potential energies, U=⟨E⟩U = \langle E\rangle). You can raise a system's internal energy with zero heat — just do work on it, as in an adiabatic compression or Joule's paddle wheel, where stirring insulated water raises its UU entirely through work.

Why does an ideal gas's internal energy depend only on temperature?

Because the molecules of an ideal gas do not interact, so there is no potential energy that depends on their separation — only kinetic energy, which depends on temperature alone. Joule's free-expansion experiment confirmed this: a gas expanding into vacuum does no work and exchanges no heat, so ΔU=0\Delta U = 0, yet its volume changes. Since UU did not change while VV did, UU cannot depend on VV — it depends on TT only. For real gases with intermolecular forces this fails slightly (the Joule–Thomson effect).

What is a perpetual-motion machine of the first kind, and why is it impossible?

It is a hypothetical engine that produces net work over a cycle with no energy input — free work forever. The first law forbids it directly: over any cycle ∮dU=0\oint\mathrm{d}U = 0, so the net work out must equal the net heat in. If no heat (or other energy) goes in, no work can come out. This is distinct from a perpetual-motion machine of the second kind, which would convert heat from a single reservoir entirely into work; that one is forbidden by the second law, not the first.

How does the first law become dU = TdS − pdV?

By substituting the reversible expressions for heat and work. For a reversible process the heat is δQrev=T dS\delta Q_{\mathrm{rev}} = T\,\mathrm{d}S (this is essentially the definition of entropy from the second law) and the work on the system is δW=−p dV\delta W = -p\,\mathrm{d}V. Putting both into dU=δQ+δW\mathrm{d}U = \delta Q + \delta W gives dU=T dS−p dV\mathrm{d}U = T\,\mathrm{d}S - p\,\mathrm{d}V. Because dU\mathrm{d}U is exact, equating its mixed second derivatives yields the Maxwell relations, and Legendre transforming it generates the Helmholtz, enthalpy, and Gibbs potentials.

Does the first law by itself tell you which direction a process goes?

No — and that gap is exactly why the second law exists. The first law is perfectly happy for heat to flow from cold to hot or for a shattered cup to reassemble, as long as energy is conserved. It constrains the amount of energy but says nothing about direction or feasibility. The arrow of time and the impossibility of spontaneous unmixing come from the second law's statement that total entropy cannot decrease, a completely independent principle.

Before this

Where this leads