---
title: Entropy and the Second Law
module: Thermodynamics
moduleNumber: 8
lessonNumber: 3
order: 803
summary: >
  The first law lets energy flow either way; it never says which way heat actually
  goes. The second law supplies the missing arrow. Entropy, defined through the
  reversible transfer $\d S=\delta Q_{\rm rev}/T$, can only increase in an isolated
  system, and that single inequality fixes the direction of heat flow and caps every
  engine, refrigerator, and heat pump at its Carnot value. We build entropy ledgers
  for reservoirs and working substances, separate the entropy carried by heat from the
  entropy generated by irreversibility, and read the sign of the total as a hard check
  on any proposed thermal machine.
topics: [Thermodynamics]
draft: false
sources:
  - book: Tipler & Mosca
    ref: "Ch. 19 — The Second Law of Thermodynamics; §§19-1–19-3, 19-5–19-7"
---

## Entropy change and thermal reservoirs

The first law balances energy transfers without a criterion for their
spontaneous direction. Comparison of initial and final energies alone permits heat
transfer in either direction. Experience and the second law add
the direction condition: heat flows spontaneously from a higher-temperature body to
a lower-temperature body, not from cold to hot without other changes. Entropy is
the state quantity used to express this condition quantitatively.

Reversible transfer of heat $Q$ to a system held at absolute temperature $T$ changes
entropy by $\Delta S=Q/T$. The unit is joules per kelvin. A reversible
transfer is an ideal limiting process in which the temperature difference between
the transferring bodies is infinitesimal, so reversing that difference reverses the
transfer without leaving a net change elsewhere. The formula defines entropy change
through a reversible reference path even when the actual process is irreversible.
Entropy itself is a state function; heat transfer is not.

A large thermal reservoir remains effectively constant in temperature during heat
exchange with a system. If the system receives $Q$, the reservoir
loses the same energy and has entropy change $-Q/T_{\rm res}$. The entropy change
of the combined system and reservoir determines the second-law result. In a
reversible exchange at the same temperature, the positive and negative changes sum
to zero. In an irreversible exchange across a finite temperature difference, the
total is positive. A negative total entropy change for an isolated combination is
not permitted by the second law.

Heat capacity connects entropy change to a measurable temperature path. For a
sample of approximately constant heat capacity $C$ heated reversibly from
$T_i$ to $T_f$, integration gives $\Delta S=C\ln(T_f/T_i)$. The logarithm requires
absolute temperatures. A body with positive heat capacity gains entropy when heated
and loses entropy when cooled. The result depends only on the endpoint temperatures
for the specified heat-capacity model, even though the actual heating apparatus can
transfer energy at different rates.

$$
% caption: Entropy accounting includes both bodies exchanging heat. Each divides the transferred $Q$ by its own temperature, so transfer from a hotter to a colder body gives a positive total change $Q(1/T_C-1/T_H)$.
\begin{tikzpicture}[>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\fill[acc!12] (0.35,0.4) rectangle (2.55,2.55);
\draw[black,thick] (0.35,0.4) rectangle (2.55,2.55);
\fill[black] (4.15,0.4) rectangle (6.35,2.55);
\draw[black,thick] (4.15,0.4) rectangle (6.35,2.55);
\node[acc] at (1.45,1.55) {hot body};
\node[black] at (5.25,1.55) {cold body};
\draw[acc,->,very thick] (2.7,1.55)--(4.0,1.55) node[midway,above] {heat};
\node[acc,anchor=north] at (1.45,0.3) {entropy loss};
\node[black,anchor=north] at (5.25,0.3) {entropy gain};
\end{tikzpicture}
$$

## Heat engines and the second law

A heat engine operates cyclically between a hot reservoir and a cold reservoir.
During one cycle it absorbs heat $Q_H$ from the hot reservoir, delivers work $W$
to the surroundings, and rejects heat $Q_C$ to the cold reservoir. Because the
engine returns to its starting state, its internal-energy change over the cycle is
zero. The first law then gives $W=Q_H-Q_C$. A heat engine cannot convert all of
the absorbed heat into work while operating in a cycle with only one thermal
reservoir; some energy must be rejected to a lower-temperature reservoir.

Thermal efficiency is the useful work divided by heat absorbed from the hot
reservoir: $e=W/Q_H=1-Q_C/Q_H$. It is a ratio, not an energy-conservation law.
The first law permits $Q_C=0$ algebraically, but the second law excludes such a
cyclic engine. The limit is established by comparing the engine with a reversible
Carnot engine operating between the same reservoir temperatures. No engine can
exceed the Carnot efficiency $e_C=1-T_C/T_H$, with both temperatures measured in
kelvins.

The Carnot expression depends only on reservoir temperatures, not on working-gas
identity, cylinder size, or the amount of heat processed per cycle. A hot reservoir
at $600\ \mathrm K$ and a cold reservoir at $300\ \mathrm K$ set an upper
efficiency bound of $0.50$. An actual engine has lower efficiency because friction,
finite-temperature heat transfer, turbulence, and incomplete combustion or other
losses generate additional entropy. The Carnot value is a benchmark for a specified
temperature pair, not a performance prediction for an ordinary machine.

Refrigerators use work to move heat from a cold region to a hot region. Their
operation does not violate the second law because the required work and the heat
delivered to the hot reservoir are included in the total account. A claim that heat
has moved from cold to hot must therefore state what work source or other external
change accompanied the transfer. The system boundary determines whether that work
is visible in the equation.

$$
% caption: A heat engine absorbs energy from a hot reservoir, rejects part to a colder reservoir, and delivers the difference as work $W=Q_H-Q_C$. The mandatory rejection is the second-law limit on cyclic heat-to-work conversion.
\begin{tikzpicture}[>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\fill[acc!12] (0.2,1.0) rectangle (1.7,2.7);
\draw[black,thick] (0.2,1.0) rectangle (1.7,2.7);
\node[acc] at (0.95,1.85) {hot};
\fill[black] (5.1,1.0) rectangle (6.6,2.7);
\draw[black,thick] (5.1,1.0) rectangle (6.6,2.7);
\node[black] at (5.85,1.85) {cold};
\draw[acc,thick] (2.7,1.15) rectangle (4.1,2.55);
\node[acc] at (3.4,1.85) {engine};
\draw[acc,->,thick] (1.75,2.1)--(2.65,2.1) node[midway,above] {heat in};
\draw[black,->,thick] (4.15,1.5)--(5.05,1.5) node[midway,above] {rejected};
\draw[acc,->,thick] (3.4,1.1)--(3.4,0.25) node[midway,right] {work};
\end{tikzpicture}
$$

## Reversible and irreversible processes

A reversible process is an ideal sequence of equilibrium states that can be
reversed by an infinitesimal change in external conditions. It has no friction,
no finite temperature jump during heat transfer, and no unrestrained expansion or
mixing. Reversibility is a limiting model, not a claim that ordinary processes can
be performed with zero elapsed time or zero engineering complexity. Its value is
that it sets the maximum-work or maximum-efficiency reference for processes between
specified equilibrium states.

Irreversible processes include heat flow across a finite temperature difference,
frictional sliding, viscous flow, diffusion, electrical resistance, and free
expansion. These processes produce positive entropy change for an isolated system.
Direct heat transfer of $Q$ from a reservoir at $T_H$ to one at $T_C$ gives
combined entropy change $Q(1/T_C-1/T_H)$, which is positive when $T_H>T_C$.
The energy transfer is the same amount entering and leaving, but the entropy
changes do not cancel because the temperatures differ.

The phrase "entropy increases" must specify the system. A cooling hot object has
negative entropy change; a warming cold object has positive entropy change. The
second law applies to the total of all participating systems and surroundings. An
open device can reduce its own entropy while exporting a larger entropy increase by
heat, matter, or work-related dissipation. A correct balance therefore names the
objects included and all transfers crossing the boundary.

An irreversible path cannot generally be replaced by a reversible path for work
calculation without accounting for the difference in transfers. It can, however,
use a reversible path to calculate the entropy change between the same equilibrium
end states because entropy is a state function. This distinction is central: use
the actual path for work and heat bookkeeping; use a convenient reversible path
only to evaluate the entropy difference. Confusing the two uses turns a state
calculation into an incorrect claim about the real apparatus.

### Clausius inequality for thermal cycles

For any cyclic process, the Clausius inequality states that
$\oint \delta Q/T\leq0$, where each heat-transfer element is divided by the absolute
temperature of the boundary at which that transfer occurs. Equality holds for a
reversible cycle. A strictly negative value identifies irreversible effects within
the cycle or at the interfaces through which heat is transferred. The inequality
does not replace the first law: it adds a restriction on the possible combinations
of heat transfers and temperatures after energy conservation has been satisfied.

The sign of $\delta Q$ follows the selected working system. Heat entering the system is
positive, and heat leaving is negative. A simple engine absorbs positive heat from
the hot reservoir and rejects negative heat to the cold reservoir. Because the
cold-reservoir temperature is smaller, the rejected term has a larger magnitude
after division by temperature unless the process is the reversible limiting case.
A reversible engine has two entropy-transfer terms whose sum is zero over a cycle
because the working substance returns to its initial state.

An irreversible engine has additional positive entropy production. Friction,
viscous flow, finite temperature differences in heat exchangers, electrical
resistance, and unrestrained expansion all contribute. The working substance can
still return to its original state after a cycle, so its own net entropy change is
zero, but the reservoir entropy changes no longer cancel. The total entropy change
of reservoirs and apparatus is positive. This is the physical content hidden by a
strict Clausius inequality rather than an equality.

The inequality is also a diagnostic for proposed machines. If measured heat
transfers in a complete cycle give a positive value for $\oint \delta Q/T$, the signs,
temperature assignments, or measurements are inconsistent. If the result is zero
within uncertainty, the data are compatible with a reversible limit but do not
prove that every internal process is reversible. A negative value is expected for
ordinary machines and quantifies the departure from the ideal limit.

### Entropy change of an ideal gas

Entropy change for an ideal gas can be evaluated from any convenient reversible
path between the same equilibrium endpoints. With constant heat capacity at
constant volume, the result is
$\Delta S=nC_{V,m}\ln(T_f/T_i)+nR\ln(V_f/V_i)$. The first term represents the
entropy change associated with changing temperature at fixed volume; the second
represents the change associated with volume at fixed temperature. The actual
process need not follow those two artificial stages. They are used because entropy
is a state function and the stages make the integral tractable.

For one mole of a monatomic ideal gas changing from $300\ \mathrm K$ and
$10.0\ \mathrm L$ to $360\ \mathrm K$ and $15.0\ \mathrm L$,
$C_{V,m}=(3/2)R$. The temperature term is
$(3/2)R\ln(360/300)=2.27\ \mathrm{J\,K^{-1}}$, and the volume term is
$R\ln(15.0/10.0)=3.37\ \mathrm{J\,K^{-1}}$. The total entropy change is
$5.64\ \mathrm{J\,K^{-1}}$. Both increased temperature and increased volume
raise the number of accessible molecular arrangements in this example.

The signs need not always agree. Isothermal compression has negative entropy
change because volume decreases. Cooling at fixed volume also has negative entropy
change. An expansion accompanied by enough cooling can have either sign depending
on the relative sizes of the two logarithmic terms. The endpoint formula replaces
informal descriptions such as "expansion increases disorder" with a quantitative
comparison of temperature and volume changes.

The result requires an ideal gas and equilibrium endpoint states. It does not
require the actual expansion to be reversible. A free expansion into vacuum is
irreversible and has no simple boundary-work integral, yet the entropy change can
still be obtained from a hypothetical reversible isothermal expansion connecting
the same initial and final volumes. The entropy increase belongs to the state
change; the irreversibility belongs to the actual path and appears in the total
entropy balance with the surroundings.

$$
% caption: An ideal-gas entropy change splits into a temperature term and a volume term. A reversible reference path may heat at fixed volume and then expand at fixed temperature, even when the real process follows the dashed direct route.
\begin{tikzpicture}[>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[->,black] (0,0)--(6.2,0) node[right] {volume};
\draw[->,black] (0,0)--(0,3.45) node[above] {temperature};
\draw[acc,very thick,->] (1.3,0.85)--(1.3,2.55) node[midway,left] {heat};
\draw[acc,very thick,->] (1.3,2.55)--(4.9,2.55) node[midway,above] {expand};
\draw[black,dashed] (1.3,0.85)--(4.9,2.55);
\draw[fill=white,draw=black,line width=.4pt] (1.3,0.85) circle (2pt);
\draw[fill=white,draw=black,line width=.4pt] (4.9,2.55) circle (2pt);
\node[black,anchor=north east] at (1.3,0.8) {initial};
\node[black,anchor=west] at (5.0,2.55) {end};
\node[black,anchor=north west] at (3.2,1.35) {direct route};
\end{tikzpicture}
$$

> **Worked example.** A reversible engine between reservoirs at $T_H$ and $T_C$ has
> zero total entropy change over one cycle. Absorbing $Q_H$ from the hot reservoir and
> rejecting $Q_C$ to the cold one, the reservoir entropy balance is
> $Q_H/T_H=Q_C/T_C$. With the first-law cycle balance $W=Q_H-Q_C$, the efficiency is
> $e_C=W/Q_H=1-T_C/T_H$, in kelvin because it is a ratio of absolute temperatures.
>
> For $T_H=600\ \mathrm K$ and $T_C=300\ \mathrm K$, $e_C=0.50$. An engine taking in
> $1000\ \mathrm J$ from the hot reservoir then delivers at most $500\ \mathrm J$ of
> work and rejects at least $500\ \mathrm J$ to the cold reservoir. Raising $T_H$ or
> lowering $T_C$ raises the limit, but no finite pair of positive temperatures allows
> unit efficiency: the rejected heat is demanded by the second law, not by an
> engineering flaw.

Real engines have efficiency below the Carnot value because their heat transfers
occur across finite temperature differences and their moving parts dissipate energy.
The Carnot relation should not be used with a working-gas temperature guessed from
one point in a cycle; the relevant temperatures are those of the thermal reservoirs
supplying and receiving heat. It is also not a formula for power. Power depends on
how much heat is processed per cycle and how many cycles occur per unit time,
whereas Carnot efficiency is a limit on energy conversion per cycle.

Reversible operation sets a benchmark; first-law energy balance still applies.
The work output equals hot heat input minus cold heat output. The second law
relates the two heat transfers through reservoir temperature, while the first law
relates them through energy. Both statements are needed to derive the efficiency
limit. Omitting either one can produce an algebraic answer that conserves energy
but permits an impossible heat engine.

An entropy sign audit begins with the stated system. Heat entering a body at
temperature $T$ contributes positively to that body's entropy by the reversible
reference value $Q/T$; heat leaving contributes negatively. The same transfer must
appear with the opposite energy sign in the other body. Adding those two changes
before inserting reservoir temperatures prevents a local entropy decrease from
being mistaken for a violation of the second law.

### Entropy generation and the total balance

Entropy generation is the nonnegative contribution produced by irreversible
processes. A closed-system balance sets entropy change equal to entropy transferred
with heat plus entropy generated internally. The generated term
is zero for a reversible limiting process and positive for friction, mixing,
finite-temperature heat transfer, viscous flow, electrical resistance, and other
dissipative effects. It is not an additional form of energy. Energy remains
conserved through the first law; entropy generation records the loss of available
ways to direct that energy into useful work.

Heat transfer between two reservoirs gives a direct calculation. Let
$500\ \mathrm J$ flow from a $500\ \mathrm K$ reservoir to a $300\ \mathrm K$
reservoir. The hot reservoir entropy change is $-500/500=-1.00\ \mathrm{J\,K^{-1}}$.
The cold reservoir entropy change is $+500/300=+1.67\ \mathrm{J\,K^{-1}}$. The
combined entropy generation is therefore $+0.667\ \mathrm{J\,K^{-1}}$. No energy
has disappeared: the same $500\ \mathrm J$ leaves one reservoir and enters the
other. The positive total entropy identifies the transfer as irreversible.

Entropy generation depends on the actual mechanism, whereas the entropy change of
an equilibrium system depends only on its endpoints. A gas can be brought between
two states by a slow sequence of small temperature differences or by direct contact
with a much hotter reservoir. The endpoint entropy change of the gas can be the
same, but the surroundings entropy change and generated entropy differ. An entropy
balance therefore includes the sample, reservoirs, and every other interacting body
whose entropy changes.

The generated term sets a performance bound. In a device receiving heat from a
finite temperature source, any positive entropy generation reduces the work that
could have been obtained in a reversible limit. Reducing friction or using smaller
temperature differences can reduce generation, but cannot make a real finite-rate
device perfectly reversible. The sign is a practical data check: a calculated
negative generation for an isolated combination indicates missing heat transfer,
an incorrect temperature, or a sign error.

### Refrigerators, heat pumps, and coefficient of performance

A refrigerator uses work input to remove heat $Q_C$ from a cold region and reject
$Q_H$ to a warmer region. The first-law cycle balance is $Q_H=Q_C+W_{\rm in}$.
The desired output of a refrigerator is cooling, so its coefficient of performance
is $\mathrm{COP}_R=Q_C/W_{\rm in}$. A coefficient of performance can exceed one
because it compares heat moved to work supplied; it is not a heat-engine efficiency
and is not limited by unity. The work input enables energy already present in the
cold region to be pumped uphill in temperature.

A heat pump uses the same physical cycle but has a different useful output: heat
delivered to the warm region. Its coefficient is
$\mathrm{COP}_{HP}=Q_H/W_{\rm in}=\mathrm{COP}_R+1$. The same appliance can be
described as a refrigerator or a heat pump depending on whether cooling the cold
space or warming the hot space is the intended service. The reservoir labels and
the chosen useful output must be written before selecting a performance ratio.

A reversible refrigerator has the maximum coefficient for reservoir temperatures
$T_C$ and $T_H$: $\mathrm{COP}_{R,C}=T_C/(T_H-T_C)$. The reversible limit for a
cold space at $270\ \mathrm K$ with surroundings at $300\ \mathrm K$ is
9.0, while the heat-pump limit is 10.0. Actual equipment has lower values because
compression losses, pressure drops, finite temperature differences in heat
exchangers, and electrical losses generate entropy. A small temperature lift gives
a high theoretical COP; this does not remove the need for work input.

The second law excludes a refrigerator whose only effect is to move heat from cold
to hot. Adding work makes the process possible because the work source and the
extra heat delivered to the hot reservoir are included in the total change. A
complete refrigerator calculation checks both the energy balance and the entropy
balance. The first law alone would allow arbitrary heat flows if work were adjusted;
the second law restricts the minimum work required for a given temperature pair.

$$
% caption: A refrigerator uses work input to move heat $Q_C$ out of a cold region and reject a larger $Q_H=Q_C+W$ to the warm surroundings. Its coefficient of performance compares cold-side heat removal with the required work.
\begin{tikzpicture}[>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\fill[black] (0.2,0.9) rectangle (1.7,2.6);
\draw[black,thick] (0.2,0.9) rectangle (1.7,2.6);
\node[black] at (0.95,1.75) {cold};
\fill[acc!12] (5.1,0.9) rectangle (6.6,2.6);
\draw[black,thick] (5.1,0.9) rectangle (6.6,2.6);
\node[acc] at (5.85,1.75) {warm};
\draw[acc,thick] (2.7,1.05) rectangle (4.1,2.45);
\node[acc] at (3.4,1.75) {unit};
\draw[acc,->,thick] (1.75,1.4)--(2.65,1.4) node[midway,above] {from cold};
\draw[black,->,thick] (4.15,2.1)--(5.05,2.1) node[midway,below] {to warm};
\draw[acc,->,thick] (3.4,0.2)--(3.4,1.0) node[midway,right] {work in};
\end{tikzpicture}
$$

**Kelvin--Planck and Clausius statements.**

The Kelvin--Planck form of the second law states that no cyclic engine can have as
its sole effect the absorption of heat from a single reservoir and the conversion of
all of that heat into work. A cyclic engine must reject some heat or produce another
change outside itself. This statement rules out a perpetual-motion machine of the
second kind. It does not prohibit conversion of stored chemical, electrical, or
mechanical energy entirely into work; the restriction concerns a cyclic device
whose only energy source is one thermal reservoir.

The Clausius form states that no process can have as its sole effect the transfer of
heat from a colder body to a hotter body. Refrigerators appear to contradict this
only when their work input is omitted. Their sole effect is not heat transfer from
cold to hot: they also consume work and reject a larger amount of heat to the warm
side. The statement makes the required external change explicit.

The two forms are equivalent. If a device violated the Clausius statement by moving
heat from cold to hot without work, it could be coupled to an ordinary heat engine
so that the cold-reservoir heat rejection is returned freely to the hot reservoir.
The combined apparatus would then convert heat from one reservoir completely into
work, violating Kelvin--Planck. Conversely, a Kelvin--Planck violation could power
a refrigerator without external work and violate Clausius. The equivalence shows
that both statements express the same direction restriction in different language.

These statements are more specific than a vague instruction that "entropy must
increase." They identify an impossible claimed device by listing its sole effect.
When another change is present, such as work input, fuel consumption, or a second
reservoir, the first and second laws must be applied to the full arrangement. The
wording prevents an incomplete system boundary from being mistaken for a physical
violation.

$$
% caption: The Kelvin–Planck statement forbids a cyclic engine drawing on one reservoir and converting all of that heat to work; the Clausius statement forbids heat passing from cold to hot with no work. Both name a device by its sole effect.
\begin{tikzpicture}[>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\node[black,anchor=south] at (1.9,2.55) {one reservoir, all to work};
\fill[acc!12] (0.3,0.65) rectangle (1.2,2.05);
\draw[black,thick] (0.3,0.65) rectangle (1.2,2.05);
\node[acc] at (0.75,1.35) {source};
\draw[acc,thick] (1.95,0.9) rectangle (2.95,1.8);
\node[acc] at (2.45,1.35) {engine};
\draw[acc,->,thick] (1.25,1.35)--(1.9,1.35) node[midway,above] {heat};
\draw[acc,->,thick] (3.0,1.35)--(3.65,1.35) node[midway,above] {work};
\node[black,anchor=north] at (2.0,0.5) {forbidden};
\fill[black] (4.4,0.65) rectangle (5.3,2.05);
\draw[black,thick] (4.4,0.65) rectangle (5.3,2.05);
\node[black] at (4.85,1.35) {cold};
\fill[acc!12] (6.35,0.65) rectangle (7.25,2.05);
\draw[black,thick] (6.35,0.65) rectangle (7.25,2.05);
\node[acc] at (6.8,1.35) {hot};
\draw[acc,->,thick] (5.35,1.35)--(6.3,1.35) node[midway,above] {heat};
\node[black,anchor=north] at (5.85,0.5) {no work: forbidden};
\end{tikzpicture}
$$

**Entropy balance for a closed system.**

A closed system separates entropy change into transfer and generation:
$\Delta S_{\rm sys}=\int \delta Q/T_b+S_{\rm gen}$. The boundary temperature
$T_b$ is the temperature at the location where the heat crosses the system
boundary. The generation term satisfies $S_{\rm gen}\geq0$. It is zero only in a
reversible limit. The balance is valid for an actual irreversible process; unlike
the reversible reference formula $\d S=\delta Q_{\rm rev}/T$, it does not pretend
that the real heat transfer occurred through an infinitesimal temperature
difference.

An insulated closed system has no entropy transfer with heat, so its entropy change
equals its internally generated entropy. A gas freely expanding into an evacuated
region is a standard example. No heat crosses the outer boundary and no
boundary work is done against an external pressure, yet the gas entropy increases.
The increase is not created from energy. It records the irreversible spreading of
the molecular distribution into a larger accessible volume. The first law gives
zero change in internal energy for an ideal-gas free expansion, while the second
law gives positive entropy generation.

A system receiving heat $Q$ across a boundary held at temperature $T_b$ receives
entropy $Q/T_b$. If the system entropy change is larger than this
transfer term, the difference is the generated entropy. If it is smaller, the
calculation has omitted an entropy transfer out or used the wrong boundary
temperature. The balance applies directly to real heat exchangers, where a
finite temperature difference generates entropy even when the energy transferred
from one stream to the other is equal and opposite.

The boundary must remain fixed during the accounting interval. Moving a piston can
perform work but does not itself carry entropy across the boundary in the way heat
does. Matter crossing an open-system boundary carries entropy with it and requires
additional terms; that case is outside the closed-system form used here. Declaring
the system as closed, insulated, or in thermal contact is therefore a mathematical
choice with physical consequences, not a label added after the calculation.

### A Carnot-cycle calculation

A reversible Carnot engine gives a complete numerical use of both thermodynamic
laws. Let the hot and cold reservoirs have temperatures $T_H=500\ \mathrm K$ and
$T_C=300\ \mathrm K$. During one cycle the engine absorbs
$Q_H=1200\ \mathrm J$ from the hot reservoir. The Carnot efficiency is
$e_C=1-T_C/T_H=0.40$, so the maximum work output is
$W=e_CQ_H=480\ \mathrm J$. The first-law cycle balance then requires cold-side
heat rejection $Q_C=Q_H-W=720\ \mathrm J$.

The entropy calculation checks the result independently. The hot reservoir loses
$Q_H/T_H=1200/500=2.40\ \mathrm{J\,K^{-1}}$. The cold reservoir gains
$Q_C/T_C=720/300=2.40\ \mathrm{J\,K^{-1}}$. Their sum is zero, as required for a
reversible cycle. The working substance also returns to its starting state, so its
net entropy change over the cycle is zero. A nonzero total would signal either an
irreversible process or inconsistent heat and temperature data.

The calculation shows why work is not the same as hot-side heat input. Forty percent
of the absorbed energy appears as work only because the reservoir temperatures
permit that reversible limit. The remaining sixty percent must be rejected to the
cold reservoir. Replacing the cold reservoir by one at a lower temperature would
raise the Carnot limit; increasing the hot reservoir temperature has the same
effect. In either case, the engine still requires two reservoirs and a cyclic
working substance.

Actual engine data can be compared with the same structure. Measured work divided
by measured hot heat input gives an actual efficiency. It must not exceed the Carnot
value computed from the reservoir temperatures. If it appears to exceed the limit,
the usual causes are an unmeasured heat input, use of Celsius rather than kelvin
temperatures, or a mismatch between the temperatures measured and the boundary
temperatures at which heat transfer occurred.

### Mixing and free-expansion entropy

Ideal-gas free expansion makes the difference between energy and entropy especially
clear. One mole of an ideal gas expands from volume $V$ to $2V$ into vacuum inside
an insulated container. No heat enters, and no work is done against an external
pressure. The first law therefore gives $\Delta E_{\rm int}=0$. An ideal gas has
internal energy depending only on temperature, so the initial and final temperatures
are equal. Nevertheless, the entropy change is $\Delta S=nR\ln(2V/V)=R\ln2$,
about $5.76\ \mathrm{J\,K^{-1}}$ for one mole.

The entropy increase can be computed with a hypothetical reversible isothermal
expansion between the same endpoints. That reference path transfers heat and does
work, unlike the actual free expansion, but it gives the correct state change. The
actual process is irreversible because the gas does not spontaneously reassemble
into the original half-volume region. The entropy generation in the insulated
container equals the positive gas entropy change.

Mixing two different ideal gases follows the same logic. Removing a partition lets
each gas occupy a larger accessible volume. For equal amounts initially occupying
equal volumes, each species gains $nR\ln2$ of entropy, so the total mixing entropy
is the sum of the two positive terms. There is no heat or work requirement in the
idealized insulated mixing process. The increased entropy reflects the larger set
of molecular arrangements compatible with the macroscopic mixture.

Mixing identical gases is different. Removing a partition between equal samples of
the same gas produces no observable composition change and no entropy of mixing in
the thermodynamic description. The distinction requires molecules of the same
species to be treated as indistinguishable. This result prevents counting a
macroscopically unchanged arrangement as a new accessible state on the basis of an
imaginary molecular label attached before partition removal.

$$
% caption: Free expansion and mixing raise ideal-gas entropy with no heat input and no boundary work. A reversible reference expansion gives the endpoint entropy change $nR\ln 2$, while the actual partition removal generates that entropy internally.
\begin{tikzpicture}[>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\draw[black,thick] (0.25,0.4) rectangle (6.45,2.75);
\draw[black,very thick,dashed] (3.35,0.4)--(3.35,2.75);
\fill[acc!12] (0.5,0.62) rectangle (3.15,2.52);
\foreach \x/\y in {0.85/0.95,1.55/1.8,2.35/1.05,2.75/2.05,1.95/0.8} {\draw[fill=acc,draw=acc,line width=.4pt] (\x,\y) circle (2.2pt);}
\draw[acc,->,thick] (3.35,3.35)--(3.35,2.85) node[midway,right] {partition removed};
\draw[<->,black] (0.5,0.15)--(6.2,0.15) node[midway,below] {larger accessible volume};
\node[acc,anchor=south] at (1.75,2.95) {initial gas};
\node[black] at (4.9,1.55) {vacuum};
\end{tikzpicture}
$$

Entropy calculations should state whether a quoted quantity is a system change, a
reservoir change, or generated entropy. The same irreversible process can have a
positive system entropy change and zero heat transfer, as in free expansion, while
another process can have entropy transfer through heat with no internal generation
in the reversible limit. Adding unlike terms without their system labels obscures
the second-law balance rather than simplifying it.

**Entropy of a phase change.**

At a phase-change temperature and pressure, heat can be transferred reversibly
while the temperature remains constant. The entropy change of the material is then
$\Delta S=Q_{\rm rev}/T=mL/T$, where $L$ is the appropriate latent heat. Melting
and vaporization have positive entropy changes because heat enters the material;
freezing and condensation have negative changes because heat leaves. The entropy
formula does not treat the phase change as an exception to energy conservation. The
latent heat is the energy transfer required to change molecular arrangement and
interaction energy without changing average translational kinetic energy.

Melting $0.200\ \mathrm{kg}$ of ice at $273.15\ \mathrm K$ requires
$Q=(0.200)(333.5\ \mathrm{kJ\,kg^{-1}})=66.7\ \mathrm{kJ}$. If the heat enters
reversibly from a reservoir at the same temperature, the ice--water system entropy
change is $66.7\ \mathrm{kJ}/273.15\ \mathrm K=244\ \mathrm{J\,K^{-1}}$.
The reservoir loses the same entropy, so the total change is zero. The two phases
can coexist at the transition temperature because their entropy and energy changes
are balanced by the latent-heat transfer under those equilibrium conditions.

Actual melting often occurs with a finite temperature difference between heat source
and ice. A reservoir warmer than the melting temperature supplies the same latent
heat, but its entropy loss has smaller magnitude because the heat is divided by a
larger temperature. The ice entropy gain remains determined by its reversible
reference path at the phase-change temperature. The combined change is positive;
the difference is entropy generation caused by transfer across the finite
temperature difference. The phase-change entropy is a state change, whereas the
generation depends on the actual heat-transfer arrangement.

Phase-change entropy also explains why a temperature equation alone is incomplete.
During melting, $mc\Delta T$ is zero while $mL$ is not. A calorimetry problem must
first determine whether heat is changing temperature, changing phase, or doing
both in sequence. The associated entropy account follows the same staging: use
$C\ln(T_f/T_i)$ for a temperature interval and $mL/T$ for a reversible phase
change. Adding only one term undercounts the state change whenever both occur.

The sign should be attached to the selected material. Water freezing releases heat
and has negative entropy change; the colder surroundings receiving that heat have
positive entropy change. Spontaneous freezing requires the combined total to be
nonnegative. A statement that a substance "becomes more ordered" is not a complete
second-law calculation until the entropy of the surroundings that receive the latent
heat is included.

> **Worked example.** An engine absorbs $Q_H=1500\ \mathrm J$ from a hot reservoir at
> $600\ \mathrm K$ and rejects $Q_C=1000\ \mathrm J$ to a cold reservoir at
> $300\ \mathrm K$. The first law gives work $W=Q_H-Q_C=500\ \mathrm J$, so the thermal
> efficiency is $500/1500=0.333$. The Carnot limit for the same pair is
> $1-300/600=0.500$; the gap cannot be closed without changing the temperatures or
> reducing irreversibility.
>
> The reservoir entropy changes are $\Delta S_H=-1500/600=-2.50\ \mathrm{J\,K^{-1}}$
> and $\Delta S_C=+1000/300=+3.33\ \mathrm{J\,K^{-1}}$. The working substance returns
> to its initial state, so its net change is zero, and the entropy generation is
> $S_{\rm gen}=+0.833\ \mathrm{J\,K^{-1}}$ per cycle — the quantitative departure from
> reversible performance.

The ledger separates energy from entropy quantities. Work has units of joules and
does not carry an entropy-transfer term in this simple cycle account. Heat transfers
have units of joules, while their associated reservoir entropy changes have units
of joules per kelvin. Adding $Q_H$ and $Q_C$ produces an energy balance; adding
$Q_H/T_H$ and $Q_C/T_C$ produces an entropy balance. Mixing the two equations is a
dimensional error even when the numerical values happen to look comparable.

Loss mechanisms can be located qualitatively. Finite-temperature heat exchangers
generate entropy at the hot and cold interfaces. Friction converts organized shaft
work into internal energy. Flow resistance and incomplete combustion or electrical
losses can add further generation. The ledger does not require resolving every
microscopic mechanism to establish the total generation, but component measurements
can identify which parts of a real engine most limit efficiency.

A reversible engine with the same $Q_H$ and reservoir temperatures would have cold
rejection $Q_C=Q_HT_C/T_H=750\ \mathrm J$ and work
$750\ \mathrm J$. Comparing this value with the real engine's $500\ \mathrm J$
shows the work lost to irreversibility for the stated heat input. The comparison is
valid only for the same hot heat input and reservoir temperatures; changing either
changes the available-work reference.

The table uses positive energy for energy entering the listed item.

| part of the account | energy entry per cycle | entropy entry per cycle | value for this engine |
|---|---:|---:|---|
| hot reservoir | $-Q_H$ | $-Q_H/T_H$ | $-1500\ \mathrm J$, $-2.50\ \mathrm{J\,K^{-1}}$ |
| cyclic working substance | $Q_H-Q_C-W=0$ | $\Delta S_{\rm ws}=0$ | returns to its initial state |
| cold reservoir | $+Q_C$ | $+Q_C/T_C$ | $+1000\ \mathrm J$, $+3.33\ \mathrm{J\,K^{-1}}$ |
| work receiver | $+W$ | no entropy-transfer term for ideal work | $+500\ \mathrm J$ |
| reservoirs and working substance | energy is balanced with the work receiver | $S_{\rm gen}$ | $+0.833\ \mathrm{J\,K^{-1}}$ |

$$
% caption: A real-engine ledger tracks energy and entropy separately. The cold-side entropy gain exceeds the hot-side loss, so the positive difference is entropy generation and the efficiency lies below the Carnot limit.
\begin{tikzpicture}[>=stealth,font=\footnotesize]
\definecolor{acc}{HTML}{4A6FA5}
\fill[acc!12] (0.2,1.0) rectangle (1.7,2.7);
\draw[black,thick] (0.2,1.0) rectangle (1.7,2.7);
\node[acc] at (0.95,1.85) {600 K};
\fill[black] (5.1,1.0) rectangle (6.6,2.7);
\draw[black,thick] (5.1,1.0) rectangle (6.6,2.7);
\node[black] at (5.85,1.85) {300 K};
\draw[acc,thick] (2.7,1.15) rectangle (4.1,2.55);
\node[acc] at (3.4,1.85) {engine};
\draw[acc,->,thick] (1.75,2.1)--(2.65,2.1) node[midway,above] {1500 J};
\draw[black,->,thick] (4.15,1.5)--(5.05,1.5) node[midway,above] {1000 J};
\draw[acc,->,thick] (3.4,1.1)--(3.4,0.3) node[midway,right] {500 J work};
\node[black,anchor=north] at (3.4,0.0) {entropy generated: 0.83 J per K};
\end{tikzpicture}
$$

> **Worked example.** A freezer at $255\ \mathrm K$ runs in a room at $295\ \mathrm K$.
> In one hour the unit removes $Q_C=1.20\ \mathrm{MJ}$ from the freezer and consumes
> $W_{\rm in}=0.480\ \mathrm{MJ}$ of electrical work, so it rejects
> $Q_H=Q_C+W_{\rm in}=1.68\ \mathrm{MJ}$ to the room. The coefficient of performance is
> $\mathrm{COP}_R=Q_C/W_{\rm in}=2.50$: cooling delivered per unit work, not a fraction
> of energy converted to work.
>
> The reservoir entropy changes over the hour are
> $-1.20\ \mathrm{MJ}/255\ \mathrm K=-4.71\ \mathrm{kJ\,K^{-1}}$ for the freezer and
> $+1.68\ \mathrm{MJ}/295\ \mathrm K=+5.69\ \mathrm{kJ\,K^{-1}}$ for the room, a
> generation of about $0.99\ \mathrm{kJ\,K^{-1}}$ from dissipation and
> finite-temperature heat exchange.
>
> The reversible limit for these temperatures is
> $\mathrm{COP}_{R,C}=T_C/(T_H-T_C)=255/(295-255)=6.38$, so the real value of $2.50$
> uses more than twice the minimum reversible work for this cooling load. Better
> insulation lowers the load $Q_C$; a better compressor and heat exchangers raise the
> COP at fixed load — distinct changes that should not be conflated.

An energy account must include the boundary selected for the freezer. Heat leaking
through its insulation enters the cold compartment and becomes part of the cooling
load. Electrical work entering the refrigerator crosses a different boundary and
eventually appears as heat delivered to the room, together with the extracted
freezer heat. A measurement of only the freezer temperature cannot determine COP:
the heat load and electrical work must both be measured over a stated interval.

A freezer illustrates the Clausius statement. Heat moves from the colder freezer to
the warmer room while electrical work enters the refrigerator. The room receives the
sum of extracted heat and work input. The complete ledger obeys energy conservation
and produces positive total entropy, as required by the second law.

Thermal ledgers are most reliable when all quantities are reported over one common
time interval. Heat and work may be listed as energies per cycle, per hour, or as
rates, but the entries must not be mixed. Dividing every entry by the same interval
converts an energy ledger into a power ledger without changing the first-law
relations. Entropy transfer and generation must similarly be reported per cycle,
per hour, or as rates consistently. A refrigerator data sheet can otherwise combine
a cooling rate with an electrical energy measurement and produce a meaningless COP.

Phase-change and reservoir calculations require the temperature at the actual heat
boundary. The melting material may be at its phase-change temperature while the
heating element is much warmer. Using the heater temperature for the material
entropy change understates the increase; using the material temperature for the
heater entropy loss overstates its magnitude. Their difference equals the entropy
generated by finite-temperature transfer. The same boundary
temperature distinction applies to real engine and freezer heat exchangers.

An audit of a complete device therefore proceeds in two passes. First, sum heat and
work with signs to verify energy conservation for the chosen system. Second, divide
each reservoir heat transfer by that reservoir temperature and add any internal
generation to verify a nonnegative total entropy change. A device can satisfy the
energy balance while failing the entropy audit. The second pass
rules out an apparently efficient but physically impossible thermal machine.

Measurement uncertainty should be carried through both ledgers. A small uncertainty
in a reservoir temperature affects every entropy-transfer term because temperature
appears in the denominator. Heat-flow calibration affects the energy balance and
the entropy balance simultaneously. A reported entropy generation that is smaller
than its propagated uncertainty is compatible with a reversible limit but does not
establish zero irreversibility. Consistent units, common intervals, and uncertainty
estimates turn a schematic entropy ledger into a testable experimental account.
