*"It is impossible to convert heat into work without transferring heat from a hotter to a colder body."*

Second Law of Thermodynamics, Kelvin-Planck Version

*"It is impossible to transfer heat from a colder to a hotter body without work being done."*

Second Law of Thermodynamics, Clausius Version

If, at any stage in a process, everything can be reversed, and the system and surroundings restored to their original states, the process is said to be reversible.

As an example, it is possible for heat to flow from a hot to a cold reservoir without any of it being converted to work. If this process were reversible, heat could flow from the cold to the hot reservoir without work being done. A reversible process is the most efficient type of process.

Consider a system that takes Q_{1} of heat from a hot reservoir, transfers Q_{2} of heat to a cold reservoir and generates W of work. This is coupled with a reversible process that uses work to transfer heat in the opposite direction. The absolute temperatures of the hot and cold reservoirs shall be denoted by T_{1} and T_{2} respectively. For the allowed process (i.e. the former), Q_{2} and W shall be Q_{A} and W_{A} respectively; and for the reversible process, Q_{2} and W shall be Q_{R} and W_{R} respectively. Let us assume W_{R}<W_{A}.

Overall, the arrangement absorbs Q_{R}-Q_{A} of heat and delivers W_{A}-W_{R} of work. For the allowed process, Q_{1}=W_{A}+Q_{A}; and for the reversible process, Q_{1}=W_{R}+Q_{R}. If Q_{1} has the same value for both processes, W_{A}+Q_{A}=W_{R}+Q_{R}. Rearranging gives Q_{R}-Q_{A}=W_{A}-W_{R}. However, this is not allowed: if I understand correctly, a net transfer of heat from the cold reservoir requires that W_{R}>W_{A}. Whatever the reason, W_{A}≥W_{R} and W_{R}≥W_{A} both apply only if W_{A}=W_{R}.

The two versions of the Second Law are equivalent in that when an engine that violates one version is coupled with a normal engine that transfers heat in the opposite direction (to or from the hot reservoir), the net result is an engine that violates the other version. For example, an engine that violates Kelvin-Planck absorbs Q_{1} of heat from the hot reservoir and performs an equivalent amount of work. This is coupled with a normal engine that absorbs Q_{2} of heat from the cold reservoir, does W of work and delivers Q_{2}+W of heat to the hot reservoir. But because W=Q_{1}, Q_{2}+W=Q_{1}+Q_{2}. The arrangement therefore delivers a net amount Q_{2} of heat to the hot reservoir, thereby violating Clausius.

An engine that violates Clausius transfers Q_{2} of heat from the cold to the hot reservoir. This is coupled with a normal engine that absorbs Q_{1} of heat from the hot reservoir, transfers Q_{2} of heat to the cold reservoir and produces W of work. The net amount of heat taken from the hot reservoir equals Q_{1}-Q_{2}. But this also equals the work done by the normal engine. The arrangement therefore violates Kelvin-Planck.

Efficiency (η) is defined as the energy output divided by the energy input. In the case of an engine that takes heat from a hot reservoir and generates work, η=W/Q_{1}. Because Q_{1}=W+Q_{2}, η=(Q_{1}-Q_{2})/Q_{1}=1-Q_{2}/Q_{1}. All reversible processes have the same efficiency between two reservoirs; for a reversible engine, therefore, Q_{2}/Q_{1} has the same value regardless of the quantity of heat absorbed and is a function of T_{1} and T_{2}.

Imagine that a reservoir of absolute temperature T_{I} lies between the hot and cold reservoirs. It receives Q_{I} of heat from the hot reservoir and discharges the same amount towards the cold reservoir. Q_{2}/Q_{1}=(Q_{2}/Q_{I})(Q_{I}/Q_{1}). Because, for a reversible engine, Q_{2}/Q_{1}=f(T_{2},T_{1}), it follows that Q_{2}/Q_{1}=f(T_{2},T_{I})f(T_{I},T_{1}). f(T_{2},T_{1})=φ(T_{2})/φ(T_{1}), or {φ(T_{2})/φ(T_{I})}{φ(T_{I})/φ(T_{1})}. Therefore, Q_{2}/Q_{1}=φ(T_{2})/φ(T_{1}). From this we get Q_{2}/Q_{1}=T_{2}/T_{1}, and rearranging this gives Q_{2}=Q_{1}T_{2}/T_{1}. When the engine is operating, Q_{1} and T_{1} both have non-zero values, in which case Q_{2}=0 only when T_{2}=0.

From the above, we can deduce that the efficiency of our engine, η=1-T_{2}/T_{1}=(T_{1}-T_{2})/T_{1}. The original efficiency equation, η=W/Q_{1}, can also be written as η=W/(W+Q_{2}). Rearranging gives ηW+ηQ_{2}=W, and in turn Q_{2}=W(1-η)/η.

Consider an engine that takes Q_{2} of heat from the cold reservoir, does W of work and transfers Q_{1} of heat to the hot reservoir. Because Q_{1}=Q_{2}+W, W=Q_{1}-Q_{2}. Dividing both sides by Q_{2} and rearranging gives W=Q_{2}(Q_{1}/Q_{2}-1). For a reversible process, this becomes W=Q_{2}(T_{1}/T_{2}-1). The power of the engine is given by dW/dt=(dQ_{2}/dt){(T_{1}-T_{2})/T_{2}}.

A reversible engine is the most efficient engine possible. Real engines are not perfectly reversible and are therefore less efficient.

The Carnot cycle consists of alternate isothermal (where the temperature is constant) and adiabatic processes. It is represented on a pressure-volume graph by a distorted square. The exact shape of the graph can be calculated, but an approximation can be drawn as follows. Starting from the top left corner and working clockwise, label the corners A, B, C and D. Then stretch the square along the line running from A to C. Finally, bend the sides so that their centres are displaced downwards or to the left. The cycle operates clockwise as denoted on the graph, so that the isothermal expansion AB is followed by the adiabatic expansion BC. The other two processes are both contractions.

A reversible cycle is a physical process that is carried out very slowly (quasistatically) in such a way that the system and its surroundings can be returned to their initial states. Consider, for example, the cycle ABA, where A and B are two points on a pressure-volume graph. Line 1 runs from A to B, line 2 runs from B to A and line 3 is an alternative route from B to A.

Entropy (S) is a measure of disorder in a system. It is defined using the equation dS=δQ/T, where δQ = heat transfer. For a reversible cycle, dS=0; this is known as the Clausius inequality.

For our cycle, therefore, ∫_{1} δQ/T + ∫_{2} δQ/T = 0 and ∫_{1} δQ/T + ∫_{3} δQ/T = 0, where the subscripts denote the path numbers. It follows that ∫_{2} δQ/T = ∫_{3} δQ/T. This shows that ∫δQ/T is independent of the path taken and depends only on the start and end points. So ∫_{A}^{B} dS = S_{B}-S_{A}.

Because δQ=dU+pdV, and because dU=c_{v}dT for unit mass, dS=c_{v}dT/T+pdV/T. Given that pV=nRT, dS=c_{v}dT/T+nRdV/V. Integrating this gives ∫dS=c_{v}∫dT/T+nR∫dV/V. This leads to ∫_{a}^{b} dS = c_{v} [ln T]_{a}^{b} + nR [ln V]_{a}^{b} = c_{v} ln (T_{b}/T_{a}) + nR ln (V_{b}/V_{a}). On another point, V_{b}/V_{a}=(T_{b}p_{a})/(T_{a}p_{b}).