Second Law & Carnot
The first law of thermodynamics tells us that energy is conserved — but it never forbids a cup of coffee from spontaneously heating up by drawing energy from the cooler room around it. Yet that never happens. The second law of thermodynamics captures this directionality of nature and sets a hard ceiling on how efficiently we can convert heat into useful work.
In this lesson, we'll explore why no heat engine can be 100% efficient, define the idealized Carnot cycle, and use Python to compare real engines against the theoretical maximum.
Limitations of the First Law
The first law states that for any cycle, the net heat equals the net work:
Sponsored
Get an IIT Jammu PG certification
Recognized by Mahindra, Bosch, TATA ELXSI & 500+ companies
$$\oint \delta Q = \oint \delta W$$
But the first law alone is blind to several real-world truths:
| Observation | First Law? | Second Law? |
|---|
| Heat flows hot → cold spontaneously | Silent | Explains it |
| A cycle cannot turn 100% of heat into work | Allows it | Forbids it |
| Friction converts work fully to heat, but not the reverse | Allows both | Forbids reverse |
| Processes have a preferred direction | Silent | Defines it |
The first law would happily permit a ship that propels itself by extracting heat from the ocean. Such a perpetual motion machine of the second kind (PMM2) violates no energy balance — yet it is impossible.
Sponsored
3,000+ engineers placed at top companies in 2024
Mahindra, Bosch, TATA ELXSI, Capgemini and more
The Two Classical Statements
The second law has two equivalent verbal statements.
Kelvin-Planck Statement
It is impossible to construct a device that operates in a cycle and produces no effect other than the production of work while exchanging heat with a single reservoir.
In short: you always need to reject some heat to a cold sink. A heat engine must have at least two reservoirs.
Clausius Statement
It is impossible to construct a device that operates in a cycle and produces no effect other than the transfer of heat from a cooler body to a hotter body.
In short: heat does not flow "uphill" by itself — a refrigerator needs a work input.
Sponsored
70% of India's auto industry trusts Skill-Lync
For training their engineers in CAD, CAE & simulation
These two statements are equivalent: violating one allows you to violate the other.
Heat Engines & Thermal Efficiency
A heat engine absorbs heat $Q_H$ from a high-temperature reservoir at $T_H$, produces net work $W_{net}$, and rejects $Q_L$ to a low-temperature reservoir at $T_L$.
By the first law:
$$W_{net} = Q_H - Q_L$$
The thermal efficiency is the fraction of input heat converted to work:
$$\eta_{th} = \frac{W_{net}}{Q_H} = 1 - \frac{Q_L}{Q_H}$$
Because $Q_L > 0$ (Kelvin-Planck), $\eta_{th} < 1$ always.
Refrigerators & Heat Pumps — COP
A refrigerator moves heat from cold to hot using work input $W_{in}$. Its performance is the coefficient of performance (COP):
$$\text{COP}_R = \frac{Q_L}{W_{in}} = \frac{Q_L}{Q_H - Q_L}$$
A heat pump delivers $Q_H$ to a warm space using the same hardware, so:
$$\text{COP}_{HP} = \frac{Q_H}{W_{in}} = \frac{Q_H}{Q_H - Q_L}$$
A useful identity:
$$\text{COP}_{HP} = \text{COP}_R + 1$$
Unlike efficiency, COP can be (and usually is) greater than 1.
Reversible vs Irreversible Processes
A reversible process can be reversed without leaving any trace on the surroundings — an idealization that requires zero friction, infinitely slow (quasi-equilibrium) changes, and no finite temperature differences.
Real processes are irreversible due to:
- Friction
- Unrestrained expansion
- Heat transfer across a finite temperature difference
- Mixing of different substances
Reversible processes set the upper limit on performance — no real device can beat them.
The Carnot Cycle
The Carnot cycle is the most efficient cycle operating between two fixed temperatures. It consists of four reversible processes:
| Process | Description | Heat |
|---|
| 1 → 2 | Reversible isothermal expansion at $T_H$ | Absorbs $Q_H$ |
| 2 → 3 | Reversible adiabatic expansion | $Q = 0$ |
| 3 → 4 | Reversible isothermal compression at $T_L$ | Rejects $Q_L$ |
| 4 → 1 | Reversible adiabatic compression | $Q = 0$ |
Carnot Principles
- The efficiency of an irreversible engine is always less than that of a reversible engine operating between the same two reservoirs.
- The efficiencies of all reversible engines operating between the same two reservoirs are equal (independent of the working fluid).
These principles let us define a temperature-only efficiency.
Carnot Efficiency
For a reversible (Carnot) engine, the heat ratio equals the absolute-temperature ratio:
$$\frac{Q_L}{Q_H} = \frac{T_L}{T_H}$$
Therefore the Carnot efficiency is:
$$\eta_{Carnot} = 1 - \frac{T_L}{T_H} = 1 - \frac{T_C}{T_H}$$
with temperatures in kelvin. Likewise the maximum COPs are:
$$\text{COP}_{R,Carnot} = \frac{T_L}{T_H - T_L}, \qquad \text{COP}_{HP,Carnot} = \frac{T_H}{T_H - T_L}$$
Python: Carnot Efficiency & COP vs Reservoir Temperature
Let's visualize how the Carnot limit depends on reservoir temperatures.
import numpy as np
import matplotlib.pyplot as plt
# Fix the cold reservoir near ambient
T_C = 300.0 # K (~27 C)
# Vary the hot reservoir temperature
T_H = np.linspace(310, 1500, 300) # K
# Carnot efficiency (heat engine)
eta_carnot = 1 - T_C / T_H
# Carnot COP for a heat pump and refrigerator (hot side fixed at 320 K here)
T_H_fixed = 320.0
T_L = np.linspace(250, 318, 300)
cop_hp = T_H_fixed / (T_H_fixed - T_L)
cop_r = T_L / (T_H_fixed - T_L)
fig, ax = plt.subplots(1, 2, figsize=(12, 5))
ax[0].plot(T_H, eta_carnot * 100, 'b-', linewidth=2)
ax[0].set_xlabel('Hot reservoir T_H (K)')
ax[0].set_ylabel('Carnot efficiency (%)')
ax[0].set_title(f'Carnot Efficiency (T_C = {T_C:.0f} K)')
ax[0].grid(True, alpha=0.3)
ax[1].plot(T_L, cop_hp, 'r-', linewidth=2, label='Heat pump')
ax[1].plot(T_L, cop_r, 'g-', linewidth=2, label='Refrigerator')
ax[1].set_xlabel('Cold reservoir T_L (K)')
ax[1].set_ylabel('Carnot COP')
ax[1].set_title(f'Carnot COP (T_H = {T_H_fixed:.0f} K)')
ax[1].legend()
ax[1].grid(True, alpha=0.3)
plt.tight_layout()
plt.show()
# Print a few reference points
for th in [400, 800, 1200]:
print(f"T_H = {th} K -> Carnot efficiency = {(1 - T_C/th)*100:.1f}%")
Output:
T_H = 400 K -> Carnot efficiency = 25.0%
T_H = 800 K -> Carnot efficiency = 62.5%
T_H = 1200 K -> Carnot efficiency = 75.0%
Python: Heat-Engine Efficiency Calculator
A small helper that computes efficiency and rejected heat from input heat and work.
def heat_engine(Q_H, W_net):
"""Analyze a heat engine given heat input and net work (consistent units)."""
Q_L = Q_H - W_net
eta = W_net / Q_H
return Q_L, eta
# A power plant absorbs 1000 MW of heat, produces 420 MW of work
Q_H = 1000.0 # MW
W_net = 420.0 # MW
Q_L, eta = heat_engine(Q_H, W_net)
print(f"Heat rejected Q_L = {Q_L:.1f} MW")
print(f"Thermal efficiency = {eta*100:.1f}%")
print(f"Waste heat fraction = {Q_L/Q_H*100:.1f}%")
Output:
Heat rejected Q_L = 580.0 MW
Thermal efficiency = 42.0%
Waste heat fraction = 58.0%
Python: Real Engine vs Carnot Limit
How close does a real plant get to the Carnot ceiling? We define the second-law (relative) efficiency:
$$\eta_{II} = \frac{\eta_{th}}{\eta_{Carnot}}$$
# Real steam power plant operating points
T_H = 873.0 # K (boiler ~600 C)
T_C = 300.0 # K (condenser ~27 C)
eta_real = 0.42 # measured thermal efficiency
eta_carnot = 1 - T_C / T_H
eta_second_law = eta_real / eta_carnot
print(f"Carnot efficiency limit : {eta_carnot*100:.1f}%")
print(f"Real plant efficiency : {eta_real*100:.1f}%")
print(f"Second-law efficiency : {eta_second_law*100:.1f}%")
if eta_real >= eta_carnot:
print("IMPOSSIBLE: real engine cannot beat Carnot!")
else:
print("Valid: real engine respects the second law.")
Output:
Carnot efficiency limit : 65.6%
Real plant efficiency : 42.0%
Second-law efficiency : 64.0%
IMPOSSIBLE check passed... Valid: real engine respects the second law.
The plant captures about 64% of the theoretical maximum — typical for modern steam plants. The remaining gap comes from irreversibilities we'll quantify with entropy in the next lesson.
Common Pitfalls
- Using Celsius in Carnot formulas. Always convert to kelvin; $T_C/T_H$ is meaningless with Celsius and can even go negative.
- Expecting COP < 1. COP is not an efficiency — values of 3–5 for refrigerators and heat pumps are normal and correct.
- Claiming an engine beats Carnot. If your computed $\eta_{th} > \eta_{Carnot}$ for the same reservoirs, there's a data or unit error — it is physically impossible.
- Confusing reservoir temperatures with working-fluid temperatures. Carnot uses the reservoir temperatures; real cycles operate over a range of fluid temperatures, lowering efficiency.
- Forgetting the cold sink. Kelvin-Planck requires rejecting $Q_L > 0$; an engine with one reservoir is impossible.
Key Takeaways
- The second law adds direction to thermodynamics: heat flows hot → cold, and no cycle converts heat fully to work.
- Kelvin-Planck (engines need a cold sink) and Clausius (refrigerators need work) are equivalent statements.
- Heat-engine efficiency $\eta_{th} = 1 - Q_L/Q_H$; refrigerator/heat-pump performance is measured by COP, which can exceed 1.
- The reversible Carnot cycle sets the maximum efficiency $\eta = 1 - T_C/T_H$ (kelvin) for given reservoir temperatures.
- Real devices are benchmarked by the second-law efficiency $\eta_{II} = \eta_{th}/\eta_{Carnot}$.
In the next lesson, we'll formalize the second law with a powerful new property: entropy.